Bug 922942 - Updated cached surface in ClippedImage using azure. r=seth
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 16 Oct 2013 14:00:30 +1300
changeset 165621 95427fe5f9b95b68cc7031c68d8e0dbd87592e5c
parent 165620 32bb598c8a821eafa85cf27e91812dc54e8bd2fc
child 165622 c0e5db20b6556eed713a25e9ccd93489e5eb71ed
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth
bugs922942
milestone27.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 922942 - Updated cached surface in ClippedImage using azure. r=seth
image/src/ClippedImage.cpp
--- a/image/src/ClippedImage.cpp
+++ b/image/src/ClippedImage.cpp
@@ -230,30 +230,39 @@ ClippedImage::GetFrameInternal(const nsI
 
   float frameToDraw = InnerImage()->GetFrameIndex(aWhichFrame);
   if (!mCachedSurface || !mCachedSurface->Matches(aViewportSize,
                                                   aSVGContext,
                                                   frameToDraw,
                                                   aFlags)) {
     // Create a surface to draw into.
     mozilla::RefPtr<mozilla::gfx::DrawTarget> target;
-    target = gfxPlatform::GetPlatform()->
-      CreateOffscreenCanvasDrawTarget(gfx::IntSize(mClip.width, mClip.height),
-                                      gfx::FORMAT_B8G8R8A8);
-    nsRefPtr<gfxASurface> surface = gfxPlatform::GetPlatform()->
-      GetThebesSurfaceForDrawTarget(target);
+    nsRefPtr<gfxContext> ctx;
+
+    if (gfxPlatform::GetPlatform()->SupportsAzureContent()) {
+      target = gfxPlatform::GetPlatform()->
+        CreateOffscreenContentDrawTarget(gfx::IntSize(mClip.width, mClip.height),
+                                        gfx::FORMAT_B8G8R8A8);
+      ctx = new gfxContext(target);
+    } else {
+      target = gfxPlatform::GetPlatform()->
+        CreateOffscreenCanvasDrawTarget(gfx::IntSize(mClip.width, mClip.height),
+                                        gfx::FORMAT_B8G8R8A8);
+      nsRefPtr<gfxASurface> surface = gfxPlatform::GetPlatform()->
+        GetThebesSurfaceForDrawTarget(target);
+      ctx = new gfxContext(surface);
+    }
 
     // Create our callback.
     nsRefPtr<gfxDrawingCallback> drawTileCallback =
       new DrawSingleTileCallback(this, mClip, aViewportSize, aSVGContext, aWhichFrame, aFlags);
     nsRefPtr<gfxDrawable> drawable =
       new gfxCallbackDrawable(drawTileCallback, mClip.Size());
 
     // Actually draw. The callback will end up invoking DrawSingleTile.
-    nsRefPtr<gfxContext> ctx = new gfxContext(surface);
     gfxRect imageRect(0, 0, mClip.width, mClip.height);
     gfxUtils::DrawPixelSnapped(ctx, drawable, gfxMatrix(),
                                imageRect, imageRect, imageRect, imageRect,
                                gfxImageFormatARGB32,
                                GraphicsFilter::FILTER_FAST);
 
     // Cache the resulting surface.
     mCachedSurface = new ClippedImageCachedSurface(target,