Bug 1211324 (part 4) - Replace GraphicsFilter constants with gfx::Filter equivalents. r=mattwoodrow.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 05 Oct 2015 17:12:46 -0700
changeset 266584 a7cd4d58ea9e5429aae27f61ebe3e3a46818767e
parent 266583 3897da20e42dec0bcf73987af1eaac4f8ce950b8
child 266585 e1fe3d531b96a5ca6a47c4476f4316bd422c0707
push id15565
push userkwierso@gmail.com
push dateWed, 07 Oct 2015 18:35:05 +0000
treeherderfx-team@eb3424a2e285 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1211324
milestone44.0a1
Bug 1211324 (part 4) - Replace GraphicsFilter constants with gfx::Filter equivalents. r=mattwoodrow. The conversion is as follows: - GraphicsFilter::FILTER_NEAREST == gfx::Filter::POINT - GraphicsFilter::FILTER_GOOD == gfx::Filter::GOOD - GraphicsFilter::FILTER_BEST == gfx::Filter::LINEAR Also typedef GraphicsFilter to gfx::Filter; this will be removed in the next patch. These changes mean ToFilter() and ThebesFilter() are no longer needed.
dom/canvas/CanvasRenderingContext2D.cpp
dom/svg/SVGFEImageElement.cpp
gfx/2d/HelpersCairo.h
gfx/2d/Types.h
gfx/gl/GLTextureImage.cpp
gfx/ipc/GfxMessageUtils.h
gfx/layers/ImageLayers.cpp
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/LayersLogging.cpp
gfx/layers/LayersLogging.h
gfx/layers/basic/BasicCanvasLayer.cpp
gfx/layers/basic/BasicImageLayer.cpp
gfx/layers/composite/CanvasLayerComposite.cpp
gfx/layers/composite/ImageLayerComposite.cpp
gfx/layers/ipc/LayersMessages.ipdlh
gfx/layers/opengl/CompositorOGL.cpp
gfx/layers/opengl/CompositorOGLVR.cpp
gfx/layers/protobuf/LayerScopePacket.pb.cc
gfx/layers/protobuf/LayerScopePacket.pb.h
gfx/thebes/GraphicsFilter.h
gfx/thebes/gfx2DGlue.h
gfx/thebes/gfxDrawable.cpp
gfx/thebes/gfxDrawable.h
gfx/thebes/gfxPattern.cpp
gfx/thebes/gfxUtils.cpp
gfx/thebes/gfxWindowsNativeDrawing.cpp
image/ClippedImage.cpp
image/DynamicImage.cpp
image/OrientedImage.cpp
image/RasterImage.cpp
image/VectorImage.cpp
layout/base/nsLayoutUtils.cpp
layout/generic/nsPluginFrame.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
widget/cocoa/nsCocoaUtils.mm
widget/nsBaseDragService.cpp
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -4677,18 +4677,17 @@ CanvasRenderingContext2D::DrawDirectlyTo
   uint32_t modifiedFlags = image.mDrawingFlags | imgIContainer::FLAG_CLAMP;
 
   CSSIntSize sz(scaledImageSize.width, scaledImageSize.height); // XXX hmm is scaledImageSize really in CSS pixels?
   SVGImageContext svgContext(sz, Nothing(), CurrentState().globalAlpha);
 
   auto result = image.mImgContainer->
     Draw(context, scaledImageSize,
          ImageRegion::Create(gfxRect(src.x, src.y, src.width, src.height)),
-         image.mWhichFrame, GraphicsFilter::FILTER_GOOD,
-         Some(svgContext), modifiedFlags);
+         image.mWhichFrame, Filter::GOOD, Some(svgContext), modifiedFlags);
 
   if (result != DrawResult::SUCCESS) {
     NS_WARNING("imgIContainer::Draw failed");
   }
 }
 
 void
 CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
--- a/dom/svg/SVGFEImageElement.cpp
+++ b/dom/svg/SVGFEImageElement.cpp
@@ -230,17 +230,17 @@ SVGFEImageElement::GetPrimitiveDescripti
 
   Matrix viewBoxTM =
     SVGContentUtils::GetViewBoxTransform(aFilterSubregion.width, aFilterSubregion.height,
                                          0, 0, nativeSize.width, nativeSize.height,
                                          mPreserveAspectRatio);
   Matrix TM = viewBoxTM;
   TM.PostTranslate(aFilterSubregion.x, aFilterSubregion.y);
 
-  Filter filter = ToFilter(nsLayoutUtils::GetGraphicsFilterForFrame(frame));
+  Filter filter = nsLayoutUtils::GetGraphicsFilterForFrame(frame);
 
   FilterPrimitiveDescription descr(PrimitiveType::Image);
   descr.Attributes().Set(eImageFilter, (uint32_t)filter);
   descr.Attributes().Set(eImageTransform, TM);
 
   // Append the image to aInputImages and store its index in the description.
   size_t imageIndex = aInputImages.Length();
   aInputImages.AppendElement(image);
--- a/gfx/2d/HelpersCairo.h
+++ b/gfx/2d/HelpersCairo.h
@@ -114,16 +114,18 @@ GfxFilterToCairoFilter(Filter filter)
   switch (filter)
   {
     case Filter::GOOD:
       return CAIRO_FILTER_GOOD;
     case Filter::LINEAR:
       return CAIRO_FILTER_BILINEAR;
     case Filter::POINT:
       return CAIRO_FILTER_NEAREST;
+    default:
+      MOZ_CRASH("bad filter");
   }
 
   return CAIRO_FILTER_BILINEAR;
 }
 
 static inline cairo_extend_t
 GfxExtendToCairoExtend(ExtendMode extend)
 {
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -187,17 +187,18 @@ enum class AntialiasMode : int8_t {
   GRAY,
   SUBPIXEL,
   DEFAULT
 };
 
 enum class Filter : int8_t {
   GOOD,
   LINEAR,
-  POINT
+  POINT,
+  SENTINEL  // one past the last valid value
 };
 
 enum class PatternType : int8_t {
   COLOR,
   SURFACE,
   LINEAR_GRADIENT,
   RADIAL_GRADIENT
 };
--- a/gfx/gl/GLTextureImage.cpp
+++ b/gfx/gl/GLTextureImage.cpp
@@ -265,17 +265,17 @@ gfx::IntSize TextureImage::GetSize() con
 }
 
 TextureImage::TextureImage(const gfx::IntSize& aSize,
              GLenum aWrapMode, ContentType aContentType,
              Flags aFlags, ImageFormat aImageFormat)
     : mSize(aSize)
     , mWrapMode(aWrapMode)
     , mContentType(aContentType)
