Bug 603885, part 5: Move the code for getting a gfxContext for a quadrant update into its own method. r=roc
This commit is contained in:
@@ -148,6 +148,26 @@ ThebesLayerBuffer::DrawBufferWithRotation(gfxContext* aTarget, float aOpacity,
|
||||
DrawBufferQuadrant(aTarget, RIGHT, BOTTOM, aOpacity, aXRes, aYRes);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxContext>
|
||||
ThebesLayerBuffer::GetContextForQuadrantUpdate(const nsIntRect& aBounds,
|
||||
float aXResolution,
|
||||
float aYResolution)
|
||||
{
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(mBuffer);
|
||||
|
||||
// Figure out which quadrant to draw in
|
||||
PRInt32 xBoundary = mBufferRect.XMost() - mBufferRotation.x;
|
||||
PRInt32 yBoundary = mBufferRect.YMost() - mBufferRotation.y;
|
||||
XSide sideX = aBounds.XMost() <= xBoundary ? RIGHT : LEFT;
|
||||
YSide sideY = aBounds.YMost() <= yBoundary ? BOTTOM : TOP;
|
||||
nsIntRect quadrantRect = GetQuadrantRectangle(sideX, sideY);
|
||||
NS_ASSERTION(quadrantRect.Contains(aBounds), "Messed up quadrants");
|
||||
ctx->Scale(aXResolution, aYResolution);
|
||||
ctx->Translate(-gfxPoint(quadrantRect.x, quadrantRect.y));
|
||||
|
||||
return ctx.forget();
|
||||
}
|
||||
|
||||
static void
|
||||
WrapRotationAxis(PRInt32* aRotationPoint, PRInt32 aSize)
|
||||
{
|
||||
@@ -290,17 +310,8 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
|
||||
invalidate.Sub(aLayer->GetValidRegion(), destBufferRect);
|
||||
result.mRegionToInvalidate.Or(result.mRegionToInvalidate, invalidate);
|
||||
|
||||
result.mContext = new gfxContext(mBuffer);
|
||||
|
||||
// Figure out which quadrant to draw in
|
||||
PRInt32 xBoundary = mBufferRect.XMost() - mBufferRotation.x;
|
||||
PRInt32 yBoundary = mBufferRect.YMost() - mBufferRotation.y;
|
||||
XSide sideX = drawBounds.XMost() <= xBoundary ? RIGHT : LEFT;
|
||||
YSide sideY = drawBounds.YMost() <= yBoundary ? BOTTOM : TOP;
|
||||
nsIntRect quadrantRect = GetQuadrantRectangle(sideX, sideY);
|
||||
NS_ASSERTION(quadrantRect.Contains(drawBounds), "Messed up quadrants");
|
||||
result.mContext->Scale(aXResolution, aYResolution);
|
||||
result.mContext->Translate(-gfxPoint(quadrantRect.x, quadrantRect.y));
|
||||
result.mContext = GetContextForQuadrantUpdate(drawBounds,
|
||||
aXResolution, aYResolution);
|
||||
|
||||
gfxUtils::ClipToRegion(result.mContext, result.mRegionToDraw);
|
||||
if (aContentType == gfxASurface::CONTENT_COLOR_ALPHA && !isClear) {
|
||||
|
||||
Reference in New Issue
Block a user