Bug 1236167: P1. Do not attempt to destroy a non allocated surface. r=nical

This commit is contained in:
Jean-Yves Avenard 2016-01-05 10:23:21 +11:00
parent c8c9146f1a
commit 8d672d003f

View File

@ -514,26 +514,27 @@ ClientLayerManager::MakeSnapshotIfRequired()
if (!bounds.IsEmpty() && if (!bounds.IsEmpty() &&
mForwarder->AllocSurfaceDescriptor(bounds.Size(), mForwarder->AllocSurfaceDescriptor(bounds.Size(),
gfxContentType::COLOR_ALPHA, gfxContentType::COLOR_ALPHA,
&inSnapshot) && &inSnapshot)) {
remoteRenderer->SendMakeSnapshot(inSnapshot, bounds)) { if (remoteRenderer->SendMakeSnapshot(inSnapshot, bounds)) {
RefPtr<DataSourceSurface> surf = GetSurfaceForDescriptor(inSnapshot); RefPtr<DataSourceSurface> surf = GetSurfaceForDescriptor(inSnapshot);
DrawTarget* dt = mShadowTarget->GetDrawTarget(); DrawTarget* dt = mShadowTarget->GetDrawTarget();
Rect dstRect(bounds.x, bounds.y, bounds.width, bounds.height); Rect dstRect(bounds.x, bounds.y, bounds.width, bounds.height);
Rect srcRect(0, 0, bounds.width, bounds.height); Rect srcRect(0, 0, bounds.width, bounds.height);
gfx::Matrix rotate = gfx::Matrix rotate =
ComputeTransformForUnRotation(outerBounds.ToUnknownRect(), ComputeTransformForUnRotation(outerBounds.ToUnknownRect(),
mTargetRotation); mTargetRotation);
gfx::Matrix oldMatrix = dt->GetTransform(); gfx::Matrix oldMatrix = dt->GetTransform();
dt->SetTransform(rotate * oldMatrix); dt->SetTransform(rotate * oldMatrix);
dt->DrawSurface(surf, dstRect, srcRect, dt->DrawSurface(surf, dstRect, srcRect,
DrawSurfaceOptions(), DrawSurfaceOptions(),
DrawOptions(1.0f, CompositionOp::OP_OVER)); DrawOptions(1.0f, CompositionOp::OP_OVER));
dt->SetTransform(oldMatrix); dt->SetTransform(oldMatrix);
}
mForwarder->DestroySharedSurface(&inSnapshot);
} }
mForwarder->DestroySharedSurface(&inSnapshot);
} }
} }
mShadowTarget = nullptr; mShadowTarget = nullptr;