зеркало из https://github.com/mozilla/pjs.git
Changes for qnx( photon ) platform only. It should not affect runtime/building other platforms.
Changes required to fix printing under 630.
This commit is contained in:
Родитель
1708aa5737
Коммит
bcb946a472
|
@ -242,8 +242,9 @@ NS_IMETHODIMP nsDeviceContextPh :: CreateRenderingContext( nsIRenderingContext *
|
|||
|
||||
surf = new nsDrawingSurfacePh();
|
||||
if( nsnull != surf ) {
|
||||
PpPrintContext_t *pc = ((nsDeviceContextSpecPh *)mSpec)->GetPrintContext();
|
||||
mGC = PgCreateGC( 0 );
|
||||
rv = surf->Init( mGC );
|
||||
rv = surf->Init( (PhDrawContext_t*)pc, mGC );
|
||||
if( NS_OK == rv ) rv = pContext->Init(this, surf);
|
||||
else rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -253,7 +254,6 @@ NS_IMETHODIMP nsDeviceContextPh :: CreateRenderingContext( nsIRenderingContext *
|
|||
if( NS_OK != rv ) NS_IF_RELEASE( pContext );
|
||||
|
||||
aContext = pContext;
|
||||
NS_ADDREF( pContext ); // otherwise it's crashing after printing
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,11 +81,11 @@ public:
|
|||
|
||||
/* Initialize a On-Screen Drawing Surface */
|
||||
inline
|
||||
NS_IMETHODIMP Init( PhGC_t *aGC )
|
||||
NS_IMETHODIMP Init( PhDrawContext_t *aDC, PhGC_t *aGC )
|
||||
{
|
||||
mGC = aGC;
|
||||
mIsOffscreen = PR_FALSE;
|
||||
mDrawContext = _Ph_->dflt_draw_context; /* it's the dc you get by doing a PhDCSetCurrent( NULL ) */
|
||||
mDrawContext = aDC;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
* @param aDC HDC to initialize drawing surface with
|
||||
* @return error status
|
||||
**/
|
||||
NS_IMETHOD Init( PhGC_t *aGc ) = 0;
|
||||
NS_IMETHOD Init( PhDrawContext_t *aDC, PhGC_t *aGC ) = 0;
|
||||
|
||||
/**
|
||||
* Initialize an offscreen drawing surface using a
|
||||
|
|
|
@ -441,56 +441,8 @@ NS_IMETHODIMP nsImagePh :: Draw(nsIRenderingContext &aContext, nsDrawingSurface
|
|||
}
|
||||
|
||||
/* New Tile code *********************************************************************/
|
||||
NS_IMETHODIMP nsImagePh::DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface, nsRect &aSrcRect, nsRect &aTileRect ) {
|
||||
PhPoint_t pos, space, rep;
|
||||
PhDrawContext_t *dc;
|
||||
PhGC_t *gc;
|
||||
|
||||
/* is this a 1x1 transparent image used for spacing? */
|
||||
if( mWidth == 1 && mHeight == 1 && mAlphaDepth == 1 && mAlphaBits[0] == 0x0 ) return NS_OK;
|
||||
|
||||
dc = PhDCGetCurrent();
|
||||
gc = PgGetGCCx( dc );
|
||||
|
||||
pos.x = aTileRect.x;
|
||||
pos.y = aTileRect.y;
|
||||
|
||||
space.x = aSrcRect.width;
|
||||
space.y = aSrcRect.height;
|
||||
rep.x = ( aTileRect.width + space.x - 1 ) / space.x;
|
||||
rep.y = ( aTileRect.height + space.y - 1 ) / space.y;
|
||||
PhRect_t clip = { {aTileRect.x, aTileRect.y}, {aTileRect.x + aTileRect.width, aTileRect.y + aTileRect.height} };
|
||||
PgSetMultiClipCx( gc, 1, &clip );
|
||||
|
||||
if ((mAlphaDepth == 1) || (mAlphaDepth == 0)) {
|
||||
if( mImageFlags & IMAGE_SHMEM )
|
||||
PgDrawRepPhImageCxv( dc, &mPhImage, 0, &pos, &rep, &space );
|
||||
else PgDrawRepPhImageCx( dc, &mPhImage, 0, &pos, &rep, &space );
|
||||
}
|
||||
else
|
||||
{
|
||||
PgMap_t map;
|
||||
map.dim.w = mAlphaWidth;
|
||||
map.dim.h = mAlphaHeight;
|
||||
map.bpl = mAlphaRowBytes;
|
||||
map.bpp = mAlphaDepth;
|
||||
map.map = (unsigned char *)mAlphaBits;
|
||||
PgSetAlphaBlendCx( gc, &map, 0 );
|
||||
|
||||
PgAlphaOnCx( gc );
|
||||
if( mImageFlags & IMAGE_SHMEM )
|
||||
PgDrawRepPhImageCxv( dc, &mPhImage, 0, &pos, &rep, &space );
|
||||
else PgDrawRepPhImageCx( dc, &mPhImage, 0, &pos, &rep, &space );
|
||||
PgAlphaOffCx( gc );
|
||||
|
||||
PgSetAlphaBlendCx( gc, NULL, 0 ); /* this shouldn't be necessary, but the ph lib's gc is holding onto our mAlphaBits */
|
||||
}
|
||||
|
||||
PgSetMultiClipCx( gc, 0, NULL );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImagePh::DrawTile( nsIRenderingContext &aContext, nsDrawingSurface aSurface, PRInt32 aSXOffset, PRInt32 aSYOffset, const nsRect &aTileRect )
|
||||
NS_IMETHODIMP nsImagePh::DrawTile( nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
PRInt32 aSXOffset, PRInt32 aSYOffset, PRInt32 aPadX, PRInt32 aPadY, const nsRect &aTileRect )
|
||||
{
|
||||
PhPoint_t pos, space, rep;
|
||||
PhDrawContext_t *dc ;
|
||||
|
@ -507,8 +459,8 @@ NS_IMETHODIMP nsImagePh::DrawTile( nsIRenderingContext &aContext, nsDrawingSurfa
|
|||
pos.x = aTileRect.x - aSXOffset;
|
||||
pos.y = aTileRect.y - aSYOffset;
|
||||
|
||||
space.x = mPhImage.size.w;
|
||||
space.y = mPhImage.size.h;
|
||||
space.x = mPhImage.size.w + aPadX;
|
||||
space.y = mPhImage.size.h + aPadY;
|
||||
rep.x = ( aTileRect.width + aSXOffset + space.x - 1 ) / space.x;
|
||||
rep.y = ( aTileRect.height + aSYOffset + space.y - 1 ) / space.y;
|
||||
|
||||
|
|
|
@ -94,11 +94,9 @@ public:
|
|||
NS_IMETHOD DrawToImage(nsIImage* aDstImage, nscoord aDX, nscoord aDY,
|
||||
nscoord aDWidth, nscoord aDHeight);
|
||||
|
||||
NS_IMETHOD DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
nsRect &aSrcRect, nsRect &aTileRect);
|
||||
|
||||
NS_IMETHOD DrawTile(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
||||
PRInt32 aSXOffset, PRInt32 aSYOffset, const nsRect &aTileRect);
|
||||
PRInt32 aSXOffset, PRInt32 aSYOffset, PRInt32 aPadX, PRInt32 aPadY,
|
||||
const nsRect &aTileRect);
|
||||
|
||||
virtual void ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect)
|
||||
{
|
||||
|
|
|
@ -163,7 +163,8 @@ NS_IMETHODIMP nsRenderingContextPh :: Init( nsIDeviceContext* aContext, nsIWidge
|
|||
mGC = PgCreateGC( 0 );
|
||||
mOwner = PR_TRUE;
|
||||
|
||||
res = mSurface->Init( mGC );
|
||||
/* use the dc you get by doing a PhDCSetCurrent( NULL ) */
|
||||
res = mSurface->Init( _Ph_->dflt_draw_context, mGC );
|
||||
if( res != NS_OK )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -878,33 +879,6 @@ NS_IMETHODIMP nsRenderingContextPh::DrawImage( nsIImage *aImage, const nsRect& a
|
|||
* See documentation in nsIRenderingContext.h
|
||||
* @update 3/16/00 dwc
|
||||
*/
|
||||
NS_IMETHODIMP nsRenderingContextPh::DrawTile( nsIImage *aImage,nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1, nscoord aWidth,nscoord aHeight )
|
||||
{
|
||||
mTranMatrix->TransformCoord(&aX0,&aY0,&aWidth,&aHeight);
|
||||
mTranMatrix->TransformCoord(&aX1,&aY1);
|
||||
|
||||
nsRect srcRect (0, 0, aWidth, aHeight);
|
||||
nsRect tileRect(aX0, aY0, aX1-aX0, aY1-aY0);
|
||||
|
||||
((nsImagePh*)aImage)->DrawTile(*this, mSurface, srcRect, tileRect);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextPh::DrawTile( nsIImage *aImage, nscoord aSrcXOffset, nscoord aSrcYOffset, const nsRect &aTileRect )
|
||||
{
|
||||
nsRect tileRect( aTileRect );
|
||||
nsRect srcRect(0, 0, aSrcXOffset, aSrcYOffset);
|
||||
mTranMatrix->TransformCoord(&srcRect.x, &srcRect.y, &srcRect.width, &srcRect.height);
|
||||
mTranMatrix->TransformCoord(&tileRect.x, &tileRect.y, &tileRect.width, &tileRect.height);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextPh :: CopyOffScreenBits( nsDrawingSurface aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY, const nsRect &aDestBounds, PRUint32 aCopyFlags )
|
||||
{
|
||||
PhArea_t darea, sarea;
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
|
||||
mSurface = (nsDrawingSurfacePh *) aSurface;
|
||||
NS_ADDREF(mSurface);
|
||||
mOffscreenSurface = mSurface;
|
||||
|
||||
mGC = mSurface->GetGC();
|
||||
mOwner = PR_FALSE;
|
||||
|
@ -346,10 +347,6 @@ public:
|
|||
NS_IMETHODIMP DrawImage(nsIImage *aImage, const nsRect& aRect) { return DrawImage( aImage, aRect.x, aRect.y, aRect.width, aRect.height ); }
|
||||
|
||||
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 DrawTile(nsIImage *aImage, nscoord aSrcXOffset, nscoord aSrcYOffset,
|
||||
const nsRect &aTileRect);
|
||||
|
||||
NS_IMETHOD CopyOffScreenBits(nsDrawingSurface aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY,
|
||||
const nsRect &aDestBounds, PRUint32 aCopyFlags);
|
||||
|
|
Загрузка…
Ссылка в новой задаче