mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
bug#13718: add hooks for natural dimensions on images. pnunn. r: cmanske, kmcclusk.
This commit is contained in:
parent
3214bb75fd
commit
99dd0f44ed
@ -109,6 +109,11 @@ public:
|
||||
virtual PRInt32 GetDecodedX2() = 0;
|
||||
virtual PRInt32 GetDecodedY2() = 0;
|
||||
|
||||
NS_IMETHOD SetNaturalWidth(PRInt32) = 0;
|
||||
NS_IMETHOD SetNaturalHeight(PRInt32) = 0;
|
||||
virtual PRInt32 GetNaturalWidth() = 0;
|
||||
virtual PRInt32 GetNaturalHeight() = 0;
|
||||
|
||||
/**
|
||||
* Get a pointer to the bits for the pixelmap, only if it is not optimized
|
||||
* @update - dwc 2/1/99
|
||||
|
@ -42,6 +42,9 @@ nsImageBeOS::nsImageBeOS()
|
||||
mAlphaBits = nsnull;
|
||||
mAlphaPixmap = nsnull;
|
||||
mImage = nsnull;
|
||||
mNaturalWidth = 0;
|
||||
mNaturalHeight = 0;
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
@ -93,6 +96,8 @@ nsresult
|
||||
}
|
||||
|
||||
SetDecodedRect(0,0,0,0); //init
|
||||
SetNaturalWidth(0);
|
||||
SetNaturalHeight(0);
|
||||
|
||||
mWidth = aWidth;
|
||||
mHeight = aHeight;
|
||||
|
@ -55,6 +55,12 @@ public:
|
||||
virtual PRInt32 GetDecodedX2() { return mDecodedX2;}
|
||||
virtual PRInt32 GetDecodedY2() { return mDecodedY2;}
|
||||
|
||||
NS_IMETHOD SetNaturalWidth(PRInt32 naturalwidth) { mNaturalWidth= naturalwidth; return NS_OK;}
|
||||
NS_IMETHOD SetNaturalHeight(PRInt32 naturalheight) { mNaturalHeight= naturalheight; return NS_OK;}
|
||||
virtual PRInt32 GetNaturalWidth() {return mNaturalWidth; }
|
||||
virtual PRInt32 GetNaturalHeight() {return mNaturalHeight; }
|
||||
|
||||
|
||||
NS_IMETHOD Draw(nsIRenderingContext &aContext,
|
||||
nsDrawingSurface aSurface,
|
||||
PRInt32 aX, PRInt32 aY,
|
||||
@ -119,6 +125,9 @@ private:
|
||||
PRInt32 mDecodedX2;
|
||||
PRInt32 mDecodedY2;
|
||||
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
|
||||
// alpha layer members
|
||||
PRUint8 *mAlphaBits;
|
||||
BBitmap *mAlphaPixmap;
|
||||
|
@ -70,6 +70,9 @@ nsImageGTK::nsImageGTK()
|
||||
mAlphaWidth = 0;
|
||||
mConvertedBits = nsnull;
|
||||
mGC = nsnull;
|
||||
mNaturalWidth = 0;
|
||||
mNaturalHeight = 0;
|
||||
|
||||
#ifdef TRACE_IMAGE_ALLOCATION
|
||||
printf("nsImageGTK::nsImageGTK(this=%p)\n",
|
||||
this);
|
||||
@ -131,7 +134,8 @@ nsresult nsImageGTK::Init(PRInt32 aWidth, PRInt32 aHeight,
|
||||
}
|
||||
|
||||
SetDecodedRect(0,0,0,0); //init
|
||||
|
||||
SetNaturalWidth(0);
|
||||
SetNaturalHeight(0);
|
||||
|
||||
// mImagePixmap gets created once per unique image bits in Draw()
|
||||
// ImageUpdated(nsImageUpdateFlags_kBitsChanged) can cause the
|
||||
|
@ -50,6 +50,11 @@ public:
|
||||
virtual PRBool GetIsRowOrderTopToBottom() { return mIsTopToBottom; }
|
||||
virtual PRInt32 GetLineStride();
|
||||
|
||||
NS_IMETHOD SetNaturalWidth(PRInt32 naturalwidth) { mNaturalWidth= naturalwidth; return NS_OK;}
|
||||
NS_IMETHOD SetNaturalHeight(PRInt32 naturalheight) { mNaturalHeight= naturalheight; return NS_OK;}
|
||||
virtual PRInt32 GetNaturalWidth() {return mNaturalWidth; }
|
||||
virtual PRInt32 GetNaturalHeight() {return mNaturalHeight; }
|
||||
|
||||
NS_IMETHOD SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2);
|
||||
virtual PRInt32 GetDecodedX1() { return mDecodedX1;}
|
||||
virtual PRInt32 GetDecodedY1() { return mDecodedY1;}
|
||||
@ -158,6 +163,9 @@ private:
|
||||
|
||||
PRInt8 mNumBytesPixel;
|
||||
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
|
||||
PRInt32 mDecodedX1; //Keeps track of what part of image
|
||||
PRInt32 mDecodedY1; // has been decoded.
|
||||
PRInt32 mDecodedX2;
|
||||
|
@ -52,6 +52,9 @@ nsImageMac::nsImageMac()
|
||||
, mARowBytes(0)
|
||||
, mIsTopToBottom(PR_TRUE)
|
||||
, mPixelDataSize(0)
|
||||
, mNaturalWidth(0)
|
||||
, mNaturalHeight(0)
|
||||
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
@ -145,7 +148,9 @@ nsImageMac::Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth, nsMaskRequirem
|
||||
mWidth = aWidth;
|
||||
mHeight = aHeight;
|
||||
SetDecodedRect(0,0,0,0); //init
|
||||
|
||||
SetNaturalWidth(0);
|
||||
SetNaturalHeight(0);
|
||||
|
||||
PRInt16 bufferdepth;
|
||||
|
||||
switch(aDepth)
|
||||
|
@ -48,6 +48,11 @@ public:
|
||||
virtual PRInt32 GetLineStride() { return mRowBytes; }
|
||||
virtual PRBool GetHasAlphaMask() { return mAlphaGWorld != nsnull; }
|
||||
|
||||
NS_IMETHOD SetNaturalWidth(PRInt32 naturalwidth) { mNaturalWidth= naturalwidth; return NS_OK;}
|
||||
NS_IMETHOD SetNaturalHeight(PRInt32 naturalheight) { mNaturalHeight= naturalheight; return NS_OK;}
|
||||
virtual PRInt32 GetNaturalWidth() {return mNaturalWidth; }
|
||||
virtual PRInt32 GetNaturalHeight() {return mNaturalHeight; }
|
||||
|
||||
NS_IMETHOD SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2);
|
||||
virtual PRInt32 GetDecodedX1() { return mDecodedX1;}
|
||||
virtual PRInt32 GetDecodedY1() { return mDecodedY1;}
|
||||
@ -103,6 +108,9 @@ private:
|
||||
PRInt16 mAlphaHeight; // alpha layer height
|
||||
PRInt32 mARowBytes; // alpha row bytes
|
||||
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
|
||||
PRInt32 mDecodedX1; //Keeps track of what part of image
|
||||
PRInt32 mDecodedY1; // has been decoded.
|
||||
PRInt32 mDecodedX2;
|
||||
|
@ -47,6 +47,9 @@ nsImageMotif :: nsImageMotif()
|
||||
mColorMap = nsnull;
|
||||
mAlphaBits = nsnull;
|
||||
mStaticImage = PR_FALSE;
|
||||
mNaturalWidth = 0;
|
||||
mNaturalHeight = 0;
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
@ -101,6 +104,8 @@ nsresult nsImageMotif :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,ns
|
||||
mConverted = PR_FALSE;
|
||||
|
||||
SetDecodedRect(0,0,0,0); //init
|
||||
SetNaturalWidth(0);
|
||||
SetNaturalHeight(0);
|
||||
|
||||
ComputePaletteSize(aDepth);
|
||||
|
||||
|
@ -57,6 +57,11 @@ public:
|
||||
virtual PRBool GetIsRowOrderTopToBottom() { return mIsTopToBottom; }
|
||||
virtual PRInt32 GetLineStride() {return mRowBytes; }
|
||||
|
||||
NS_IMETHOD SetNaturalWidth(PRInt32 naturalwidth) { mNaturalWidth= naturalwidth; return NS_OK;}
|
||||
NS_IMETHOD SetNaturalHeight(PRInt32 naturalheight) { mNaturalHeight= naturalheight; return NS_OK;}
|
||||
virtual PRInt32 GetNaturalWidth() {return mNaturalWidth; }
|
||||
virtual PRInt32 GetNaturalHeight() {return mNaturalHeight; }
|
||||
|
||||
NS_IMETHOD SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2);
|
||||
virtual PRInt32 GetDecodedX1() { return mDecodedX1;}
|
||||
virtual PRInt32 GetDecodedY1() { return mDecodedY1;}
|
||||
@ -141,6 +146,9 @@ private:
|
||||
PRInt16 mNumPalleteColors;
|
||||
PRInt8 mNumBytesPixel;
|
||||
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
|
||||
PRInt32 mDecodedX1; //Keeps track of what part of image
|
||||
PRInt32 mDecodedY1; // has been decoded.
|
||||
PRInt32 mDecodedX2;
|
||||
|
@ -65,6 +65,9 @@ public:
|
||||
PRInt32 *aWidthPtr, PRInt32 *aHeightPtr,
|
||||
PRUint32 aIconNumber);
|
||||
|
||||
NS_IMETHOD SetImageNaturalDimensions(IL_Pixmap* aImage, PRInt32 naturalwidth, PRInt32 naturalheight);
|
||||
|
||||
|
||||
NS_IMETHOD SetDecodedRect(IL_Pixmap* aImage,
|
||||
PRInt32 x1, PRInt32 y1,
|
||||
PRInt32 x2, PRInt32 y2);
|
||||
@ -72,6 +75,20 @@ public:
|
||||
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageRendererImpl::SetImageNaturalDimensions(
|
||||
IL_Pixmap* aImage,
|
||||
PRInt32 naturalwidth,
|
||||
PRInt32 naturalheight){
|
||||
|
||||
nsIImage *img = (nsIImage *)aImage->client_data;
|
||||
|
||||
if(img){
|
||||
nsresult rv = img->SetNaturalWidth(naturalwidth);
|
||||
rv = img->SetNaturalHeight(naturalheight);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
ImageRendererImpl::ImageRendererImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
@ -59,6 +59,9 @@ nsImageOS2::nsImageOS2()
|
||||
mIsTopToBottom = PR_FALSE;
|
||||
|
||||
mDeviceDepth = 0;
|
||||
mNaturalWidth = 0;
|
||||
mNaturalHeight = 0;
|
||||
|
||||
}
|
||||
|
||||
nsImageOS2::~nsImageOS2()
|
||||
@ -87,6 +90,8 @@ nsresult nsImageOS2::Init( PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,
|
||||
// mRowBytes = (mRowBytes + 3) & ~0x3;
|
||||
|
||||
SetDecodedRect(0,0,0,0); //init
|
||||
SetNaturalWidth(0);
|
||||
SetNaturalHeight(0);
|
||||
|
||||
mImageBits = new PRUint8 [ aHeight * mRowBytes ];
|
||||
|
||||
|
@ -49,6 +49,11 @@ public:
|
||||
virtual PRUint8* GetBits() { return mImageBits; }
|
||||
virtual PRInt32 GetLineStride() { return mRowBytes; }
|
||||
|
||||
NS_IMETHOD SetNaturalWidth(PRInt32 naturalwidth) { mNaturalWidth= naturalwidth; return NS_OK;}
|
||||
NS_IMETHOD SetNaturalHeight(PRInt32 naturalheight) { mNaturalHeight= naturalheight; return NS_OK;}
|
||||
virtual PRInt32 GetNaturalWidth() {return mNaturalWidth; }
|
||||
virtual PRInt32 GetNaturalHeight() {return mNaturalHeight; }
|
||||
|
||||
NS_IMETHOD SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2);
|
||||
virtual PRInt32 GetDecodedX1() { return mDecodedX1;}
|
||||
virtual PRInt32 GetDecodedY1() { return mDecodedY1;}
|
||||
@ -188,6 +193,9 @@ public:
|
||||
PRBool mIsOptimized; // Did we convert our DIB to a HBITMAP
|
||||
nsColorMap* mColorMap; // Redundant with mColorTable, but necessary
|
||||
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
|
||||
PRInt32 mDecodedX1; //Keeps track of what part of image
|
||||
PRInt32 mDecodedY1; // has been decoded.
|
||||
PRInt32 mDecodedX2;
|
||||
|
@ -66,6 +66,9 @@ nsImagePh :: nsImagePh()
|
||||
mAlphaLevel = 0;
|
||||
mImage.palette = nsnull;
|
||||
mImage.image = nsnull;
|
||||
mNaturalWidth = 0;
|
||||
mNaturalHeight = 0;
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
@ -127,6 +130,8 @@ nsresult nsImagePh :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsMas
|
||||
}
|
||||
|
||||
SetDecodedRect(0,0,0,0); //init
|
||||
SetNaturalWidth(0);
|
||||
SetNaturalHeight(0);
|
||||
|
||||
if (24 == aDepth)
|
||||
{
|
||||
|
@ -44,6 +44,11 @@ public:
|
||||
virtual PRBool GetIsRowOrderTopToBottom() { return mIsTopToBottom; }
|
||||
virtual PRInt32 GetLineStride();
|
||||
|
||||
NS_IMETHOD SetNaturalWidth(PRInt32 naturalwidth) { mNaturalWidth= naturalwidth; return NS_OK;}
|
||||
NS_IMETHOD SetNaturalHeight(PRInt32 naturalheight) { mNaturalHeight= naturalheight; return NS_OK;}
|
||||
virtual PRInt32 GetNaturalWidth() {return mNaturalWidth; }
|
||||
virtual PRInt32 GetNaturalHeight() {return mNaturalHeight; }
|
||||
|
||||
NS_IMETHOD SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2);
|
||||
virtual PRInt32 GetDecodedX1() { return mDecodedX1;}
|
||||
virtual PRInt32 GetDecodedY1() { return mDecodedY1;}
|
||||
@ -110,6 +115,8 @@ private:
|
||||
|
||||
// PRBool mIsOptimized; // Have we turned our DIB into a GDI?
|
||||
// nsColorMap* mColorMap; // Redundant with mColorTable, but necessary
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
|
||||
PRInt32 mDecodedX1; //Keeps track of what part of image
|
||||
PRInt32 mDecodedY1; // has been decoded.
|
||||
|
@ -47,6 +47,9 @@ nsImageQT::nsImageQT()
|
||||
mAlphaBits = nsnull;
|
||||
mAlphaPixmap = nsnull;
|
||||
mImagePixmap = nsnull;
|
||||
mNaturalWidth = 0;
|
||||
mNaturalHeight = 0;
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
@ -96,6 +99,8 @@ nsresult nsImageQT::Init(PRInt32 aWidth,
|
||||
}
|
||||
|
||||
SetDecodedRect(0,0,0,0); //init
|
||||
SetNaturalWidth(0);
|
||||
SetNaturalHeight(0);
|
||||
|
||||
if (nsnull != mImageBits)
|
||||
{
|
||||
|
@ -47,6 +47,11 @@ public:
|
||||
virtual PRUint8* GetBits();
|
||||
virtual void* GetBitInfo();
|
||||
virtual PRInt32 GetLineStride();
|
||||
|
||||
NS_IMETHOD SetNaturalWidth(PRInt32 naturalwidth) { mNaturalWidth= naturalwidth; return NS_OK;}
|
||||
NS_IMETHOD SetNaturalHeight(PRInt32 naturalheight) { mNaturalHeight= naturalheight; return NS_OK;}
|
||||
virtual PRInt32 GetNaturalWidth() {return mNaturalWidth; }
|
||||
virtual PRInt32 GetNaturalHeight() {return mNaturalHeight; }
|
||||
|
||||
NS_IMETHOD SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2);
|
||||
virtual PRInt32 GetDecodedX1() { return mDecodedX1;}
|
||||
@ -117,6 +122,9 @@ private:
|
||||
|
||||
PRInt8 mNumBytesPixel;
|
||||
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
|
||||
PRInt32 mDecodedX1; //Keeps track of what part of image
|
||||
PRInt32 mDecodedY1; // has been decoded.
|
||||
PRInt32 mDecodedX2;
|
||||
|
@ -58,6 +58,9 @@ nsImageWin :: nsImageWin()
|
||||
mColorMap = nsnull;
|
||||
mBHead = nsnull;
|
||||
|
||||
mNaturalWidth = 0;
|
||||
mNaturalHeight = 0;
|
||||
|
||||
//CleanUp(PR_TRUE);
|
||||
CleanUpDDB();
|
||||
CleanUpDIB();
|
||||
@ -98,6 +101,9 @@ nsresult nsImageWin :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsMa
|
||||
} else {
|
||||
NS_ASSERTION(PR_FALSE, "unexpected image depth");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
SetNaturalWidth(0);
|
||||
SetNaturalHeight(0);
|
||||
}
|
||||
|
||||
SetDecodedRect(0,0,0,0); //init
|
||||
|
@ -69,6 +69,12 @@ public:
|
||||
virtual PRInt32 GetWidth() { return mBHead->biWidth; }
|
||||
virtual PRUint8* GetBits() { return mImageBits; }
|
||||
virtual PRInt32 GetLineStride() { return mRowBytes; }
|
||||
|
||||
NS_IMETHOD SetNaturalWidth(PRInt32 naturalwidth) { mNaturalWidth= naturalwidth; return NS_OK;}
|
||||
NS_IMETHOD SetNaturalHeight(PRInt32 naturalheight) { mNaturalHeight= naturalheight; return NS_OK;}
|
||||
virtual PRInt32 GetNaturalWidth() {return mNaturalWidth; }
|
||||
virtual PRInt32 GetNaturalHeight() {return mNaturalHeight; }
|
||||
|
||||
|
||||
NS_IMETHOD SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2);
|
||||
virtual PRInt32 GetDecodedX1() { return mDecodedX1;}
|
||||
@ -244,6 +250,9 @@ private:
|
||||
PRInt32 mDecodedY1; // has been decoded.
|
||||
PRInt32 mDecodedX2;
|
||||
PRInt32 mDecodedY2;
|
||||
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
|
||||
// alpha layer members
|
||||
PRUint8 *mAlphaBits; // alpha layer if we made one
|
||||
|
@ -54,6 +54,9 @@ nsImageXlib::nsImageXlib()
|
||||
mLocation.y = 0;
|
||||
mDisplay = nsnull;
|
||||
mConvertedBits = nsnull;
|
||||
mNaturalWidth = 0;
|
||||
mNaturalHeight = 0;
|
||||
|
||||
}
|
||||
|
||||
nsImageXlib::~nsImageXlib()
|
||||
@ -114,6 +117,8 @@ nsresult nsImageXlib::Init(PRInt32 aWidth, PRInt32 aHeight,
|
||||
}
|
||||
|
||||
SetDecodedRect(0,0,0,0);
|
||||
SetNaturalWidth(0);
|
||||
SetNaturalHeight(0);
|
||||
|
||||
if (nsnull != mImagePixmap) {
|
||||
XFreePixmap(mDisplay, mImagePixmap);
|
||||
|
@ -45,6 +45,11 @@ public:
|
||||
virtual PRBool GetIsRowOrderTopToBottom() { return mIsTopToBottom; }
|
||||
virtual PRInt32 GetLineStride();
|
||||
|
||||
NS_IMETHOD SetNaturalWidth(PRInt32 naturalwidth) { mNaturalWidth= naturalwidth; return NS_OK;}
|
||||
NS_IMETHOD SetNaturalHeight(PRInt32 naturalheight) { mNaturalHeight= naturalheight; return NS_OK;}
|
||||
virtual PRInt32 GetNaturalWidth() {return mNaturalWidth; }
|
||||
virtual PRInt32 GetNaturalHeight() {return mNaturalHeight; }
|
||||
|
||||
NS_IMETHOD SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2);
|
||||
virtual PRInt32 GetDecodedX1() { return mDecodedX1;}
|
||||
virtual PRInt32 GetDecodedY1() { return mDecodedY1;}
|
||||
@ -157,6 +162,9 @@ private:
|
||||
|
||||
PRInt8 mNumBytesPixel;
|
||||
|
||||
PRInt32 mNaturalWidth;
|
||||
PRInt32 mNaturalHeight;
|
||||
|
||||
PRInt32 mDecodedX1; //Keeps track of what part of image
|
||||
PRInt32 mDecodedY1; // has been decoded.
|
||||
PRInt32 mDecodedX2;
|
||||
|
Loading…
Reference in New Issue
Block a user