b=782185 use extend_pad when compositing image layers even for Quartz and X11 r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 14 Aug 2012 23:47:49 +1200
changeset 105725 016e279674347ecd82b1ae1c23b96954e8fdeb52
parent 105724 48d2889019edcd94c119aa0ec7000d9c95938af2
child 105726 26ae4450ab79d1a4b0cf4dd2be81775b79aa284b
push id1989
push userakeybl@mozilla.com
push dateTue, 28 Aug 2012 00:20:43 +0000
treeherdermozilla-aurora@a8e95ae10ea7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs782185
milestone17.0a1
b=782185 use extend_pad when compositing image layers even for Quartz and X11 r=roc
dom/plugins/test/reftest/reftest.list
gfx/layers/basic/BasicImageLayer.cpp
--- a/dom/plugins/test/reftest/reftest.list
+++ b/dom/plugins/test/reftest/reftest.list
@@ -19,9 +19,9 @@ fails-if(!haveTestPlugin) == plugin-canv
 fails-if(!haveTestPlugin) == plugin-transform-alpha-zindex.html div-alpha-zindex.html
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == plugin-busy-alpha-zindex.html div-alpha-zindex.html
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == plugin-background.html plugin-background-ref.html
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == plugin-background-1-step.html plugin-background-ref.html
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == plugin-background-2-step.html plugin-background-ref.html
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == plugin-background-5-step.html plugin-background-ref.html
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == plugin-background-10-step.html plugin-background-ref.html
 random-if(!haveTestPlugin) == plugin-transform-1.html plugin-transform-1-ref.html
-fails-if(!haveTestPlugin) fails-if(http.platform=="X11"&&!layersGPUAccelerated) == plugin-transform-2.html plugin-transform-2-ref.html # bug 468496
+fails-if(!haveTestPlugin) == plugin-transform-2.html plugin-transform-2-ref.html
--- a/gfx/layers/basic/BasicImageLayer.cpp
+++ b/gfx/layers/basic/BasicImageLayer.cpp
@@ -4,16 +4,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/PLayersParent.h"
 #include "BasicLayersImpl.h"
 #include "SharedTextureImage.h"
 #include "gfxUtils.h"
 #include "gfxSharedImageSurface.h"
 #include "mozilla/layers/ImageContainerChild.h"
+#ifdef MOZ_X11
+#include "gfxXlibSurface.h"
+#endif
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace layers {
 
 class BasicImageLayer : public ImageLayer, public BasicImplData {
 public:
@@ -125,27 +128,27 @@ BasicImageLayer::PaintContext(gfxPattern
                               float aOpacity,
                               gfxContext* aContext,
                               Layer* aMaskLayer)
 {
   // Set PAD mode so that when the video is being scaled, we do not sample
   // outside the bounds of the video image.
   gfxPattern::GraphicsExtend extend = gfxPattern::EXTEND_PAD;
 
+#ifdef MOZ_X11
+  // PAD is slow with cairo and old X11 servers, so prefer speed over
+  // correctness and use NONE.
   if (aContext->IsCairo()) {
-    // PAD is slow with X11 and Quartz surfaces, so prefer speed over correctness
-    // and use NONE.
     nsRefPtr<gfxASurface> target = aContext->CurrentSurface();
-    gfxASurface::gfxSurfaceType type = target->GetType();
-    if (type == gfxASurface::SurfaceTypeXlib ||
-        type == gfxASurface::SurfaceTypeXcb ||
-        type == gfxASurface::SurfaceTypeQuartz) {
+    if (target->GetType() == gfxASurface::SurfaceTypeXlib &&
+        static_cast<gfxXlibSurface*>(target.get())->IsPadSlow()) {
       extend = gfxPattern::EXTEND_NONE;
     }
   }
+#endif
 
   aContext->NewPath();
   // No need to snap here; our transform has already taken care of it.
   // XXX true for arbitrary regions?  Don't care yet though
   gfxUtils::PathFromRegion(aContext, aVisible);
   aPattern->SetExtend(extend);
   aContext->SetPattern(aPattern);
   FillWithMask(aContext, aOpacity, aMaskLayer);