Bug 1277862, part 1 - Rename Moz2D's Filter to SamplingFilter in gfx/2d/. r=Bas
authorJonathan Watt <jwatt@jwatt.org>
Wed, 25 May 2016 17:01:18 +0100
changeset 339465 985578e6b5817adb81bc6ee83e07f72423d82606
parent 339464 7f84cbdcc9f27469e260b53eb4527e80f042d1f6
child 339466 ac8b323f4ca841ba86c08fe534c567f17e029cb3
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1277862
milestone49.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 1277862, part 1 - Rename Moz2D's Filter to SamplingFilter in gfx/2d/. r=Bas
gfx/2d/2D.h
gfx/2d/DrawTargetCG.cpp
gfx/2d/DrawTargetCairo.cpp
gfx/2d/DrawTargetD2D1.cpp
gfx/2d/DrawTargetDual.cpp
gfx/2d/DrawTargetRecording.cpp
gfx/2d/DrawTargetSkia.cpp
gfx/2d/FilterNodeD2D1.cpp
gfx/2d/FilterNodeSoftware.cpp
gfx/2d/FilterNodeSoftware.h
gfx/2d/HelpersCairo.h
gfx/2d/HelpersD2D.h
gfx/2d/PatternHelpers.h
gfx/2d/RecordedEvent.cpp
gfx/2d/RecordedEvent.h
gfx/2d/Types.h
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -131,23 +131,23 @@ struct StrokeOptions {
   CapStyle mLineCap;         //!< Cap style used for capping lines.
 };
 
 /**
  * This structure supplies additional options for calls to DrawSurface.
  */
 struct DrawSurfaceOptions {
   /// For constructor parameter description, see member data documentation.
-  explicit DrawSurfaceOptions(Filter aFilter = Filter::LINEAR,
+  explicit DrawSurfaceOptions(SamplingFilter aSamplingFilter = SamplingFilter::LINEAR,
                               SamplingBounds aSamplingBounds = SamplingBounds::UNBOUNDED)
-    : mFilter(aFilter)
+    : mSamplingFilter(aSamplingFilter)
     , mSamplingBounds(aSamplingBounds)
   { }
 
-  Filter mFilter;                 /**< Filter used when resampling source surface
+  SamplingFilter mSamplingFilter; /**< SamplingFilter used when resampling source surface
                                        region to the destination region. */
   SamplingBounds mSamplingBounds; /**< This indicates whether the implementation is
                                        allowed to sample pixels outside the source
                                        rectangle as specified in DrawSurface on
                                        the surface. */
 
 };
 
@@ -282,34 +282,35 @@ public:
  * This class is used for Surface Patterns, they wrap a surface and a
  * repetition mode for the surface. This may be used on the stack.
  */
 class SurfacePattern : public Pattern
 {
 public:
   /// For constructor parameter description, see member data documentation.
   SurfacePattern(SourceSurface *aSourceSurface, ExtendMode aExtendMode,
-                 const Matrix &aMatrix = Matrix(), Filter aFilter = Filter::GOOD,
+                 const Matrix &aMatrix = Matrix(),
+                 SamplingFilter aSamplingFilter = SamplingFilter::GOOD,
                  const IntRect &aSamplingRect = IntRect())
     : mSurface(aSourceSurface)
     , mExtendMode(aExtendMode)
-    , mFilter(aFilter)
+    , mSamplingFilter(aSamplingFilter)
     , mMatrix(aMatrix)
     , mSamplingRect(aSamplingRect)
   {}
 
   virtual PatternType GetType() const override
   {
     return PatternType::SURFACE;
   }
 
   RefPtr<SourceSurface> mSurface; //!< Surface to use for drawing
   ExtendMode mExtendMode;         /**< This determines how the image is extended
                                        outside the bounds of the image */
-  Filter mFilter;                 //!< Resampling filter for resampling the image.
+  SamplingFilter mSamplingFilter; //!< Resampling filter for resampling the image.
   Matrix mMatrix;                 //!< Transforms the pattern into user space
 
   IntRect mSamplingRect;          /**< Rect that must not be sampled outside of,
                                        or an empty rect if none has been specified. */
 };
 
 class StoredPattern;
 class DrawTargetCaptureImpl;
--- a/gfx/2d/DrawTargetCG.cpp
+++ b/gfx/2d/DrawTargetCG.cpp
@@ -127,25 +127,25 @@ CGBlendMode ToBlendMode(CompositionOp op
       break;*/
     default:
       mode = kCGBlendModeNormal;
   }
   return mode;
 }
 
 static CGInterpolationQuality
-InterpolationQualityFromFilter(Filter aFilter)
+InterpolationQualityFromSamplingFilter(SamplingFilter aSamplingFilter)
 {
-  switch (aFilter) {
+  switch (aSamplingFilter) {
     default:
-    case Filter::LINEAR:
+    case SamplingFilter::LINEAR:
       return kCGInterpolationLow;
-    case Filter::POINT:
+    case SamplingFilter::POINT:
       return kCGInterpolationNone;
-    case Filter::GOOD:
+    case SamplingFilter::GOOD:
       return kCGInterpolationLow;
   }
 }
 
 
 DrawTargetCG::DrawTargetCG()
   : mColorSpace(nullptr)
   , mCg(nullptr)
@@ -357,21 +357,21 @@ DrawTargetCG::DrawSurface(SourceSurface 
   UnboundnessFixer fixer;
   CGContextRef cg = fixer.Check(this, aDrawOptions.mCompositionOp, &aDest);
   if (MOZ2D_ERROR_IF(!cg)) {
     return;
   }
   CGContextSetAlpha(cg, aDrawOptions.mAlpha);
   CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AntialiasMode::NONE);
 
-  CGContextSetInterpolationQuality(cg, InterpolationQualityFromFilter(aSurfOptions.mFilter));
+  CGContextSetInterpolationQuality(cg, InterpolationQualityFromSamplingFilter(aSurfOptions.mSamplingFilter));
 
   CGImageRef image = GetRetainedImageFromSourceSurface(aSurface);
 
-  if (aSurfOptions.mFilter == Filter::POINT) {
+  if (aSurfOptions.mSamplingFilter == SamplingFilter::POINT) {
     CGImageRef subimage = CGImageCreateWithImageInRect(image, RectToCGRect(aSource));
     CGImageRelease(image);
 
     CGContextScaleCTM(cg, 1, -1);
 
     CGRect flippedRect = CGRectMake(aDest.x, -(aDest.y + aDest.height),
                                     aDest.width, aDest.height);
 
@@ -863,17 +863,17 @@ SetFillFromPattern(CGContextRef cg, CGCo
 
     CGColorSpaceRef patternSpace;
     patternSpace = CGColorSpaceCreatePattern (nullptr);
     CGContextSetFillColorSpace(cg, patternSpace);
     CGColorSpaceRelease(patternSpace);
 
     CGPatternRef pattern = CreateCGPattern(aPattern, CGContextGetCTM(cg));
     const SurfacePattern& pat = static_cast<const SurfacePattern&>(aPattern);
-    CGContextSetInterpolationQuality(cg, InterpolationQualityFromFilter(pat.mFilter));
+    CGContextSetInterpolationQuality(cg, InterpolationQualityFromSamplingFilter(pat.mSamplingFilter));
     CGFloat alpha = 1.;
     CGContextSetFillPattern(cg, pattern, &alpha);
     CGPatternRelease(pattern);
   }
 }
 
 static void
 SetStrokeFromPattern(CGContextRef cg, CGColorSpaceRef aColorSpace, const Pattern &aPattern)
@@ -888,17 +888,17 @@ SetStrokeFromPattern(CGContextRef cg, CG
   } else if (aPattern.GetType() == PatternType::SURFACE) {
     CGColorSpaceRef patternSpace;
     patternSpace = CGColorSpaceCreatePattern (nullptr);
     CGContextSetStrokeColorSpace(cg, patternSpace);
     CGColorSpaceRelease(patternSpace);
 
     CGPatternRef pattern = CreateCGPattern(aPattern, CGContextGetCTM(cg));
     const SurfacePattern& pat = static_cast<const SurfacePattern&>(aPattern);
-    CGContextSetInterpolationQuality(cg, InterpolationQualityFromFilter(pat.mFilter));
+    CGContextSetInterpolationQuality(cg, InterpolationQualityFromSamplingFilter(pat.mSamplingFilter));
     CGFloat alpha = 1.;
     CGContextSetStrokePattern(cg, pattern, &alpha);
     CGPatternRelease(pattern);
   }
 
 }
 
 void
@@ -1001,17 +1001,17 @@ DrawTargetCG::FillRect(const Rect &aRect
     }
     CGContextClipToRect(cg, RectToCGRect(aRect));
     CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(transform));
     CGContextTranslateCTM(cg, 0, CGImageGetHeight(image));
     CGContextScaleCTM(cg, 1, -1);
 
     CGRect imageRect = CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image));
 
