mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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.
This commit is contained in:
parent
3f7d3adcae
commit
36c18a61f7
@ -20,14 +20,14 @@
|
|||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
|
||||||
gfxPattern::gfxPattern(const Color& aColor)
|
gfxPattern::gfxPattern(const Color& aColor)
|
||||||
: mExtend(EXTEND_NONE)
|
: mExtend(ExtendMode::CLAMP)
|
||||||
{
|
{
|
||||||
mGfxPattern.InitColorPattern(ToDeviceColor(aColor));
|
mGfxPattern.InitColorPattern(ToDeviceColor(aColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// linear
|
// linear
|
||||||
gfxPattern::gfxPattern(gfxFloat x0, gfxFloat y0, gfxFloat x1, gfxFloat y1)
|
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);
|
mGfxPattern.InitLinearGradientPattern(Point(x0, y0), Point(x1, y1), nullptr);
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ gfxPattern::gfxPattern(gfxFloat x0, gfxFloat y0, gfxFloat x1, gfxFloat y1)
|
|||||||
// radial
|
// radial
|
||||||
gfxPattern::gfxPattern(gfxFloat cx0, gfxFloat cy0, gfxFloat radius0,
|
gfxPattern::gfxPattern(gfxFloat cx0, gfxFloat cy0, gfxFloat radius0,
|
||||||
gfxFloat cx1, gfxFloat cy1, gfxFloat radius1)
|
gfxFloat cx1, gfxFloat cy1, gfxFloat radius1)
|
||||||
: mExtend(EXTEND_NONE)
|
: mExtend(ExtendMode::CLAMP)
|
||||||
{
|
{
|
||||||
mGfxPattern.InitRadialGradientPattern(Point(cx0, cy0), Point(cx1, cy1),
|
mGfxPattern.InitRadialGradientPattern(Point(cx0, cy0), Point(cx1, cy1),
|
||||||
radius0, radius1, nullptr);
|
radius0, radius1, nullptr);
|
||||||
@ -44,9 +44,9 @@ gfxPattern::gfxPattern(gfxFloat cx0, gfxFloat cy0, gfxFloat radius0,
|
|||||||
// Azure
|
// Azure
|
||||||
gfxPattern::gfxPattern(SourceSurface *aSurface, const Matrix &aPatternToUserSpace)
|
gfxPattern::gfxPattern(SourceSurface *aSurface, const Matrix &aPatternToUserSpace)
|
||||||
: mPatternToUserSpace(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);
|
mozilla::gfx::Filter::GOOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,8 +75,7 @@ gfxPattern::SetColorStops(GradientStops* aStops)
|
|||||||
void
|
void
|
||||||
gfxPattern::CacheColorStops(const DrawTarget *aDT)
|
gfxPattern::CacheColorStops(const DrawTarget *aDT)
|
||||||
{
|
{
|
||||||
mStops = gfxGradientCache::GetOrCreateGradientStops(aDT, mStopsList,
|
mStops = gfxGradientCache::GetOrCreateGradientStops(aDT, mStopsList, mExtend);
|
||||||
ToExtendMode(mExtend));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -132,15 +131,14 @@ gfxPattern::GetPattern(const DrawTarget *aTarget,
|
|||||||
if (!mStops &&
|
if (!mStops &&
|
||||||
!mStopsList.IsEmpty()) {
|
!mStopsList.IsEmpty()) {
|
||||||
mStops = aTarget->CreateGradientStops(mStopsList.Elements(),
|
mStops = aTarget->CreateGradientStops(mStopsList.Elements(),
|
||||||
mStopsList.Length(),
|
mStopsList.Length(), mExtend);
|
||||||
ToExtendMode(mExtend));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mGfxPattern.GetPattern()->GetType()) {
|
switch (mGfxPattern.GetPattern()->GetType()) {
|
||||||
case PatternType::SURFACE: {
|
case PatternType::SURFACE: {
|
||||||
SurfacePattern* surfacePattern = static_cast<SurfacePattern*>(mGfxPattern.GetPattern());
|
SurfacePattern* surfacePattern = static_cast<SurfacePattern*>(mGfxPattern.GetPattern());
|
||||||
surfacePattern->mMatrix = patternToUser;
|
surfacePattern->mMatrix = patternToUser;
|
||||||
surfacePattern->mExtendMode = ToExtendMode(mExtend);
|
surfacePattern->mExtendMode = mExtend;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PatternType::LINEAR_GRADIENT: {
|
case PatternType::LINEAR_GRADIENT: {
|
||||||
@ -164,9 +162,9 @@ gfxPattern::GetPattern(const DrawTarget *aTarget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gfxPattern::SetExtend(GraphicsExtend extend)
|
gfxPattern::SetExtend(ExtendMode aExtend)
|
||||||
{
|
{
|
||||||
mExtend = extend;
|
mExtend = aExtend;
|
||||||
mStops = nullptr;
|
mStops = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ public:
|
|||||||
EXTEND_PAD
|
EXTEND_PAD
|
||||||
};
|
};
|
||||||
|
|
||||||
// none, repeat, reflect
|
// clamp, repeat, reflect
|
||||||
void SetExtend(GraphicsExtend extend);
|
void SetExtend(mozilla::gfx::ExtendMode aExtend);
|
||||||
|
|
||||||
int CairoStatus();
|
int CairoStatus();
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ private:
|
|||||||
mozilla::gfx::Matrix mPatternToUserSpace;
|
mozilla::gfx::Matrix mPatternToUserSpace;
|
||||||
mozilla::RefPtr<mozilla::gfx::GradientStops> mStops;
|
mozilla::RefPtr<mozilla::gfx::GradientStops> mStops;
|
||||||
nsTArray<mozilla::gfx::GradientStop> mStopsList;
|
nsTArray<mozilla::gfx::GradientStop> mStopsList;
|
||||||
GraphicsExtend mExtend;
|
mozilla::gfx::ExtendMode mExtend;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* GFX_PATTERN_H */
|
#endif /* GFX_PATTERN_H */
|
||||||
|
@ -290,7 +290,7 @@ gfxWindowsNativeDrawing::PaintToContext()
|
|||||||
if (mNativeDrawFlags & DO_NEAREST_NEIGHBOR_FILTERING)
|
if (mNativeDrawFlags & DO_NEAREST_NEIGHBOR_FILTERING)
|
||||||
pat->SetFilter(GraphicsFilter::FILTER_FAST);
|
pat->SetFilter(GraphicsFilter::FILTER_FAST);
|
||||||
|
|
||||||
pat->SetExtend(gfxPattern::EXTEND_PAD);
|
pat->SetExtend(ExtendMode::CLAMP);
|
||||||
mContext->SetPattern(pat);
|
mContext->SetPattern(pat);
|
||||||
mContext->Fill();
|
mContext->Fill();
|
||||||
mContext->Restore();
|
mContext->Restore();
|
||||||
|
@ -278,11 +278,11 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
|
|||||||
|
|
||||||
uint16_t aSpread = GetSpreadMethod();
|
uint16_t aSpread = GetSpreadMethod();
|
||||||
if (aSpread == SVG_SPREADMETHOD_PAD)
|
if (aSpread == SVG_SPREADMETHOD_PAD)
|
||||||
gradient->SetExtend(gfxPattern::EXTEND_PAD);
|
gradient->SetExtend(ExtendMode::CLAMP);
|
||||||
else if (aSpread == SVG_SPREADMETHOD_REFLECT)
|
else if (aSpread == SVG_SPREADMETHOD_REFLECT)
|
||||||
gradient->SetExtend(gfxPattern::EXTEND_REFLECT);
|
gradient->SetExtend(ExtendMode::REFLECT);
|
||||||
else if (aSpread == SVG_SPREADMETHOD_REPEAT)
|
else if (aSpread == SVG_SPREADMETHOD_REPEAT)
|
||||||
gradient->SetExtend(gfxPattern::EXTEND_REPEAT);
|
gradient->SetExtend(ExtendMode::REPEAT);
|
||||||
|
|
||||||
gradient->SetMatrix(patternMatrix);
|
gradient->SetMatrix(patternMatrix);
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ typedef nsSVGPaintServerFrame nsSVGGradientFrameBase;
|
|||||||
*/
|
*/
|
||||||
class nsSVGGradientFrame : public nsSVGGradientFrameBase
|
class nsSVGGradientFrame : public nsSVGGradientFrameBase
|
||||||
{
|
{
|
||||||
|
typedef mozilla::gfx::ExtendMode ExtendMode;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit nsSVGGradientFrame(nsStyleContext* aContext);
|
explicit nsSVGGradientFrame(nsStyleContext* aContext);
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ nsSVGPatternFrame::GetPaintServerPattern(nsIFrame *aSource,
|
|||||||
if (!pattern || pattern->CairoStatus())
|
if (!pattern || pattern->CairoStatus())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
pattern->SetExtend(gfxPattern::EXTEND_REPEAT);
|
pattern->SetExtend(ExtendMode::REPEAT);
|
||||||
return pattern.forget();
|
return pattern.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user