Bug 1247380: Only copy the background if we can succesfully get a snapshot. r=jrmuizel draft
authorBas Schouten <bschouten@mozilla.com>
Thu, 11 Feb 2016 13:24:52 +0100
changeset 330325 ed9eec48f87656a9aa1a354bff696a0a0d871e7d
parent 330062 b6ac829c36bbb76734b496bd7b1678f5a079300b
child 514146 9d2ec50a688dabe45d0bac65b91bfc7dec04450b
push id10728
push userbschouten@mozilla.com
push dateThu, 11 Feb 2016 12:25:02 +0000
reviewersjrmuizel
bugs1247380
milestone47.0a1
Bug 1247380: Only copy the background if we can succesfully get a snapshot. r=jrmuizel MozReview-Commit-ID: uWH7MtJmSp
gfx/thebes/gfxContext.cpp
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -849,19 +849,19 @@ gfxContext::PushGroupAndCopyBackground(g
     Save();
 
     if (pushOpaqueWithCopiedBG) {
       mDT->PushLayer(true, aOpacity, aMask, aMaskTransform, IntRect(), true);
     } else {
       mDT->PushLayer(content == gfxContentType::COLOR, aOpacity, aMask, aMaskTransform, IntRect(), false);
     }
   } else {
-    if (pushOpaqueWithCopiedBG) {
+    RefPtr<SourceSurface> source;
+    if (pushOpaqueWithCopiedBG && (source = mDT->Snapshot())) {
       DrawTarget *oldDT = mDT;
-      RefPtr<SourceSurface> source = mDT->Snapshot();
       Point oldDeviceOffset = CurrentState().deviceOffset;
 
       PushNewDT(gfxContentType::COLOR);
 
       if (oldDT == mDT) {
         // Creating new DT failed.
         return;
       }