-    CGContextSetInterpolationQuality(cg, InterpolationQualityFromFilter(pat.mFilter));
+    CGContextSetInterpolationQuality(cg, InterpolationQualityFromSamplingFilter(pat.mSamplingFilter));
 
     CGContextDrawImage(cg, imageRect, image);
     CGImageRelease(image);
   } else {
     SetFillFromPattern(cg, mColorSpace, aPattern);
     CGContextFillRect(cg, RectToCGRect(aRect));
   }
 
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -511,17 +511,17 @@ GfxPatternToCairoPattern(const Pattern& 
                                                               pattern.mSamplingRect);
       if (!surf)
         return nullptr;
 
       pat = cairo_pattern_create_for_surface(surf);
 
       matrix = &pattern.mMatrix;
 
-      cairo_pattern_set_filter(pat, GfxFilterToCairoFilter(pattern.mFilter));
+      cairo_pattern_set_filter(pat, GfxSamplingFilterToCairoFilter(pattern.mSamplingFilter));
       cairo_pattern_set_extend(pat, GfxExtendToCairoExtend(pattern.mExtendMode));
 
       cairo_surface_destroy(surf);
       break;
     }
     case PatternType::LINEAR_GRADIENT:
     {
       const LinearGradientPattern& pattern = static_cast<const LinearGradientPattern&>(aPattern);
@@ -848,17 +848,17 @@ DrawTargetCairo::DrawSurface(SourceSurfa
   cairo_matrix_init_translate(&src_mat, aSource.X(), aSource.Y());
   cairo_matrix_scale(&src_mat, sx, sy);
 
   cairo_surface_t* surf = GetCairoSurfaceForSourceSurface(aSurface);
   cairo_pattern_t* pat = cairo_pattern_create_for_surface(surf);
   cairo_surface_destroy(surf);
 
   cairo_pattern_set_matrix(pat, &src_mat);
-  cairo_pattern_set_filter(pat, GfxFilterToCairoFilter(aSurfOptions.mFilter));
+  cairo_pattern_set_filter(pat, GfxSamplingFilterToCairoFilter(aSurfOptions.mSamplingFilter));
   cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
 
   cairo_set_antialias(mContext, GfxAntialiasToCairoAntialias(aOptions.mAntialiasMode));
 
   // If the destination rect covers the entire clipped area, then unbounded and bounded
   // operations are identical, and we don't need to push a group.
   bool needsGroup = !IsOperatorBoundByMask(aOptions.mCompositionOp) &&
                     !aDest.Contains(GetUserSpaceClip());
--- a/gfx/2d/DrawTargetD2D1.cpp
+++ b/gfx/2d/DrawTargetD2D1.cpp
@@ -165,25 +165,26 @@ DrawTargetD2D1::DrawSurface(SourceSurfac
   RefPtr<ID2D1Bitmap> bitmap;
   if (aSurface->GetType() == SurfaceType::D2D1_1_IMAGE) {
     // If this is called with a DataSourceSurface it might do a partial upload
     // that our DrawBitmap call doesn't support.
     image->QueryInterface((ID2D1Bitmap**)getter_AddRefs(bitmap));
   }
 
   if (bitmap && aSurfOptions.mSamplingBounds == SamplingBounds::UNBOUNDED) {
-    mDC->DrawBitmap(bitmap, D2DRect(aDest), aOptions.mAlpha, D2DFilter(aSurfOptions.mFilter), D2DRect(aSource));
+    mDC->DrawBitmap(bitmap, D2DRect(aDest), aOptions.mAlpha,
+                    D2DFilter(aSurfOptions.mSamplingFilter), D2DRect(aSource));
   } else {
     // This has issues ignoring the alpha channel on windows 7 with images marked opaque.
     MOZ_ASSERT(aSurface->GetFormat() != SurfaceFormat::B8G8R8X8);
     mDC->CreateImageBrush(image,
                           D2D1::ImageBrushProperties(samplingBounds,
                                                      D2D1_EXTEND_MODE_CLAMP,
                                                      D2D1_EXTEND_MODE_CLAMP,
-                                                     D2DInterpolationMode(aSurfOptions.mFilter)),
+                                                     D2DInterpolationMode(aSurfOptions.mSamplingFilter)),
                           D2D1::BrushProperties(aOptions.mAlpha, D2DMatrix(transform)),
                           getter_AddRefs(brush));
     mDC->FillRectangle(D2DRect(aDest), brush);
   }
 
   FinalizeDrawing(aOptions.mCompositionOp, ColorPattern(Color()));
 }
 
@@ -1699,17 +1700,17 @@ DrawTargetD2D1::CreateBrushForPattern(co
          * Create the brush with the proper repeat modes.
          */
         RefPtr<ID2D1BitmapBrush> bitmapBrush;
         D2D1_EXTEND_MODE xRepeat = D2DExtend(pat->mExtendMode, Axis::X_AXIS);
         D2D1_EXTEND_MODE yRepeat = D2DExtend(pat->mExtendMode, Axis::Y_AXIS);
 
         mDC->CreateBitmapBrush(bitmap,
                                D2D1::BitmapBrushProperties(xRepeat, yRepeat,
-                                                           D2DFilter(pat->mFilter)),
+                                                           D2DFilter(pat->mSamplingFilter)),
                                D2D1::BrushProperties(aAlpha, D2DMatrix(mat)),
                                getter_AddRefs(bitmapBrush));
         if (!bitmapBrush) {
           gfxWarning() << "Couldn't create bitmap brush!";
           return CreateTransparentBlackBrush();
         }
         return bitmapBrush.forget();
       }
@@ -1730,17 +1731,17 @@ DrawTargetD2D1::CreateBrushForPattern(co
 
     D2D1_EXTEND_MODE xRepeat = D2DExtend(pat->mExtendMode, Axis::X_AXIS);
     D2D1_EXTEND_MODE yRepeat = D2DExtend(pat->mExtendMode, Axis::Y_AXIS);
 
     mDC->CreateImageBrush(image,
                           D2D1::ImageBrushProperties(samplingBounds,
                                                      xRepeat,
                                                      yRepeat,
-                                                     D2DInterpolationMode(pat->mFilter)),
+                                                     D2DInterpolationMode(pat->mSamplingFilter)),
                           D2D1::BrushProperties(aAlpha, D2DMatrix(mat)),
                           getter_AddRefs(imageBrush));
 
     if (!imageBrush) {
       gfxWarning() << "Couldn't create image brush!";
       return CreateTransparentBlackBrush();
     }
 
--- a/gfx/2d/DrawTargetDual.cpp
+++ b/gfx/2d/DrawTargetDual.cpp
@@ -56,19 +56,21 @@ public:
     if (surfPat->mSurface->GetType() != SurfaceType::DUAL_DT) {
       mA = mB = &aPattern;
       return;
     }
 
     const SourceSurfaceDual *ssDual =
       static_cast<const SourceSurfaceDual*>(surfPat->mSurface.get());
     mA = new (mSurfPatA.addr()) SurfacePattern(ssDual->mA, surfPat->mExtendMode,
-                                               surfPat->mMatrix, surfPat->mFilter);
+                                               surfPat->mMatrix,
+                                               surfPat->mSamplingFilter);
     mB = new (mSurfPatB.addr()) SurfacePattern(ssDual->mB, surfPat->mExtendMode,
-                                               surfPat->mMatrix, surfPat->mFilter);
+                                               surfPat->mMatrix,
+                                               surfPat->mSamplingFilter);
     mPatternsInitialized = true;
   }
 
   inline ~DualPattern()
   {
     if (mPatternsInitialized) {
       mA->~Pattern();
       mB->~Pattern();
--- a/gfx/2d/DrawTargetRecording.cpp
+++ b/gfx/2d/DrawTargetRecording.cpp
@@ -240,17 +240,17 @@ struct AdjustedPattern
     case PatternType::COLOR:
       return mOrigPattern;
     case PatternType::SURFACE:
       {
         SurfacePattern *surfPat = static_cast<SurfacePattern*>(mOrigPattern);
         mPattern =
           new (mSurfPat) SurfacePattern(GetSourceSurface(surfPat->mSurface),
                                         surfPat->mExtendMode, surfPat->mMatrix,
-                                        surfPat->mFilter);
+                                        surfPat->mSamplingFilter);
         return mPattern;
       }
     case PatternType::LINEAR_GRADIENT:
       {
         LinearGradientPattern *linGradPat = static_cast<LinearGradientPattern*>(mOrigPattern);
         mPattern =
           new (mLinGradPat) LinearGradientPattern(linGradPat->mBegin, linGradPat->mEnd,
                                                   GetGradientStops(linGradPat->mStops),
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -285,17 +285,17 @@ SetPaintPattern(SkPaint& aPaint, const P
         mat.preTranslate(rect.x(), rect.y());
       }
 
       SkShader::TileMode xTileMode = ExtendModeToTileMode(pat.mExtendMode, Axis::X_AXIS);
       SkShader::TileMode yTileMode = ExtendModeToTileMode(pat.mExtendMode, Axis::Y_AXIS);
 
       sk_sp<SkShader> shader = SkShader::MakeBitmapShader(bitmap, xTileMode, yTileMode, &mat);
       aPaint.setShader(shader);
-      if (pat.mFilter == Filter::POINT) {
+      if (pat.mSamplingFilter == SamplingFilter::POINT) {
         aPaint.setFilterQuality(kNone_SkFilterQuality);
       }
       break;
     }
   }
 }
 
 static inline Rect
@@ -400,17 +400,17 @@ DrawTargetSkia::DrawSurface(SourceSurfac
   MarkChanged();
 
   SkRect destRect = RectToSkRect(aDest);
   SkRect sourceRect = RectToSkRect(aSource);
 
   SkBitmap bitmap = GetBitmapForSurface(aSurface);
 
   AutoPaintSetup paint(mCanvas.get(), aOptions, &aDest);
-  if (aSurfOptions.mFilter == Filter::POINT) {
+  if (aSurfOptions.mSamplingFilter == SamplingFilter::POINT) {
     paint.mPaint.setFilterQuality(kNone_SkFilterQuality);
   }
 
   mCanvas->drawBitmapRect(bitmap, sourceRect, destRect, &paint.mPaint);
 }
 
 DrawTargetType
 DrawTargetSkia::GetType() const
--- a/gfx/2d/FilterNodeD2D1.cpp
+++ b/gfx/2d/FilterNodeD2D1.cpp
@@ -23,24 +23,24 @@ D2D1_COLORMATRIX_ALPHA_MODE D2DAlphaMode
     return D2D1_COLORMATRIX_ALPHA_MODE_STRAIGHT;
   default:
     MOZ_CRASH("GFX: Unknown enum value D2DAlphaMode!");
   }
 
   return D2D1_COLORMATRIX_ALPHA_MODE_PREMULTIPLIED;
 }
 
-D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE D2DAffineTransformInterpolationMode(Filter aFilter)
+D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE D2DAffineTransformInterpolationMode(SamplingFilter aSamplingFilter)
 {
-  switch (aFilter) {
-  case Filter::GOOD:
+  switch (aSamplingFilter) {
+  case SamplingFilter::GOOD:
     return D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR;
-  case Filter::LINEAR:
+  case SamplingFilter::LINEAR:
     return D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR;
-  case Filter::POINT:
+  case SamplingFilter::POINT:
     return D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
   default:
     MOZ_CRASH("GFX: Unknown enum value D2DAffineTIM!");
   }
 
   return D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR;
 }
 
@@ -167,17 +167,17 @@ uint32_t ConvertValue(FilterType aType, 
   switch (aType) {
   case FilterType::COLOR_MATRIX:
     if (aAttribute == ATT_COLOR_MATRIX_ALPHA_MODE) {
       aValue = D2DAlphaMode(aValue);
     }
     break;
   case FilterType::TRANSFORM:
     if (aAttribute == ATT_TRANSFORM_FILTER) {
-      aValue = D2DAffineTransformInterpolationMode(Filter(aValue));
+      aValue = D2DAffineTransformInterpolationMode(SamplingFilter(aValue));
     }
     break;
   case FilterType::BLEND:
     if (aAttribute == ATT_BLEND_BLENDMODE) {
       aValue = D2DBlendMode(aValue);
     }
     break;
   case FilterType::MORPHOLOGY:
--- a/gfx/2d/FilterNodeSoftware.cpp
+++ b/gfx/2d/FilterNodeSoftware.cpp
@@ -1037,33 +1037,33 @@ FilterNodeBlendSoftware::RequestFromInpu
 IntRect
 FilterNodeBlendSoftware::GetOutputRectInRect(const IntRect& aRect)
 {
   return GetInputRectInRect(IN_BLEND_IN, aRect).Union(
     GetInputRectInRect(IN_BLEND_IN2, aRect)).Intersect(aRect);
 }
 
 FilterNodeTransformSoftware::FilterNodeTransformSoftware()
- : mFilter(Filter::GOOD)
+  : mSamplingFilter(SamplingFilter::GOOD)
 {}
 
 int32_t
 FilterNodeTransformSoftware::InputIndex(uint32_t aInputEnumIndex)
 {
   switch (aInputEnumIndex) {
     case IN_TRANSFORM_IN: return 0;
     default: return -1;
   }
 }
 
 void
 FilterNodeTransformSoftware::SetAttribute(uint32_t aIndex, uint32_t aFilter)
 {
   MOZ_ASSERT(aIndex == ATT_TRANSFORM_FILTER);
-  mFilter = static_cast<Filter>(aFilter);
+  mSamplingFilter = static_cast<SamplingFilter>(aFilter);
   Invalidate();
 }
 
 void
 FilterNodeTransformSoftware::SetAttribute(uint32_t aIndex, const Matrix &aMatrix)
 {
   MOZ_ASSERT(aIndex == ATT_TRANSFORM_MATRIX);
   mMatrix = aMatrix;
@@ -1130,17 +1130,17 @@ FilterNodeTransformSoftware::Render(cons
                                      surf->GetFormat());
   if (!dt) {
     gfxWarning() << "FilterNodeTransformSoftware::Render failed in CreateDrawTargetForData";
     return nullptr;
   }
 
   Rect r(0, 0, srcRect.width, srcRect.height);
   dt->SetTransform(transform);
-  dt->DrawSurface(input, r, r, DrawSurfaceOptions(mFilter));
+  dt->DrawSurface(input, r, r, DrawSurfaceOptions(mSamplingFilter));
 
   dt->Flush();
   surf->Unmap();
   return surf.forget();
 }
 
 void
 FilterNodeTransformSoftware::RequestFromInputsForRect(const IntRect &aRect)
--- a/gfx/2d/FilterNodeSoftware.h
+++ b/gfx/2d/FilterNodeSoftware.h
@@ -229,17 +229,17 @@ protected:
   virtual already_AddRefed<DataSourceSurface> Render(const IntRect& aRect) override;
   virtual IntRect GetOutputRectInRect(const IntRect& aRect) override;
   virtual int32_t InputIndex(uint32_t aInputEnumIndex) override;
   virtual void RequestFromInputsForRect(const IntRect &aRect) override;
   IntRect SourceRectForOutputRect(const IntRect &aRect);
 
 private:
   Matrix mMatrix;
-  Filter mFilter;
+  SamplingFilter mSamplingFilter;
 };
 
 class FilterNodeBlendSoftware : public FilterNodeSoftware
 {
 public:
   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeBlendSoftware, override)
   FilterNodeBlendSoftware();
   virtual const char* GetName() override { return "Blend"; }
--- a/gfx/2d/HelpersCairo.h
+++ b/gfx/2d/HelpersCairo.h
@@ -104,25 +104,25 @@ CairoAntialiasToGfxAntialias(cairo_antia
     case CAIRO_ANTIALIAS_SUBPIXEL:
       return AntialiasMode::SUBPIXEL;
     default:
       return AntialiasMode::DEFAULT;
   }
 }
 
 static inline cairo_filter_t
-GfxFilterToCairoFilter(Filter filter)
+GfxSamplingFilterToCairoFilter(SamplingFilter filter)
 {
   switch (filter)
   {
-    case Filter::GOOD:
+    case SamplingFilter::GOOD:
       return CAIRO_FILTER_GOOD;
-    case Filter::LINEAR:
+    case SamplingFilter::LINEAR:
       return CAIRO_FILTER_BILINEAR;
-    case Filter::POINT:
+    case SamplingFilter::POINT:
       return CAIRO_FILTER_NEAREST;
     default:
       MOZ_CRASH("GFX: bad Cairo filter");
   }
 
   return CAIRO_FILTER_BILINEAR;
 }
 
--- a/gfx/2d/HelpersD2D.h
+++ b/gfx/2d/HelpersD2D.h
@@ -70,30 +70,30 @@ static inline D2D1_EXTEND_MODE D2DExtend
     break;
   default:
     extend = D2D1_EXTEND_MODE_CLAMP;
   }
 
   return extend;
 }
 
-static inline D2D1_BITMAP_INTERPOLATION_MODE D2DFilter(const Filter &aFilter)
+static inline D2D1_BITMAP_INTERPOLATION_MODE D2DFilter(const SamplingFilter aSamplingFilter)
 {
-  switch (aFilter) {
-  case Filter::POINT:
+  switch (aSamplingFilter) {
+  case SamplingFilter::POINT:
     return D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
   default:
     return D2D1_BITMAP_INTERPOLATION_MODE_LINEAR;
   }
 }
 
-static inline D2D1_INTERPOLATION_MODE D2DInterpolationMode(const Filter &aFilter)
+static inline D2D1_INTERPOLATION_MODE D2DInterpolationMode(const SamplingFilter aSamplingFilter)
 {
-  switch (aFilter) {
-  case Filter::POINT:
+  switch (aSamplingFilter) {
+  case SamplingFilter::POINT:
     return D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
   default:
     return D2D1_INTERPOLATION_MODE_LINEAR;
   }
 }
 
 static inline D2D1_MATRIX_5X4_F D2DMatrix5x4(const Matrix5x4 &aMatrix)
 {
--- a/gfx/2d/PatternHelpers.h
+++ b/gfx/2d/PatternHelpers.h
@@ -92,21 +92,21 @@ public:
     mPattern = new (mRadialGradientPattern.addr())
       RadialGradientPattern(aCenter1, aCenter2, aRadius1, aRadius2, aStops, aMatrix);
     return mRadialGradientPattern.addr();
   }
 
   SurfacePattern* InitSurfacePattern(SourceSurface *aSourceSurface,
                                      ExtendMode aExtendMode,
                                      const Matrix &aMatrix = Matrix(),
-                                     Filter aFilter = Filter::GOOD,
+                                     SamplingFilter aSamplingFilter = SamplingFilter::GOOD,
                                      const IntRect &aSamplingRect = IntRect()) {
     MOZ_ASSERT(!mPattern);
     mPattern = new (mSurfacePattern.addr())
-      SurfacePattern(aSourceSurface, aExtendMode, aMatrix, aFilter, aSamplingRect);
+      SurfacePattern(aSourceSurface, aExtendMode, aMatrix, aSamplingFilter, aSamplingRect);
     return mSurfacePattern.addr();
   }
 
   Pattern* GetPattern() {
     return mPattern;
   }
 
   const Pattern* GetPattern() const {
--- a/gfx/2d/RecordedEvent.cpp
+++ b/gfx/2d/RecordedEvent.cpp
@@ -274,17 +274,17 @@ RecordedEvent::StorePattern(PatternStora
     }
   case PatternType::SURFACE:
     {
       SurfacePatternStorage *store =
         reinterpret_cast<SurfacePatternStorage*>(&aDestination.mStorage);
       const SurfacePattern *pat =
         static_cast<const SurfacePattern*>(&aSource);
       store->mExtend = pat->mExtendMode;
-      store->mFilter = pat->mFilter;
+      store->mSamplingFilter = pat->mSamplingFilter;
       store->mMatrix = pat->mMatrix;
       store->mSurface = pat->mSurface;
       return;
     }
   }
 }
 
 void
@@ -528,17 +528,18 @@ struct GenericPattern
     switch(mStorage->mType) {
     case PatternType::COLOR:
       return new (mColPat) ColorPattern(reinterpret_cast<ColorPatternStorage*>(&mStorage->mStorage)->mColor);
     case PatternType::SURFACE:
       {
         SurfacePatternStorage *storage = reinterpret_cast<SurfacePatternStorage*>(&mStorage->mStorage);
         mPattern =
           new (mSurfPat) SurfacePattern(mTranslator->LookupSourceSurface(storage->mSurface),
-                                        storage->mExtend, storage->mMatrix, storage->mFilter);
+                                        storage->mExtend, storage->mMatrix,
+                                        storage->mSamplingFilter);
         return mPattern;
       }
     case PatternType::LINEAR_GRADIENT:
       {
         LinearGradientPatternStorage *storage = reinterpret_cast<LinearGradientPatternStorage*>(&mStorage->mStorage);
         mPattern =
           new (mLinGradPat) LinearGradientPattern(storage->mBegin, storage->mEnd,
                                                   mTranslator->LookupGradientStops(storage->mStops),
--- a/gfx/2d/RecordedEvent.h
+++ b/gfx/2d/RecordedEvent.h
@@ -133,17 +133,17 @@ struct RadialGradientPatternStorage
   Float mRadius2;
   ReferencePtr mStops;
   Matrix mMatrix;
 };
 
 struct SurfacePatternStorage
 {
   ExtendMode mExtend;
-  Filter mFilter;
+  SamplingFilter mSamplingFilter;
   ReferencePtr mSurface;
   Matrix mMatrix;
 };
 
 struct PatternStorage
 {
   PatternType mType;
   union {
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -230,17 +230,18 @@ enum class FillRule : int8_t {
 
 enum class AntialiasMode : int8_t {
   NONE,
   GRAY,
   SUBPIXEL,
   DEFAULT
 };
 
-enum class Filter : int8_t {
+// See https://en.wikipedia.org/wiki/Texture_filtering
+enum class SamplingFilter : int8_t {
   GOOD,
   LINEAR,
   POINT,
   SENTINEL  // one past the last valid value
 };
 
 enum class PatternType : int8_t {
   COLOR,