Bug 970294 - Set our surface offset as a gfxContext device offset instead of a transform so that other callers don't accidentally overwrite it. r=nrc

This commit is contained in:
Matt Woodrow 2014-02-28 12:32:38 +13:00
parent f954df12ae
commit cf387ac0d5
3 changed files with 7 additions and 6 deletions

View File

@ -961,8 +961,8 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
return;
}
nsRefPtr<gfxContext> groupTarget = new gfxContext(untransformedDT);
groupTarget->Translate(gfxPoint(-bounds.x, -bounds.y));
nsRefPtr<gfxContext> groupTarget = new gfxContext(untransformedDT,
Point(bounds.x, bounds.y));
PaintSelfOrChildren(paintLayerContext, groupTarget);
@ -978,8 +978,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
(aLayer->GetDebugColorIndex() & 4) ? 1.0 : 0.0,
1.0);
nsRefPtr<gfxContext> temp = new gfxContext(untransformedDT);
temp->Translate(gfxPoint(-bounds.x, -bounds.y));
nsRefPtr<gfxContext> temp = new gfxContext(untransformedDT, Point(bounds.x, bounds.y));
temp->SetColor(color);
temp->Paint();
}

View File

@ -98,7 +98,7 @@ gfxContext::gfxContext(gfxASurface *surface)
}
}
gfxContext::gfxContext(DrawTarget *aTarget)
gfxContext::gfxContext(DrawTarget *aTarget, const Point& aDeviceOffset)
: mPathIsRect(false)
, mTransformChanged(false)
, mCairo(nullptr)
@ -112,6 +112,7 @@ gfxContext::gfxContext(DrawTarget *aTarget)
mStateStack.SetLength(1);
CurrentState().drawTarget = mDT;
CurrentState().deviceOffset = aDeviceOffset;
mDT->SetTransform(Matrix());
}

View File

@ -51,7 +51,8 @@ public:
* Strips any transform from aTarget.
* aTarget will be flushed in the gfxContext's destructor.
*/
gfxContext(mozilla::gfx::DrawTarget *aTarget);
gfxContext(mozilla::gfx::DrawTarget *aTarget,
const mozilla::gfx::Point& aDeviceOffset = mozilla::gfx::Point());
~gfxContext();