Bug 795737 - To avoid Cairo assertions, call Flush when we MarkDirty too, because we can draw locked images, which adds snapshots to the Cairo surfaces. r=Bas
authorJoe Drew <joe@drew.ca>
Thu, 04 Jul 2013 14:46:02 -0400
changeset 149748 8e2e52c72e42031c7da46fc63b96aa46190b5be2
parent 149747 6bc751e34867b78facdf9be40bb49cfafea04229
child 149749 4210dd438a369ed1d2c47efd3ee21904e7db4685
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs795737
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 795737 - To avoid Cairo assertions, call Flush when we MarkDirty too, because we can draw locked images, which adds snapshots to the Cairo surfaces. r=Bas
image/src/imgFrame.cpp
--- a/image/src/imgFrame.cpp
+++ b/image/src/imgFrame.cpp
@@ -679,16 +679,27 @@ nsresult imgFrame::UnlockImageData()
   if (mLockCount != 0) {
     return NS_OK;
   }
 
   // Paletted images don't have surfaces, so there's nothing to do.
   if (mPalettedImageData)
     return NS_OK;
 
+  // FIXME: Bug 795737
+  // If this image has been drawn since we were locked, it has had snapshots
+  // added, and we need to remove them before calling MarkDirty.
+  if (mImageSurface)
+    mImageSurface->Flush();
+
+#ifdef USE_WIN_SURFACE
+  if (mWinSurface)
+    mWinSurface->Flush();
+#endif
+
   // Assume we've been written to.
   if (mImageSurface)
     mImageSurface->MarkDirty();
 
 #ifdef USE_WIN_SURFACE
   if (mWinSurface)
     mWinSurface->MarkDirty();
 #endif
@@ -704,16 +715,19 @@ nsresult imgFrame::UnlockImageData()
 }
 
 void imgFrame::ApplyDirtToSurfaces()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   MutexAutoLock lock(mDirtyMutex);
   if (mDirty) {
+    // FIXME: Bug 795737
+    // If this image has been drawn since we were locked, it has had snapshots
+    // added, and we need to remove them before calling MarkDirty.
     if (mImageSurface)
       mImageSurface->Flush();
 
 #ifdef USE_WIN_SURFACE
     if (mWinSurface)
       mWinSurface->Flush();
 #endif