Bug 1123080 - Use cairo's image backend as canvas fallback on windows. r=Bas a=lmandel
authorNicolas Silva <nsilva@mozilla.com>
Thu, 12 Mar 2015 19:45:44 +0100
changeset 250364 45cc75aa62d9
parent 250363 05df69e4ada6
child 250365 e15e6597d699
push id4561
push usernsilva@mozilla.com
push date2015-03-12 18:47 +0000
treeherdermozilla-beta@45cc75aa62d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, lmandel
bugs1123080
milestone37.0
Bug 1123080 - Use cairo's image backend as canvas fallback on windows. r=Bas a=lmandel
gfx/2d/DrawTargetCairo.cpp
gfx/thebes/gfxPlatform.cpp
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -1503,18 +1503,19 @@ DrawTargetCairo::CreateSimilarDrawTarget
 
   return nullptr;
 }
 
 bool
 DrawTargetCairo::InitAlreadyReferenced(cairo_surface_t* aSurface, const IntSize& aSize, SurfaceFormat* aFormat)
 {
   if (cairo_surface_status(aSurface)) {
-    gfxCriticalError() << "Attempt to create DrawTarget for invalid surface. "
-                       << aSize << " Cairo Status: " << cairo_surface_status(aSurface);
+    gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(aSize)))
+      << "Attempt to create DrawTarget for invalid surface. "
+      << aSize << " Cairo Status: " << cairo_surface_status(aSurface);
     cairo_surface_destroy(aSurface);
     return false;
   }
 
   mContext = cairo_create(aSurface);
   mSurface = aSurface;
   mSize = aSize;
   mFormat = aFormat ? *aFormat : GfxFormatForCairoSurface(aSurface);
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1162,17 +1162,22 @@ gfxPlatform::CreateOffscreenCanvasDrawTa
 {
   NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend.");
   RefPtr<DrawTarget> target = CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat);
   if (target ||
       mFallbackCanvasBackend == BackendType::NONE) {
     return target.forget();
   }
 
+#ifdef XP_WIN
+  // On Windows, the fallback backend (Cairo) should use its image backend.
+  return Factory::CreateDrawTarget(mFallbackCanvasBackend, aSize, aFormat);
+#else
   return CreateDrawTargetForBackend(mFallbackCanvasBackend, aSize, aFormat);
+#endif
 }
 
 TemporaryRef<DrawTarget>
 gfxPlatform::CreateOffscreenContentDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
 {
   NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend.");
   return CreateDrawTargetForBackend(mContentBackend, aSize, aFormat);
 }