diff --git a/gfx/thebes/gfxPattern.cpp b/gfx/thebes/gfxPattern.cpp index e37f53a7bf0..0492c66f050 100644 --- a/gfx/thebes/gfxPattern.cpp +++ b/gfx/thebes/gfxPattern.cpp @@ -20,14 +20,14 @@ using namespace mozilla::gfx; gfxPattern::gfxPattern(const Color& aColor) - : mExtend(EXTEND_NONE) + : mExtend(ExtendMode::CLAMP) { mGfxPattern.InitColorPattern(ToDeviceColor(aColor)); } // linear gfxPattern::gfxPattern(gfxFloat x0, gfxFloat y0, gfxFloat x1, gfxFloat y1) - : mExtend(EXTEND_NONE) + : mExtend(ExtendMode::CLAMP) { mGfxPattern.InitLinearGradientPattern(Point(x0, y0), Point(x1, y1), nullptr); } @@ -35,7 +35,7 @@ gfxPattern::gfxPattern(gfxFloat x0, gfxFloat y0, gfxFloat x1, gfxFloat y1) // radial gfxPattern::gfxPattern(gfxFloat cx0, gfxFloat cy0, gfxFloat radius0, gfxFloat cx1, gfxFloat cy1, gfxFloat radius1) - : mExtend(EXTEND_NONE) + : mExtend(ExtendMode::CLAMP) { mGfxPattern.InitRadialGradientPattern(Point(cx0, cy0), Point(cx1, cy1), radius0, radius1, nullptr); @@ -44,9 +44,9 @@ gfxPattern::gfxPattern(gfxFloat cx0, gfxFloat cy0, gfxFloat radius0, // Azure gfxPattern::gfxPattern(SourceSurface *aSurface, const Matrix &aPatternToUserSpace) : mPatternToUserSpace(aPatternToUserSpace) - , mExtend(EXTEND_NONE) + , mExtend(ExtendMode::CLAMP) { - mGfxPattern.InitSurfacePattern(aSurface, ToExtendMode(mExtend), Matrix(), // matrix is overridden in GetPattern() + mGfxPattern.InitSurfacePattern(aSurface, mExtend, Matrix(), // matrix is overridden in GetPattern() mozilla::gfx::Filter::GOOD); } @@ -75,8 +75,7 @@ gfxPattern::SetColorStops(GradientStops* aStops) void gfxPattern::CacheColorStops(const DrawTarget *aDT) { - mStops = gfxGradientCache::GetOrCreateGradientStops(aDT, mStopsList, - ToExtendMode(mExtend)); + mStops = gfxGradientCache::GetOrCreateGradientStops(aDT, mStopsList, mExtend); } void @@ -132,15 +131,14 @@ gfxPattern::GetPattern(const DrawTarget *aTarget, if (!mStops && !mStopsList.IsEmpty()) { mStops = aTarget->CreateGradientStops(mStopsList.Elements(), - mStopsList.Length(), - ToExtendMode(mExtend)); + mStopsList.Length(), mExtend); } switch (mGfxPattern.GetPattern()->GetType()) { case PatternType::SURFACE: { SurfacePattern* surfacePattern = static_cast(mGfxPattern.GetPattern()); surfacePattern->mMatrix = patternToUser; - surfacePattern->mExtendMode = ToExtendMode(mExtend); + surfacePattern->mExtendMode = mExtend; break; } case PatternType::LINEAR_GRADIENT: { @@ -164,9 +162,9 @@ gfxPattern::GetPattern(const DrawTarget *aTarget, } void -gfxPattern::SetExtend(GraphicsExtend extend) +gfxPattern::SetExtend(ExtendMode aExtend) { - mExtend = extend; + mExtend = aExtend; mStops = nullptr; } diff --git a/gfx/thebes/gfxPattern.h b/gfx/thebes/gfxPattern.h index 699cbd7cede..e2bd433c739 100644 --- a/gfx/thebes/gfxPattern.h +++ b/gfx/thebes/gfxPattern.h @@ -60,8 +60,8 @@ public: EXTEND_PAD }; - // none, repeat, reflect - void SetExtend(GraphicsExtend extend); + // clamp, repeat, reflect + void SetExtend(mozilla::gfx::ExtendMode aExtend); int CairoStatus(); @@ -80,7 +80,7 @@ private: mozilla::gfx::Matrix mPatternToUserSpace; mozilla::RefPtr mStops; nsTArray mStopsList; - GraphicsExtend mExtend; + mozilla::gfx::ExtendMode mExtend; }; #endif /* GFX_PATTERN_H */ diff --git a/gfx/thebes/gfxWindowsNativeDrawing.cpp b/gfx/thebes/gfxWindowsNativeDrawing.cpp index f3407806b3f..b6c3093b5d5 100644 --- a/gfx/thebes/gfxWindowsNativeDrawing.cpp +++ b/gfx/thebes/gfxWindowsNativeDrawing.cpp @@ -290,7 +290,7 @@ gfxWindowsNativeDrawing::PaintToContext() if (mNativeDrawFlags & DO_NEAREST_NEIGHBOR_FILTERING) pat->SetFilter(GraphicsFilter::FILTER_FAST); - pat->SetExtend(gfxPattern::EXTEND_PAD); + pat->SetExtend(ExtendMode::CLAMP); mContext->SetPattern(pat); mContext->Fill(); mContext->Restore(); diff --git a/layout/svg/nsSVGGradientFrame.cpp b/layout/svg/nsSVGGradientFrame.cpp index 9af45a8270b..e26b95270f4 100644 --- a/layout/svg/nsSVGGradientFrame.cpp +++ b/layout/svg/nsSVGGradientFrame.cpp @@ -278,11 +278,11 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource, uint16_t aSpread = GetSpreadMethod(); if (aSpread == SVG_SPREADMETHOD_PAD) - gradient->SetExtend(gfxPattern::EXTEND_PAD); + gradient->SetExtend(ExtendMode::CLAMP); else if (aSpread == SVG_SPREADMETHOD_REFLECT) - gradient->SetExtend(gfxPattern::EXTEND_REFLECT); + gradient->SetExtend(ExtendMode::REFLECT); else if (aSpread == SVG_SPREADMETHOD_REPEAT) - gradient->SetExtend(gfxPattern::EXTEND_REPEAT); + gradient->SetExtend(ExtendMode::REPEAT); gradient->SetMatrix(patternMatrix); diff --git a/layout/svg/nsSVGGradientFrame.h b/layout/svg/nsSVGGradientFrame.h index 314b0a60533..591b83089b1 100644 --- a/layout/svg/nsSVGGradientFrame.h +++ b/layout/svg/nsSVGGradientFrame.h @@ -39,6 +39,8 @@ typedef nsSVGPaintServerFrame nsSVGGradientFrameBase; */ class nsSVGGradientFrame : public nsSVGGradientFrameBase { + typedef mozilla::gfx::ExtendMode ExtendMode; + protected: explicit nsSVGGradientFrame(nsStyleContext* aContext); diff --git a/layout/svg/nsSVGPatternFrame.cpp b/layout/svg/nsSVGPatternFrame.cpp index 0b2a6d257eb..90ff295150e 100644 --- a/layout/svg/nsSVGPatternFrame.cpp +++ b/layout/svg/nsSVGPatternFrame.cpp @@ -723,7 +723,7 @@ nsSVGPatternFrame::GetPaintServerPattern(nsIFrame *aSource, if (!pattern || pattern->CairoStatus()) return nullptr; - pattern->SetExtend(gfxPattern::EXTEND_REPEAT); + pattern->SetExtend(ExtendMode::REPEAT); return pattern.forget(); }