зеркало из https://github.com/mozilla/gecko-dev.git
Fix OS/2 fallout from removal of old imglib.
OS/2 now has no image tiling and no 256 color support. And I bet windows lost any reasonable 256 color support as well.
This commit is contained in:
Родитель
6c248a1a71
Коммит
9d96281d1a
|
@ -58,7 +58,7 @@ EXPORTS = \
|
|||
nsIRenderingContextOS2.h \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LIBS = gkgfx img_s mozutil_s
|
||||
EXTRA_DSO_LIBS = gkgfx mozutil_s
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
#include "nsDeviceContextOS2.h"
|
||||
#include "nsRenderingContextOS2.h"
|
||||
#include "nsDeviceContextSpecOS2.h"
|
||||
#ifdef COLOR_256
|
||||
#include "il_util.h"
|
||||
#endif
|
||||
#include "nsIPref.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -52,10 +54,12 @@ nsDeviceContextOS2 :: nsDeviceContextOS2()
|
|||
: DeviceContextImpl()
|
||||
{
|
||||
mSurface = NULL;
|
||||
#ifdef COLOR_256
|
||||
mPaletteInfo.isPaletteDevice = PR_FALSE;
|
||||
mPaletteInfo.sizePalette = 0;
|
||||
mPaletteInfo.numReserved = 0;
|
||||
mPaletteInfo.palette = NULL;
|
||||
#endif
|
||||
mPrintDC = NULL;
|
||||
mPixelScale = 1.0f;
|
||||
mWidth = -1;
|
||||
|
@ -192,6 +196,7 @@ void nsDeviceContextOS2 :: CommonInit(HDC aDC)
|
|||
mPelsPerMeter = alArray[CAPS_VERTICAL_RESOLUTION];
|
||||
|
||||
mDepth = alArray[CAPS_COLOR_BITCOUNT];
|
||||
#ifdef COLOR_256
|
||||
mPaletteInfo.isPaletteDevice = !!(alArray[CAPS_ADDITIONAL_GRAPHICS] & CAPS_PALETTE_MANAGER);
|
||||
|
||||
/* OS2TODO - pref to turn off palette management should set isPaletteDevice to false */
|
||||
|
@ -204,6 +209,7 @@ void nsDeviceContextOS2 :: CommonInit(HDC aDC)
|
|||
} else {
|
||||
mPaletteInfo.numReserved = alArray[CAPS_COLORS];
|
||||
} /* endif */
|
||||
#endif
|
||||
|
||||
mWidth = alArray[CAPS_WIDTH];
|
||||
mHeight = alArray[CAPS_HEIGHT];
|
||||
|
@ -654,6 +660,7 @@ NS_IMETHODIMP nsDeviceContextOS2::GetDepth(PRUint32& aDepth)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef COLOR_256
|
||||
NS_IMETHODIMP nsDeviceContextOS2::GetILColorSpace(IL_ColorSpace*& aColorSpace)
|
||||
{
|
||||
if (nsnull == mColorSpace) {
|
||||
|
@ -814,6 +821,7 @@ NS_IMETHODIMP nsDeviceContextOS2::GetPaletteInfo(nsPaletteInfo& aPaletteInfo)
|
|||
aPaletteInfo.palette = mPaletteInfo.palette;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextOS2 :: ConvertPixel(nscolor aColor, PRUint32 & aPixel)
|
||||
{
|
||||
|
|
|
@ -57,9 +57,11 @@ public:
|
|||
|
||||
NS_IMETHOD GetDepth(PRUint32& aDepth);
|
||||
|
||||
#ifdef COLOR_256
|
||||
NS_IMETHOD GetILColorSpace(IL_ColorSpace*& aColorSpace);
|
||||
|
||||
NS_IMETHOD GetPaletteInfo(nsPaletteInfo&);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD ConvertPixel(nscolor aColor, PRUint32 & aPixel);
|
||||
|
||||
|
@ -89,7 +91,9 @@ protected:
|
|||
|
||||
nsDrawingSurface mSurface;
|
||||
PRUint32 mDepth; // bit depth of device
|
||||
#ifdef COLOR_256
|
||||
nsPaletteInfo mPaletteInfo;
|
||||
#endif
|
||||
float mPixelScale;
|
||||
PRInt32 mWidth;
|
||||
PRInt32 mHeight;
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "nsDeviceContextSpecFactoryO.h"
|
||||
#include "nsScreenManagerOS2.h"
|
||||
#include "nsScriptableRegion.h"
|
||||
#include "nsIImageManager.h"
|
||||
#include "nsDeviceContextOS2.h"
|
||||
#include "nsImageOS2.h"
|
||||
#include "nsRegionOS2.h"
|
||||
|
@ -98,26 +97,6 @@ static NS_IMETHODIMP nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID
|
|||
return rv;
|
||||
}
|
||||
|
||||
static NS_IMETHODIMP nsImageManagerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if ( !aResult )
|
||||
{
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
return rv;
|
||||
}
|
||||
*aResult = nsnull;
|
||||
if (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[] =
|
||||
{
|
||||
{ "OS/2 Font Metrics",
|
||||
|
@ -164,11 +143,6 @@ static nsModuleComponentInfo components[] =
|
|||
// "@mozilla.org/gfx/device_context_spec_factory/gtk;1",
|
||||
"@mozilla.org/gfx/devicecontextspecfactory;1",
|
||||
nsDeviceContextSpecFactoryOS2Constructor },
|
||||
{ "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",
|
||||
|
|
|
@ -557,6 +557,7 @@ nsImageOS2::BuildTile (HPS hpsTile, PRUint8* pImageBits, PBITMAPINFO2 pBitmapInf
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef PAVLOV_REALLY_SUCKS
|
||||
PRBool
|
||||
nsImageOS2::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1,
|
||||
|
@ -686,6 +687,19 @@ nsImageOS2::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
|||
|
||||
return(PR_TRUE);
|
||||
}
|
||||
#else
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsIRenderingContext.h
|
||||
* @update 3/16/00 dwc
|
||||
*/
|
||||
NS_IMETHODIMP nsImageOS2::DrawTile(nsIRenderingContext &aContext,
|
||||
nsDrawingSurface aSurface,
|
||||
PRInt32 aSXOffset, PRInt32 aSYOffset,
|
||||
const nsRect &aTileRect)
|
||||
{
|
||||
return(PR_FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
PRBool nsImageOS2::SlowTile (nsIRenderingContext& aContext, nsDrawingSurface aSurface,
|
||||
nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1,
|
||||
|
|
|
@ -85,8 +85,10 @@ public:
|
|||
* @param aHeight The destination height of the pixelmap
|
||||
* @return if TRUE, no errors
|
||||
*/
|
||||
// OS2TODO
|
||||
PRBool DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1,nscoord aWidth,nscoord aHeight);
|
||||
NS_IMETHOD DrawTile(nsIRenderingContext &aContext,
|
||||
nsDrawingSurface aSurface,
|
||||
PRInt32 aSXOffset, PRInt32 aSYOffset,
|
||||
const nsRect &aTileRect);
|
||||
|
||||
#ifdef USE_IMG2
|
||||
NS_IMETHOD DrawToImage(nsIImage* aDstImage, nscoord aDX, nscoord aDY,
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsGfxCIID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsFont.h"
|
||||
#include "libimg.h"
|
||||
#include "prprf.h"
|
||||
#include "nsIRenderingContextOS2.h"
|
||||
|
||||
|
@ -265,12 +264,13 @@ nsRenderingContextOS2::Init( nsIDeviceContext *aContext,
|
|||
|
||||
nsresult nsRenderingContextOS2::SetupPS (void)
|
||||
{
|
||||
LONG BlackColor, WhiteColor;
|
||||
|
||||
#ifdef COLOR_256
|
||||
// If this is a palette device, then select and realize the palette
|
||||
nsPaletteInfo palInfo;
|
||||
mContext->GetPaletteInfo(palInfo);
|
||||
|
||||
LONG BlackColor, WhiteColor;
|
||||
|
||||
if (palInfo.isPaletteDevice && palInfo.palette)
|
||||
{
|
||||
ULONG cclr;
|
||||
|
@ -287,6 +287,7 @@ nsresult nsRenderingContextOS2::SetupPS (void)
|
|||
mPaletteMode = PR_TRUE;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
GFX (::GpiCreateLogColorTable (mPS, 0, LCOLF_RGB, 0, 0, 0), FALSE);
|
||||
|
||||
|
@ -1728,41 +1729,6 @@ NS_IMETHODIMP nsRenderingContextOS2::DrawImage( nsIImage *aImage, const nsRect&
|
|||
return aImage->Draw( *this, mSurface, tr.x, tr.y, tr.width, tr.height);
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsIRenderingContext.h
|
||||
* @update 3/16/00 dwc
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsRenderingContextOS2::DrawTile(nsIImage *aImage,nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1,
|
||||
nscoord aWidth,nscoord aHeight)
|
||||
{
|
||||
nscoord orgX,orgY,orgWidth,orgHeight;
|
||||
PRBool didtile = FALSE;
|
||||
|
||||
// convert output platform, but no translation.. just scale
|
||||
orgX = aX0;
|
||||
orgY = aY0;
|
||||
orgWidth = aX1 - aX0;
|
||||
orgHeight = aY1 - aY0;
|
||||
mTranMatrix->TransformCoord(&aX0,&aY0,&aWidth,&aHeight);
|
||||
mTranMatrix->TransformCoord(&orgX,&orgY,&orgWidth,&orgHeight);
|
||||
aX1 = aX0 + orgWidth;
|
||||
aY1 = aY0 + orgHeight;
|
||||
|
||||
// if ( PR_TRUE==CanTile(aWidth,aHeight) ) {
|
||||
// didtile = ((nsImageOS2*)aImage)->PatBltTile(*this,mSurface,aX0,aY0,aX1,aY1,aWidth,aHeight);
|
||||
// }
|
||||
|
||||
// if (PR_FALSE ==didtile){
|
||||
// rely on the slower tiler supported in nsRenderingContextWin.. don't have
|
||||
// to use xplatform which is really slow (slowest is the only one that supports transparency
|
||||
didtile = ((nsImageOS2*)aImage)->DrawTile(*this,mSurface,aX0,aY0,aX1,aY1,aWidth,aHeight);
|
||||
// }
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextOS2::CopyOffScreenBits(
|
||||
nsDrawingSurface aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY,
|
||||
const nsRect &aDestBounds, PRUint32 aCopyFlags)
|
||||
|
|
|
@ -182,10 +182,6 @@ public:
|
|||
NS_IMETHOD DrawImage( nsIImage *aImage, const nsRect& aRect);
|
||||
NS_IMETHOD DrawImage( nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect);
|
||||
|
||||
NS_IMETHOD DrawTile(nsIImage *aImage,nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1,
|
||||
nscoord aWidth,nscoord aHeight);
|
||||
|
||||
|
||||
//~~~
|
||||
NS_IMETHOD RetrieveCurrentNativeGraphicData(PRUint32 * ngd);
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ PRBool nsCanvas::OnPaint()
|
|||
if (NS_OK == winrc->CreateDrawingSurface(hPS, surf, event.widget))
|
||||
{
|
||||
event.renderingContext->Init(mContext, surf);
|
||||
#ifdef COLOR_256
|
||||
nsPaletteInfo palInfo;
|
||||
mContext->GetPaletteInfo(palInfo);
|
||||
if (palInfo.isPaletteDevice && palInfo.palette)
|
||||
|
@ -187,6 +188,7 @@ PRBool nsCanvas::OnPaint()
|
|||
ULONG cclr;
|
||||
::WinRealizePalette(mWnd, hPS, &cclr);
|
||||
}
|
||||
#endif
|
||||
rc = DispatchWindowEvent(&event);
|
||||
event.renderingContext->DestroyDrawingSurface(surf);
|
||||
}
|
||||
|
@ -212,6 +214,7 @@ PRBool nsCanvas::OnRealizePalette()
|
|||
{
|
||||
PRBool rc = PR_FALSE;
|
||||
|
||||
#ifdef COLOR_256
|
||||
// Get palette info from device
|
||||
nsPaletteInfo palInfo;
|
||||
mContext->GetPaletteInfo( palInfo);
|
||||
|
@ -228,6 +231,7 @@ PRBool nsCanvas::OnRealizePalette()
|
|||
|
||||
rc = PR_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче