зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1208365 (part 3) - Change gfxPattern::mExtend from a GraphicsExtend to a gfx::ExtendMode. r=bas.
At this point, the relationship between GraphicsExtend and gfx::ExtendMode is as follows. - EXTEND_REPEAT matches up with REPEAT. - EXTEND_REFLECT matches up with REFLECT. - EXTEND_PAD matches up with CLAMP. - EXTEND_NONE has no matching value in gfx::ExtendMode. The only use of EXTEND_NONE is with nsSVGGradientFrame::mExtend. That field gets assigned EXTEND_NONE in the various constructors, and other values via SetExtend(). And all uses of that field go immediately into ToExtend() calls, which convert EXTEND_NONE to CLAMP. So it's safe to change this field to gfx::ExtendMode and initialize it to CLAMP. --HG-- extra : rebase_source : 8873174223e77b341e046093d25b320a33f0582b
This commit is contained in:
Родитель
5fbb397d4c
Коммит
b4181c38e0
|
@ -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<SurfacePattern*>(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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<mozilla::gfx::GradientStops> mStops;
|
||||
nsTArray<mozilla::gfx::GradientStop> mStopsList;
|
||||
GraphicsExtend mExtend;
|
||||
mozilla::gfx::ExtendMode mExtend;
|
||||
};
|
||||
|
||||
#endif /* GFX_PATTERN_H */
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ typedef nsSVGPaintServerFrame nsSVGGradientFrameBase;
|
|||
*/
|
||||
class nsSVGGradientFrame : public nsSVGGradientFrameBase
|
||||
{
|
||||
typedef mozilla::gfx::ExtendMode ExtendMode;
|
||||
|
||||
protected:
|
||||
explicit nsSVGGradientFrame(nsStyleContext* aContext);
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче