Clear SkCanvas::fLastDeviceToGainFocus when releasing a device
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 29 Aug 2012 19:40:59 +0000 (19:40 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 29 Aug 2012 19:40:59 +0000 (19:40 +0000)
Review URL: https://codereview.appspot.com/6499051/

git-svn-id: http://skia.googlecode.com/svn/trunk@5338 2bbb7eff-a529-9590-31e7-b0007b416f81

src/core/SkCanvas.cpp

index f5c6bc2..dc6da11 100644 (file)
@@ -875,6 +875,13 @@ void SkCanvas::internalRestore() {
 
     fDeviceCMDirty = true;
     fLocalBoundsCompareTypeDirty = true;
+    // Dirty this pointer to handle the case of a new device created at the same address as the
+    // device we are restoring from. E.g.:
+    // saveLayer (creates a device)
+    // drawSomething
+    // restore (deletes the device)
+    // saveLayer (oops new device at the same address)
+    fLastDeviceToGainFocus = NULL;
 
     fClipStack.restore();
     // reserve our layer (if any)