Bug 598736 - Use bilinear image scaling when NEON is available [r=jrmuizel, a=johnath]
authorMatt Brubeck <mbrubeck@mozilla.com>
Fri, 08 Apr 2011 10:15:37 -0700
changeset 70396 0cc33d48765146264416f6e10aac08bc1d1cc7c3
parent 70395 488cd9e29d657ad84817a80c25f97dc2b71e6d29
child 70397 7e194aec476b579dcdccefc54fd2e6ccbc1454a8
push idunknown
push userunknown
push dateunknown
reviewersjrmuizel, johnath
bugs598736
milestone6.0a2
Bug 598736 - Use bilinear image scaling when NEON is available [r=jrmuizel, a=johnath]
gfx/thebes/gfxDrawable.cpp
layout/base/nsLayoutUtils.cpp
--- a/gfx/thebes/gfxDrawable.cpp
+++ b/gfx/thebes/gfxDrawable.cpp
@@ -33,16 +33,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "gfxDrawable.h"
 #include "gfxASurface.h"
 #include "gfxContext.h"
 #include "gfxPlatform.h"
+#include "mozilla/arm.h"
 #ifdef MOZ_X11
 #include "cairo.h"
 #include "gfxXlibSurface.h"
 #endif
 
 gfxSurfaceDrawable::gfxSurfaceDrawable(gfxASurface* aSurface,
                                        const gfxIntSize aSize,
                                        const gfxMatrix aTransform)
@@ -168,17 +169,19 @@ gfxSurfaceDrawable::Draw(gfxContext* aCo
         nsRefPtr<gfxASurface> currentTarget = aContext->CurrentSurface();
         gfxASurface::gfxSurfaceType surfaceType = currentTarget->GetType();
         gfxMatrix deviceSpaceToImageSpace =
             DeviceToImageTransform(aContext, aTransform);
         PreparePatternForUntiledDrawing(pattern, deviceSpaceToImageSpace,
                                         surfaceType, currentTarget, filter);
     }
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
-    pattern->SetFilter(gfxPattern::FILTER_FAST); 
+    if (!mozilla::supports_neon()) {
+        pattern->SetFilter(gfxPattern::FILTER_FAST);
+    }
 #endif
     pattern->SetMatrix(gfxMatrix(aTransform).Multiply(mTransform));
     aContext->NewPath();
     aContext->SetPattern(pattern);
     aContext->Rectangle(aFillRect);
     aContext->Fill();
     return PR_TRUE;
 }
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -87,16 +87,17 @@
 #include "nsHTMLVideoElement.h"
 #endif
 #include "imgIRequest.h"
 #include "imgIContainer.h"
 #include "nsIImageLoadingContent.h"
 #include "nsCOMPtr.h"
 #include "nsListControlFrame.h"
 #include "ImageLayers.h"
+#include "mozilla/arm.h"
 #include "mozilla/dom/Element.h"
 #include "nsCanvasFrame.h"
 #include "gfxDrawable.h"
 #include "gfxUtils.h"
 #include "nsDataHashtable.h"
 
 #ifdef MOZ_SVG
 #include "nsSVGUtils.h"
@@ -3056,20 +3057,21 @@ nsLayoutUtils::GetClosestLayer(nsIFrame*
   if (layer)
     return layer;
   return aFrame->PresContext()->PresShell()->FrameManager()->GetRootFrame();
 }
 
 GraphicsFilter
 nsLayoutUtils::GetGraphicsFilterForFrame(nsIFrame* aForFrame)
 {
+  GraphicsFilter defaultFilter = gfxPattern::FILTER_GOOD;
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
-  GraphicsFilter defaultFilter = gfxPattern::FILTER_NEAREST;
-#else
-  GraphicsFilter defaultFilter = gfxPattern::FILTER_GOOD;
+  if (!mozilla::supports_neon()) {
+    defaultFilter = gfxPattern::FILTER_NEAREST;
+  }
 #endif
 #ifdef MOZ_SVG
   nsIFrame *frame = nsCSSRendering::IsCanvasFrame(aForFrame) ?
     nsCSSRendering::FindBackgroundStyleFrame(aForFrame) : aForFrame;
 
   switch (frame->GetStyleSVG()->mImageRendering) {
   case NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED:
     return gfxPattern::FILTER_FAST;