From 5ef9f129e6d32a2ea7e2906df2ece5f68714a762 Mon Sep 17 00:00:00 2001 From: "timeless%mac.com" Date: Mon, 13 Aug 2001 08:03:28 +0000 Subject: [PATCH] Bugzilla Bug 78690 Remove the old imagelib. The removal left some builds likely broken xlib by Tomi.Leppikangas@oulu.fi qt by jcgriggs@sympatico.ca photon by timeless@mac.com based on tomi's patch for xlib git-svn-id: svn://10.0.0.236/trunk@100912 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/photon/nsDeviceContextPh.cpp | 25 ------------------ mozilla/gfx/src/photon/nsGfxFactoryPh.cpp | 26 ------------------- .../gfx/src/photon/nsRenderingContextPh.cpp | 3 +++ mozilla/gfx/src/qt/Makefile.in | 2 +- mozilla/gfx/src/qt/nsDeviceContextQT.cpp | 4 --- mozilla/gfx/src/qt/nsGfxFactoryQT.cpp | 23 ---------------- mozilla/gfx/src/qt/nsImageQT.cpp | 5 ++++ mozilla/gfx/src/xlib/Makefile.in | 2 +- mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp | 4 --- mozilla/gfx/src/xlib/nsGfxFactoryXlib.cpp | 26 ------------------- mozilla/gfx/src/xlib/nsImageXlib.cpp | 6 +++++ 11 files changed, 16 insertions(+), 110 deletions(-) diff --git a/mozilla/gfx/src/photon/nsDeviceContextPh.cpp b/mozilla/gfx/src/photon/nsDeviceContextPh.cpp index c664d59a3df..7336ab9ee61 100644 --- a/mozilla/gfx/src/photon/nsDeviceContextPh.cpp +++ b/mozilla/gfx/src/photon/nsDeviceContextPh.cpp @@ -51,10 +51,6 @@ nsDeviceContextPh :: nsDeviceContextPh( ) { mPixelsToTwips = 1.0; mDepth = 0 ; mSurface = NULL; - mPaletteInfo.isPaletteDevice = PR_FALSE; - mPaletteInfo.sizePalette = 0; - mPaletteInfo.numReserved = 0; - mPaletteInfo.palette = NULL; mPixelScale = 1.0f; mWidthFloat = 0.0f; mHeightFloat = 0.0f; @@ -75,8 +71,6 @@ nsDeviceContextPh :: ~nsDeviceContextPh( ) { NS_IF_RELEASE(surf); //this clears the surf pointer... mSurface = nsnull; - if( NULL != mPaletteInfo.palette ) PR_Free( mPaletteInfo.palette ); - if( mFontLoadCache ) { delete mFontLoadCache; mFontLoadCache = nsnull; @@ -212,25 +206,6 @@ void nsDeviceContextPh :: CommonInit( nsNativeDeviceContext aDC ) { mWidthFloat = (float) aWidth; mHeightFloat = (float) aHeight; - if( mDepth > 8 ) { - mPaletteInfo.isPaletteDevice = PR_FALSE; - mPaletteInfo.sizePalette = 0; - mPaletteInfo.numReserved = 0; - mPaletteInfo.palette = NULL; - } - else { - PgColor_t color[_Pg_MAX_PALETTE]; - - PgGetPalette(color); - // palette based - mPaletteInfo.isPaletteDevice = PR_TRUE; - mPaletteInfo.sizePalette = _Pg_MAX_PALETTE; - mPaletteInfo.numReserved = 16; /* GUESS */ - mPaletteInfo.palette = PR_Malloc(_Pg_MAX_PALETTE * sizeof(PgColor_t)); - memcpy(mPaletteInfo.palette, color, _Pg_MAX_PALETTE * sizeof(PgColor_t)); - } - - /* Revisit: the scroll bar sizes is a gross guess based on Phab */ mScrollbarHeight = 17; mScrollbarWidth = 17; diff --git a/mozilla/gfx/src/photon/nsGfxFactoryPh.cpp b/mozilla/gfx/src/photon/nsGfxFactoryPh.cpp index c8244559e0c..f62bcec724c 100644 --- a/mozilla/gfx/src/photon/nsGfxFactoryPh.cpp +++ b/mozilla/gfx/src/photon/nsGfxFactoryPh.cpp @@ -34,7 +34,6 @@ #include "nsDeviceContextSpecFactoryP.h" #include "nsScreenManagerPh.h" #include "nsScriptableRegion.h" -#include "nsIImageManager.h" #include "nsDeviceContextPh.h" #include "nsPrintOptionsPh.h" #include "nsFontList.h" @@ -93,26 +92,6 @@ static nsresult nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID aIID return rv; } -static nsresult nsImageManagerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult) -{ - nsresult rv; - - if ( NULL == aResult ) - { - rv = NS_ERROR_NULL_POINTER; - return rv; - } - *aResult = NULL; - if (NULL != aOuter) - { - rv = NS_ERROR_NO_AGGREGATION; - return rv; - } - // this will return an image manager with a count of 1 - rv = NS_NewImageManager((nsIImageManager **)aResult); - return rv; -} - static nsModuleComponentInfo components[] = { { "Ph Font Metrics", @@ -158,11 +137,6 @@ static nsModuleComponentInfo components[] = "@mozilla.org/gfx/devicecontextspecfactory;1", //"@mozilla.org/gfx/device_context_spec_factory/Ph;1", nsDeviceContextSpecFactoryPhConstructor }, - { "Image Manager", - NS_IMAGEMANAGER_CID, - "@mozilla.org/gfx/imagemanager;1", - //"@mozilla.org/gfx/image_manager;1", - nsImageManagerConstructor }, { "Print Options", NS_PRINTOPTIONS_CID, // "@mozilla.org/gfx/printoptions;1", diff --git a/mozilla/gfx/src/photon/nsRenderingContextPh.cpp b/mozilla/gfx/src/photon/nsRenderingContextPh.cpp index 4746cd50326..1967c579b66 100644 --- a/mozilla/gfx/src/photon/nsRenderingContextPh.cpp +++ b/mozilla/gfx/src/photon/nsRenderingContextPh.cpp @@ -1097,6 +1097,9 @@ NS_IMETHODIMP nsRenderingContextPh::DrawTile( nsIImage *aImage, nscoord aSrcXOff if( tileRect.width > 0 && tileRect.height > 0 ) ((nsImagePh*)aImage)->DrawTile(*this, mSurface, srcRect.width, srcRect.height, tileRect); + else + NS_ASSERTION(aTileRect.width > 0 && aTileRect.height > 0, + "You can't draw an image with a 0 width or height!"); return NS_OK; } diff --git a/mozilla/gfx/src/qt/Makefile.in b/mozilla/gfx/src/qt/Makefile.in index b2c584cda34..5c3cbad3e1f 100644 --- a/mozilla/gfx/src/qt/Makefile.in +++ b/mozilla/gfx/src/qt/Makefile.in @@ -30,7 +30,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = layout LIBRARY_NAME = gfx_qt EXPORT_LIBRARY = 1 -REQUIRES = xpcom string widget view gfx2 uconv pref img dom util js appshell mozcomps windowwatcher unicharutil +REQUIRES = xpcom string widget view gfx2 uconv pref dom util js appshell mozcomps windowwatcher unicharutil IS_COMPONENT = 1 MODULE_NAME = nsGfxQTModule diff --git a/mozilla/gfx/src/qt/nsDeviceContextQT.cpp b/mozilla/gfx/src/qt/nsDeviceContextQT.cpp index 232a7d6fa21..b46bd989320 100644 --- a/mozilla/gfx/src/qt/nsDeviceContextQT.cpp +++ b/mozilla/gfx/src/qt/nsDeviceContextQT.cpp @@ -62,10 +62,6 @@ nsDeviceContextQT::nsDeviceContextQT() mTwipsToPixels = 1.0; mPixelsToTwips = 1.0; mDepth = 0 ; - mPaletteInfo.isPaletteDevice = PR_FALSE; - mPaletteInfo.sizePalette = 0; - mPaletteInfo.numReserved = 0; - mPaletteInfo.palette = NULL; mNumCells = 0; mWidthFloat = 0.0f; mHeightFloat = 0.0f; diff --git a/mozilla/gfx/src/qt/nsGfxFactoryQT.cpp b/mozilla/gfx/src/qt/nsGfxFactoryQT.cpp index 667bdb71c1f..c5c0b2aac56 100644 --- a/mozilla/gfx/src/qt/nsGfxFactoryQT.cpp +++ b/mozilla/gfx/src/qt/nsGfxFactoryQT.cpp @@ -33,7 +33,6 @@ #include "nsDeviceContextSpecFactoryQT.h" #include "nsScreenManagerQT.h" #include "nsScriptableRegion.h" -#include "nsIImageManager.h" #include "nsDeviceContextQT.h" #include "nsImageQT.h" #include "nsFontList.h" @@ -86,24 +85,6 @@ static nsresult nsScriptableRegionConstructor(nsISupports *aOuter,REFNSIID aIID, return rv; } -static nsresult nsImageManagerConstructor(nsISupports *aOuter,REFNSIID aIID,void **aResult) -{ - nsresult rv; - - if (NULL == aResult) { - rv = NS_ERROR_NULL_POINTER; - return rv; - } - *aResult = NULL; - if (NULL != aOuter) { - rv = NS_ERROR_NO_AGGREGATION; - return rv; - } - // this will return an image manager with a count of 1 - rv = NS_NewImageManager((nsIImageManager**)aResult); - return rv; -} - static nsModuleComponentInfo components[] = { { "Qt Font Metrics", @@ -142,10 +123,6 @@ static nsModuleComponentInfo components[] = NS_DEVICE_CONTEXT_SPEC_FACTORY_CID, "@mozilla.org/gfx/devicecontextspecfactory;1", nsDeviceContextSpecFactoryQTConstructor }, - { "Image Manager", - NS_IMAGEMANAGER_CID, - "@mozilla.org/gfx/imagemanager;1", - nsImageManagerConstructor }, { "Qt Font Enumerator", NS_FONT_ENUMERATOR_CID, "@mozilla.org/gfx/fontenumerator;1", diff --git a/mozilla/gfx/src/qt/nsImageQT.cpp b/mozilla/gfx/src/qt/nsImageQT.cpp index 2d9656791e7..36018f14ea5 100644 --- a/mozilla/gfx/src/qt/nsImageQT.cpp +++ b/mozilla/gfx/src/qt/nsImageQT.cpp @@ -422,6 +422,11 @@ NS_IMETHODIMP nsImageQT::DrawTile(nsIRenderingContext &aContext, { nsDrawingSurfaceQT *drawing = (nsDrawingSurfaceQT*)aSurface; + if (aTileRect.width <= 0 || aTileRect.height <= 0) { + NS_ASSERTION(aTileRect.width > 0 && aTileRect.height > 0, + "Error: image has 0 width or height!"); + return NS_OK; + } if (drawing->GetDepth() == 8 || mAlphaDepth == 8) { PRInt32 aY0 = aTileRect.y, aX0 = aTileRect.x; PRInt32 aY1 = aTileRect.y + aTileRect.height; diff --git a/mozilla/gfx/src/xlib/Makefile.in b/mozilla/gfx/src/xlib/Makefile.in index bdfe23831f5..6c418ee24a1 100644 --- a/mozilla/gfx/src/xlib/Makefile.in +++ b/mozilla/gfx/src/xlib/Makefile.in @@ -33,7 +33,7 @@ EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsGfxXlibModule -REQUIRES = xpcom string xlibrgb widget dom layout appshell js necko pref img util view uconv locale unicharutil gfx2 mozcomps windowwatcher +REQUIRES = xpcom string xlibrgb widget dom layout appshell js necko pref util view uconv locale unicharutil gfx2 mozcomps windowwatcher CPPSRCS = \ nsDeviceContextSpecFactoryX.cpp \ diff --git a/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp b/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp index 1506d23c318..071c0286403 100644 --- a/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp +++ b/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp @@ -68,10 +68,6 @@ nsDeviceContextXlib::nsDeviceContextXlib() NS_INIT_REFCNT(); mTwipsToPixels = 1.0; mPixelsToTwips = 1.0; - mPaletteInfo.isPaletteDevice = PR_FALSE; - mPaletteInfo.sizePalette = 0; - mPaletteInfo.numReserved = 0; - mPaletteInfo.palette = NULL; mNumCells = 0; mSurface = nsnull; mDisplay = nsnull; diff --git a/mozilla/gfx/src/xlib/nsGfxFactoryXlib.cpp b/mozilla/gfx/src/xlib/nsGfxFactoryXlib.cpp index 748558cabb7..ac961fde034 100644 --- a/mozilla/gfx/src/xlib/nsGfxFactoryXlib.cpp +++ b/mozilla/gfx/src/xlib/nsGfxFactoryXlib.cpp @@ -37,7 +37,6 @@ #include "nsDeviceContextSpecFactoryX.h" #include "nsScreenManagerXlib.h" #include "nsScriptableRegion.h" -#include "nsIImageManager.h" #include "nsDeviceContextXlib.h" #include "nsImageXlib.h" #include "nsFontList.h" @@ -97,26 +96,6 @@ static nsresult nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID aIID return rv; } -static nsresult nsImageManagerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult) -{ - nsresult rv; - - if ( NULL == aResult ) - { - rv = NS_ERROR_NULL_POINTER; - return rv; - } - *aResult = NULL; - if (NULL != aOuter) - { - rv = NS_ERROR_NO_AGGREGATION; - return rv; - } - // this will return an image manager with a count of 1 - rv = NS_NewImageManager((nsIImageManager **)aResult); - return rv; -} - static nsModuleComponentInfo components[] = { { "Xlib Font Metrics", @@ -163,11 +142,6 @@ static nsModuleComponentInfo components[] = // "@mozilla.org/gfx/device_context_spec_factory/xlib;1", "@mozilla.org/gfx/devicecontextspecfactory;1", nsDeviceContextSpecFactoryXlibConstructor }, - { "Image Manager", - NS_IMAGEMANAGER_CID, - // "@mozilla.org/gfx/image_manager;1", - "@mozilla.org/gfx/imagemanager;1", - nsImageManagerConstructor }, { "Print Options", NS_PRINTOPTIONS_CID, // "@mozilla.org/gfx/printoptions;1", diff --git a/mozilla/gfx/src/xlib/nsImageXlib.cpp b/mozilla/gfx/src/xlib/nsImageXlib.cpp index 6901689307e..c0838260ec0 100644 --- a/mozilla/gfx/src/xlib/nsImageXlib.cpp +++ b/mozilla/gfx/src/xlib/nsImageXlib.cpp @@ -1452,6 +1452,12 @@ NS_IMETHODIMP nsImageXlib::DrawTile(nsIRenderingContext &aContext, { if ((mAlphaDepth == 1) && mIsSpacer) return NS_OK; + + if (aTileRect.width <= 0 || aTileRect.height <= 0) { + NS_ASSERTION(aTileRect.width > 0 && aTileRect.height > 0, + "You can't draw an image with a 0 width or height!"); + return NS_OK; + } nsDrawingSurfaceXlib *drawing = (nsDrawingSurfaceXlib*)aSurface; if (mDisplay == nsnull)