Bug 722975 - --enable-system-cairo build is broken after Bug 715658 fixed. r=Bas
☠☠ backed out by 8fa702386c7c ☠ ☠
authorUli Schlachter <psychon@znc.in>
Wed, 10 Oct 2012 06:32:36 -0400
changeset 109970 2231b8e778a3b772d57f908f375af849b9751d33
parent 109969 4bfeb954d6d2a750f2cb473960e03cd00dc13165
child 109971 0e0098d68198ec228ef2aacad6eb85b647703656
push id84
push usernmatsakis@mozilla.com
push dateThu, 11 Oct 2012 23:26:24 +0000
reviewersBas
bugs722975, 715658
milestone19.0a1
Bug 722975 - --enable-system-cairo build is broken after Bug 715658 fixed. r=Bas
gfx/thebes/gfxPlatform.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -498,21 +498,19 @@ struct SourceSurfaceUserData
   BackendType mBackendType;
 };
 
 void SourceBufferDestroy(void *srcSurfUD)
 {
   delete static_cast<SourceSurfaceUserData*>(srcSurfUD);
 }
 
-void SourceSnapshotDetached(cairo_surface_t *nullSurf)
+void SourceSnapshotDetached(void *nullSurf)
 {
-  gfxImageSurface* origSurf =
-    static_cast<gfxImageSurface*>(cairo_surface_get_user_data(nullSurf, &kSourceSurface));
-
+  gfxImageSurface *origSurf = static_cast<gfxImageSurface*>(nullSurf);
   origSurf->SetData(&kSourceSurface, NULL, NULL);
 }
 
 RefPtr<SourceSurface>
 gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface)
 {
   void *userData = aSurface->GetData(&kSourceSurface);
 
@@ -617,24 +615,19 @@ gfxPlatform::GetSourceSurfaceForSurface(
       }
 
       srcBuffer = Factory::CreateWrappingDataSourceSurface(imgSurface->Data(),
                                                            imgSurface->Stride(),
                                                            size, format);
 
     }
 
-    cairo_surface_t *nullSurf =
-	cairo_null_surface_create(CAIRO_CONTENT_COLOR_ALPHA);
-    cairo_surface_set_user_data(nullSurf,
-                                &kSourceSurface,
-                                imgSurface,
-                                NULL);
-    cairo_surface_attach_snapshot(imgSurface->CairoSurface(), nullSurf, SourceSnapshotDetached);
-    cairo_surface_destroy(nullSurf);
+    cairo_surface_set_mime_data(imgSurface->CairoSurface(), "mozilla/magic",
+                                (const unsigned char *) "data", 4,
+                                SourceSnapshotDetached, imgSurface.get());
   }
 
   SourceSurfaceUserData *srcSurfUD = new SourceSurfaceUserData;
   srcSurfUD->mBackendType = aTarget->GetType();
   srcSurfUD->mSrcSurface = srcBuffer;
   aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy);
 
   return srcBuffer;