mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 11:56:51 +00:00
r=mkaply, a=brendan Implement DrawTile so background images are displayed
This commit is contained in:
parent
648d67e382
commit
45ed74357a
@ -401,3 +401,19 @@ nsImageOS2::SetDecodedRect(PRInt32 x1, PRInt32 y1, PRInt32 x2, PRInt32 y2 )
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsImageOS2::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1,
|
||||
nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
PRInt32 x,y;
|
||||
|
||||
// OS2TODO - use the old way... slow, but will always work.
|
||||
for(y=aY0;y<aY1;y+=aHeight){
|
||||
for(x=aX0;x<aX1;x+=aWidth){
|
||||
this->Draw(aContext,aSurface,x,y,aWidth,aHeight);
|
||||
}
|
||||
}
|
||||
return(PR_TRUE);
|
||||
}
|
||||
|
||||
|
@ -80,9 +80,8 @@ public:
|
||||
* @param aHeight The destination height of the pixelmap
|
||||
* @return if TRUE, no errors
|
||||
*/
|
||||
#if 0 // OS2TODO
|
||||
// OS2TODO
|
||||
PRBool DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1,nscoord aWidth,nscoord aHeight);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return the header size of the Device Independent Bitmap(DIB).
|
||||
|
@ -1379,6 +1379,28 @@ 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;
|
||||
mTMatrix.TransformCoord(&aX0,&aY0,&aWidth,&aHeight);
|
||||
mTMatrix.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;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "nsTransform2D.h"
|
||||
#include "nscoord.h"
|
||||
#include "nsDrawingSurfaceOS2.h"
|
||||
#include "nsImageOS2.h"
|
||||
#include "nsRenderingContextImpl.h"
|
||||
|
||||
class nsIDeviceContext;
|
||||
|
Loading…
Reference in New Issue
Block a user