fix unix tiling code so that it runs (not turned on yet)
git-svn-id: svn://10.0.0.236/trunk@67572 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
80fb5117d9
commit
a70e6f512e
@ -1018,20 +1018,20 @@ static void TileImage(GdkWindow *dest, GdkGC *gc, GdkWindow *src, nsRect &aSrcRe
|
||||
*/
|
||||
NS_IMETHODIMP nsImageGTK::DrawTile(nsIRenderingContext &aContext,
|
||||
nsDrawingSurface aSurface,
|
||||
nscoord aX0, nscoord aY0,
|
||||
nscoord aX1, nscoord aY1,
|
||||
nscoord aWidth, nscoord aHeight)
|
||||
nsRect &aSrcRect,
|
||||
nsRect &aTileRect)
|
||||
{
|
||||
mWidth = aX1 - aX0;
|
||||
mHeight = aY1 - aY0;
|
||||
mWidth = aSrcRect.width;
|
||||
mHeight = aSrcRect.height;
|
||||
|
||||
printf("nsImageGTK::DrawTile((0, 0, %d, %d), %d, %d) %p\n", mWidth, mHeight, aWidth, aHeight, this);
|
||||
printf("nsImageGTK::DrawTile((src: %d, %d), (tile: %d, %d) %p\n", mWidth, mHeight,
|
||||
aTileRect.width, aTileRect.height, this);
|
||||
|
||||
nsDrawingSurfaceGTK *drawing = (nsDrawingSurfaceGTK*)aSurface;
|
||||
|
||||
GdkGC *copyGC;
|
||||
copyGC = gdk_gc_new(drawing->GetDrawable());
|
||||
gdk_gc_copy(copyGC, ((nsRenderingContextGTK&)aContext).GetGC());
|
||||
// gdk_gc_copy(copyGC, ((nsRenderingContextGTK&)aContext).GetGC());
|
||||
|
||||
CreateOffscreenPixmap(mWidth, mHeight);
|
||||
|
||||
@ -1041,25 +1041,31 @@ NS_IMETHODIMP nsImageGTK::DrawTile(nsIRenderingContext &aContext,
|
||||
|
||||
SetupGCForAlpha(copyGC, 0, 0);
|
||||
|
||||
nsRect srcRect(0, 0, mWidth, mHeight);
|
||||
TileImage(drawing->GetDrawable(), copyGC, mImagePixmap, srcRect, aWidth, aHeight);
|
||||
TileImage(drawing->GetDrawable(), copyGC, mImagePixmap, aSrcRect, aTileRect.width, aTileRect.height);
|
||||
}
|
||||
|
||||
else {
|
||||
// XXX we should properly handle the image not being completly decoded here
|
||||
|
||||
DrawImageOffscreen(0, 0, mWidth, mHeight);
|
||||
DrawImageOffscreen(0, 0,
|
||||
PR_MIN(mDecodedX2-mDecodedX1, mWidth),
|
||||
PR_MIN(mDecodedY2-mDecodedY1, mHeight));
|
||||
|
||||
XGCValues xvalues;
|
||||
memset(&xvalues, 0, sizeof(XGCValues));
|
||||
unsigned long xvalues_mask = 0;
|
||||
xvalues.fill_style = FillTiled;
|
||||
xvalues.tile = GDK_WINDOW_XWINDOW(mImagePixmap);
|
||||
xvalues_mask = GCFillRule | GCTile;
|
||||
xvalues_mask = GCFillStyle | GCTile;
|
||||
XChangeGC(GDK_DISPLAY(), GDK_GC_XGC(copyGC), xvalues_mask, &xvalues);
|
||||
|
||||
// draw onscreen
|
||||
gdk_draw_rectangle(drawing->GetDrawable(), copyGC, PR_TRUE, aX0, aY0, aWidth, aHeight);
|
||||
printf("gdk_draw_rectangle(..., %d, %d, %d, %d)\n",
|
||||
aTileRect.x, aTileRect.y,
|
||||
aTileRect.width, aTileRect.height);
|
||||
|
||||
gdk_draw_rectangle(drawing->GetDrawable(), copyGC, PR_TRUE,
|
||||
aTileRect.x, aTileRect.y,
|
||||
aTileRect.width, aTileRect.height);
|
||||
}
|
||||
|
||||
gdk_gc_unref(copyGC);
|
||||
|
||||
@ -69,9 +69,8 @@ public:
|
||||
|
||||
NS_IMETHOD DrawTile(nsIRenderingContext &aContext,
|
||||
nsDrawingSurface aSurface,
|
||||
nscoord aX0, nscoord aY0,
|
||||
nscoord aX1, nscoord aY1,
|
||||
nscoord aWidth, nscoord aHeight);
|
||||
nsRect &aSrcRect,
|
||||
nsRect &aTileRect);
|
||||
|
||||
virtual void ImageUpdated(nsIDeviceContext *aContext,
|
||||
PRUint8 aFlags, nsRect *aUpdateRect);
|
||||
|
||||
@ -1488,7 +1488,7 @@ NS_IMETHODIMP nsRenderingContextGTK::DrawImage(nsIImage *aImage,
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
#ifdef USE_NATIVE_TILING
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsIRenderingContext.h
|
||||
* @update 3/16/00 dwc
|
||||
@ -1502,12 +1502,14 @@ nsRenderingContextGTK::DrawTile(nsIImage *aImage,
|
||||
|
||||
printf("nsRenderingContextGTK::DrawTile()\n");
|
||||
|
||||
// convert to pixels
|
||||
mTMatrix->TransformCoord(&aX0,&aY0);
|
||||
mTMatrix->TransformCoord(&aX1,&aY1);
|
||||
mTMatrix->TransformCoord(&aWidth,&aHeight);
|
||||
nsRect srcRect (0, 0, aWidth, aHeight);
|
||||
nsRect tileRect(aX0, aY0, aX1-aX0, aY1-aY0);
|
||||
|
||||
((nsImageGTK*)aImage)->DrawTile(*this,mSurface,aX0,aY0,aX1,aY1,aWidth,aHeight);
|
||||
// convert to pixels
|
||||
mTMatrix->TransformCoord(&srcRect.width, &srcRect.height);
|
||||
mTMatrix->TransformCoord(&tileRect.x, &tileRect.y, &tileRect.width, &tileRect.height);
|
||||
|
||||
((nsImageGTK*)aImage)->DrawTile(*this, mSurface, srcRect, tileRect);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -42,6 +42,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#undef USE_NATIVE_TILING
|
||||
|
||||
class nsRenderingContextGTK : public nsRenderingContextImpl
|
||||
{
|
||||
public:
|
||||
@ -155,7 +157,7 @@ public:
|
||||
nscoord aWidth, nscoord aHeight);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aRect);
|
||||
NS_IMETHOD DrawImage(nsIImage *aImage, const nsRect& aSRect, const nsRect& aDRect);
|
||||
#if 0
|
||||
#ifdef USE_NATIVE_TILING
|
||||
NS_IMETHOD DrawTile(nsIImage *aImage,nscoord aX0,nscoord aY0,nscoord aX1,nscoord aY1,
|
||||
nscoord aWidth,nscoord aHeight);
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user