New and improved background tiling code for GTK. We take an offset into

the image as a parameter so we avoid drawing the whole tile if it's not
all needed.  Also, we can avoid setting any clip regions at all this
way, and avoid trips to the X server.  Fixes several background rendering
problems.  Also fix a signedness problem in the compositing code
(r=tor).  r=pavlov.


git-svn-id: svn://10.0.0.236/trunk@69388 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%uiuc.edu
2000-05-12 06:29:37 +00:00
parent 4d95440295
commit a626fea704
9 changed files with 214 additions and 17 deletions

View File

@@ -2273,12 +2273,14 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
}
}
#ifndef XP_UNIX
// Setup clipping so that rendering doesn't leak out of the computed
// dirty rect
PRBool clipState;
aRenderingContext.PushState();
aRenderingContext.SetClipRect(dirtyRect, nsClipCombine_kIntersect,
clipState);
#endif
// Compute the x and y starting points and limits for tiling
nscoord x0, x1;
@@ -2353,8 +2355,19 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
}
}
#ifdef XP_UNIX
// Take the intersection again to paint only the required area
nsRect tileRect(x0,y0,(x1-x0),(y1-y0));
nsRect drawRect;
if (drawRect.IntersectRect(tileRect, dirtyRect)) {
PRInt32 xOffset = drawRect.x - x0,
yOffset = drawRect.y - y0;
aRenderingContext.DrawTile(image,xOffset,yOffset,drawRect);
}
#else
aRenderingContext.DrawTile(image,x0,y0,x1,y1,tileWidth,tileHeight);
#endif
aRenderingContext.DrawTile(image,x0,y0,x1,y1,tileWidth,tileHeight);
#ifdef DOTILE
nsIDrawingSurface *theSurface,*ts=nsnull;
@@ -2458,8 +2471,10 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
}
#endif
#ifndef XP_UNIX
// Restore clipping
aRenderingContext.PopState(clipState);
#endif
NS_IF_RELEASE(image);
} else {
// See if there's a background color specified. The background color