-    , mFilter(GraphicsFilter::FILTER_GOOD)
+    , mFilter(Filter::GOOD)
     , mFlags(aFlags)
 {}
 
 BasicTextureImage::BasicTextureImage(GLuint aTexture,
                   const gfx::IntSize& aSize,
                   GLenum aWrapMode,
                   ContentType aContentType,
                   GLContext* aContext,
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -28,17 +28,16 @@
 
 #ifdef _MSC_VER
 #pragma warning( disable : 4800 )
 #endif
 
 namespace mozilla {
 
 typedef gfxImageFormat PixelFormat;
-typedef ::GraphicsFilter GraphicsFilterType;
 
 } // namespace mozilla
 
 namespace IPC {
 
 template<>
 struct ParamTraits<mozilla::gfx::Matrix>
 {
@@ -201,21 +200,21 @@ template <>
 struct ParamTraits<gfxSurfaceType>
   : public ContiguousEnumSerializer<
              gfxSurfaceType,
              gfxSurfaceType::Image,
              gfxSurfaceType::Max>
 {};
 
 template <>
-struct ParamTraits<mozilla::GraphicsFilterType>
+struct ParamTraits<mozilla::gfx::Filter>
   : public ContiguousEnumSerializer<
-             mozilla::GraphicsFilterType,
-             GraphicsFilter::FILTER_GOOD,
-             GraphicsFilter::FILTER_SENTINEL>
+             mozilla::gfx::Filter,
+             mozilla::gfx::Filter::GOOD,
+             mozilla::gfx::Filter::SENTINEL>
 {};
 
 template <>
 struct ParamTraits<mozilla::layers::LayersBackend>
   : public ContiguousEnumSerializer<
              mozilla::layers::LayersBackend,
              mozilla::layers::LayersBackend::LAYERS_NONE,
              mozilla::layers::LayersBackend::LAYERS_LAST>
--- a/gfx/layers/ImageLayers.cpp
+++ b/gfx/layers/ImageLayers.cpp
@@ -9,17 +9,17 @@
 #include "nsDebug.h"                    // for NS_ASSERTION
 #include "nsISupportsImpl.h"            // for ImageContainer::Release, etc
 #include "gfx2DGlue.h"
 
 namespace mozilla {
 namespace layers {
 
 ImageLayer::ImageLayer(LayerManager* aManager, void* aImplData)
-: Layer(aManager, aImplData), mFilter(GraphicsFilter::FILTER_GOOD)
+: Layer(aManager, aImplData), mFilter(gfx::Filter::GOOD)
 , mScaleMode(ScaleMode::SCALE_NONE), mDisallowBigImage(false)
 {}
 
 ImageLayer::~ImageLayer()
 {}
 
 void ImageLayer::SetContainer(ImageContainer* aContainer) 
 {
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -2131,36 +2131,36 @@ ColorLayer::DumpPacket(layerscope::Layer
   layer->set_type(LayersPacket::Layer::ColorLayer);
   layer->set_color(mColor.ToABGR());
 }
 
 void
 CanvasLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
 {
   Layer::PrintInfo(aStream, aPrefix);
-  if (mFilter != GraphicsFilter::FILTER_GOOD) {
+  if (mFilter != Filter::GOOD) {
     AppendToString(aStream, mFilter, " [filter=", "]");
   }
 }
 
 // This help function is used to assign the correct enum value
 // to the packet
 static void
 DumpFilter(layerscope::LayersPacket::Layer* aLayer, const GraphicsFilter& aFilter)
 {
   using namespace layerscope;
   switch (aFilter) {
-    case GraphicsFilter::FILTER_GOOD:
+    case Filter::GOOD:
       aLayer->set_filter(LayersPacket::Layer::FILTER_GOOD);
       break;
-    case GraphicsFilter::FILTER_BEST:
-      aLayer->set_filter(LayersPacket::Layer::FILTER_BEST);
+    case Filter::LINEAR:
+      aLayer->set_filter(LayersPacket::Layer::FILTER_LINEAR);
       break;
-    case GraphicsFilter::FILTER_NEAREST:
-      aLayer->set_filter(LayersPacket::Layer::FILTER_NEAREST);
+    case Filter::POINT:
+      aLayer->set_filter(LayersPacket::Layer::FILTER_POINT);
       break;
     default:
       // ignore it
       break;
   }
 }
 
 void
@@ -2173,17 +2173,17 @@ CanvasLayer::DumpPacket(layerscope::Laye
   layer->set_type(LayersPacket::Layer::CanvasLayer);
   DumpFilter(layer, mFilter);
 }
 
 void
 ImageLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
 {
   Layer::PrintInfo(aStream, aPrefix);
-  if (mFilter != GraphicsFilter::FILTER_GOOD) {
+  if (mFilter != Filter::GOOD) {
     AppendToString(aStream, mFilter, " [filter=", "]");
   }
 }
 
 void
 ImageLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
 {
   Layer::DumpPacket(aPacket, aParent);
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -2399,17 +2399,17 @@ public:
 
 protected:
   CanvasLayer(LayerManager* aManager, void* aImplData)
     : Layer(aManager, aImplData)
     , mPreTransCallback(nullptr)
     , mPreTransCallbackData(nullptr)
     , mPostTransCallback(nullptr)
     , mPostTransCallbackData(nullptr)
-    , mFilter(GraphicsFilter::FILTER_GOOD)
+    , mFilter(gfx::Filter::GOOD)
     , mDirty(false)
   {}
 
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
 
   virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) override;
 
   void FireDidTransactionCallback()
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -24,32 +24,16 @@ AppendToString(std::stringstream& aStrea
                const char* pfx, const char* sfx)
 {
   aStream << pfx;
   aStream << nsPrintfCString("%p", p).get();
   aStream << sfx;
 }
 
 void
-AppendToString(std::stringstream& aStream, const GraphicsFilter& f,
-               const char* pfx, const char* sfx)
-{
-  aStream << pfx;
-  switch (f) {
-  case GraphicsFilter::FILTER_GOOD:      aStream << "good"; break;
-  case GraphicsFilter::FILTER_BEST:      aStream << "best"; break;
-  case GraphicsFilter::FILTER_NEAREST:   aStream << "nearest"; break;
-  default:
-    NS_ERROR("unknown filter type");
-    aStream << "???";
-  }
-  aStream << sfx;
-}
-
-void
 AppendToString(std::stringstream& aStream, FrameMetrics::ViewID n,
                const char* pfx, const char* sfx)
 {
   aStream << pfx;
   aStream << n;
   aStream << sfx;
 }
 
@@ -271,27 +255,29 @@ AppendToString(std::stringstream& aStrea
     m._11, m._12, m._13, m._14,
     m._21, m._22, m._23, m._24,
     m._31, m._32, m._33, m._34,
     m._41, m._42, m._43, m._44,
     m._51, m._52, m._53, m._54).get();
   aStream << sfx;
 }
 
-
 void
 AppendToString(std::stringstream& aStream, const Filter filter,
                const char* pfx, const char* sfx)
 {
   aStream << pfx;
 
   switch (filter) {
     case Filter::GOOD: aStream << "Filter::GOOD"; break;
     case Filter::LINEAR: aStream << "Filter::LINEAR"; break;
     case Filter::POINT: aStream << "Filter::POINT"; break;
+    default:
+      NS_ERROR("unknown filter type");
+      aStream << "???";
   }
   aStream << sfx;
 }
 
 void
 AppendToString(std::stringstream& aStream, TextureFlags flags,
                const char* pfx, const char* sfx)
 {
--- a/gfx/layers/LayersLogging.h
+++ b/gfx/layers/LayersLogging.h
@@ -26,20 +26,16 @@ enum class ImageFormat;
 
 namespace layers {
 
 void
 AppendToString(std::stringstream& aStream, const void* p,
                const char* pfx="", const char* sfx="");
 
 void
-AppendToString(std::stringstream& aStream, const GraphicsFilter& f,
-               const char* pfx="", const char* sfx="");
-
-void
 AppendToString(std::stringstream& aStream, FrameMetrics::ViewID n,
                const char* pfx="", const char* sfx="");
 
 void
 AppendToString(std::stringstream& aStream, const gfx::Color& c,
                const char* pfx="", const char* sfx="");
 
 void
--- a/gfx/layers/basic/BasicCanvasLayer.cpp
+++ b/gfx/layers/basic/BasicCanvasLayer.cpp
@@ -47,17 +47,17 @@ BasicCanvasLayer::Paint(DrawTarget* aDT,
     oldTM = aDT->GetTransform();
     aDT->SetTransform(Matrix(oldTM).
                         PreTranslate(0.0f, mBounds.height).
                         PreScale(1.0f, -1.0f));
   }
 
   FillRectWithMask(aDT, aDeviceOffset,
                    Rect(0, 0, mBounds.width, mBounds.height),
-                   mSurface, ToFilter(mFilter),
+                   mSurface, mFilter,
                    DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
                    aMaskLayer);
 
   if (needsYFlip) {
     aDT->SetTransform(oldTM);
   }
 }
 
--- a/gfx/layers/basic/BasicImageLayer.cpp
+++ b/gfx/layers/basic/BasicImageLayer.cpp
@@ -80,18 +80,18 @@ BasicImageLayer::Paint(DrawTarget* aDT,
   }
   RefPtr<gfx::SourceSurface> surface = image->GetAsSourceSurface();
   if (!surface || !surface->IsValid()) {
     mContainer->SetImageFactory(originalIF);
     return;
   }
 
   gfx::IntSize size = mSize = surface->GetSize();
-  FillRectWithMask(aDT, aDeviceOffset, Rect(0, 0, size.width, size.height), 
-                   surface, ToFilter(mFilter),
+  FillRectWithMask(aDT, aDeviceOffset, Rect(0, 0, size.width, size.height),
+                   surface, mFilter,
                    DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
                    aMaskLayer);
 
   mContainer->SetImageFactory(originalIF);
 }
 
 already_AddRefed<SourceSurface>
 BasicImageLayer::GetAsSourceSurface()
--- a/gfx/layers/composite/CanvasLayerComposite.cpp
+++ b/gfx/layers/composite/CanvasLayerComposite.cpp
@@ -132,20 +132,20 @@ CanvasLayerComposite::GetEffectFilter()
   GraphicsFilter filter = mFilter;
 #ifdef ANDROID
   // Bug 691354
   // Using the LINEAR filter we get unexplained artifacts.
   // Use NEAREST when no scaling is required.
   Matrix matrix;
   bool is2D = GetEffectiveTransform().Is2D(&matrix);
   if (is2D && !ThebesMatrix(matrix).HasNonTranslationOrFlip()) {
-    filter = GraphicsFilter::FILTER_NEAREST;
+    filter = Filter::POINT;
   }
 #endif
-  return gfx::ToFilter(filter);
+  return filter;
 }
 
 void
 CanvasLayerComposite::GenEffectChain(EffectChain& aEffect)
 {
   aEffect.mLayerRef = this;
   aEffect.mPrimaryEffect = mCompositableHost->GenEffect(GetEffectFilter());
 }
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -161,17 +161,17 @@ ImageLayerComposite::CleanupResources()
     mImageHost->Detach(this);
   }
   mImageHost = nullptr;
 }
 
 gfx::Filter
 ImageLayerComposite::GetEffectFilter()
 {
-  return gfx::ToFilter(mFilter);
+  return mFilter;
 }
 
 void
 ImageLayerComposite::GenEffectChain(EffectChain& aEffect)
 {
   aEffect.mLayerRef = this;
   aEffect.mPrimaryEffect = mImageHost->GenEffect(GetEffectFilter());
 }
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -12,17 +12,17 @@ include protocol PLayer;
 include protocol PImageContainer;
 include protocol PRenderFrame;
 include protocol PTexture;
 
 include "gfxipc/ShadowLayerUtils.h";
 include "mozilla/GfxMessageUtils.h";
 include "ImageLayers.h";
 
-using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h";
+using mozilla::gfx::Filter from "mozilla/gfx/2D.h";
 using struct mozilla::gfx::Color from "mozilla/gfx/2D.h";
 using struct mozilla::gfx::Point3D from "mozilla/gfx/Point.h";
 using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
 using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
 using nscoord from "nsCoord.h";
 using struct nsRect from "nsRect.h";
 using struct nsPoint from "nsPoint.h";
 using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
@@ -248,24 +248,24 @@ struct ContainerLayerAttributes {
   bool scaleToResolution;
   EventRegionsOverride eventRegionsOverride;
   // This is a bare pointer; LayerTransactionParent::RecvUpdate prevents this
   // from being used when !IsSameProcess(), but we should make this truly
   // cross process at some point by passing the HMDConfig
   uint64_t hmdInfo;
 };
 struct ColorLayerAttributes     { LayerColor color; IntRect bounds; };
-struct CanvasLayerAttributes    { GraphicsFilterType filter; IntRect bounds; };
+struct CanvasLayerAttributes    { Filter filter; IntRect bounds; };
 struct RefLayerAttributes {
   int64_t id;
   // TODO: Once bug 1132895 is fixed we shouldn't need to propagate the override
   // explicitly here.
   EventRegionsOverride eventRegionsOverride;
 };
-struct ImageLayerAttributes     { GraphicsFilterType filter; IntSize scaleToSize; ScaleMode scaleMode; };
+struct ImageLayerAttributes     { Filter filter; IntSize scaleToSize; ScaleMode scaleMode; };
 
 union SpecificLayerAttributes {
   null_t;
   PaintedLayerAttributes;
   ContainerLayerAttributes;
   ColorLayerAttributes;
   CanvasLayerAttributes;
   RefLayerAttributes;
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -7,17 +7,16 @@
 #include <stddef.h>                     // for size_t
 #include <stdint.h>                     // for uint32_t, uint8_t
 #include <stdlib.h>                     // for free, malloc
 #include "GLContextProvider.h"          // for GLContextProvider
 #include "GLContext.h"                  // for GLContext
 #include "GLUploadHelpers.h"
 #include "Layers.h"                     // for WriteSnapshotToDumpFile
 #include "LayerScope.h"                 // for LayerScope
-#include "gfx2DGlue.h"                  // for ThebesFilter
 #include "gfxCrashReporterUtils.h"      // for ScopedGfxFeatureReporter
 #include "GraphicsFilter.h"             // for GraphicsFilter
 #include "gfxPlatform.h"                // for gfxPlatform
 #include "gfxPrefs.h"                   // for gfxPrefs
 #include "gfxRect.h"                    // for gfxRect
 #include "gfxUtils.h"                   // for NextPowerOfTwo, gfxUtils, etc
 #include "mozilla/ArrayUtils.h"         // for ArrayLength
 #include "mozilla/Preferences.h"        // for Preferences
--- a/gfx/layers/opengl/CompositorOGLVR.cpp
+++ b/gfx/layers/opengl/CompositorOGLVR.cpp
@@ -13,17 +13,16 @@
 #include "mozilla/layers/CompositingRenderTargetOGL.h"
 #include "mozilla/layers/TextureHost.h"  // for TextureSource, etc
 #include "mozilla/layers/TextureHostOGL.h"  // for TextureSourceOGL, etc
 #include "GLContextProvider.h"          // for GLContextProvider
 #include "GLContext.h"                  // for GLContext
 #include "GLUploadHelpers.h"
 #include "Layers.h"                     // for WriteSnapshotToDumpFile
 #include "LayerScope.h"                 // for LayerScope
-#include "gfx2DGlue.h"                  // for ThebesFilter
 #include "gfxCrashReporterUtils.h"      // for ScopedGfxFeatureReporter
 #include "gfxMatrix.h"                  // for gfxMatrix
 #include "GraphicsFilter.h"             // for GraphicsFilter
 #include "gfxPlatform.h"                // for gfxPlatform
 #include "gfxPrefs.h"                   // for gfxPrefs
 #include "gfxRect.h"                    // for gfxRect
 #include "gfxUtils.h"                   // for NextPowerOfTwo, gfxUtils, etc
 #include "gfxVR.h"
--- a/gfx/layers/protobuf/LayerScopePacket.pb.cc
+++ b/gfx/layers/protobuf/LayerScopePacket.pb.cc
@@ -1182,18 +1182,18 @@ bool LayersPacket_Layer_Filter_IsValid(i
       return true;
     default:
       return false;
   }
 }
 
 #ifndef _MSC_VER
 const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_GOOD;
-const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_BEST;
-const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_NEAREST;
+const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_LINEAR;
+const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_POINT;
 const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_SENTINEL;
 #endif  // _MSC_VER
 #ifndef _MSC_VER
 const int LayersPacket_Layer_Size::kWFieldNumber;
 const int LayersPacket_Layer_Size::kHFieldNumber;
 #endif  // !_MSC_VER
 
 LayersPacket_Layer_Size::LayersPacket_Layer_Size()
--- a/gfx/layers/protobuf/LayerScopePacket.pb.h
+++ b/gfx/layers/protobuf/LayerScopePacket.pb.h
@@ -71,21 +71,20 @@ enum LayersPacket_Layer_ScrollingDirect 
   LayersPacket_Layer_ScrollingDirect_HORIZONTAL = 2
 };
 bool LayersPacket_Layer_ScrollingDirect_IsValid(int value);
 const LayersPacket_Layer_ScrollingDirect LayersPacket_Layer_ScrollingDirect_ScrollingDirect_MIN = LayersPacket_Layer_ScrollingDirect_VERTICAL;
 const LayersPacket_Layer_ScrollingDirect LayersPacket_Layer_ScrollingDirect_ScrollingDirect_MAX = LayersPacket_Layer_ScrollingDirect_HORIZONTAL;
 const int LayersPacket_Layer_ScrollingDirect_ScrollingDirect_ARRAYSIZE = LayersPacket_Layer_ScrollingDirect_ScrollingDirect_MAX + 1;
 
 enum LayersPacket_Layer_Filter {
-  LayersPacket_Layer_Filter_FILTER_FAST = 0,
-  LayersPacket_Layer_Filter_FILTER_GOOD = 1,
-  LayersPacket_Layer_Filter_FILTER_BEST = 2,
-  LayersPacket_Layer_Filter_FILTER_NEAREST = 3,
-  LayersPacket_Layer_Filter_FILTER_SENTINEL = 6
+  LayersPacket_Layer_Filter_FILTER_GOOD = 0,
+  LayersPacket_Layer_Filter_FILTER_LINEAR = 1,
+  LayersPacket_Layer_Filter_FILTER_POINT = 2,
+  LayersPacket_Layer_Filter_FILTER_SENTINEL = 3
 };
 bool LayersPacket_Layer_Filter_IsValid(int value);
 
 enum Packet_DataType {
   Packet_DataType_FRAMESTART = 1,
   Packet_DataType_FRAMEEND = 2,
   Packet_DataType_COLOR = 3,
   Packet_DataType_TEXTURE = 4,
@@ -1150,18 +1149,18 @@ class LayersPacket_Layer : public ::goog
     LayersPacket_Layer_ScrollingDirect_ScrollingDirect_MIN;
   static const ScrollingDirect ScrollingDirect_MAX =
     LayersPacket_Layer_ScrollingDirect_ScrollingDirect_MAX;
   static const int ScrollingDirect_ARRAYSIZE =
     LayersPacket_Layer_ScrollingDirect_ScrollingDirect_ARRAYSIZE;
 
   typedef LayersPacket_Layer_Filter Filter;
   static const Filter FILTER_GOOD = LayersPacket_Layer_Filter_FILTER_GOOD;
-  static const Filter FILTER_BEST = LayersPacket_Layer_Filter_FILTER_BEST;
-  static const Filter FILTER_NEAREST = LayersPacket_Layer_Filter_FILTER_NEAREST;
+  static const Filter FILTER_LINEAR = LayersPacket_Layer_Filter_FILTER_LINEAR;
+  static const Filter FILTER_POINT = LayersPacket_Layer_Filter_FILTER_POINT;
   static const Filter FILTER_SENTINEL = LayersPacket_Layer_Filter_FILTER_SENTINEL;
   static inline bool Filter_IsValid(int value) {
     return LayersPacket_Layer_Filter_IsValid(value);
   }
 
   // accessors -------------------------------------------------------
 
   // required .mozilla.layers.layerscope.LayersPacket.Layer.LayerType type = 1;
--- a/gfx/thebes/GraphicsFilter.h
+++ b/gfx/thebes/GraphicsFilter.h
@@ -1,17 +1,14 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GraphicsFilter_h
 #define GraphicsFilter_h
 
-enum class GraphicsFilter : int {
-  FILTER_GOOD,
-  FILTER_BEST,
-  FILTER_NEAREST,
-  FILTER_SENTINEL
-};
+#include "mozilla/gfx/Types.h"
+
+typedef mozilla::gfx::Filter GraphicsFilter;
 
 #endif
 
--- a/gfx/thebes/gfx2DGlue.h
+++ b/gfx/thebes/gfx2DGlue.h
@@ -1,16 +1,17 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_2D_GLUE_H
 #define GFX_2D_GLUE_H
 
-
 #include "gfxPlatform.h"
 #include "gfxRect.h"
 #include "gfxMatrix.h"
 #include "gfxContext.h"
 #include "mozilla/gfx/Matrix.h"
 #include "mozilla/gfx/Rect.h"
 #include "mozilla/gfx/2D.h"
 
@@ -55,40 +56,16 @@ inline IntMargin ToIntMargin(const nsInt
   return IntMargin(aMargin.top, aMargin.right, aMargin.bottom, aMargin.left);
 }
 
 inline Size ToSize(const gfxSize &aSize)
 {
   return Size(Float(aSize.width), Float(aSize.height));
 }
 
-inline Filter ToFilter(GraphicsFilter aFilter)
-{
-  switch (aFilter) {
-  case GraphicsFilter::FILTER_NEAREST:
-    return Filter::POINT;
-  case GraphicsFilter::FILTER_GOOD:
-    return Filter::GOOD;
-  default:
-    return Filter::LINEAR;
-  }
-}
-
-inline GraphicsFilter ThebesFilter(Filter aFilter)
-{
-  switch (aFilter) {
-  case Filter::POINT:
-    return GraphicsFilter::FILTER_NEAREST;
-  case Filter::GOOD:
-    return GraphicsFilter::FILTER_GOOD;
-  default:
-    return GraphicsFilter::FILTER_BEST;
-  }
-}
-
 inline gfxPoint ThebesPoint(const Point &aPoint)
 {
   return gfxPoint(aPoint.x, aPoint.y);
 }
 
 inline gfxSize ThebesSize(const Size &aSize)
 {
   return gfxSize(aSize.width, aSize.height);
--- a/gfx/thebes/gfxDrawable.cpp
+++ b/gfx/thebes/gfxDrawable.cpp
@@ -86,17 +86,17 @@ gfxSurfaceDrawable::DrawInternal(gfxCont
     if (aRepeat) {
         extend = ExtendMode::REPEAT;
     }
 
     Matrix patternTransform = ToMatrix(aTransform * mTransform);
     patternTransform.Invert();
 
     SurfacePattern pattern(mSourceSurface, extend,
-                           patternTransform, ToFilter(aFilter), aSamplingRect);
+                           patternTransform, aFilter, aSamplingRect);
 
     Rect fillRect = ToRect(aFillRect);
     DrawTarget* dt = aContext->GetDrawTarget();
 
     if (aContext->CurrentOp() == CompositionOp::OP_SOURCE &&
         aOpacity == 1.0) {
         // Emulate cairo operator source which is bound by mask!
         dt->ClearRect(fillRect);
--- a/gfx/thebes/gfxDrawable.h
+++ b/gfx/thebes/gfxDrawable.h
@@ -131,17 +131,17 @@ public:
     virtual bool Draw(gfxContext* aContext,
                         const gfxRect& aFillRect,
                         bool aRepeat,
                         const GraphicsFilter& aFilter,
                         gfxFloat aOpacity = 1.0,
                         const gfxMatrix& aTransform = gfxMatrix());
 
 protected:
-    already_AddRefed<gfxSurfaceDrawable> MakeSurfaceDrawable(const GraphicsFilter aFilter = GraphicsFilter::FILTER_BEST);
+    already_AddRefed<gfxSurfaceDrawable> MakeSurfaceDrawable(const GraphicsFilter aFilter = mozilla::gfx::Filter::LINEAR);
 
     nsRefPtr<gfxDrawingCallback> mCallback;
     nsRefPtr<gfxSurfaceDrawable> mSurfaceDrawable;
 };
 
 /**
  * gfxPatternDrawable
  * A convenience implementation of gfxDrawable for patterns.
--- a/gfx/thebes/gfxPattern.cpp
+++ b/gfx/thebes/gfxPattern.cpp
@@ -183,26 +183,26 @@ gfxPattern::IsOpaque()
 
 void
 gfxPattern::SetFilter(GraphicsFilter filter)
 {
   if (mGfxPattern.GetPattern()->GetType() != PatternType::SURFACE) {
     return;
   }
 
-  static_cast<SurfacePattern*>(mGfxPattern.GetPattern())->mFilter = ToFilter(filter);
+  static_cast<SurfacePattern*>(mGfxPattern.GetPattern())->mFilter = filter;
 }
 
 GraphicsFilter
 gfxPattern::Filter() const
 {
   if (mGfxPattern.GetPattern()->GetType() != PatternType::SURFACE) {
-    return GraphicsFilter::FILTER_GOOD;
+    return Filter::GOOD;
   }
-  return ThebesFilter(static_cast<const SurfacePattern*>(mGfxPattern.GetPattern())->mFilter);
+  return static_cast<const SurfacePattern*>(mGfxPattern.GetPattern())->mFilter;
 }
 
 bool
 gfxPattern::GetSolidColor(Color& aColorOut)
 {
   if (mGfxPattern.GetPattern()->GetType() == PatternType::COLOR) {
     aColorOut = static_cast<ColorPattern*>(mGfxPattern.GetPattern())->mColor;
     return true;
--- a/gfx/thebes/gfxUtils.cpp
+++ b/gfx/thebes/gfxUtils.cpp
@@ -448,18 +448,18 @@ CreateSamplingRestrictedDrawable(gfxDraw
     RefPtr<DrawTarget> target =
       gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(size, aFormat);
     if (!target) {
       return nullptr;
     }
 
     nsRefPtr<gfxContext> tmpCtx = new gfxContext(target);
     tmpCtx->SetOp(OptimalFillOp());
-    aDrawable->Draw(tmpCtx, needed - needed.TopLeft(), true,
-                    GraphicsFilter::FILTER_BEST, 1.0, gfxMatrix::Translation(needed.TopLeft()));
+    aDrawable->Draw(tmpCtx, needed - needed.TopLeft(), true, Filter::LINEAR,
+                    1.0, gfxMatrix::Translation(needed.TopLeft()));
     RefPtr<SourceSurface> surface = target->Snapshot();
 
     nsRefPtr<gfxDrawable> drawable = new gfxSurfaceDrawable(surface, size, gfxMatrix::Translation(-needed.TopLeft()));
     return drawable.forget();
 }
 #endif // !MOZ_GFX_OPTIMIZE_MOBILE
 
 // working around cairo/pixman bug (bug 364968)
@@ -554,28 +554,28 @@ static GraphicsFilter ReduceResamplingFi
     // say that it is being stretched so much that it must be a line or
     // background that doesn't need resampling.
     const float kLargeStretch = 3.0f;
 
     if (aImgWidth <= kSmallImageSizeThreshold
         || aImgHeight <= kSmallImageSizeThreshold) {
         // Never resample small images. These are often used for borders and
         // rules (think 1x1 images used to make lines).
-        return GraphicsFilter::FILTER_NEAREST;
+        return Filter::POINT;
     }
 
     if (aImgHeight * kLargeStretch <= aSourceHeight || aImgWidth * kLargeStretch <= aSourceWidth) {
         // Large image tiling detected.
 
         // Don't resample if it is being tiled a lot in only one direction.
         // This is trying to catch cases where somebody has created a border
         // (which might be large) and then is stretching it to fill some part
         // of the page.
         if (fabs(aSourceWidth - aImgWidth)/aImgWidth < 0.5 || fabs(aSourceHeight - aImgHeight)/aImgHeight < 0.5)
-            return GraphicsFilter::FILTER_NEAREST;
+            return Filter::POINT;
 
         // The image is growing a lot and in more than one direction. Resampling
         // is slow and doesn't give us very much when growing a lot.
         return aFilter;
     }
 
     /* Some notes on other heuristics:
        The Skia backend also uses nearest for backgrounds that are stretched by
@@ -690,17 +690,17 @@ PrescaleAndTileDrawable(gfxDrawable* aDr
     // The translation still is in scaled units
     withoutScale.PreScale(1.0 / scaleFactor.width, 1.0 / scaleFactor.height);
     aContext->SetMatrix(ThebesMatrix(withoutScale));
 
     DrawOptions drawOptions(aOpacity, aContext->CurrentOp(),
                             aContext->CurrentAntialiasMode());
 
     SurfacePattern scaledImagePattern(scaledImage, ExtendMode::REPEAT,
-                                      Matrix(), ToFilter(aFilter));
+                                      Matrix(), aFilter);
     destDrawTarget->FillRect(scaledNeededRect, scaledImagePattern, drawOptions);
   }
   return true;
 }
 #endif // MOZ_WIDGET_COCOA
 
 /* static */ void
 gfxUtils::DrawPixelSnapped(gfxContext*         aContext,
--- a/gfx/thebes/gfxWindowsNativeDrawing.cpp
+++ b/gfx/thebes/gfxWindowsNativeDrawing.cpp
@@ -283,17 +283,17 @@ gfxWindowsNativeDrawing::PaintToContext(
 
         nsRefPtr<gfxPattern> pat = new gfxPattern(source, Matrix());
 
         gfxMatrix m;
         m.Scale(mScale.width, mScale.height);
         pat->SetMatrix(m);
 
         if (mNativeDrawFlags & DO_NEAREST_NEIGHBOR_FILTERING)
-            pat->SetFilter(GraphicsFilter::FILTER_BEST);
+            pat->SetFilter(Filter::LINEAR);
 
         pat->SetExtend(ExtendMode::CLAMP);
         mContext->SetPattern(pat);
         mContext->Fill();
         mContext->Restore();
 
         mRenderState = RENDER_STATE_DONE;
     } else {
--- a/image/ClippedImage.cpp
+++ b/image/ClippedImage.cpp
@@ -286,17 +286,17 @@ ClippedImage::GetFrameInternal(const nsI
       new DrawSingleTileCallback(this, aSize, aSVGContext, aWhichFrame, aFlags);
     nsRefPtr<gfxDrawable> drawable =
       new gfxCallbackDrawable(drawTileCallback, aSize);
 
     // Actually draw. The callback will end up invoking DrawSingleTile.
     gfxUtils::DrawPixelSnapped(ctx, drawable, aSize,
                                ImageRegion::Create(aSize),
                                SurfaceFormat::B8G8R8A8,
-                               GraphicsFilter::FILTER_BEST,
+                               Filter::LINEAR,
                                imgIContainer::FLAG_CLAMP);
 
     // Cache the resulting surface.
     mCachedSurface =
       new ClippedImageCachedSurface(target->Snapshot(), aSize, aSVGContext,
                                     frameToDraw, aFlags,
                                     drawTileCallback->GetDrawResult());
   }
--- a/image/DynamicImage.cpp
+++ b/image/DynamicImage.cpp
@@ -183,18 +183,17 @@ DynamicImage::GetFrameAtSize(const IntSi
   if (!dt) {
     gfxWarning() <<
       "DynamicImage::GetFrame failed in CreateOffscreenContentDrawTarget";
     return nullptr;
   }
   nsRefPtr<gfxContext> context = new gfxContext(dt);
 
   auto result = Draw(context, aSize, ImageRegion::Create(aSize),
-                     aWhichFrame, GraphicsFilter::FILTER_NEAREST,
-                     Nothing(), aFlags);
+                     aWhichFrame, Filter::POINT, Nothing(), aFlags);
 
   return result == DrawResult::SUCCESS ? dt->Snapshot() : nullptr;
 }
 
 NS_IMETHODIMP_(bool)
 DynamicImage::IsOpaque()
 {
   // XXX(seth): For performance reasons it'd be better to return true here, but
--- a/image/OrientedImage.cpp
+++ b/image/OrientedImage.cpp
@@ -110,19 +110,18 @@ OrientedImage::GetFrame(uint32_t aWhichF
     InnerImage()->GetFrame(aWhichFrame, aFlags);
   NS_ENSURE_TRUE(innerSurface, nullptr);
   nsRefPtr<gfxDrawable> drawable =
     new gfxSurfaceDrawable(innerSurface, size);
 
   // Draw.
   nsRefPtr<gfxContext> ctx = new gfxContext(target);
   ctx->Multiply(OrientationMatrix(size));
-  gfxUtils::DrawPixelSnapped(ctx, drawable, size,
-                             ImageRegion::Create(size),
-                             surfaceFormat, GraphicsFilter::FILTER_BEST);
+  gfxUtils::DrawPixelSnapped(ctx, drawable, size, ImageRegion::Create(size),
+                             surfaceFormat, Filter::LINEAR);
 
   return target->Snapshot();
 }
 
 NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
 OrientedImage::GetFrameAtSize(const IntSize& aSize,
                               uint32_t aWhichFrame,
                               uint32_t aFlags)
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -1515,19 +1515,19 @@ RasterImage::Draw(gfxContext* aContext,
   if (!aContext) {
     return DrawResult::BAD_ARGS;
   }
 
   if (IsUnlocked() && mProgressTracker) {
     mProgressTracker->OnUnlockedDraw();
   }
 
-  // If we're not using GraphicsFilter::FILTER_GOOD, we shouldn't high-quality
-  // scale or downscale during decode.
-  uint32_t flags = aFilter == GraphicsFilter::FILTER_GOOD
+  // If we're not using Filter::GOOD, we shouldn't high-quality scale or
+  // downscale during decode.
+  uint32_t flags = aFilter == Filter::GOOD
                  ? aFlags
                  : aFlags & ~FLAG_HIGH_QUALITY_SCALING;
 
   DrawableFrameRef ref =
     LookupFrame(GetRequestedFrameIndex(aWhichFrame), aSize, flags);
   if (!ref) {
     // Getting the frame (above) touches the image and kicks off decoding.
     if (mDrawStartTime.IsNull()) {
@@ -1857,18 +1857,17 @@ RasterImage::OptimalImageSizeForDest(con
              "Unexpected destination size");
 
   if (mSize.IsEmpty() || aDest.IsEmpty()) {
     return IntSize(0, 0);
   }
 
   IntSize destSize(ceil(aDest.width), ceil(aDest.height));
 
-  if (aFilter == GraphicsFilter::FILTER_GOOD &&
-      CanDownscaleDuringDecode(destSize, aFlags)) {
+  if (aFilter == Filter::GOOD && CanDownscaleDuringDecode(destSize, aFlags)) {
     return destSize;
   }
 
   // We can't scale to this size. Use our intrinsic size for now.
   return mSize;
 }
 
 } // namespace image
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -730,20 +730,18 @@ VectorImage::GetFrameAtSize(const IntSiz
     CreateOffscreenContentDrawTarget(aSize, SurfaceFormat::B8G8R8A8);
   if (!dt) {
     NS_ERROR("Could not create a DrawTarget");
     return nullptr;
   }
 
   nsRefPtr<gfxContext> context = new gfxContext(dt);
 
-  auto result = Draw(context, aSize,
-                     ImageRegion::Create(aSize),
-                     aWhichFrame, GraphicsFilter::FILTER_NEAREST,
-                     Nothing(), aFlags);
+  auto result = Draw(context, aSize, ImageRegion::Create(aSize),
+                     aWhichFrame, Filter::POINT, Nothing(), aFlags);
 
   return result == DrawResult::SUCCESS ? dt->Snapshot() : nullptr;
 }
 
 NS_IMETHODIMP_(bool)
 VectorImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
 {
   return false;
@@ -913,17 +911,17 @@ VectorImage::CreateSurfaceAndShow(const 
   SurfaceCache::UnlockSurfaces(ImageKey(this));
 
   // Try to create an imgFrame, initializing the surface it contains by drawing
   // our gfxDrawable into it. (We use FILTER_NEAREST since we never scale here.)
   nsRefPtr<imgFrame> frame = new imgFrame;
   nsresult rv =
     frame->InitWithDrawable(svgDrawable, aParams.size,
                             SurfaceFormat::B8G8R8A8,
-                            GraphicsFilter::FILTER_NEAREST, aParams.flags);
+                            Filter::POINT, aParams.flags);
 
   // If we couldn't create the frame, it was probably because it would end
   // up way too big. Generally it also wouldn't fit in the cache, but the prefs
   // could be set such that the cache isn't the limiting factor.
   if (NS_FAILED(rv)) {
     return Show(svgDrawable, aParams);
   }
 
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -5866,31 +5866,31 @@ nsLayoutUtils::GetClosestLayer(nsIFrame*
   if (layer)
     return layer;
   return aFrame->PresContext()->PresShell()->FrameManager()->GetRootFrame();
 }
 
 GraphicsFilter
 nsLayoutUtils::GetGraphicsFilterForFrame(nsIFrame* aForFrame)
 {
-  GraphicsFilter defaultFilter = GraphicsFilter::FILTER_GOOD;
+  GraphicsFilter defaultFilter = Filter::GOOD;
   nsStyleContext *sc;
   if (nsCSSRendering::IsCanvasFrame(aForFrame)) {
     nsCSSRendering::FindBackground(aForFrame, &sc);
   } else {
     sc = aForFrame->StyleContext();
   }
 
   switch (sc->StyleSVG()->mImageRendering) {
   case NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED:
-    return GraphicsFilter::FILTER_BEST;
+    return Filter::POINT;
   case NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY:
-    return GraphicsFilter::FILTER_BEST;
+    return Filter::LINEAR;
   case NS_STYLE_IMAGE_RENDERING_CRISPEDGES:
-    return GraphicsFilter::FILTER_NEAREST;
+    return Filter::POINT;
   default:
     return defaultFilter;
   }
 }
 
 /**
  * Given an image being drawn into an appunit coordinate system, and
  * a point in that coordinate system, map the point back into image
@@ -6409,17 +6409,17 @@ nsLayoutUtils::DrawBackgroundImage(gfxCo
                                    const nsPoint&      aAnchor,
                                    const nsRect&       aDirty,
                                    uint32_t            aImageFlags)
 {
   PROFILER_LABEL("layout", "nsLayoutUtils::DrawBackgroundImage",
                  js::ProfileEntry::Category::GRAPHICS);
 
   if (UseBackgroundNearestFiltering()) {
-    aGraphicsFilter = GraphicsFilter::FILTER_NEAREST;
+    aGraphicsFilter = Filter::POINT;
   }
 
   SVGImageContext svgContext(aImageSize, Nothing());
 
   return DrawImageInternal(aContext, aPresContext, aImage,
                            aGraphicsFilter, aDest, aFill, aAnchor,
                            aDirty, &svgContext, aImageFlags);
 }
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -1457,17 +1457,17 @@ nsPluginFrame::BuildLayer(nsDisplayListB
 
     imglayer->SetScaleToSize(size, ScaleMode::STRETCH);
     imglayer->SetContainer(container);
     GraphicsFilter filter =
       nsLayoutUtils::GetGraphicsFilterForFrame(this);
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
     if (!aManager->IsCompositingCheap()) {
       // Pixman just horrible with bilinear filter scaling
-      filter = GraphicsFilter::FILTER_NEAREST;
+      filter = Filter::POINT;
     }
 #endif
     imglayer->SetFilter(filter);
 
     layer->SetContentFlags(IsOpaque() ? Layer::CONTENT_OPAQUE : 0);
 #ifdef MOZ_WIDGET_ANDROID
   } else if (aItem->GetType() == nsDisplayItem::TYPE_PLUGIN_VIDEO) {
     nsDisplayPluginVideo* videoItem = reinterpret_cast<nsDisplayPluginVideo*>(aItem);
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -3414,21 +3414,21 @@ nsTreeBodyFrame::PaintTwisty(int32_t    
       GetImage(aRowIndex, aColumn, true, twistyContext, useImageRegion, getter_AddRefs(image));
       if (image) {
         nsPoint pt = twistyRect.TopLeft();
 
         // Center the image. XXX Obey vertical-align style prop?
         if (imageSize.height < twistyRect.height) {
           pt.y += (twistyRect.height - imageSize.height)/2;
         }
-          
+
         // Paint the image.
-        nsLayoutUtils::DrawSingleUnscaledImage(*aRenderingContext.ThebesContext(),
-            aPresContext, image,
-            GraphicsFilter::FILTER_NEAREST, pt, &aDirtyRect,
+        nsLayoutUtils::DrawSingleUnscaledImage(
+            *aRenderingContext.ThebesContext(), aPresContext, image,
+            Filter::POINT, pt, &aDirtyRect,
             imgIContainer::FLAG_NONE, &imageSize);
       }
     }
   }
 }
 
 void
 nsTreeBodyFrame::PaintImage(int32_t              aRowIndex,
@@ -3762,17 +3762,17 @@ nsTreeBodyFrame::PaintCheckbox(int32_t  
 
     if (imageSize.width < checkboxRect.width) {
       pt.x += (checkboxRect.width - imageSize.width)/2;
     }
 
     // Paint the image.
     nsLayoutUtils::DrawSingleUnscaledImage(*aRenderingContext.ThebesContext(),
         aPresContext,
-        image, GraphicsFilter::FILTER_NEAREST, pt, &aDirtyRect,
+        image, Filter::POINT, pt, &aDirtyRect,
         imgIContainer::FLAG_NONE, &imageSize);
   }
 }
 
 void
 nsTreeBodyFrame::PaintProgressMeter(int32_t              aRowIndex,
                                     nsTreeColumn*        aColumn,
                                     const nsRect&        aProgressMeterRect,
--- a/widget/cocoa/nsCocoaUtils.mm
+++ b/widget/cocoa/nsCocoaUtils.mm
@@ -30,16 +30,17 @@
 
 using namespace mozilla;
 using namespace mozilla::widget;
 
 using mozilla::gfx::BackendType;
 using mozilla::gfx::DataSourceSurface;
 using mozilla::gfx::DrawTarget;
 using mozilla::gfx::Factory;
+using mozilla::gfx::Filter;
 using mozilla::gfx::IntPoint;
 using mozilla::gfx::IntRect;
 using mozilla::gfx::IntSize;
 using mozilla::gfx::SurfaceFormat;
 using mozilla::gfx::SourceSurface;
 using mozilla::image::ImageRegion;
 using std::ceil;
 
@@ -486,17 +487,17 @@ nsresult nsCocoaUtils::CreateNSImageFrom
 
     nsRefPtr<gfxContext> context = new gfxContext(drawTarget);
     if (!context) {
       NS_ERROR("Failed to create gfxContext");
       return NS_ERROR_FAILURE;
     }
 
     aImage->Draw(context, scaledSize, ImageRegion::Create(scaledSize),
-                 aWhichFrame, GraphicsFilter::FILTER_NEAREST, Nothing(),
+                 aWhichFrame, Filter::POINT, Nothing(),
                  imgIContainer::FLAG_SYNC_DECODE);
 
     surface = drawTarget->Snapshot();
   } else {
     surface = aImage->GetFrame(aWhichFrame, imgIContainer::FLAG_SYNC_DECODE);
   }
 
   NS_ENSURE_TRUE(surface, NS_ERROR_FAILURE);
--- a/widget/nsBaseDragService.cpp
+++ b/widget/nsBaseDragService.cpp
@@ -665,17 +665,17 @@ nsBaseDragService::DrawDragForImage(nsPr
       return NS_ERROR_FAILURE;
 
     nsRefPtr<gfxContext> ctx = new gfxContext(dt);
     if (!ctx)
       return NS_ERROR_FAILURE;
 
     imgContainer->Draw(ctx, destSize, ImageRegion::Create(destSize),
                        imgIContainer::FRAME_CURRENT,
-                       GraphicsFilter::FILTER_GOOD, Nothing(),
+                       Filter::GOOD, Nothing(),
                        imgIContainer::FLAG_SYNC_DECODE);
     *aSurface = dt->Snapshot();
   } else {
     *aSurface = aCanvas->GetSurfaceSnapshot();
   }
 
   return result;
 }