Bug 995721 patch 1 - Honor the translation on mShadowTarget in ClientLayerManager::MakeSnapshotIfRequired. r=mattwoodrow

This switches from DrawTarget::CopySurface (which ignores the transform)
to DrawSurface (which honors the transform).
This commit is contained in:
L. David Baron 2014-04-14 11:12:00 -07:00
parent b5bb8d4250
commit 8f4c6c0e7e

View File

@ -281,8 +281,9 @@ ClientLayerManager::MakeSnapshotIfRequired()
if (CompositorChild* remoteRenderer = GetRemoteRenderer()) { if (CompositorChild* remoteRenderer = GetRemoteRenderer()) {
nsIntRect bounds; nsIntRect bounds;
mWidget->GetBounds(bounds); mWidget->GetBounds(bounds);
IntSize widgetSize = bounds.Size().ToIntSize();
SurfaceDescriptor inSnapshot, snapshot; SurfaceDescriptor inSnapshot, snapshot;
if (mForwarder->AllocSurfaceDescriptor(bounds.Size().ToIntSize(), if (mForwarder->AllocSurfaceDescriptor(widgetSize,
gfxContentType::COLOR_ALPHA, gfxContentType::COLOR_ALPHA,
&inSnapshot) && &inSnapshot) &&
// The compositor will usually reuse |snapshot| and return // The compositor will usually reuse |snapshot| and return
@ -290,9 +291,11 @@ ClientLayerManager::MakeSnapshotIfRequired()
// responsible for freeing |snapshot|. // responsible for freeing |snapshot|.
remoteRenderer->SendMakeSnapshot(inSnapshot, &snapshot)) { remoteRenderer->SendMakeSnapshot(inSnapshot, &snapshot)) {
RefPtr<DataSourceSurface> surf = GetSurfaceForDescriptor(snapshot); RefPtr<DataSourceSurface> surf = GetSurfaceForDescriptor(snapshot);
mShadowTarget->GetDrawTarget()->CopySurface(surf, DrawTarget* dt = mShadowTarget->GetDrawTarget();
IntRect(0, 0, bounds.Size().width, bounds.Size().height), Rect widgetRect(Point(0, 0), Size(widgetSize.width, widgetSize.height));
IntPoint(0, 0)); dt->DrawSurface(surf, widgetRect, widgetRect,
DrawSurfaceOptions(),
DrawOptions(1.0f, CompositionOp::OP_OVER));
} }
if (IsSurfaceDescriptorValid(snapshot)) { if (IsSurfaceDescriptorValid(snapshot)) {
mForwarder->DestroySharedSurface(&snapshot); mForwarder->DestroySharedSurface(&snapshot);