Bug 958375 - 8/9 - Make remaining Moz2D enums typed - r=Bas

Specifically:
  r=Bas for manual changes
  f=Bas for automatic changes
See attachments on the bug for the specific breakdown.
This commit is contained in:
Benoit Jacob 2014-01-10 14:06:17 -05:00
parent 3a7886f0e9
commit 06f7a9c4a2
68 changed files with 628 additions and 557 deletions

View File

@ -45,7 +45,7 @@ public:
mStops =
gfx::gfxGradientCache::GetOrCreateGradientStops(aRT,
mRawStops,
gfx::EXTEND_CLAMP);
gfx::ExtendMode::CLAMP);
return mStops;
}

View File

@ -250,9 +250,9 @@ public:
ExtendMode mode;
if (state.patternStyles[aStyle]->mRepeat == CanvasPattern::NOREPEAT) {
mode = EXTEND_CLAMP;
mode = ExtendMode::CLAMP;
} else {
mode = EXTEND_REPEAT;
mode = ExtendMode::REPEAT;
}
mPattern = new (mSurfacePattern.addr())
SurfacePattern(state.patternStyles[aStyle]->mSurface, mode);
@ -1381,9 +1381,9 @@ CanvasRenderingContext2D::SetFillRule(const nsAString& aString)
FillRule rule;
if (aString.EqualsLiteral("evenodd"))
rule = FILL_EVEN_ODD;
rule = FillRule::FILL_EVEN_ODD;
else if (aString.EqualsLiteral("nonzero"))
rule = FILL_WINDING;
rule = FillRule::FILL_WINDING;
else
return;
@ -1394,9 +1394,9 @@ void
CanvasRenderingContext2D::GetFillRule(nsAString& aString)
{
switch (CurrentState().fillRule) {
case FILL_WINDING:
case FillRule::FILL_WINDING:
aString.AssignLiteral("nonzero"); break;
case FILL_EVEN_ODD:
case FillRule::FILL_EVEN_ODD:
aString.AssignLiteral("evenodd"); break;
}
}
@ -1620,9 +1620,9 @@ CanvasRenderingContext2D::StrokeRect(double x, double y, double w,
}
if (!h) {
CapStyle cap = CAP_BUTT;
if (state.lineJoin == JOIN_ROUND) {
cap = CAP_ROUND;
CapStyle cap = CapStyle::BUTT;
if (state.lineJoin == JoinStyle::ROUND) {
cap = CapStyle::ROUND;
}
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
StrokeLine(Point(x, y), Point(x + w, y),
@ -1637,9 +1637,9 @@ CanvasRenderingContext2D::StrokeRect(double x, double y, double w,
}
if (!w) {
CapStyle cap = CAP_BUTT;
if (state.lineJoin == JOIN_ROUND) {
cap = CAP_ROUND;
CapStyle cap = CapStyle::BUTT;
if (state.lineJoin == JoinStyle::ROUND) {
cap = CapStyle::ROUND;
}
AdjustedTarget(this, bounds.IsEmpty() ? nullptr : &bounds)->
StrokeLine(Point(x, y), Point(x, y + h),
@ -1747,10 +1747,10 @@ void CanvasRenderingContext2D::DrawSystemFocusRing(mozilla::dom::Element& aEleme
state.shadowBlur = 0;
state.shadowOffset.x = 0;
state.shadowOffset.y = 0;
state.op = mozilla::gfx::OP_OVER;
state.op = mozilla::gfx::CompositionOp::OP_OVER;
state.lineCap = CAP_BUTT;
state.lineJoin = mozilla::gfx::JOIN_MITER_OR_BEVEL;
state.lineCap = CapStyle::BUTT;
state.lineJoin = mozilla::gfx::JoinStyle::MITER_OR_BEVEL;
state.lineWidth = 1;
CurrentState().dash.Clear();
@ -1963,7 +1963,7 @@ CanvasRenderingContext2D::EnsureUserSpacePath(const CanvasWindingRule& winding)
{
FillRule fillRule = CurrentState().fillRule;
if(winding == CanvasWindingRule::Evenodd)
fillRule = FILL_EVEN_ODD;
fillRule = FillRule::FILL_EVEN_ODD;
if (!mPath && !mPathBuilder && !mDSPathBuilder) {
EnsureTarget();
@ -2840,11 +2840,11 @@ CanvasRenderingContext2D::SetLineCap(const nsAString& capstyle)
CapStyle cap;
if (capstyle.EqualsLiteral("butt")) {
cap = CAP_BUTT;
cap = CapStyle::BUTT;
} else if (capstyle.EqualsLiteral("round")) {
cap = CAP_ROUND;
cap = CapStyle::ROUND;
} else if (capstyle.EqualsLiteral("square")) {
cap = CAP_SQUARE;
cap = CapStyle::SQUARE;
} else {
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
return;
@ -2857,13 +2857,13 @@ void
CanvasRenderingContext2D::GetLineCap(nsAString& capstyle)
{
switch (CurrentState().lineCap) {
case CAP_BUTT:
case CapStyle::BUTT:
capstyle.AssignLiteral("butt");
break;
case CAP_ROUND:
case CapStyle::ROUND:
capstyle.AssignLiteral("round");
break;
case CAP_SQUARE:
case CapStyle::SQUARE:
capstyle.AssignLiteral("square");
break;
}
@ -2875,11 +2875,11 @@ CanvasRenderingContext2D::SetLineJoin(const nsAString& joinstyle)
JoinStyle j;
if (joinstyle.EqualsLiteral("round")) {
j = JOIN_ROUND;
j = JoinStyle::ROUND;
} else if (joinstyle.EqualsLiteral("bevel")) {
j = JOIN_BEVEL;
j = JoinStyle::BEVEL;
} else if (joinstyle.EqualsLiteral("miter")) {
j = JOIN_MITER_OR_BEVEL;
j = JoinStyle::MITER_OR_BEVEL;
} else {
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
return;
@ -2892,13 +2892,13 @@ void
CanvasRenderingContext2D::GetLineJoin(nsAString& joinstyle, ErrorResult& error)
{
switch (CurrentState().lineJoin) {
case JOIN_ROUND:
case JoinStyle::ROUND:
joinstyle.AssignLiteral("round");
break;
case JOIN_BEVEL:
case JoinStyle::BEVEL:
joinstyle.AssignLiteral("bevel");
break;
case JOIN_MITER_OR_BEVEL:
case JoinStyle::MITER_OR_BEVEL:
joinstyle.AssignLiteral("miter");
break;
default:
@ -3167,9 +3167,9 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
Filter filter;
if (CurrentState().imageSmoothingEnabled)
filter = mgfx::FILTER_LINEAR;
filter = mgfx::Filter::LINEAR;
else
filter = mgfx::FILTER_POINT;
filter = mgfx::Filter::POINT;
mgfx::Rect bounds;
@ -3192,17 +3192,17 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
static bool
IsStandardCompositeOp(CompositionOp op)
{
return (op == OP_SOURCE ||
op == OP_ATOP ||
op == OP_IN ||
op == OP_OUT ||
op == OP_OVER ||
op == OP_DEST_IN ||
op == OP_DEST_OUT ||
op == OP_DEST_OVER ||
op == OP_DEST_ATOP ||
op == OP_ADD ||
op == OP_XOR);
return (op == CompositionOp::OP_SOURCE ||
op == CompositionOp::OP_ATOP ||
op == CompositionOp::OP_IN ||
op == CompositionOp::OP_OUT ||
op == CompositionOp::OP_OVER ||
op == CompositionOp::OP_DEST_IN ||
op == CompositionOp::OP_DEST_OUT ||
op == CompositionOp::OP_DEST_OVER ||
op == CompositionOp::OP_DEST_ATOP ||
op == CompositionOp::OP_ADD ||
op == CompositionOp::OP_XOR);
}
#endif
@ -3214,7 +3214,7 @@ CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
#define CANVAS_OP_TO_GFX_OP(cvsop, op2d) \
if (op.EqualsLiteral(cvsop)) \
comp_op = OP_##op2d;
comp_op = CompositionOp::OP_##op2d;
CANVAS_OP_TO_GFX_OP("copy", SOURCE)
else CANVAS_OP_TO_GFX_OP("source-atop", ATOP)
@ -3262,7 +3262,7 @@ CanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op,
CompositionOp comp_op = CurrentState().op;
#define CANVAS_OP_TO_GFX_OP(cvsop, op2d) \
if (comp_op == OP_##op2d) \
if (comp_op == CompositionOp::OP_##op2d) \
op.AssignLiteral(cvsop);
CANVAS_OP_TO_GFX_OP("copy", SOURCE)
@ -3454,8 +3454,8 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
mgfx::Rect destRect(0, 0, w, h);
mgfx::Rect sourceRect(0, 0, sw, sh);
mTarget->DrawSurface(source, destRect, sourceRect,
DrawSurfaceOptions(mgfx::FILTER_POINT),
DrawOptions(1.0f, OP_SOURCE, AA_NONE));
DrawSurfaceOptions(mgfx::Filter::POINT),
DrawOptions(1.0f, CompositionOp::OP_SOURCE, AntialiasMode::NONE));
mTarget->Flush();
} else {
mTarget->SetTransform(matrix);

View File

@ -693,7 +693,7 @@ protected:
{
if (NeedToDrawShadow()) {
// In this case the shadow rendering will use the operator.
return mozilla::gfx::OP_OVER;
return mozilla::gfx::CompositionOp::OP_OVER;
}
return CurrentState().op;
@ -759,10 +759,10 @@ protected:
globalAlpha(1.0f),
shadowBlur(0.0),
dashOffset(0.0f),
op(mozilla::gfx::OP_OVER),
fillRule(mozilla::gfx::FILL_WINDING),
lineCap(mozilla::gfx::CAP_BUTT),
lineJoin(mozilla::gfx::JOIN_MITER_OR_BEVEL),
op(mozilla::gfx::CompositionOp::OP_OVER),
fillRule(mozilla::gfx::FillRule::FILL_WINDING),
lineCap(mozilla::gfx::CapStyle::BUTT),
lineJoin(mozilla::gfx::JoinStyle::MITER_OR_BEVEL),
imageSmoothingEnabled(true)
{ }

View File

@ -817,7 +817,7 @@ SVGPathData::ToPathForLengthOrPositionMeasuring() const
// pass as aStrokeWidth doesn't matter (since it's only used to determine the
// length of those extra little lines).
return BuildPath(FILL_WINDING, NS_STYLE_STROKE_LINECAP_BUTT, 0);
return BuildPath(FillRule::FILL_WINDING, NS_STYLE_STROKE_LINECAP_BUTT, 0);
}
static double

View File

@ -89,7 +89,7 @@ nsSVGPathGeometryElement::CreatePathBuilder()
FillRule
nsSVGPathGeometryElement::GetFillRule()
{
FillRule fillRule = FILL_WINDING; // Equivalent to NS_STYLE_FILL_RULE_NONZERO
FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to NS_STYLE_FILL_RULE_NONZERO
nsRefPtr<nsStyleContext> styleContext =
nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr,
@ -102,7 +102,7 @@ nsSVGPathGeometryElement::GetFillRule()
NS_STYLE_FILL_RULE_EVENODD);
if (styleContext->StyleSVG()->mFillRule == NS_STYLE_FILL_RULE_EVENODD) {
fillRule = FILL_EVEN_ODD;
fillRule = FillRule::FILL_EVEN_ODD;
}
} else {
// ReportToConsole

View File

@ -78,16 +78,16 @@ struct NativeFont {
*/
struct DrawOptions {
DrawOptions(Float aAlpha = 1.0f,
CompositionOp aCompositionOp = OP_OVER,
AntialiasMode aAntialiasMode = AA_DEFAULT)
CompositionOp aCompositionOp = CompositionOp::OP_OVER,
AntialiasMode aAntialiasMode = AntialiasMode::DEFAULT)
: mAlpha(aAlpha)
, mCompositionOp(aCompositionOp)
, mAntialiasMode(aAntialiasMode)
{}
Float mAlpha;
CompositionOp mCompositionOp : 8;
AntialiasMode mAntialiasMode : 3;
CompositionOp mCompositionOp;
AntialiasMode mAntialiasMode;
};
/*
@ -108,8 +108,8 @@ struct DrawOptions {
*/
struct StrokeOptions {
StrokeOptions(Float aLineWidth = 1.0f,
JoinStyle aLineJoin = JOIN_MITER_OR_BEVEL,
CapStyle aLineCap = CAP_BUTT,
JoinStyle aLineJoin = JoinStyle::MITER_OR_BEVEL,
CapStyle aLineCap = CapStyle::BUTT,
Float aMiterLimit = 10.0f,
size_t aDashLength = 0,
const Float* aDashPattern = 0,
@ -130,8 +130,8 @@ struct StrokeOptions {
const Float* mDashPattern;
size_t mDashLength;
Float mDashOffset;
JoinStyle mLineJoin : 4;
CapStyle mLineCap : 3;
JoinStyle mLineJoin;
CapStyle mLineCap;
};
/*
@ -144,14 +144,14 @@ struct StrokeOptions {
* specified in DrawSurface on the surface.
*/
struct DrawSurfaceOptions {
DrawSurfaceOptions(Filter aFilter = FILTER_LINEAR,
SamplingBounds aSamplingBounds = SAMPLING_UNBOUNDED)
DrawSurfaceOptions(Filter aFilter = Filter::LINEAR,
SamplingBounds aSamplingBounds = SamplingBounds::UNBOUNDED)
: mFilter(aFilter)
, mSamplingBounds(aSamplingBounds)
{ }
Filter mFilter : 3;
SamplingBounds mSamplingBounds : 1;
Filter mFilter;
SamplingBounds mSamplingBounds;
};
/*
@ -194,7 +194,7 @@ public:
: mColor(aColor)
{}
virtual PatternType GetType() const { return PATTERN_COLOR; }
virtual PatternType GetType() const { return PatternType::COLOR; }
Color mColor;
};
@ -226,7 +226,7 @@ public:
{
}
virtual PatternType GetType() const { return PATTERN_LINEAR_GRADIENT; }
virtual PatternType GetType() const { return PatternType::LINEAR_GRADIENT; }
Point mBegin;
Point mEnd;
@ -266,7 +266,7 @@ public:
{
}
virtual PatternType GetType() const { return PATTERN_RADIAL_GRADIENT; }
virtual PatternType GetType() const { return PatternType::RADIAL_GRADIENT; }
Point mCenter1;
Point mCenter2;
@ -291,14 +291,14 @@ public:
* aFilter Resampling filter used for resampling the image.
*/
SurfacePattern(SourceSurface *aSourceSurface, ExtendMode aExtendMode,
const Matrix &aMatrix = Matrix(), Filter aFilter = FILTER_GOOD)
const Matrix &aMatrix = Matrix(), Filter aFilter = Filter::GOOD)
: mSurface(aSourceSurface)
, mExtendMode(aExtendMode)
, mFilter(aFilter)
, mMatrix(aMatrix)
{}
virtual PatternType GetType() const { return PATTERN_SURFACE; }
virtual PatternType GetType() const { return PatternType::SURFACE; }
RefPtr<SourceSurface> mSurface;
ExtendMode mExtendMode;
@ -413,9 +413,9 @@ public:
/* This returns a PathBuilder object that contains a copy of the contents of
* this path and is still writable.
*/
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FILL_WINDING) const = 0;
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const = 0;
virtual TemporaryRef<PathBuilder> TransformedCopyToBuilder(const Matrix &aTransform,
FillRule aFillRule = FILL_WINDING) const = 0;
FillRule aFillRule = FillRule::FILL_WINDING) const = 0;
/* This function checks if a point lies within a path. It allows passing a
* transform that will transform the path to the coordinate space in which
@ -863,7 +863,7 @@ public:
* ID2D1SimplifiedGeometrySink requires the fill mode
* to be set before calling BeginFigure().
*/
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FILL_WINDING) const = 0;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const = 0;
/*
* Create a GradientStops object that holds information about a set of
@ -878,7 +878,7 @@ public:
virtual TemporaryRef<GradientStops>
CreateGradientStops(GradientStop *aStops,
uint32_t aNumStops,
ExtendMode aExtendMode = EXTEND_CLAMP) const = 0;
ExtendMode aExtendMode = ExtendMode::CLAMP) const = 0;
/*
* Create a FilterNode object that can be used to apply a filter to various

View File

@ -38,11 +38,11 @@ struct BaseMargin {
T& Side(SideT aSide) {
// This is ugly!
return *(&top + aSide);
return *(&top + T(aSide));
}
T Side(SideT aSide) const {
// This is ugly!
return *(&top + aSide);
return *(&top + T(aSide));
}
// Overloaded operators. Note that '=' isn't defined so we'll get the

View File

@ -37,82 +37,82 @@ CGBlendMode ToBlendMode(CompositionOp op)
{
CGBlendMode mode;
switch (op) {
case OP_OVER:
case CompositionOp::OP_OVER:
mode = kCGBlendModeNormal;
break;
case OP_ADD:
case CompositionOp::OP_ADD:
mode = kCGBlendModePlusLighter;
break;
case OP_ATOP:
case CompositionOp::OP_ATOP:
mode = kCGBlendModeSourceAtop;
break;
case OP_OUT:
case CompositionOp::OP_OUT:
mode = kCGBlendModeSourceOut;
break;
case OP_IN:
case CompositionOp::OP_IN:
mode = kCGBlendModeSourceIn;
break;
case OP_SOURCE:
case CompositionOp::OP_SOURCE:
mode = kCGBlendModeCopy;
break;
case OP_DEST_IN:
case CompositionOp::OP_DEST_IN:
mode = kCGBlendModeDestinationIn;
break;
case OP_DEST_OUT:
case CompositionOp::OP_DEST_OUT:
mode = kCGBlendModeDestinationOut;
break;
case OP_DEST_OVER:
case CompositionOp::OP_DEST_OVER:
mode = kCGBlendModeDestinationOver;
break;
case OP_DEST_ATOP:
case CompositionOp::OP_DEST_ATOP:
mode = kCGBlendModeDestinationAtop;
break;
case OP_XOR:
case CompositionOp::OP_XOR:
mode = kCGBlendModeXOR;
break;
case OP_MULTIPLY:
case CompositionOp::OP_MULTIPLY:
mode = kCGBlendModeMultiply;
break;
case OP_SCREEN:
case CompositionOp::OP_SCREEN:
mode = kCGBlendModeScreen;
break;
case OP_OVERLAY:
case CompositionOp::OP_OVERLAY:
mode = kCGBlendModeOverlay;
break;
case OP_DARKEN:
case CompositionOp::OP_DARKEN:
mode = kCGBlendModeDarken;
break;
case OP_LIGHTEN:
case CompositionOp::OP_LIGHTEN:
mode = kCGBlendModeLighten;
break;
case OP_COLOR_DODGE:
case CompositionOp::OP_COLOR_DODGE:
mode = kCGBlendModeColorDodge;
break;
case OP_COLOR_BURN:
case CompositionOp::OP_COLOR_BURN:
mode = kCGBlendModeColorBurn;
break;
case OP_HARD_LIGHT:
case CompositionOp::OP_HARD_LIGHT:
mode = kCGBlendModeHardLight;
break;
case OP_SOFT_LIGHT:
case CompositionOp::OP_SOFT_LIGHT:
mode = kCGBlendModeSoftLight;
break;
case OP_DIFFERENCE:
case CompositionOp::OP_DIFFERENCE:
mode = kCGBlendModeDifference;
break;
case OP_EXCLUSION:
case CompositionOp::OP_EXCLUSION:
mode = kCGBlendModeExclusion;
break;
case OP_HUE:
case CompositionOp::OP_HUE:
mode = kCGBlendModeHue;
break;
case OP_SATURATION:
case CompositionOp::OP_SATURATION:
mode = kCGBlendModeSaturation;
break;
case OP_COLOR:
case CompositionOp::OP_COLOR:
mode = kCGBlendModeColor;
break;
case OP_LUMINOSITY:
case CompositionOp::OP_LUMINOSITY:
mode = kCGBlendModeLuminosity;
break;
/*
@ -130,11 +130,11 @@ InterpolationQualityFromFilter(Filter aFilter)
{
switch (aFilter) {
default:
case FILTER_LINEAR:
case Filter::LINEAR:
return kCGInterpolationLow;
case FILTER_POINT:
case Filter::POINT:
return kCGInterpolationNone;
case FILTER_GOOD:
case Filter::GOOD:
return kCGInterpolationDefault;
}
}
@ -297,7 +297,7 @@ DrawTargetCG::DrawSurface(SourceSurface *aSurface,
UnboundnessFixer fixer;
CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
CGContextSetAlpha(cg, aDrawOptions.mAlpha);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AA_NONE);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AntialiasMode::NONE);
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
CGImageRef image = GetRetainedImageFromSourceSurface(aSurface);
@ -353,7 +353,7 @@ class GradientStopsCG : public GradientStops
GradientStopsCG(GradientStop* aStops, uint32_t aNumStops, ExtendMode aExtendMode)
{
mExtend = aExtendMode;
if (aExtendMode == EXTEND_CLAMP) {
if (aExtendMode == ExtendMode::CLAMP) {
//XXX: do the stops need to be in any particular order?
// what should we do about the color space here? we certainly shouldn't be
// recreating it all the time
@ -605,11 +605,11 @@ DrawRadialRepeatingGradient(CGContextRef cg, const RadialGradientPattern &aPatte
static void
DrawGradient(CGContextRef cg, const Pattern &aPattern, const CGRect &aExtents)
{
if (aPattern.GetType() == PATTERN_LINEAR_GRADIENT) {
if (aPattern.GetType() == PatternType::LINEAR_GRADIENT) {
const LinearGradientPattern& pat = static_cast<const LinearGradientPattern&>(aPattern);
GradientStopsCG *stops = static_cast<GradientStopsCG*>(pat.mStops.get());
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(pat.mMatrix));
if (stops->mExtend == EXTEND_CLAMP) {
if (stops->mExtend == ExtendMode::CLAMP) {
// XXX: we should take the m out of the properties of LinearGradientPatterns
CGPoint startPoint = { pat.mBegin.x, pat.mBegin.y };
@ -621,14 +621,14 @@ DrawGradient(CGContextRef cg, const Pattern &aPattern, const CGRect &aExtents)
CGContextDrawLinearGradient(cg, stops->mGradient, startPoint, endPoint,
kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
} else if (stops->mExtend == EXTEND_REPEAT) {
} else if (stops->mExtend == ExtendMode::REPEAT) {
DrawLinearRepeatingGradient(cg, pat, aExtents);
}
} else if (aPattern.GetType() == PATTERN_RADIAL_GRADIENT) {
} else if (aPattern.GetType() == PatternType::RADIAL_GRADIENT) {
const RadialGradientPattern& pat = static_cast<const RadialGradientPattern&>(aPattern);
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(pat.mMatrix));
GradientStopsCG *stops = static_cast<GradientStopsCG*>(pat.mStops.get());
if (stops->mExtend == EXTEND_CLAMP) {
if (stops->mExtend == ExtendMode::CLAMP) {
// XXX: we should take the m out of the properties of RadialGradientPatterns
CGPoint startCenter = { pat.mCenter1.x, pat.mCenter1.y };
@ -639,7 +639,7 @@ DrawGradient(CGContextRef cg, const Pattern &aPattern, const CGRect &aExtents)
//XXX: are there degenerate radial gradients that we should avoid drawing?
CGContextDrawRadialGradient(cg, stops->mGradient, startCenter, startRadius, endCenter, endRadius,
kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
} else if (stops->mExtend == EXTEND_REPEAT) {
} else if (stops->mExtend == ExtendMode::REPEAT) {
DrawRadialRepeatingGradient(cg, pat, aExtents);
}
} else {
@ -674,7 +674,7 @@ CGPatternCallbacks patternCallbacks = {
static bool
isGradient(const Pattern &aPattern)
{
return aPattern.GetType() == PATTERN_LINEAR_GRADIENT || aPattern.GetType() == PATTERN_RADIAL_GRADIENT;
return aPattern.GetType() == PatternType::LINEAR_GRADIENT || aPattern.GetType() == PatternType::RADIAL_GRADIENT;
}
/* CoreGraphics patterns ignore the userspace transform so
@ -687,14 +687,14 @@ CreateCGPattern(const Pattern &aPattern, CGAffineTransform aUserSpace)
CGImageRef image = GetRetainedImageFromSourceSurface(pat.mSurface.get());
CGFloat xStep, yStep;
switch (pat.mExtendMode) {
case EXTEND_CLAMP:
case ExtendMode::CLAMP:
// The 1 << 22 comes from Webkit see Pattern::createPlatformPattern() in PatternCG.cpp for more info
xStep = static_cast<CGFloat>(1 << 22);
yStep = static_cast<CGFloat>(1 << 22);
break;
case EXTEND_REFLECT:
case ExtendMode::REFLECT:
assert(0);
case EXTEND_REPEAT:
case ExtendMode::REPEAT:
xStep = static_cast<CGFloat>(CGImageGetWidth(image));
yStep = static_cast<CGFloat>(CGImageGetHeight(image));
// webkit uses wkCGPatternCreateWithImageAndTransform a wrapper around CGPatternCreateWithImage2
@ -729,14 +729,14 @@ static void
SetFillFromPattern(CGContextRef cg, CGColorSpaceRef aColorSpace, const Pattern &aPattern)
{
assert(!isGradient(aPattern));
if (aPattern.GetType() == PATTERN_COLOR) {
if (aPattern.GetType() == PatternType::COLOR) {
const Color& color = static_cast<const ColorPattern&>(aPattern).mColor;
//XXX: we should cache colors
CGColorRef cgcolor = ColorToCGColor(aColorSpace, color);
CGContextSetFillColorWithColor(cg, cgcolor);
CGColorRelease(cgcolor);
} else if (aPattern.GetType() == PATTERN_SURFACE) {
} else if (aPattern.GetType() == PatternType::SURFACE) {
CGColorSpaceRef patternSpace;
patternSpace = CGColorSpaceCreatePattern (nullptr);
@ -756,13 +756,13 @@ static void
SetStrokeFromPattern(CGContextRef cg, CGColorSpaceRef aColorSpace, const Pattern &aPattern)
{
assert(!isGradient(aPattern));
if (aPattern.GetType() == PATTERN_COLOR) {
if (aPattern.GetType() == PatternType::COLOR) {
const Color& color = static_cast<const ColorPattern&>(aPattern).mColor;
//XXX: we should cache colors
CGColorRef cgcolor = ColorToCGColor(aColorSpace, color);
CGContextSetStrokeColorWithColor(cg, cgcolor);
CGColorRelease(cgcolor);
} else if (aPattern.GetType() == PATTERN_SURFACE) {
} else if (aPattern.GetType() == PatternType::SURFACE) {
CGColorSpaceRef patternSpace;
patternSpace = CGColorSpaceCreatePattern (nullptr);
CGContextSetStrokeColorSpace(cg, patternSpace);
@ -792,7 +792,7 @@ DrawTargetCG::MaskSurface(const Pattern &aSource,
UnboundnessFixer fixer;
CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
CGContextSetAlpha(cg, aDrawOptions.mAlpha);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AA_NONE);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AntialiasMode::NONE);
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
CGImageRef image = GetRetainedImageFromSourceSurface(aMask);
@ -835,7 +835,7 @@ DrawTargetCG::FillRect(const Rect &aRect,
UnboundnessFixer fixer;
CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
CGContextSetAlpha(mCg, aDrawOptions.mAlpha);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AA_NONE);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AntialiasMode::NONE);
CGContextSetBlendMode(mCg, ToBlendMode(aDrawOptions.mCompositionOp));
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
@ -844,7 +844,7 @@ DrawTargetCG::FillRect(const Rect &aRect,
CGContextClipToRect(cg, RectToCGRect(aRect));
DrawGradient(cg, aPattern, RectToCGRect(aRect));
} else {
if (aPattern.GetType() == PATTERN_SURFACE && static_cast<const SurfacePattern&>(aPattern).mExtendMode != EXTEND_REPEAT) {
if (aPattern.GetType() == PatternType::SURFACE && static_cast<const SurfacePattern&>(aPattern).mExtendMode != ExtendMode::REPEAT) {
// SetFillFromPattern can handle this case but using CGContextDrawImage
// should give us better performance, better output, smaller PDF and
// matches what cairo does.
@ -888,7 +888,7 @@ DrawTargetCG::StrokeLine(const Point &p1, const Point &p2, const Pattern &aPatte
UnboundnessFixer fixer;
CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
CGContextSetAlpha(mCg, aDrawOptions.mAlpha);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AA_NONE);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AntialiasMode::NONE);
CGContextSetBlendMode(mCg, ToBlendMode(aDrawOptions.mCompositionOp));
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
@ -931,7 +931,7 @@ DrawTargetCG::StrokeRect(const Rect &aRect,
UnboundnessFixer fixer;
CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
CGContextSetAlpha(mCg, aDrawOptions.mAlpha);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AA_NONE);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AntialiasMode::NONE);
CGContextSetBlendMode(mCg, ToBlendMode(aDrawOptions.mCompositionOp));
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
@ -984,7 +984,7 @@ DrawTargetCG::Stroke(const Path *aPath, const Pattern &aPattern, const StrokeOpt
UnboundnessFixer fixer;
CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
CGContextSetAlpha(mCg, aDrawOptions.mAlpha);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AA_NONE);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AntialiasMode::NONE);
CGContextSetBlendMode(mCg, ToBlendMode(aDrawOptions.mCompositionOp));
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
@ -1028,7 +1028,7 @@ DrawTargetCG::Fill(const Path *aPath, const Pattern &aPattern, const DrawOptions
UnboundnessFixer fixer;
CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
CGContextSetAlpha(cg, aDrawOptions.mAlpha);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AA_NONE);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AntialiasMode::NONE);
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
@ -1047,7 +1047,7 @@ DrawTargetCG::Fill(const Path *aPath, const Pattern &aPattern, const DrawOptions
} else {
CGContextAddPath(cg, cgPath->GetPath());
extents = CGContextGetPathBoundingBox(cg);
if (cgPath->GetFillRule() == FILL_EVEN_ODD)
if (cgPath->GetFillRule() == FillRule::FILL_EVEN_ODD)
CGContextEOClip(mCg);
else
CGContextClip(mCg);
@ -1059,7 +1059,7 @@ DrawTargetCG::Fill(const Path *aPath, const Pattern &aPattern, const DrawOptions
SetFillFromPattern(cg, mColorSpace, aPattern);
if (cgPath->GetFillRule() == FILL_EVEN_ODD)
if (cgPath->GetFillRule() == FillRule::FILL_EVEN_ODD)
CGContextEOFillPath(cg);
else
CGContextFillPath(cg);
@ -1106,9 +1106,9 @@ DrawTargetCG::FillGlyphs(ScaledFont *aFont, const GlyphBuffer &aBuffer, const Pa
UnboundnessFixer fixer;
CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
CGContextSetAlpha(cg, aDrawOptions.mAlpha);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AA_NONE);
if (aDrawOptions.mAntialiasMode != AA_DEFAULT) {
CGContextSetShouldSmoothFonts(cg, aDrawOptions.mAntialiasMode == AA_SUBPIXEL);
CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AntialiasMode::NONE);
if (aDrawOptions.mAntialiasMode != AntialiasMode::DEFAULT) {
CGContextSetShouldSmoothFonts(cg, aDrawOptions.mAntialiasMode == AntialiasMode::SUBPIXEL);
}
CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
@ -1448,7 +1448,7 @@ DrawTargetCG::Mask(const Pattern &aSource,
if (isGradient(aMask)) {
assert(0);
} else {
if (aMask.GetType() == PATTERN_COLOR) {
if (aMask.GetType() == PatternType::COLOR) {
DrawOptions drawOptions(aDrawOptions);
const Color& color = static_cast<const ColorPattern&>(aMask).mColor;
drawOptions.mAlpha *= color.a;
@ -1456,7 +1456,7 @@ DrawTargetCG::Mask(const Pattern &aSource,
// XXX: we need to get a rect that when transformed covers the entire surface
//Rect
//FillRect(rect, aSource, drawOptions);
} else if (aMask.GetType() == PATTERN_SURFACE) {
} else if (aMask.GetType() == PatternType::SURFACE) {
const SurfacePattern& pat = static_cast<const SurfacePattern&>(aMask);
CGImageRef mask = GetRetainedImageFromSourceSurface(pat.mSurface.get());
Rect rect(0,0, CGImageGetWidth(mask), CGImageGetHeight(mask));
@ -1511,7 +1511,7 @@ DrawTargetCG::PushClip(const Path *aPath)
CGContextAddPath(mCg, cgPath->GetPath());
CGContextRestoreGState(mCg);
if (cgPath->GetFillRule() == FILL_EVEN_ODD)
if (cgPath->GetFillRule() == FillRule::FILL_EVEN_ODD)
CGContextEOClip(mCg);
else
CGContextClip(mCg);

View File

@ -51,27 +51,27 @@ SetStrokeOptions(CGContextRef cg, const StrokeOptions &aStrokeOptions)
{
switch (aStrokeOptions.mLineCap)
{
case CAP_BUTT:
case CapStyle::BUTT:
CGContextSetLineCap(cg, kCGLineCapButt);
break;
case CAP_ROUND:
case CapStyle::ROUND:
CGContextSetLineCap(cg, kCGLineCapRound);
break;
case CAP_SQUARE:
case CapStyle::SQUARE:
CGContextSetLineCap(cg, kCGLineCapSquare);
break;
}
switch (aStrokeOptions.mLineJoin)
{
case JOIN_BEVEL:
case JoinStyle::BEVEL:
CGContextSetLineJoin(cg, kCGLineJoinBevel);
break;
case JOIN_ROUND:
case JoinStyle::ROUND:
CGContextSetLineJoin(cg, kCGLineJoinRound);
break;
case JOIN_MITER:
case JOIN_MITER_OR_BEVEL:
case JoinStyle::MITER:
case JoinStyle::MITER_OR_BEVEL:
CGContextSetLineJoin(cg, kCGLineJoinMiter);
break;
}
@ -147,7 +147,7 @@ public:
virtual TemporaryRef<DrawTarget> CreateSimilarDrawTarget(const IntSize &, SurfaceFormat) const;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule) const;
virtual TemporaryRef<GradientStops> CreateGradientStops(GradientStop *, uint32_t,
ExtendMode aExtendMode = EXTEND_CLAMP) const;
ExtendMode aExtendMode = ExtendMode::CLAMP) const;
virtual TemporaryRef<FilterNode> CreateFilter(FilterType aType);
virtual void *GetNativeSurface(NativeSurfaceType);

View File

@ -169,12 +169,12 @@ PatternIsCompatible(const Pattern& aPattern)
{
switch (aPattern.GetType())
{
case PATTERN_LINEAR_GRADIENT:
case PatternType::LINEAR_GRADIENT:
{
const LinearGradientPattern& pattern = static_cast<const LinearGradientPattern&>(aPattern);
return pattern.mStops->GetBackendType() == BackendType::CAIRO;
}
case PATTERN_RADIAL_GRADIENT:
case PatternType::RADIAL_GRADIENT:
{
const RadialGradientPattern& pattern = static_cast<const RadialGradientPattern&>(aPattern);
return pattern.mStops->GetBackendType() == BackendType::CAIRO;
@ -261,7 +261,7 @@ public:
AutoClearDeviceOffset(const Pattern& aPattern)
: mSurface(nullptr)
{
if (aPattern.GetType() == PATTERN_SURFACE) {
if (aPattern.GetType() == PatternType::SURFACE) {
const SurfacePattern& pattern = static_cast<const SurfacePattern&>(aPattern);
Init(pattern.mSurface);
}
@ -311,14 +311,14 @@ GfxPatternToCairoPattern(const Pattern& aPattern, Float aAlpha)
switch (aPattern.GetType())
{
case PATTERN_COLOR:
case PatternType::COLOR:
{
Color color = static_cast<const ColorPattern&>(aPattern).mColor;
pat = cairo_pattern_create_rgba(color.r, color.g, color.b, color.a * aAlpha);
break;
}
case PATTERN_SURFACE:
case PatternType::SURFACE:
{
const SurfacePattern& pattern = static_cast<const SurfacePattern&>(aPattern);
cairo_surface_t* surf = GetCairoSurfaceForSourceSurface(pattern.mSurface);
@ -334,7 +334,7 @@ GfxPatternToCairoPattern(const Pattern& aPattern, Float aAlpha)
break;
}
case PATTERN_LINEAR_GRADIENT:
case PatternType::LINEAR_GRADIENT:
{
const LinearGradientPattern& pattern = static_cast<const LinearGradientPattern&>(aPattern);
@ -357,7 +357,7 @@ GfxPatternToCairoPattern(const Pattern& aPattern, Float aAlpha)
break;
}
case PATTERN_RADIAL_GRADIENT:
case PatternType::RADIAL_GRADIENT:
{
const RadialGradientPattern& pattern = static_cast<const RadialGradientPattern&>(aPattern);
@ -405,7 +405,7 @@ NeedIntermediateSurface(const Pattern& aPattern, const DrawOptions& aOptions)
{
// We pre-multiply colours' alpha by the global alpha, so we don't need to
// use an intermediate surface for them.
if (aPattern.GetType() == PATTERN_COLOR)
if (aPattern.GetType() == PatternType::COLOR)
return false;
if (aOptions.mAlpha == 1.0)
@ -1010,7 +1010,7 @@ DrawTargetCairo::PopClip()
}
TemporaryRef<PathBuilder>
DrawTargetCairo::CreatePathBuilder(FillRule aFillRule /* = FILL_WINDING */) const
DrawTargetCairo::CreatePathBuilder(FillRule aFillRule /* = FillRule::FILL_WINDING */) const
{
RefPtr<PathBuilderCairo> builder = new PathBuilderCairo(aFillRule);
@ -1020,7 +1020,7 @@ DrawTargetCairo::CreatePathBuilder(FillRule aFillRule /* = FILL_WINDING */) cons
void
DrawTargetCairo::ClearSurfaceForUnboundedSource(const CompositionOp &aOperator)
{
if (aOperator != OP_SOURCE)
if (aOperator != CompositionOp::OP_SOURCE)
return;
cairo_set_operator(mContext, CAIRO_OPERATOR_CLEAR);
// It doesn't really matter what the source is here, since Paint

View File

@ -130,7 +130,7 @@ public:
virtual void PushClipRect(const Rect &aRect);
virtual void PopClip();
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual TemporaryRef<SourceSurface> CreateSourceSurfaceFromData(unsigned char *aData,
const IntSize &aSize,
@ -148,7 +148,7 @@ public:
virtual TemporaryRef<GradientStops>
CreateGradientStops(GradientStop *aStops,
uint32_t aNumStops,
ExtendMode aExtendMode = EXTEND_CLAMP) const;
ExtendMode aExtendMode = ExtendMode::CLAMP) const;
virtual TemporaryRef<FilterNode> CreateFilter(FilterType aType);

View File

@ -581,7 +581,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface,
mPrivateData->mEffect->GetTechniqueByName("SampleTexture")->
GetPassByIndex(0)->Apply(0);
mDevice->OMSetBlendState(GetBlendStateForOperator(OP_OVER), nullptr, 0xffffffff);
mDevice->OMSetBlendState(GetBlendStateForOperator(CompositionOp::OP_OVER), nullptr, 0xffffffff);
mDevice->Draw(4, 0);
@ -956,7 +956,7 @@ DrawTargetD2D::Fill(const Path *aPath,
}
Rect bounds;
if (aOptions.mCompositionOp != OP_OVER) {
if (aOptions.mCompositionOp != CompositionOp::OP_OVER) {
D2D1_RECT_F d2dbounds;
d2dPath->mGeometry->GetBounds(D2D1::IdentityMatrix(), &d2dbounds);
bounds = ToRect(d2dbounds);
@ -991,13 +991,13 @@ DrawTargetD2D::FillGlyphs(ScaledFont *aFont,
AntialiasMode aaMode = font->GetDefaultAAMode();
if (aOptions.mAntialiasMode != AA_DEFAULT) {
if (aOptions.mAntialiasMode != AntialiasMode::DEFAULT) {
aaMode = aOptions.mAntialiasMode;
}
if (mFormat == SurfaceFormat::B8G8R8A8 && mPermitSubpixelAA &&
aOptions.mCompositionOp == OP_OVER && aPattern.GetType() == PATTERN_COLOR &&
aaMode == AA_SUBPIXEL) {
aOptions.mCompositionOp == CompositionOp::OP_OVER && aPattern.GetType() == PatternType::COLOR &&
aaMode == AntialiasMode::SUBPIXEL) {
if (FillGlyphsManual(font, aBuffer,
static_cast<const ColorPattern*>(&aPattern)->mColor,
params, aOptions)) {
@ -1012,13 +1012,13 @@ DrawTargetD2D::FillGlyphs(ScaledFont *aFont,
D2D1_TEXT_ANTIALIAS_MODE d2dAAMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT;
switch (aaMode) {
case AA_NONE:
case AntialiasMode::NONE:
d2dAAMode = D2D1_TEXT_ANTIALIAS_MODE_ALIASED;
break;
case AA_GRAY:
case AntialiasMode::GRAY:
d2dAAMode = D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE;
break;
case AA_SUBPIXEL:
case AntialiasMode::SUBPIXEL:
d2dAAMode = D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE;
break;
default:
@ -1243,7 +1243,7 @@ DrawTargetD2D::CreatePathBuilder(FillRule aFillRule) const
return nullptr;
}
if (aFillRule == FILL_WINDING) {
if (aFillRule == FillRule::FILL_WINDING) {
sink->SetFillMode(D2D1_FILL_MODE_WINDING);
}
@ -1561,43 +1561,43 @@ DrawTargetD2D::GetBlendStateForOperator(CompositionOp aOperator)
desc.BlendOp = desc.BlendOpAlpha = D3D10_BLEND_OP_ADD;
switch (aOperator) {
case OP_ADD:
case CompositionOp::OP_ADD:
desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ONE;
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ONE;
break;
case OP_IN:
case CompositionOp::OP_IN:
desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_DEST_ALPHA;
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ZERO;
break;
case OP_OUT:
case CompositionOp::OP_OUT:
desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_INV_DEST_ALPHA;
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ZERO;
break;
case OP_ATOP:
case CompositionOp::OP_ATOP:
desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_DEST_ALPHA;
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA;
break;
case OP_DEST_IN:
case CompositionOp::OP_DEST_IN:
desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ZERO;
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_SRC_ALPHA;
break;
case OP_DEST_OUT:
case CompositionOp::OP_DEST_OUT:
desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ZERO;
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA;
break;
case OP_DEST_ATOP:
case CompositionOp::OP_DEST_ATOP:
desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_INV_DEST_ALPHA;
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_SRC_ALPHA;
break;
case OP_DEST_OVER:
case CompositionOp::OP_DEST_OVER:
desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_INV_DEST_ALPHA;
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ONE;
break;
case OP_XOR:
case CompositionOp::OP_XOR:
desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_INV_DEST_ALPHA;
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA;
break;
case OP_SOURCE:
case CompositionOp::OP_SOURCE:
desc.SrcBlend = desc.SrcBlendAlpha = D3D10_BLEND_ONE;
desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_ZERO;
break;
@ -1617,13 +1617,13 @@ DrawTargetD2D::GetBlendStateForOperator(CompositionOp aOperator)
ID2D1RenderTarget*
DrawTargetD2D::GetRTForOperation(CompositionOp aOperator, const Pattern &aPattern)
{
if (aOperator == OP_OVER && IsPatternSupportedByD2D(aPattern)) {
if (aOperator == CompositionOp::OP_OVER && IsPatternSupportedByD2D(aPattern)) {
return mRT;
}
PopAllClips();
if (aOperator > OP_XOR) {
if (aOperator > CompositionOp::OP_XOR) {
mRT->Flush();
}
@ -1635,7 +1635,7 @@ DrawTargetD2D::GetRTForOperation(CompositionOp aOperator, const Pattern &aPatter
EnsureViews();
if (!mRTView || !mSRView) {
gfxDebug() << *this << ": Failed to get required views. Defaulting to OP_OVER.";
gfxDebug() << *this << ": Failed to get required views. Defaulting to CompositionOp::OP_OVER.";
return mRT;
}
@ -1664,7 +1664,7 @@ DrawTargetD2D::GetRTForOperation(CompositionOp aOperator, const Pattern &aPatter
void
DrawTargetD2D::FinalizeRTForOperation(CompositionOp aOperator, const Pattern &aPattern, const Rect &aBounds)
{
if (aOperator == OP_OVER && IsPatternSupportedByD2D(aPattern)) {
if (aOperator == CompositionOp::OP_OVER && IsPatternSupportedByD2D(aPattern)) {
return;
}
@ -1718,7 +1718,7 @@ DrawTargetD2D::FinalizeRTForOperation(CompositionOp aOperator, const Pattern &aP
mPrivateData->mEffect->GetVariableByName("tex")->AsShaderResource()->SetResource(mSRView);
// Handle the case where we blend with the backdrop
if (aOperator > OP_XOR) {
if (aOperator > CompositionOp::OP_XOR) {
IntSize size = mSize;
SurfaceFormat format = mFormat;
@ -1746,14 +1746,14 @@ DrawTargetD2D::FinalizeRTForOperation(CompositionOp aOperator, const Pattern &aP
return;
}
unsigned int compop = (unsigned int)aOperator - (unsigned int)OP_XOR;
unsigned int compop = (unsigned int)aOperator - (unsigned int)CompositionOp::OP_XOR;
mPrivateData->mEffect->GetVariableByName("bcktex")->AsShaderResource()->SetResource(mBckSRView);
mPrivateData->mEffect->GetVariableByName("blendop")->AsScalar()->SetInt(compop);
if (aOperator > OP_EXCLUSION)
if (aOperator > CompositionOp::OP_EXCLUSION)
mPrivateData->mEffect->GetTechniqueByName("SampleTextureForNonSeparableBlending")->
GetPassByIndex(0)->Apply(0);
else if (aOperator > OP_COLOR_DODGE)
else if (aOperator > CompositionOp::OP_COLOR_DODGE)
mPrivateData->mEffect->GetTechniqueByName("SampleTextureForSeparableBlending_2")->
GetPassByIndex(0)->Apply(0);
else
@ -1764,7 +1764,7 @@ DrawTargetD2D::FinalizeRTForOperation(CompositionOp aOperator, const Pattern &aP
mPrivateData->mEffect->GetTechniqueByName("SampleTexture")->GetPassByIndex(0)->Apply(0);
}
} else if (aPattern.GetType() == PATTERN_RADIAL_GRADIENT) {
} else if (aPattern.GetType() == PatternType::RADIAL_GRADIENT) {
const RadialGradientPattern *pat = static_cast<const RadialGradientPattern*>(&aPattern);
if (pat->mCenter1 == pat->mCenter2 && pat->mRadius1 == pat->mRadius2) {
@ -2248,7 +2248,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
return colBrush;
}
if (aPattern.GetType() == PATTERN_COLOR) {
if (aPattern.GetType() == PatternType::COLOR) {
RefPtr<ID2D1SolidColorBrush> colBrush;
Color color = static_cast<const ColorPattern*>(&aPattern)->mColor;
mRT->CreateSolidColorBrush(D2D1::ColorF(color.r, color.g,
@ -2256,7 +2256,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
D2D1::BrushProperties(aAlpha),
byRef(colBrush));
return colBrush;
} else if (aPattern.GetType() == PATTERN_LINEAR_GRADIENT) {
} else if (aPattern.GetType() == PatternType::LINEAR_GRADIENT) {
RefPtr<ID2D1LinearGradientBrush> gradBrush;
const LinearGradientPattern *pat =
static_cast<const LinearGradientPattern*>(&aPattern);
@ -2285,7 +2285,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
stops->mStopCollection,
byRef(gradBrush));
return gradBrush;
} else if (aPattern.GetType() == PATTERN_RADIAL_GRADIENT) {
} else if (aPattern.GetType() == PatternType::RADIAL_GRADIENT) {
RefPtr<ID2D1RadialGradientBrush> gradBrush;
const RadialGradientPattern *pat =
static_cast<const RadialGradientPattern*>(&aPattern);
@ -2307,7 +2307,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
byRef(gradBrush));
return gradBrush;
} else if (aPattern.GetType() == PATTERN_SURFACE) {
} else if (aPattern.GetType() == PatternType::SURFACE) {
RefPtr<ID2D1BitmapBrush> bmBrush;
const SurfacePattern *pat =
static_cast<const SurfacePattern*>(&aPattern);

View File

@ -37,7 +37,7 @@ struct PrivateD3D10DataD2D
RefPtr<ID3D10Effect> mEffect;
RefPtr<ID3D10InputLayout> mInputLayout;
RefPtr<ID3D10Buffer> mVB;
RefPtr<ID3D10BlendState> mBlendStates[OP_COUNT];
RefPtr<ID3D10BlendState> mBlendStates[CompositionOp::OP_COUNT];
};
class DrawTargetD2D : public DrawTarget
@ -120,12 +120,12 @@ public:
virtual TemporaryRef<DrawTarget>
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual TemporaryRef<GradientStops>
CreateGradientStops(GradientStop *aStops,
uint32_t aNumStops,
ExtendMode aExtendMode = EXTEND_CLAMP) const;
ExtendMode aExtendMode = ExtendMode::CLAMP) const;
virtual TemporaryRef<FilterNode> CreateFilter(FilterType aType);

View File

@ -69,7 +69,7 @@ DrawTargetD2D1::DrawSurface(SourceSurface *aSurface,
const DrawSurfaceOptions &aSurfOptions,
const DrawOptions &aOptions)
{
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, EXTEND_CLAMP);
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, ExtendMode::CLAMP);
if (!image) {
gfxWarning() << *this << ": Unable to get D2D image for surface.";
@ -80,7 +80,7 @@ DrawTargetD2D1::DrawSurface(SourceSurface *aSurface,
D2D1_RECT_F samplingBounds;
if (aSurfOptions.mSamplingBounds == SAMPLING_BOUNDED) {
if (aSurfOptions.mSamplingBounds == SamplingBounds::BOUNDED) {
samplingBounds = D2DRect(aSource);
} else {
samplingBounds = D2D1::RectF(0, 0, Float(aSurface->GetSize().width), Float(aSurface->GetSize().height));
@ -134,7 +134,7 @@ DrawTargetD2D1::DrawSurfaceWithShadow(SourceSurface *aSurface,
mTransformDirty = true;
Matrix mat;
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, mat, EXTEND_CLAMP);
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP);
if (!mat.IsIdentity()) {
gfxDebug() << *this << ": At this point complex partial uploads are not supported for Shadow surfaces.";
@ -185,7 +185,7 @@ DrawTargetD2D1::MaskSurface(const Pattern &aSource,
{
RefPtr<ID2D1Bitmap> bitmap;
RefPtr<ID2D1Image> image = GetImageForSurface(aMask, EXTEND_CLAMP);
RefPtr<ID2D1Image> image = GetImageForSurface(aMask, ExtendMode::CLAMP);
PrepareForDrawing(aOptions.mCompositionOp, aSource);
@ -220,7 +220,7 @@ DrawTargetD2D1::CopySurface(SourceSurface *aSurface,
mTransformDirty = true;
Matrix mat;
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, mat, EXTEND_CLAMP);
RefPtr<ID2D1Image> image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP);
if (!mat.IsIdentity()) {
gfxDebug() << *this << ": At this point complex partial uploads are not supported for CopySurface.";
@ -348,7 +348,7 @@ DrawTargetD2D1::FillGlyphs(ScaledFont *aFont,
AntialiasMode aaMode = font->GetDefaultAAMode();
if (aOptions.mAntialiasMode != AA_DEFAULT) {
if (aOptions.mAntialiasMode != AntialiasMode::DEFAULT) {
aaMode = aOptions.mAntialiasMode;
}
@ -356,7 +356,7 @@ DrawTargetD2D1::FillGlyphs(ScaledFont *aFont,
bool forceClearType = false;
if (mFormat == SurfaceFormat::B8G8R8A8 && mPermitSubpixelAA &&
aOptions.mCompositionOp == OP_OVER && aaMode == AA_SUBPIXEL) {
aOptions.mCompositionOp == CompositionOp::OP_OVER && aaMode == AntialiasMode::SUBPIXEL) {
forceClearType = true;
}
@ -364,13 +364,13 @@ DrawTargetD2D1::FillGlyphs(ScaledFont *aFont,
D2D1_TEXT_ANTIALIAS_MODE d2dAAMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT;
switch (aaMode) {
case AA_NONE:
case AntialiasMode::NONE:
d2dAAMode = D2D1_TEXT_ANTIALIAS_MODE_ALIASED;
break;
case AA_GRAY:
case AntialiasMode::GRAY:
d2dAAMode = D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE;
break;
case AA_SUBPIXEL:
case AntialiasMode::SUBPIXEL:
d2dAAMode = D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE;
break;
default:
@ -553,7 +553,7 @@ DrawTargetD2D1::CreatePathBuilder(FillRule aFillRule) const
return nullptr;
}
if (aFillRule == FILL_WINDING) {
if (aFillRule == FillRule::FILL_WINDING) {
sink->SetFillMode(D2D1_FILL_MODE_WINDING);
}
@ -695,7 +695,7 @@ DrawTargetD2D1::PrepareForDrawing(CompositionOp aOp, const Pattern &aPattern)
FlushTransformToDC();
if (aOp == OP_OVER && IsPatternSupportedByD2D(aPattern)) {
if (aOp == CompositionOp::OP_OVER && IsPatternSupportedByD2D(aPattern)) {
return;
}
@ -708,7 +708,7 @@ DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp, const Pattern &aPattern)
{
bool patternSupported = IsPatternSupportedByD2D(aPattern);
if (aOp == OP_OVER && patternSupported) {
if (aOp == CompositionOp::OP_OVER && patternSupported) {
return;
}
@ -799,7 +799,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
return colBrush;
}
if (aPattern.GetType() == PATTERN_COLOR) {
if (aPattern.GetType() == PatternType::COLOR) {
RefPtr<ID2D1SolidColorBrush> colBrush;
Color color = static_cast<const ColorPattern*>(&aPattern)->mColor;
mDC->CreateSolidColorBrush(D2D1::ColorF(color.r, color.g,
@ -807,7 +807,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
D2D1::BrushProperties(aAlpha),
byRef(colBrush));
return colBrush;
} else if (aPattern.GetType() == PATTERN_LINEAR_GRADIENT) {
} else if (aPattern.GetType() == PatternType::LINEAR_GRADIENT) {
RefPtr<ID2D1LinearGradientBrush> gradBrush;
const LinearGradientPattern *pat =
static_cast<const LinearGradientPattern*>(&aPattern);
@ -836,7 +836,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
stops->mStopCollection,
byRef(gradBrush));
return gradBrush;
} else if (aPattern.GetType() == PATTERN_RADIAL_GRADIENT) {
} else if (aPattern.GetType() == PatternType::RADIAL_GRADIENT) {
RefPtr<ID2D1RadialGradientBrush> gradBrush;
const RadialGradientPattern *pat =
static_cast<const RadialGradientPattern*>(&aPattern);
@ -858,7 +858,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
byRef(gradBrush));
return gradBrush;
} else if (aPattern.GetType() == PATTERN_SURFACE) {
} else if (aPattern.GetType() == PatternType::SURFACE) {
const SurfacePattern *pat =
static_cast<const SurfacePattern*>(&aPattern);

View File

@ -111,12 +111,12 @@ public:
virtual TemporaryRef<DrawTarget>
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual TemporaryRef<GradientStops>
CreateGradientStops(GradientStop *aStops,
uint32_t aNumStops,
ExtendMode aExtendMode = EXTEND_CLAMP) const;
ExtendMode aExtendMode = ExtendMode::CLAMP) const;
virtual TemporaryRef<FilterNode> CreateFilter(FilterType aType);

View File

@ -39,7 +39,7 @@ public:
inline DualPattern(const Pattern &aPattern)
: mPatternsInitialized(false)
{
if (aPattern.GetType() != PATTERN_SURFACE) {
if (aPattern.GetType() != PatternType::SURFACE) {
mA = mB = &aPattern;
return;
}

View File

@ -124,7 +124,7 @@ public:
virtual TemporaryRef<DrawTarget>
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FILL_WINDING) const
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const
{
return mA->CreatePathBuilder(aFillRule);
}
@ -132,7 +132,7 @@ public:
virtual TemporaryRef<GradientStops>
CreateGradientStops(GradientStop *aStops,
uint32_t aNumStops,
ExtendMode aExtendMode = EXTEND_CLAMP) const
ExtendMode aExtendMode = ExtendMode::CLAMP) const
{
return mA->CreateGradientStops(aStops, aNumStops, aExtendMode);
}

View File

@ -169,9 +169,9 @@ struct AdjustedPattern
operator Pattern*()
{
switch(mOrigPattern->GetType()) {
case PATTERN_COLOR:
case PatternType::COLOR:
return mOrigPattern;
case PATTERN_SURFACE:
case PatternType::SURFACE:
{
SurfacePattern *surfPat = static_cast<SurfacePattern*>(mOrigPattern);
mPattern =
@ -180,7 +180,7 @@ struct AdjustedPattern
surfPat->mFilter);
return mPattern;
}
case PATTERN_LINEAR_GRADIENT:
case PatternType::LINEAR_GRADIENT:
{
LinearGradientPattern *linGradPat = static_cast<LinearGradientPattern*>(mOrigPattern);
mPattern =
@ -189,7 +189,7 @@ struct AdjustedPattern
linGradPat->mMatrix);
return mPattern;
}
case PATTERN_RADIAL_GRADIENT:
case PatternType::RADIAL_GRADIENT:
{
RadialGradientPattern *radGradPat = static_cast<RadialGradientPattern*>(mOrigPattern);
mPattern =

View File

@ -241,7 +241,7 @@ public:
* ID2D1SimplifiedGeometrySink requires the fill mode
* to be set before calling BeginFigure().
*/
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
/*
* Create a GradientStops object that holds information about a set of
@ -256,7 +256,7 @@ public:
virtual TemporaryRef<GradientStops>
CreateGradientStops(GradientStop *aStops,
uint32_t aNumStops,
ExtendMode aExtendMode = EXTEND_CLAMP) const;
ExtendMode aExtendMode = ExtendMode::CLAMP) const;
virtual TemporaryRef<FilterNode> CreateFilter(FilterType aType);

View File

@ -200,12 +200,12 @@ DrawTargetSkia::Snapshot()
void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern, Float aAlpha = 1.0)
{
switch (aPattern.GetType()) {
case PATTERN_COLOR: {
case PatternType::COLOR: {
Color color = static_cast<const ColorPattern&>(aPattern).mColor;
aPaint.setColor(ColorToSkColor(color, aAlpha));
break;
}
case PATTERN_LINEAR_GRADIENT: {
case PatternType::LINEAR_GRADIENT: {
const LinearGradientPattern& pat = static_cast<const LinearGradientPattern&>(aPattern);
GradientStopsSkia *stops = static_cast<GradientStopsSkia*>(pat.mStops.get());
SkShader::TileMode mode = ExtendModeToTileMode(stops->mExtendMode);
@ -233,7 +233,7 @@ void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern, Float aAlpha = 1.
}
break;
}
case PATTERN_RADIAL_GRADIENT: {
case PatternType::RADIAL_GRADIENT: {
const RadialGradientPattern& pat = static_cast<const RadialGradientPattern&>(aPattern);
GradientStopsSkia *stops = static_cast<GradientStopsSkia*>(pat.mStops.get());
SkShader::TileMode mode = ExtendModeToTileMode(stops->mExtendMode);
@ -263,7 +263,7 @@ void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern, Float aAlpha = 1.
}
break;
}
case PATTERN_SURFACE: {
case PatternType::SURFACE: {
const SurfacePattern& pat = static_cast<const SurfacePattern&>(aPattern);
const SkBitmap& bitmap = GetBitmapForSurface(pat.mSurface);
@ -273,7 +273,7 @@ void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern, Float aAlpha = 1.
GfxMatrixToSkiaMatrix(pat.mMatrix, mat);
shader->setLocalMatrix(mat);
SkSafeUnref(aPaint.setShader(shader));
if (pat.mFilter == FILTER_POINT) {
if (pat.mFilter == Filter::POINT) {
aPaint.setFilterBitmap(false);
}
break;
@ -308,7 +308,7 @@ struct AutoPaintSetup {
mCanvas = aCanvas;
//TODO: Can we set greyscale somehow?
if (aOptions.mAntialiasMode != AA_NONE) {
if (aOptions.mAntialiasMode != AntialiasMode::NONE) {
mPaint.setAntiAlias(true);
} else {
mPaint.setAntiAlias(false);
@ -377,7 +377,7 @@ DrawTargetSkia::DrawSurface(SourceSurface *aSurface,
const SkBitmap& bitmap = GetBitmapForSurface(aSurface);
AutoPaintSetup paint(mCanvas.get(), aOptions);
if (aSurfOptions.mFilter == FILTER_POINT) {
if (aSurfOptions.mFilter == Filter::POINT) {
paint.mPaint.setFilterBitmap(false);
}
@ -647,7 +647,7 @@ DrawTargetSkia::MaskSurface(const Pattern &aSource,
AutoPaintSetup paint(mCanvas.get(), aOptions, aSource);
SkPaint maskPaint;
SetPaintPattern(maskPaint, SurfacePattern(aMask, EXTEND_CLAMP));
SetPaintPattern(maskPaint, SurfacePattern(aMask, ExtendMode::CLAMP));
SkMatrix transform = maskPaint.getShader()->getLocalMatrix();
transform.postTranslate(SkFloatToScalar(aOffset.x), SkFloatToScalar(aOffset.y));

View File

@ -95,8 +95,8 @@ public:
CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const;
virtual TemporaryRef<DrawTarget>
CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FILL_WINDING) const;
virtual TemporaryRef<GradientStops> CreateGradientStops(GradientStop *aStops, uint32_t aNumStops, ExtendMode aExtendMode = EXTEND_CLAMP) const;
virtual TemporaryRef<PathBuilder> CreatePathBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual TemporaryRef<GradientStops> CreateGradientStops(GradientStop *aStops, uint32_t aNumStops, ExtendMode aExtendMode = ExtendMode::CLAMP) const;
virtual TemporaryRef<FilterNode> CreateFilter(FilterType aType);
virtual void SetTransform(const Matrix &aTransform);

View File

@ -33,11 +33,11 @@ D2D1_COLORMATRIX_ALPHA_MODE D2DAlphaMode(uint32_t aMode)
D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE D2DAffineTransformInterpolationMode(uint32_t aFilter)
{
switch (aFilter) {
case FILTER_GOOD:
case Filter::GOOD:
return D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR;
case FILTER_LINEAR:
case Filter::LINEAR:
return D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR;
case FILTER_POINT:
case Filter::POINT:
return D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
default:
MOZ_CRASH("Unknown enum value!");
@ -129,7 +129,7 @@ D2D1_CHANNEL_SELECTOR D2DChannelSelector(uint32_t aMode)
TemporaryRef<ID2D1Image> GetImageForSourceSurface(DrawTarget *aDT, SourceSurface *aSurface)
{
if (aDT->GetType() == BackendType::DIRECT2D1_1) {
return static_cast<DrawTargetD2D1*>(aDT)->GetImageForSurface(aSurface, EXTEND_CLAMP);
return static_cast<DrawTargetD2D1*>(aDT)->GetImageForSurface(aSurface, ExtendMode::CLAMP);
}
RefPtr<ID2D1Image> image;
switch (aSurface->GetType()) {

View File

@ -924,7 +924,7 @@ FilterNodeBlendSoftware::GetOutputRectInRect(const IntRect& aRect)
}
FilterNodeTransformSoftware::FilterNodeTransformSoftware()
: mFilter(FILTER_GOOD)
: mFilter(Filter::GOOD)
{}
int32_t

View File

@ -18,59 +18,59 @@ GfxOpToCairoOp(CompositionOp op)
{
switch (op)
{
case OP_OVER:
case CompositionOp::OP_OVER:
return CAIRO_OPERATOR_OVER;
case OP_ADD:
case CompositionOp::OP_ADD:
return CAIRO_OPERATOR_ADD;
case OP_ATOP:
case CompositionOp::OP_ATOP:
return CAIRO_OPERATOR_ATOP;
case OP_OUT:
case CompositionOp::OP_OUT:
return CAIRO_OPERATOR_OUT;
case OP_IN:
case CompositionOp::OP_IN:
return CAIRO_OPERATOR_IN;
case OP_SOURCE:
case CompositionOp::OP_SOURCE:
return CAIRO_OPERATOR_SOURCE;
case OP_DEST_IN:
case CompositionOp::OP_DEST_IN:
return CAIRO_OPERATOR_DEST_IN;
case OP_DEST_OUT:
case CompositionOp::OP_DEST_OUT:
return CAIRO_OPERATOR_DEST_OUT;
case OP_DEST_OVER:
case CompositionOp::OP_DEST_OVER:
return CAIRO_OPERATOR_DEST_OVER;
case OP_DEST_ATOP:
case CompositionOp::OP_DEST_ATOP:
return CAIRO_OPERATOR_DEST_ATOP;
case OP_XOR:
case CompositionOp::OP_XOR:
return CAIRO_OPERATOR_XOR;
case OP_MULTIPLY:
case CompositionOp::OP_MULTIPLY:
return CAIRO_OPERATOR_MULTIPLY;
case OP_SCREEN:
case CompositionOp::OP_SCREEN:
return CAIRO_OPERATOR_SCREEN;
case OP_OVERLAY:
case CompositionOp::OP_OVERLAY:
return CAIRO_OPERATOR_OVERLAY;
case OP_DARKEN:
case CompositionOp::OP_DARKEN:
return CAIRO_OPERATOR_DARKEN;
case OP_LIGHTEN:
case CompositionOp::OP_LIGHTEN:
return CAIRO_OPERATOR_LIGHTEN;
case OP_COLOR_DODGE:
case CompositionOp::OP_COLOR_DODGE:
return CAIRO_OPERATOR_COLOR_DODGE;
case OP_COLOR_BURN:
case CompositionOp::OP_COLOR_BURN:
return CAIRO_OPERATOR_COLOR_BURN;
case OP_HARD_LIGHT:
case CompositionOp::OP_HARD_LIGHT:
return CAIRO_OPERATOR_HARD_LIGHT;
case OP_SOFT_LIGHT:
case CompositionOp::OP_SOFT_LIGHT:
return CAIRO_OPERATOR_SOFT_LIGHT;
case OP_DIFFERENCE:
case CompositionOp::OP_DIFFERENCE:
return CAIRO_OPERATOR_DIFFERENCE;
case OP_EXCLUSION:
case CompositionOp::OP_EXCLUSION:
return CAIRO_OPERATOR_EXCLUSION;
case OP_HUE:
case CompositionOp::OP_HUE:
return CAIRO_OPERATOR_HSL_HUE;
case OP_SATURATION:
case CompositionOp::OP_SATURATION:
return CAIRO_OPERATOR_HSL_SATURATION;
case OP_COLOR:
case CompositionOp::OP_COLOR:
return CAIRO_OPERATOR_HSL_COLOR;
case OP_LUMINOSITY:
case CompositionOp::OP_LUMINOSITY:
return CAIRO_OPERATOR_HSL_LUMINOSITY;
case OP_COUNT:
case CompositionOp::OP_COUNT:
break;
}
@ -82,13 +82,13 @@ GfxAntialiasToCairoAntialias(AntialiasMode antialias)
{
switch (antialias)
{
case AA_NONE:
case AntialiasMode::NONE:
return CAIRO_ANTIALIAS_NONE;
case AA_GRAY:
case AntialiasMode::GRAY:
return CAIRO_ANTIALIAS_GRAY;
case AA_SUBPIXEL:
case AntialiasMode::SUBPIXEL:
return CAIRO_ANTIALIAS_SUBPIXEL;
case AA_DEFAULT:
case AntialiasMode::DEFAULT:
return CAIRO_ANTIALIAS_DEFAULT;
}
return CAIRO_ANTIALIAS_DEFAULT;
@ -99,11 +99,11 @@ GfxFilterToCairoFilter(Filter filter)
{
switch (filter)
{
case FILTER_GOOD:
case Filter::GOOD:
return CAIRO_FILTER_GOOD;
case FILTER_LINEAR:
case Filter::LINEAR:
return CAIRO_FILTER_BILINEAR;
case FILTER_POINT:
case Filter::POINT:
return CAIRO_FILTER_NEAREST;
}
@ -115,11 +115,11 @@ GfxExtendToCairoExtend(ExtendMode extend)
{
switch (extend)
{
case EXTEND_CLAMP:
case ExtendMode::CLAMP:
return CAIRO_EXTEND_PAD;
case EXTEND_REPEAT:
case ExtendMode::REPEAT:
return CAIRO_EXTEND_REPEAT;
case EXTEND_REFLECT:
case ExtendMode::REFLECT:
return CAIRO_EXTEND_REFLECT;
}
@ -168,13 +168,13 @@ GfxLineJoinToCairoLineJoin(JoinStyle style)
{
switch (style)
{
case JOIN_BEVEL:
case JoinStyle::BEVEL:
return CAIRO_LINE_JOIN_BEVEL;
case JOIN_ROUND:
case JoinStyle::ROUND:
return CAIRO_LINE_JOIN_ROUND;
case JOIN_MITER:
case JoinStyle::MITER:
return CAIRO_LINE_JOIN_MITER;
case JOIN_MITER_OR_BEVEL:
case JoinStyle::MITER_OR_BEVEL:
return CAIRO_LINE_JOIN_MITER;
}
@ -186,11 +186,11 @@ GfxLineCapToCairoLineCap(CapStyle style)
{
switch (style)
{
case CAP_BUTT:
case CapStyle::BUTT:
return CAIRO_LINE_CAP_BUTT;
case CAP_ROUND:
case CapStyle::ROUND:
return CAIRO_LINE_CAP_ROUND;
case CAP_SQUARE:
case CapStyle::SQUARE:
return CAIRO_LINE_CAP_SQUARE;
}
@ -247,9 +247,9 @@ GfxFillRuleToCairoFillRule(FillRule rule)
{
switch (rule)
{
case FILL_WINDING:
case FillRule::FILL_WINDING:
return CAIRO_FILL_RULE_WINDING;
case FILL_EVEN_ODD:
case FillRule::FILL_EVEN_ODD:
return CAIRO_FILL_RULE_EVEN_ODD;
}

View File

@ -53,10 +53,10 @@ static inline D2D1_EXTEND_MODE D2DExtend(ExtendMode aExtendMode)
{
D2D1_EXTEND_MODE extend;
switch (aExtendMode) {
case EXTEND_REPEAT:
case ExtendMode::REPEAT:
extend = D2D1_EXTEND_MODE_WRAP;
break;
case EXTEND_REFLECT:
case ExtendMode::REFLECT:
extend = D2D1_EXTEND_MODE_MIRROR;
break;
default:
@ -69,7 +69,7 @@ static inline D2D1_EXTEND_MODE D2DExtend(ExtendMode aExtendMode)
static inline D2D1_BITMAP_INTERPOLATION_MODE D2DFilter(const Filter &aFilter)
{
switch (aFilter) {
case FILTER_POINT:
case Filter::POINT:
return D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
default:
return D2D1_BITMAP_INTERPOLATION_MODE_LINEAR;
@ -80,7 +80,7 @@ static inline D2D1_BITMAP_INTERPOLATION_MODE D2DFilter(const Filter &aFilter)
static inline D2D1_INTERPOLATION_MODE D2DInterpolationMode(const Filter &aFilter)
{
switch (aFilter) {
case FILTER_POINT:
case Filter::POINT:
return D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
default:
return D2D1_INTERPOLATION_MODE_LINEAR;
@ -106,7 +106,7 @@ static inline D2D1_VECTOR_3F D2DVector3D(const Point3D &aPoint)
static inline D2D1_ANTIALIAS_MODE D2DAAMode(AntialiasMode aMode)
{
switch (aMode) {
case AA_NONE:
case AntialiasMode::NONE:
return D2D1_ANTIALIAS_MODE_ALIASED;
default:
return D2D1_ANTIALIAS_MODE_PER_PRIMITIVE;
@ -196,27 +196,27 @@ static inline D2D1_PIXEL_FORMAT D2DPixelFormat(SurfaceFormat aFormat)
static inline D2D1_COMPOSITE_MODE D2DCompositionMode(CompositionOp aOp)
{
switch(aOp) {
case OP_OVER:
case CompositionOp::OP_OVER:
return D2D1_COMPOSITE_MODE_SOURCE_OVER;
case OP_ADD:
case CompositionOp::OP_ADD:
return D2D1_COMPOSITE_MODE_PLUS;
case OP_ATOP:
case CompositionOp::OP_ATOP:
return D2D1_COMPOSITE_MODE_SOURCE_ATOP;
case OP_OUT:
case CompositionOp::OP_OUT:
return D2D1_COMPOSITE_MODE_SOURCE_OUT;
case OP_IN:
case CompositionOp::OP_IN:
return D2D1_COMPOSITE_MODE_SOURCE_IN;
case OP_SOURCE:
case CompositionOp::OP_SOURCE:
return D2D1_COMPOSITE_MODE_SOURCE_COPY;
case OP_DEST_IN:
case CompositionOp::OP_DEST_IN:
return D2D1_COMPOSITE_MODE_DESTINATION_IN;
case OP_DEST_OUT:
case CompositionOp::OP_DEST_OUT:
return D2D1_COMPOSITE_MODE_DESTINATION_OUT;
case OP_DEST_OVER:
case CompositionOp::OP_DEST_OVER:
return D2D1_COMPOSITE_MODE_DESTINATION_OVER;
case OP_DEST_ATOP:
case CompositionOp::OP_DEST_ATOP:
return D2D1_COMPOSITE_MODE_DESTINATION_ATOP;
case OP_XOR:
case CompositionOp::OP_XOR:
return D2D1_COMPOSITE_MODE_XOR;
default:
return D2D1_COMPOSITE_MODE_SOURCE_OVER;
@ -226,7 +226,7 @@ static inline D2D1_COMPOSITE_MODE D2DCompositionMode(CompositionOp aOp)
static inline bool IsPatternSupportedByD2D(const Pattern &aPattern)
{
if (aPattern.GetType() != PATTERN_RADIAL_GRADIENT) {
if (aPattern.GetType() != PatternType::RADIAL_GRADIENT) {
return true;
}
@ -380,28 +380,28 @@ CreateStrokeStyleForOptions(const StrokeOptions &aStrokeOptions)
D2D1_LINE_JOIN joinStyle;
switch (aStrokeOptions.mLineCap) {
case CAP_BUTT:
case CapStyle::BUTT:
capStyle = D2D1_CAP_STYLE_FLAT;
break;
case CAP_ROUND:
case CapStyle::ROUND:
capStyle = D2D1_CAP_STYLE_ROUND;
break;
case CAP_SQUARE:
case CapStyle::SQUARE:
capStyle = D2D1_CAP_STYLE_SQUARE;
break;
}
switch (aStrokeOptions.mLineJoin) {
case JOIN_MITER:
case JoinStyle::MITER:
joinStyle = D2D1_LINE_JOIN_MITER;
break;
case JOIN_MITER_OR_BEVEL:
case JoinStyle::MITER_OR_BEVEL:
joinStyle = D2D1_LINE_JOIN_MITER_OR_BEVEL;
break;
case JOIN_ROUND:
case JoinStyle::ROUND:
joinStyle = D2D1_LINE_JOIN_ROUND;
break;
case JOIN_BEVEL:
case JoinStyle::BEVEL:
joinStyle = D2D1_LINE_JOIN_BEVEL;
break;
}
@ -494,9 +494,9 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin
// Extend mode is irrelevant, the displayed rect is completely contained
// by the source bitmap.
uploadRect = rect;
} else if (aExtendMode == EXTEND_CLAMP && uploadRect.Intersects(rect)) {
} else if (aExtendMode == ExtendMode::CLAMP && uploadRect.Intersects(rect)) {
// Calculate the rectangle on the source bitmap that touches our
// surface, and upload that, for EXTEND_CLAMP we can actually guarantee
// surface, and upload that, for ExtendMode::CLAMP we can actually guarantee
// correct behaviour in this case.
uploadRect = uploadRect.Intersect(rect);

View File

@ -88,11 +88,11 @@ CapStyleToSkiaCap(CapStyle aCap)
{
switch (aCap)
{
case CAP_BUTT:
case CapStyle::BUTT:
return SkPaint::kButt_Cap;
case CAP_ROUND:
case CapStyle::ROUND:
return SkPaint::kRound_Cap;
case CAP_SQUARE:
case CapStyle::SQUARE:
return SkPaint::kSquare_Cap;
}
return SkPaint::kDefault_Cap;
@ -103,12 +103,12 @@ JoinStyleToSkiaJoin(JoinStyle aJoin)
{
switch (aJoin)
{
case JOIN_BEVEL:
case JoinStyle::BEVEL:
return SkPaint::kBevel_Join;
case JOIN_ROUND:
case JoinStyle::ROUND:
return SkPaint::kRound_Join;
case JOIN_MITER:
case JOIN_MITER_OR_BEVEL:
case JoinStyle::MITER:
case JoinStyle::MITER_OR_BEVEL:
return SkPaint::kMiter_Join;
}
return SkPaint::kDefault_Join;
@ -159,57 +159,57 @@ GfxOpToSkiaOp(CompositionOp op)
{
switch (op)
{
case OP_OVER:
case CompositionOp::OP_OVER:
return SkXfermode::kSrcOver_Mode;
case OP_ADD:
case CompositionOp::OP_ADD:
return SkXfermode::kPlus_Mode;
case OP_ATOP:
case CompositionOp::OP_ATOP:
return SkXfermode::kSrcATop_Mode;
case OP_OUT:
case CompositionOp::OP_OUT:
return SkXfermode::kSrcOut_Mode;
case OP_IN:
case CompositionOp::OP_IN:
return SkXfermode::kSrcIn_Mode;
case OP_SOURCE:
case CompositionOp::OP_SOURCE:
return SkXfermode::kSrc_Mode;
case OP_DEST_IN:
case CompositionOp::OP_DEST_IN:
return SkXfermode::kDstIn_Mode;
case OP_DEST_OUT:
case CompositionOp::OP_DEST_OUT:
return SkXfermode::kDstOut_Mode;
case OP_DEST_OVER:
case CompositionOp::OP_DEST_OVER:
return SkXfermode::kDstOver_Mode;
case OP_DEST_ATOP:
case CompositionOp::OP_DEST_ATOP:
return SkXfermode::kDstATop_Mode;
case OP_XOR:
case CompositionOp::OP_XOR:
return SkXfermode::kXor_Mode;
case OP_MULTIPLY:
case CompositionOp::OP_MULTIPLY:
return SkXfermode::kMultiply_Mode;
case OP_SCREEN:
case CompositionOp::OP_SCREEN:
return SkXfermode::kScreen_Mode;
case OP_OVERLAY:
case CompositionOp::OP_OVERLAY:
return SkXfermode::kOverlay_Mode;
case OP_DARKEN:
case CompositionOp::OP_DARKEN:
return SkXfermode::kDarken_Mode;
case OP_LIGHTEN:
case CompositionOp::OP_LIGHTEN:
return SkXfermode::kLighten_Mode;
case OP_COLOR_DODGE:
case CompositionOp::OP_COLOR_DODGE:
return SkXfermode::kColorDodge_Mode;
case OP_COLOR_BURN:
case CompositionOp::OP_COLOR_BURN:
return SkXfermode::kColorBurn_Mode;
case OP_HARD_LIGHT:
case CompositionOp::OP_HARD_LIGHT:
return SkXfermode::kHardLight_Mode;
case OP_SOFT_LIGHT:
case CompositionOp::OP_SOFT_LIGHT:
return SkXfermode::kSoftLight_Mode;
case OP_DIFFERENCE:
case CompositionOp::OP_DIFFERENCE:
return SkXfermode::kDifference_Mode;
case OP_EXCLUSION:
case CompositionOp::OP_EXCLUSION:
return SkXfermode::kExclusion_Mode;
case OP_HUE:
case CompositionOp::OP_HUE:
return SkXfermode::kHue_Mode;
case OP_SATURATION:
case CompositionOp::OP_SATURATION:
return SkXfermode::kSaturation_Mode;
case OP_COLOR:
case CompositionOp::OP_COLOR:
return SkXfermode::kColor_Mode;
case OP_LUMINOSITY:
case CompositionOp::OP_LUMINOSITY:
return SkXfermode::kLuminosity_Mode;
default:
return SkXfermode::kSrcOver_Mode;
@ -261,11 +261,11 @@ ExtendModeToTileMode(ExtendMode aMode)
{
switch (aMode)
{
case EXTEND_CLAMP:
case ExtendMode::CLAMP:
return SkShader::kClamp_TileMode;
case EXTEND_REPEAT:
case ExtendMode::REPEAT:
return SkShader::kRepeat_TileMode;
case EXTEND_REFLECT:
case ExtendMode::REFLECT:
return SkShader::kMirror_TileMode;
}
return SkShader::kClamp_TileMode;

View File

@ -233,7 +233,7 @@ PathCG::ContainsPoint(const Point &aPoint, const Matrix &aTransform) const
// The transform parameter of CGPathContainsPoint doesn't seem to work properly on OS X 10.5
// so we transform aPoint ourselves.
return CGPathContainsPoint(mPath, nullptr, point, mFillRule == FILL_EVEN_ODD);
return CGPathContainsPoint(mPath, nullptr, point, mFillRule == FillRule::FILL_EVEN_ODD);
}
static size_t

View File

@ -73,9 +73,9 @@ public:
// are compatible with BackendType::COREGRAPHICS_ACCELERATED backend.
virtual BackendType GetBackendType() const { return BackendType::COREGRAPHICS; }
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> TransformedCopyToBuilder(const Matrix &aTransform,
FillRule aFillRule = FILL_WINDING) const;
FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const;
virtual bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions,

View File

@ -137,7 +137,7 @@ PathCairo::PathCairo(FillRule aFillRule, std::vector<cairo_path_data_t> &aPathDa
}
PathCairo::PathCairo(cairo_t *aContext)
: mFillRule(FILL_WINDING)
: mFillRule(FillRule::FILL_WINDING)
, mContainingContext(nullptr)
{
cairo_path_t *path = cairo_copy_path(aContext);

View File

@ -54,9 +54,9 @@ public:
virtual BackendType GetBackendType() const { return BackendType::CAIRO; }
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> TransformedCopyToBuilder(const Matrix &aTransform,
FillRule aFillRule = FILL_WINDING) const;
FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const;

View File

@ -330,7 +330,7 @@ PathD2D::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule)
return nullptr;
}
if (aFillRule == FILL_WINDING) {
if (aFillRule == FillRule::FILL_WINDING) {
sink->SetFillMode(D2D1_FILL_MODE_WINDING);
}

View File

@ -70,9 +70,9 @@ public:
virtual BackendType GetBackendType() const { return BackendType::DIRECT2D; }
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> TransformedCopyToBuilder(const Matrix &aTransform,
FillRule aFillRule = FILL_WINDING) const;
FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const;

View File

@ -90,9 +90,9 @@ public:
~PathRecording();
virtual BackendType GetBackendType() const { return BackendType::RECORDING; }
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> TransformedCopyToBuilder(const Matrix &aTransform,
FillRule aFillRule = FILL_WINDING) const;
FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const
{ return mPath->ContainsPoint(aPoint, aTransform); }
virtual bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions,

View File

@ -31,7 +31,7 @@ void
PathBuilderSkia::SetFillRule(FillRule aFillRule)
{
mFillRule = aFillRule;
if (mFillRule == FILL_WINDING) {
if (mFillRule == FillRule::FILL_WINDING) {
mPath.setFillType(SkPath::kWinding_FillType);
} else {
mPath.setFillType(SkPath::kEvenOdd_FillType);

View File

@ -54,9 +54,9 @@ public:
virtual BackendType GetBackendType() const { return BackendType::SKIA; }
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual TemporaryRef<PathBuilder> TransformedCopyToBuilder(const Matrix &aTransform,
FillRule aFillRule = FILL_WINDING) const;
FillRule aFillRule = FillRule::FILL_WINDING) const;
virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const;

View File

@ -149,22 +149,22 @@ RecordedEvent::RecordPatternData(std::ostream &aStream, const PatternStorage &aP
WriteElement(aStream, aPattern.mType);
switch (aPattern.mType) {
case PATTERN_COLOR:
case PatternType::COLOR:
{
WriteElement(aStream, *reinterpret_cast<const ColorPatternStorage*>(&aPattern.mStorage));
return;
}
case PATTERN_LINEAR_GRADIENT:
case PatternType::LINEAR_GRADIENT:
{
WriteElement(aStream, *reinterpret_cast<const LinearGradientPatternStorage*>(&aPattern.mStorage));
return;
}
case PATTERN_RADIAL_GRADIENT:
case PatternType::RADIAL_GRADIENT:
{
WriteElement(aStream, *reinterpret_cast<const RadialGradientPatternStorage*>(&aPattern.mStorage));
return;
}
case PATTERN_SURFACE:
case PatternType::SURFACE:
{
WriteElement(aStream, *reinterpret_cast<const SurfacePatternStorage*>(&aPattern.mStorage));
return;
@ -180,22 +180,22 @@ RecordedEvent::ReadPatternData(std::istream &aStream, PatternStorage &aPattern)
ReadElement(aStream, aPattern.mType);
switch (aPattern.mType) {
case PATTERN_COLOR:
case PatternType::COLOR:
{
ReadElement(aStream, *reinterpret_cast<ColorPatternStorage*>(&aPattern.mStorage));
return;
}
case PATTERN_LINEAR_GRADIENT:
case PatternType::LINEAR_GRADIENT:
{
ReadElement(aStream, *reinterpret_cast<LinearGradientPatternStorage*>(&aPattern.mStorage));
return;
}
case PATTERN_RADIAL_GRADIENT:
case PatternType::RADIAL_GRADIENT:
{
ReadElement(aStream, *reinterpret_cast<RadialGradientPatternStorage*>(&aPattern.mStorage));
return;
}
case PATTERN_SURFACE:
case PatternType::SURFACE:
{
ReadElement(aStream, *reinterpret_cast<SurfacePatternStorage*>(&aPattern.mStorage));
return;
@ -211,13 +211,13 @@ RecordedEvent::StorePattern(PatternStorage &aDestination, const Pattern &aSource
aDestination.mType = aSource.GetType();
switch (aSource.GetType()) {
case PATTERN_COLOR:
case PatternType::COLOR:
{
reinterpret_cast<ColorPatternStorage*>(&aDestination.mStorage)->mColor =
static_cast<const ColorPattern*>(&aSource)->mColor;
return;
}
case PATTERN_LINEAR_GRADIENT:
case PatternType::LINEAR_GRADIENT:
{
LinearGradientPatternStorage *store =
reinterpret_cast<LinearGradientPatternStorage*>(&aDestination.mStorage);
@ -229,7 +229,7 @@ RecordedEvent::StorePattern(PatternStorage &aDestination, const Pattern &aSource
store->mStops = pat->mStops.get();
return;
}
case PATTERN_RADIAL_GRADIENT:
case PatternType::RADIAL_GRADIENT:
{
RadialGradientPatternStorage *store =
reinterpret_cast<RadialGradientPatternStorage*>(&aDestination.mStorage);
@ -243,7 +243,7 @@ RecordedEvent::StorePattern(PatternStorage &aDestination, const Pattern &aSource
store->mStops = pat->mStops.get();
return;
}
case PATTERN_SURFACE:
case PatternType::SURFACE:
{
SurfacePatternStorage *store =
reinterpret_cast<SurfacePatternStorage*>(&aDestination.mStorage);
@ -310,13 +310,13 @@ void
RecordedEvent::OutputSimplePatternInfo(const PatternStorage &aStorage, std::stringstream &aOutput) const
{
switch (aStorage.mType) {
case PATTERN_COLOR:
case PatternType::COLOR:
{
const Color color = reinterpret_cast<const ColorPatternStorage*>(&aStorage.mStorage)->mColor;
aOutput << "Color: (" << color.r << ", " << color.g << ", " << color.b << ", " << color.a << ")";
return;
}
case PATTERN_LINEAR_GRADIENT:
case PatternType::LINEAR_GRADIENT:
{
const LinearGradientPatternStorage *store =
reinterpret_cast<const LinearGradientPatternStorage*>(&aStorage.mStorage);
@ -325,7 +325,7 @@ RecordedEvent::OutputSimplePatternInfo(const PatternStorage &aStorage, std::stri
") - (" << store->mEnd.x << ", " << store->mEnd.y << ") Stops: " << store->mStops;
return;
}
case PATTERN_RADIAL_GRADIENT:
case PatternType::RADIAL_GRADIENT:
{
const RadialGradientPatternStorage *store =
reinterpret_cast<const RadialGradientPatternStorage*>(&aStorage.mStorage);
@ -333,7 +333,7 @@ RecordedEvent::OutputSimplePatternInfo(const PatternStorage &aStorage, std::stri
store->mCenter2.y << ") Radius 2: " << store->mRadius2;
return;
}
case PATTERN_SURFACE:
case PatternType::SURFACE:
{
const SurfacePatternStorage *store =
reinterpret_cast<const SurfacePatternStorage*>(&aStorage.mStorage);
@ -461,9 +461,9 @@ struct GenericPattern
operator Pattern*()
{
switch(mStorage->mType) {
case PATTERN_COLOR:
case PatternType::COLOR:
return new (mColPat) ColorPattern(reinterpret_cast<ColorPatternStorage*>(&mStorage->mStorage)->mColor);
case PATTERN_SURFACE:
case PatternType::SURFACE:
{
SurfacePatternStorage *storage = reinterpret_cast<SurfacePatternStorage*>(&mStorage->mStorage);
mPattern =
@ -471,7 +471,7 @@ struct GenericPattern
storage->mExtend, storage->mMatrix, storage->mFilter);
return mPattern;
}
case PATTERN_LINEAR_GRADIENT:
case PatternType::LINEAR_GRADIENT:
{
LinearGradientPatternStorage *storage = reinterpret_cast<LinearGradientPatternStorage*>(&mStorage->mStorage);
mPattern =
@ -480,7 +480,7 @@ struct GenericPattern
storage->mMatrix);
return mPattern;
}
case PATTERN_RADIAL_GRADIENT:
case PatternType::RADIAL_GRADIENT:
{
RadialGradientPatternStorage *storage = reinterpret_cast<RadialGradientPatternStorage*>(&mStorage->mStorage);
mPattern =

View File

@ -81,7 +81,7 @@ ScaledFontBase::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *a
#ifdef USE_SKIA
if (aTarget->GetType() == BackendType::SKIA) {
SkPath path = GetSkiaPathForGlyphs(aBuffer);
return new PathSkia(path, FILL_WINDING);
return new PathSkia(path, FillRule::FILL_WINDING);
}
#endif
#ifdef USE_CAIRO

View File

@ -409,23 +409,23 @@ ScaledFontDWrite::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton
AntialiasMode
ScaledFontDWrite::GetDefaultAAMode()
{
AntialiasMode defaultMode = AA_SUBPIXEL;
AntialiasMode defaultMode = AntialiasMode::SUBPIXEL;
switch (GetSystemTextQuality()) {
case CLEARTYPE_QUALITY:
defaultMode = AA_SUBPIXEL;
defaultMode = AntialiasMode::SUBPIXEL;
break;
case ANTIALIASED_QUALITY:
defaultMode = AA_GRAY;
defaultMode = AntialiasMode::GRAY;
break;
case DEFAULT_QUALITY:
defaultMode = AA_NONE;
defaultMode = AntialiasMode::NONE;
break;
}
if (defaultMode == AA_GRAY) {
if (defaultMode == AntialiasMode::GRAY) {
if (!DoGrayscale(mFontFace, mSize)) {
defaultMode = AA_NONE;
defaultMode = AntialiasMode::NONE;
}
}
return defaultMode;

View File

@ -93,7 +93,7 @@ ScaledFontMac::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aT
CGPathAddPath(path, &matrix, glyphPath);
CGPathRelease(glyphPath);
}
TemporaryRef<Path> ret = new PathCG(path, FILL_WINDING);
TemporaryRef<Path> ret = new PathCG(path, FillRule::FILL_WINDING);
CGPathRelease(path);
return ret;
} else {

View File

@ -19,11 +19,11 @@ namespace gfx {
static inline bool
IsOperatorBoundByMask(CompositionOp aOp) {
switch (aOp) {
case OP_IN:
case OP_OUT:
case OP_DEST_IN:
case OP_DEST_ATOP:
case OP_SOURCE:
case CompositionOp::OP_IN:
case CompositionOp::OP_OUT:
case CompositionOp::OP_DEST_IN:
case CompositionOp::OP_DEST_ATOP:
case CompositionOp::OP_SOURCE:
return false;
default:
return true;

View File

@ -17,7 +17,7 @@ namespace gfx {
typedef float Float;
MOZ_BEGIN_ENUM_CLASS(SurfaceType)
MOZ_BEGIN_ENUM_CLASS(SurfaceType, int8_t)
DATA, /* Data surface - bitmap in memory */
D2D1_BITMAP, /* Surface wrapping a ID2D1Bitmap */
D2D1_DRAWTARGET, /* Surface made from a D2D draw target */
@ -31,7 +31,7 @@ MOZ_BEGIN_ENUM_CLASS(SurfaceType)
RECORDING /* Surface used for recording */
MOZ_END_ENUM_CLASS(SurfaceType)
MOZ_BEGIN_ENUM_CLASS(SurfaceFormat)
MOZ_BEGIN_ENUM_CLASS(SurfaceFormat, int8_t)
B8G8R8A8,
B8G8R8X8,
R8G8B8A8,
@ -42,7 +42,7 @@ MOZ_BEGIN_ENUM_CLASS(SurfaceFormat)
UNKNOWN
MOZ_END_ENUM_CLASS(SurfaceFormat)
MOZ_BEGIN_ENUM_CLASS(FilterType)
MOZ_BEGIN_ENUM_CLASS(FilterType, int8_t)
BLEND = 0,
TRANSFORM,
MORPHOLOGY,
@ -71,7 +71,7 @@ MOZ_BEGIN_ENUM_CLASS(FilterType)
UNPREMULTIPLY
MOZ_END_ENUM_CLASS(FilterType)
MOZ_BEGIN_ENUM_CLASS(BackendType)
MOZ_BEGIN_ENUM_CLASS(BackendType, int8_t)
NONE = 0,
DIRECT2D,
COREGRAPHICS,
@ -82,7 +82,7 @@ MOZ_BEGIN_ENUM_CLASS(BackendType)
DIRECT2D1_1
MOZ_END_ENUM_CLASS(BackendType)
MOZ_BEGIN_ENUM_CLASS(FontType)
MOZ_BEGIN_ENUM_CLASS(FontType, int8_t)
DWRITE,
GDI,
MAC,
@ -91,7 +91,7 @@ MOZ_BEGIN_ENUM_CLASS(FontType)
COREGRAPHICS
MOZ_END_ENUM_CLASS(FontType)
MOZ_BEGIN_ENUM_CLASS(NativeSurfaceType)
MOZ_BEGIN_ENUM_CLASS(NativeSurfaceType, int8_t)
D3D10_TEXTURE,
CAIRO_SURFACE,
CAIRO_CONTEXT,
@ -99,7 +99,7 @@ MOZ_BEGIN_ENUM_CLASS(NativeSurfaceType)
CGCONTEXT_ACCELERATED
MOZ_END_ENUM_CLASS(NativeSurfaceType)
MOZ_BEGIN_ENUM_CLASS(NativeFontType)
MOZ_BEGIN_ENUM_CLASS(NativeFontType, int8_t)
DWRITE_FONT_FACE,
GDI_FONT_FACE,
MAC_FONT_FACE,
@ -107,30 +107,98 @@ MOZ_BEGIN_ENUM_CLASS(NativeFontType)
CAIRO_FONT_FACE
MOZ_END_ENUM_CLASS(NativeFontType)
MOZ_BEGIN_ENUM_CLASS(FontStyle)
MOZ_BEGIN_ENUM_CLASS(FontStyle, int8_t)
NORMAL,
ITALIC,
BOLD,
BOLD_ITALIC
MOZ_END_ENUM_CLASS(FontStyle)
MOZ_BEGIN_ENUM_CLASS(FontHinting)
MOZ_BEGIN_ENUM_CLASS(FontHinting, int8_t)
NONE,
LIGHT,
NORMAL,
FULL
MOZ_END_ENUM_CLASS(FontHinting)
enum CompositionOp { OP_OVER, OP_ADD, OP_ATOP, OP_OUT, OP_IN, OP_SOURCE, OP_DEST_IN, OP_DEST_OUT, OP_DEST_OVER, OP_DEST_ATOP, OP_XOR,
OP_MULTIPLY, OP_SCREEN, OP_OVERLAY, OP_DARKEN, OP_LIGHTEN, OP_COLOR_DODGE, OP_COLOR_BURN, OP_HARD_LIGHT, OP_SOFT_LIGHT, OP_DIFFERENCE, OP_EXCLUSION, OP_HUE, OP_SATURATION, OP_COLOR, OP_LUMINOSITY, OP_COUNT };
enum ExtendMode { EXTEND_CLAMP, EXTEND_REPEAT, EXTEND_REFLECT };
enum FillRule { FILL_WINDING, FILL_EVEN_ODD };
enum AntialiasMode { AA_NONE, AA_GRAY, AA_SUBPIXEL, AA_DEFAULT };
enum Filter { FILTER_GOOD, FILTER_LINEAR, FILTER_POINT };
enum PatternType { PATTERN_COLOR, PATTERN_SURFACE, PATTERN_LINEAR_GRADIENT, PATTERN_RADIAL_GRADIENT };
enum JoinStyle { JOIN_BEVEL, JOIN_ROUND, JOIN_MITER, JOIN_MITER_OR_BEVEL };
enum CapStyle { CAP_BUTT, CAP_ROUND, CAP_SQUARE };
enum SamplingBounds { SAMPLING_UNBOUNDED, SAMPLING_BOUNDED };
MOZ_BEGIN_ENUM_CLASS(CompositionOp, int8_t)
OP_OVER,
OP_ADD,
OP_ATOP,
OP_OUT,
OP_IN,
OP_SOURCE,
OP_DEST_IN,
OP_DEST_OUT,
OP_DEST_OVER,
OP_DEST_ATOP,
OP_XOR,
OP_MULTIPLY,
OP_SCREEN,
OP_OVERLAY,
OP_DARKEN,
OP_LIGHTEN,
OP_COLOR_DODGE,
OP_COLOR_BURN,
OP_HARD_LIGHT,
OP_SOFT_LIGHT,
OP_DIFFERENCE,
OP_EXCLUSION,
OP_HUE,
OP_SATURATION,
OP_COLOR,
OP_LUMINOSITY,
OP_COUNT
MOZ_END_ENUM_CLASS(CompositionOp)
MOZ_BEGIN_ENUM_CLASS(ExtendMode, int8_t)
CLAMP,
REPEAT,
REFLECT
MOZ_END_ENUM_CLASS(ExtendMode)
MOZ_BEGIN_ENUM_CLASS(FillRule, int8_t)
FILL_WINDING,
FILL_EVEN_ODD
MOZ_END_ENUM_CLASS(FillRule)
MOZ_BEGIN_ENUM_CLASS(AntialiasMode, int8_t)
NONE,
GRAY,
SUBPIXEL,
DEFAULT
MOZ_END_ENUM_CLASS(AntialiasMode)
MOZ_BEGIN_ENUM_CLASS(Filter, int8_t)
GOOD,
LINEAR,
POINT
MOZ_END_ENUM_CLASS(Filter)
MOZ_BEGIN_ENUM_CLASS(PatternType, int8_t)
COLOR,
SURFACE,
LINEAR_GRADIENT,
RADIAL_GRADIENT
MOZ_END_ENUM_CLASS(PatternType)
MOZ_BEGIN_ENUM_CLASS(JoinStyle, int8_t)
BEVEL,
ROUND,
MITER,
MITER_OR_BEVEL
MOZ_END_ENUM_CLASS(JoinStyle)
MOZ_BEGIN_ENUM_CLASS(CapStyle, int8_t)
BUTT,
ROUND,
SQUARE
MOZ_END_ENUM_CLASS(CapStyle)
MOZ_BEGIN_ENUM_CLASS(SamplingBounds, int8_t)
UNBOUNDED,
BOUNDED
MOZ_END_ENUM_CLASS(SamplingBounds)
/* Color is stored in non-premultiplied form */
struct Color

View File

@ -1074,7 +1074,7 @@ in cairo_quartz_surface_create.
Fix to correctly handle 0x0 sized surfaces.
Optimize drawing of EXTEND_REPEAT patterns for OS X 10.5.
Optimize drawing of ExtendMode::REPEAT patterns for OS X 10.5.
Snapshot 1.5.2 (2007-10-30 Carl Worth <cworth@cworth.org>)
==========================================================
@ -3111,7 +3111,7 @@ And at least the following bugs have been fixed:
* PS: Don't walk off end of array when printing "~>"
* Fix some memory leaks in the test suite rig
* SVG: Fix memory leak when using cairo_mask
* Fix EXTEND_REFLECT and EXTEND_PAD to not crash (though these are
* Fix ExtendMode::REFLECT and EXTEND_PAD to not crash (though these are
still not yet fully implemented for surface patterns).
This has been a tremendous effort by everyone, and I'm proud to have

View File

@ -1733,9 +1733,9 @@ cairo_qt_surface_get_image (cairo_surface_t *surface)
*
* - Figure out why QBrush isn't working with non-repeated images
*
* - Correct repeat mode; right now, every surface source is EXTEND_REPEAT
* - Correct repeat mode; right now, every surface source is ExtendMode::REPEAT
* - implement EXTEND_NONE (?? probably need to clip to the extents of the source)
* - implement EXTEND_REFLECT (create temporary and copy 4x, then EXTEND_REPEAT that)
* - implement ExtendMode::REFLECT (create temporary and copy 4x, then ExtendMode::REPEAT that)
*
* - stroke-image failure
*

View File

@ -317,8 +317,8 @@ _extend_to_string (cairo_extend_t extend)
{
static const char *names[] = {
"EXTEND_NONE", /* CAIRO_EXTEND_NONE */
"EXTEND_REPEAT", /* CAIRO_EXTEND_REPEAT */
"EXTEND_REFLECT", /* CAIRO_EXTEND_REFLECT */
"ExtendMode::REPEAT", /* CAIRO_EXTEND_REPEAT */
"ExtendMode::REFLECT", /* CAIRO_EXTEND_REFLECT */
"EXTEND_PAD" /* CAIRO_EXTEND_PAD */
};
assert (extend < ARRAY_LENGTH (names));
@ -330,7 +330,7 @@ _filter_to_string (cairo_filter_t filter)
{
static const char *names[] = {
"FILTER_FAST", /* CAIRO_FILTER_FAST */
"FILTER_GOOD", /* CAIRO_FILTER_GOOD */
"Filter::GOOD", /* CAIRO_FILTER_GOOD */
"FILTER_BEST", /* CAIRO_FILTER_BEST */
"FILTER_NEAREST", /* CAIRO_FILTER_NEAREST */
"FILTER_BILINEAR", /* CAIRO_FILTER_BILINEAR */

View File

@ -118,8 +118,8 @@ _extend_to_string (cairo_extend_t extend)
{
static const char *names[] = {
"EXTEND_NONE", /* CAIRO_EXTEND_NONE */
"EXTEND_REPEAT", /* CAIRO_EXTEND_REPEAT */
"EXTEND_REFLECT", /* CAIRO_EXTEND_REFLECT */
"ExtendMode::REPEAT", /* CAIRO_EXTEND_REPEAT */
"ExtendMode::REFLECT", /* CAIRO_EXTEND_REFLECT */
"EXTEND_PAD" /* CAIRO_EXTEND_PAD */
};
assert (extend < ARRAY_LENGTH (names));
@ -131,7 +131,7 @@ _filter_to_string (cairo_filter_t filter)
{
static const char *names[] = {
"FILTER_FAST", /* CAIRO_FILTER_FAST */
"FILTER_GOOD", /* CAIRO_FILTER_GOOD */
"Filter::GOOD", /* CAIRO_FILTER_GOOD */
"FILTER_BEST", /* CAIRO_FILTER_BEST */
"FILTER_NEAREST", /* CAIRO_FILTER_NEAREST */
"FILTER_BILINEAR", /* CAIRO_FILTER_BILINEAR */

View File

@ -95,7 +95,7 @@ struct EffectMask : public Effect
struct EffectRenderTarget : public TexturedEffect
{
EffectRenderTarget(CompositingRenderTarget *aRenderTarget)
: TexturedEffect(EFFECT_RENDER_TARGET, aRenderTarget, true, gfx::FILTER_LINEAR)
: TexturedEffect(EFFECT_RENDER_TARGET, aRenderTarget, true, gfx::Filter::LINEAR)
, mRenderTarget(aRenderTarget)
{}

View File

@ -193,9 +193,9 @@ AppendToString(nsACString& s, const Filter filter,
s += pfx;
switch (filter) {
case FILTER_GOOD: s += "FILTER_GOOD"; break;
case FILTER_LINEAR: s += "FILTER_LINEAR"; break;
case FILTER_POINT: s += "FILTER_POINT"; break;
case Filter::GOOD: s += "Filter::GOOD"; break;
case Filter::LINEAR: s += "Filter::LINEAR"; break;
case Filter::POINT: s += "Filter::POINT"; break;
}
return s += sfx;
}

View File

@ -21,7 +21,7 @@
#include "mozilla/gfx/Matrix.h" // for Matrix
#include "mozilla/gfx/Point.h" // for Point, IntPoint
#include "mozilla/gfx/Rect.h" // for Rect, IntRect
#include "mozilla/gfx/Types.h" // for ExtendMode::EXTEND_CLAMP, etc
#include "mozilla/gfx/Types.h" // for ExtendMode::ExtendMode::CLAMP, etc
#include "mozilla/layers/ShadowLayers.h" // for ShadowableLayer
#include "mozilla/layers/TextureClient.h" // for DeprecatedTextureClient
#include "nsSize.h" // for nsIntSize
@ -95,14 +95,14 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
gfx::Point quadrantTranslation(quadrantRect.x, quadrantRect.y);
MOZ_ASSERT(aOperator == OP_OVER || aOperator == OP_SOURCE);
MOZ_ASSERT(aOperator == CompositionOp::OP_OVER || aOperator == CompositionOp::OP_SOURCE);
// direct2d is much slower when using OP_SOURCE so use OP_OVER and
// (maybe) a clear instead. Normally we need to draw in a single operation
// (to avoid flickering) but direct2d is ok since it defers rendering.
// We should try abstract this logic in a helper when we have other use
// cases.
if (aTarget->GetType() == BackendType::DIRECT2D && aOperator == OP_SOURCE) {
aOperator = OP_OVER;
if (aTarget->GetType() == BackendType::DIRECT2D && aOperator == CompositionOp::OP_SOURCE) {
aOperator = CompositionOp::OP_OVER;
if (mDTBuffer->GetFormat() == SurfaceFormat::B8G8R8A8) {
aTarget->ClearRect(ToRect(fillRect));
}
@ -116,7 +116,7 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
snapshot = mDTBufferOnWhite->Snapshot();
}
if (aOperator == OP_SOURCE) {
if (aOperator == CompositionOp::OP_SOURCE) {
// OP_SOURCE is unbounded in Azure, and we really don't want that behaviour here.
// We also can't do a ClearRect+FillRect since we need the drawing to happen
// as an atomic operation (to prevent flickering).
@ -130,9 +130,9 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
transform.Translate(quadrantTranslation.x, quadrantTranslation.y);
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
SurfacePattern source(snapshot, EXTEND_CLAMP, transform, FILTER_POINT);
SurfacePattern source(snapshot, ExtendMode::CLAMP, transform, Filter::POINT);
#else
SurfacePattern source(snapshot, EXTEND_CLAMP, transform);
SurfacePattern source(snapshot, ExtendMode::CLAMP, transform);
#endif
Matrix oldTransform = aTarget->GetTransform();
@ -141,7 +141,7 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
aTarget->SetTransform(oldTransform);
} else {
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
DrawSurfaceOptions options(FILTER_POINT);
DrawSurfaceOptions options(Filter::POINT);
#else
DrawSurfaceOptions options;
#endif
@ -151,7 +151,7 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
DrawOptions(aOpacity, aOperator));
}
if (aOperator == OP_SOURCE) {
if (aOperator == CompositionOp::OP_SOURCE) {
aTarget->PopClip();
}
}
@ -631,7 +631,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
return result;
}
MOZ_ASSERT(mDTBuffer, "Have we got a Thebes buffer for some reason?");
DrawBufferWithRotation(destDTBuffer, BUFFER_BLACK, 1.0, OP_SOURCE);
DrawBufferWithRotation(destDTBuffer, BUFFER_BLACK, 1.0, CompositionOp::OP_SOURCE);
destDTBuffer->SetTransform(Matrix());
if (mode == Layer::SURFACE_COMPONENT_ALPHA) {
@ -641,7 +641,7 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
return result;
}
MOZ_ASSERT(mDTBufferOnWhite, "Have we got a Thebes buffer for some reason?");
DrawBufferWithRotation(destDTBufferOnWhite, BUFFER_WHITE, 1.0, OP_SOURCE);
DrawBufferWithRotation(destDTBufferOnWhite, BUFFER_WHITE, 1.0, CompositionOp::OP_SOURCE);
destDTBufferOnWhite->SetTransform(Matrix());
}
}

View File

@ -79,7 +79,7 @@ public:
// this method.
void DrawBufferWithRotation(gfx::DrawTarget* aTarget, ContextSource aSource,
float aOpacity = 1.0,
gfx::CompositionOp aOperator = gfx::OP_OVER,
gfx::CompositionOp aOperator = gfx::CompositionOp::OP_OVER,
gfx::SourceSurface* aMask = nullptr,
const gfx::Matrix* aMaskTransform = nullptr) const;

View File

@ -307,13 +307,13 @@ DrawSurfaceWithTextureCoords(DrawTarget *aDest,
Matrix dtTransform = aDest->GetTransform();
aDest->SetTransform(aMaskTransform);
Matrix patternMatrix = maskTransformInverse * dtTransform * matrix;
aDest->MaskSurface(SurfacePattern(aSource, EXTEND_REPEAT, patternMatrix),
aDest->MaskSurface(SurfacePattern(aSource, ExtendMode::REPEAT, patternMatrix),
aMask, Point(), DrawOptions(aOpacity));
aDest->SetTransform(dtTransform);
aDest->PopClip();
} else {
aDest->FillRect(aDestRect,
SurfacePattern(aSource, EXTEND_REPEAT, matrix),
SurfacePattern(aSource, ExtendMode::REPEAT, matrix),
DrawOptions(aOpacity));
}
}

View File

@ -618,7 +618,7 @@ ContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
gfxUtils::ClipToRegion(destDT, aUpdateRegion);
}
aSource.DrawBufferWithRotation(destDT, BUFFER_BLACK, 1.0, OP_SOURCE);
aSource.DrawBufferWithRotation(destDT, BUFFER_BLACK, 1.0, CompositionOp::OP_SOURCE);
if (isClippingCheap) {
destDT->PopClip();
}
@ -634,7 +634,7 @@ ContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
gfxUtils::ClipToRegion(destDT, aUpdateRegion);
}
aSource.DrawBufferWithRotation(destDT, BUFFER_WHITE, 1.0, OP_SOURCE);
aSource.DrawBufferWithRotation(destDT, BUFFER_WHITE, 1.0, CompositionOp::OP_SOURCE);
if (isClippingCheap) {
destDT->PopClip();
}
@ -839,7 +839,7 @@ DeprecatedContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer
gfxUtils::ClipToRegion(destDT, aUpdateRegion);
}
aSource.DrawBufferWithRotation(destDT, BUFFER_BLACK, 1.0, OP_SOURCE);
aSource.DrawBufferWithRotation(destDT, BUFFER_BLACK, 1.0, CompositionOp::OP_SOURCE);
if (isClippingCheap) {
destDT->PopClip();
}
@ -855,7 +855,7 @@ DeprecatedContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer
gfxUtils::ClipToRegion(destDT, aUpdateRegion);
}
aSource.DrawBufferWithRotation(destDT, BUFFER_WHITE, 1.0, OP_SOURCE);
aSource.DrawBufferWithRotation(destDT, BUFFER_WHITE, 1.0, CompositionOp::OP_SOURCE);
if (isClippingCheap) {
destDT->PopClip();
}

View File

@ -14,7 +14,7 @@
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for Point
#include "mozilla/gfx/Rect.h" // for RoundedToInt, Rect
#include "mozilla/gfx/Types.h" // for Filter::FILTER_LINEAR
#include "mozilla/gfx/Types.h" // for Filter::Filter::LINEAR
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/ContentHost.h" // for ContentHost
#include "mozilla/layers/Effects.h" // for EffectChain
@ -135,7 +135,7 @@ ThebesLayerComposite::RenderLayer(const nsIntRect& aClipRect)
mBuffer->Composite(effectChain,
GetEffectiveOpacity(),
transform,
gfx::FILTER_LINEAR,
gfx::Filter::LINEAR,
clipRect,
&visibleRegion,
mRequiresTiledProperties ? &tiledLayerProps

View File

@ -592,7 +592,7 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
EffectYCbCr* ycbcrEffect =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
SetSamplerForFilter(FILTER_LINEAR);
SetSamplerForFilter(Filter::LINEAR);
mVSConstants.textureCoords = ycbcrEffect->mTextureCoords;
@ -919,10 +919,10 @@ CompositorD3D11::SetSamplerForFilter(Filter aFilter)
ID3D11SamplerState *sampler;
switch (aFilter) {
default:
case FILTER_LINEAR:
case Filter::LINEAR:
sampler = mAttachments->mLinearSamplerState;
break;
case FILTER_POINT:
case Filter::POINT:
sampler = mAttachments->mPointSamplerState;
break;
}

View File

@ -320,7 +320,7 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
EffectYCbCr* ycbcrEffect =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
SetSamplerForFilter(FILTER_LINEAR);
SetSamplerForFilter(Filter::LINEAR);
Rect textureCoords = ycbcrEffect->mTextureCoords;
d3d9Device->SetVertexShaderConstantF(CBvTextureCoords,
@ -684,11 +684,11 @@ void
CompositorD3D9::SetSamplerForFilter(Filter aFilter)
{
switch (aFilter) {
case FILTER_LINEAR:
case Filter::LINEAR:
device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
return;
case FILTER_POINT:
case Filter::POINT:
device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
return;

View File

@ -1505,7 +1505,7 @@ CompositorOGL::CopyToTarget(DrawTarget *aTarget, const gfxMatrix& aTransform)
Matrix oldMatrix = aTarget->GetTransform();
aTarget->SetTransform(glToCairoTransform);
Rect floatRect = Rect(rect.x, rect.y, rect.width, rect.height);
aTarget->DrawSurface(source, floatRect, floatRect, DrawSurfaceOptions(), DrawOptions(1.0f, OP_SOURCE));
aTarget->DrawSurface(source, floatRect, floatRect, DrawSurfaceOptions(), DrawOptions(1.0f, CompositionOp::OP_SOURCE));
aTarget->SetTransform(oldMatrix);
aTarget->Flush();
}

View File

@ -9,7 +9,10 @@
#include "nsString.h" // for nsAutoString, etc
#include "nsMargin.h" // for nsMargin
static_assert((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3),
static_assert((int(NS_SIDE_TOP) == 0) &&
(int(NS_SIDE_RIGHT) == 1) &&
(int(NS_SIDE_BOTTOM) == 2) &&
(int(NS_SIDE_LEFT) == 3),
"The mozilla::css::Side sequence must match the nsMargin nscoord sequence");
#ifdef DEBUG

View File

@ -80,18 +80,18 @@ inline Filter ToFilter(GraphicsFilter aFilter)
{
switch (aFilter) {
case GraphicsFilter::FILTER_NEAREST:
return FILTER_POINT;
return Filter::POINT;
case GraphicsFilter::FILTER_GOOD:
return FILTER_GOOD;
return Filter::GOOD;
default:
return FILTER_LINEAR;
return Filter::LINEAR;
}
}
inline GraphicsFilter ThebesFilter(Filter aFilter)
{
switch (aFilter) {
case FILTER_POINT:
case Filter::POINT:
return GraphicsFilter::FILTER_NEAREST;
default:
return GraphicsFilter::FILTER_BEST;
@ -102,20 +102,20 @@ inline ExtendMode ToExtendMode(gfxPattern::GraphicsExtend aExtend)
{
switch (aExtend) {
case gfxPattern::EXTEND_REPEAT:
return EXTEND_REPEAT;
return ExtendMode::REPEAT;
case gfxPattern::EXTEND_REFLECT:
return EXTEND_REFLECT;
return ExtendMode::REFLECT;
default:
return EXTEND_CLAMP;
return ExtendMode::CLAMP;
}
}
inline gfxPattern::GraphicsExtend ThebesExtend(ExtendMode aExtend)
{
switch (aExtend) {
case EXTEND_REPEAT:
case ExtendMode::REPEAT:
return gfxPattern::EXTEND_REPEAT;
case EXTEND_REFLECT:
case ExtendMode::REFLECT:
return gfxPattern::EXTEND_REFLECT;
default:
return gfxPattern::EXTEND_PAD;
@ -155,11 +155,11 @@ inline gfxRGBA ThebesRGBA(const Color &aColor)
inline gfxContext::GraphicsLineCap ThebesLineCap(CapStyle aStyle)
{
switch (aStyle) {
case CAP_BUTT:
case CapStyle::BUTT:
return gfxContext::LINE_CAP_BUTT;
case CAP_ROUND:
case CapStyle::ROUND:
return gfxContext::LINE_CAP_ROUND;
case CAP_SQUARE:
case CapStyle::SQUARE:
return gfxContext::LINE_CAP_SQUARE;
}
MOZ_CRASH("Incomplete switch");
@ -169,11 +169,11 @@ inline CapStyle ToCapStyle(gfxContext::GraphicsLineCap aStyle)
{
switch (aStyle) {
case gfxContext::LINE_CAP_BUTT:
return CAP_BUTT;
return CapStyle::BUTT;
case gfxContext::LINE_CAP_ROUND:
return CAP_ROUND;
return CapStyle::ROUND;
case gfxContext::LINE_CAP_SQUARE:
return CAP_SQUARE;
return CapStyle::SQUARE;
}
MOZ_CRASH("Incomplete switch");
}
@ -181,11 +181,11 @@ inline CapStyle ToCapStyle(gfxContext::GraphicsLineCap aStyle)
inline gfxContext::GraphicsLineJoin ThebesLineJoin(JoinStyle aStyle)
{
switch (aStyle) {
case JOIN_MITER:
case JoinStyle::MITER:
return gfxContext::LINE_JOIN_MITER;
case JOIN_BEVEL:
case JoinStyle::BEVEL:
return gfxContext::LINE_JOIN_BEVEL;
case JOIN_ROUND:
case JoinStyle::ROUND:
return gfxContext::LINE_JOIN_ROUND;
default:
return gfxContext::LINE_JOIN_MITER;
@ -196,11 +196,11 @@ inline JoinStyle ToJoinStyle(gfxContext::GraphicsLineJoin aStyle)
{
switch (aStyle) {
case gfxContext::LINE_JOIN_MITER:
return JOIN_MITER;
return JoinStyle::MITER;
case gfxContext::LINE_JOIN_BEVEL:
return JOIN_BEVEL;
return JoinStyle::BEVEL;
case gfxContext::LINE_JOIN_ROUND:
return JOIN_ROUND;
return JoinStyle::ROUND;
}
MOZ_CRASH("Incomplete switch");
}
@ -258,108 +258,108 @@ inline CompositionOp CompositionOpForOp(gfxContext::GraphicsOperator aOp)
{
switch (aOp) {
case gfxContext::OPERATOR_ADD:
return OP_ADD;
return CompositionOp::OP_ADD;
case gfxContext::OPERATOR_ATOP:
return OP_ATOP;
return CompositionOp::OP_ATOP;
case gfxContext::OPERATOR_IN:
return OP_IN;
return CompositionOp::OP_IN;
case gfxContext::OPERATOR_OUT:
return OP_OUT;
return CompositionOp::OP_OUT;
case gfxContext::OPERATOR_SOURCE:
return OP_SOURCE;
return CompositionOp::OP_SOURCE;
case gfxContext::OPERATOR_DEST_IN:
return OP_DEST_IN;
return CompositionOp::OP_DEST_IN;
case gfxContext::OPERATOR_DEST_OUT:
return OP_DEST_OUT;
return CompositionOp::OP_DEST_OUT;
case gfxContext::OPERATOR_DEST_ATOP:
return OP_DEST_ATOP;
return CompositionOp::OP_DEST_ATOP;
case gfxContext::OPERATOR_XOR:
return OP_XOR;
return CompositionOp::OP_XOR;
case gfxContext::OPERATOR_MULTIPLY:
return OP_MULTIPLY;
return CompositionOp::OP_MULTIPLY;
case gfxContext::OPERATOR_SCREEN:
return OP_SCREEN;
return CompositionOp::OP_SCREEN;
case gfxContext::OPERATOR_OVERLAY:
return OP_OVERLAY;
return CompositionOp::OP_OVERLAY;
case gfxContext::OPERATOR_DARKEN:
return OP_DARKEN;
return CompositionOp::OP_DARKEN;
case gfxContext::OPERATOR_LIGHTEN:
return OP_LIGHTEN;
return CompositionOp::OP_LIGHTEN;
case gfxContext::OPERATOR_COLOR_DODGE:
return OP_COLOR_DODGE;
return CompositionOp::OP_COLOR_DODGE;
case gfxContext::OPERATOR_COLOR_BURN:
return OP_COLOR_BURN;
return CompositionOp::OP_COLOR_BURN;
case gfxContext::OPERATOR_HARD_LIGHT:
return OP_HARD_LIGHT;
return CompositionOp::OP_HARD_LIGHT;
case gfxContext::OPERATOR_SOFT_LIGHT:
return OP_SOFT_LIGHT;
return CompositionOp::OP_SOFT_LIGHT;
case gfxContext::OPERATOR_DIFFERENCE:
return OP_DIFFERENCE;
return CompositionOp::OP_DIFFERENCE;
case gfxContext::OPERATOR_EXCLUSION:
return OP_EXCLUSION;
return CompositionOp::OP_EXCLUSION;
case gfxContext::OPERATOR_HUE:
return OP_HUE;
return CompositionOp::OP_HUE;
case gfxContext::OPERATOR_SATURATION:
return OP_SATURATION;
return CompositionOp::OP_SATURATION;
case gfxContext::OPERATOR_COLOR:
return OP_COLOR;
return CompositionOp::OP_COLOR;
case gfxContext::OPERATOR_LUMINOSITY:
return OP_LUMINOSITY;
return CompositionOp::OP_LUMINOSITY;
default:
return OP_OVER;
return CompositionOp::OP_OVER;
}
}
inline gfxContext::GraphicsOperator ThebesOp(CompositionOp aOp)
{
switch (aOp) {
case OP_ADD:
case CompositionOp::OP_ADD:
return gfxContext::OPERATOR_ADD;
case OP_ATOP:
case CompositionOp::OP_ATOP:
return gfxContext::OPERATOR_ATOP;
case OP_IN:
case CompositionOp::OP_IN:
return gfxContext::OPERATOR_IN;
case OP_OUT:
case CompositionOp::OP_OUT:
return gfxContext::OPERATOR_OUT;
case OP_SOURCE:
case CompositionOp::OP_SOURCE:
return gfxContext::OPERATOR_SOURCE;
case OP_DEST_IN:
case CompositionOp::OP_DEST_IN:
return gfxContext::OPERATOR_DEST_IN;
case OP_DEST_OUT:
case CompositionOp::OP_DEST_OUT:
return gfxContext::OPERATOR_DEST_OUT;
case OP_DEST_ATOP:
case CompositionOp::OP_DEST_ATOP:
return gfxContext::OPERATOR_DEST_ATOP;
case OP_XOR:
case CompositionOp::OP_XOR:
return gfxContext::OPERATOR_XOR;
case OP_MULTIPLY:
case CompositionOp::OP_MULTIPLY:
return gfxContext::OPERATOR_MULTIPLY;
case OP_SCREEN:
case CompositionOp::OP_SCREEN:
return gfxContext::OPERATOR_SCREEN;
case OP_OVERLAY:
case CompositionOp::OP_OVERLAY:
return gfxContext::OPERATOR_OVERLAY;
case OP_DARKEN:
case CompositionOp::OP_DARKEN:
return gfxContext::OPERATOR_DARKEN;
case OP_LIGHTEN:
case CompositionOp::OP_LIGHTEN:
return gfxContext::OPERATOR_LIGHTEN;
case OP_COLOR_DODGE:
case CompositionOp::OP_COLOR_DODGE:
return gfxContext::OPERATOR_COLOR_DODGE;
case OP_COLOR_BURN:
case CompositionOp::OP_COLOR_BURN:
return gfxContext::OPERATOR_COLOR_BURN;
case OP_HARD_LIGHT:
case CompositionOp::OP_HARD_LIGHT:
return gfxContext::OPERATOR_HARD_LIGHT;
case OP_SOFT_LIGHT:
case CompositionOp::OP_SOFT_LIGHT:
return gfxContext::OPERATOR_SOFT_LIGHT;
case OP_DIFFERENCE:
case CompositionOp::OP_DIFFERENCE:
return gfxContext::OPERATOR_DIFFERENCE;
case OP_EXCLUSION:
case CompositionOp::OP_EXCLUSION:
return gfxContext::OPERATOR_EXCLUSION;
case OP_HUE:
case CompositionOp::OP_HUE:
return gfxContext::OPERATOR_HUE;
case OP_SATURATION:
case CompositionOp::OP_SATURATION:
return gfxContext::OPERATOR_SATURATION;
case OP_COLOR:
case CompositionOp::OP_COLOR:
return gfxContext::OPERATOR_COLOR;
case OP_LUMINOSITY:
case CompositionOp::OP_LUMINOSITY:
return gfxContext::OPERATOR_LUMINOSITY;
default:
return gfxContext::OPERATOR_OVER;

View File

@ -60,7 +60,7 @@ public:
}
mPattern = new (mSurfacePattern.addr())
SurfacePattern(state.sourceSurface, EXTEND_CLAMP, transform);
SurfacePattern(state.sourceSurface, ExtendMode::CLAMP, transform);
return *mPattern;
} else {
mPattern = new (mColorPattern.addr())
@ -930,9 +930,9 @@ gfxContext::SetAntialiasMode(AntialiasMode mode)
}
} else {
if (mode == MODE_ALIASED) {
CurrentState().aaMode = AA_NONE;
CurrentState().aaMode = gfx::AntialiasMode::NONE;
} else if (mode == MODE_COVERAGE) {
CurrentState().aaMode = AA_SUBPIXEL;
CurrentState().aaMode = gfx::AntialiasMode::SUBPIXEL;
}
}
}
@ -946,7 +946,7 @@ gfxContext::CurrentAntialiasMode() const
return MODE_ALIASED;
return MODE_COVERAGE;
} else {
if (CurrentState().aaMode == AA_NONE) {
if (CurrentState().aaMode == gfx::AntialiasMode::NONE) {
return MODE_ALIASED;
}
return MODE_COVERAGE;
@ -1153,7 +1153,7 @@ gfxContext::SetFillRule(FillRule rule)
if (mCairo) {
cairo_set_fill_rule(mCairo, (cairo_fill_rule_t)rule);
} else {
CurrentState().fillRule = rule == FILL_RULE_WINDING ? FILL_WINDING : FILL_EVEN_ODD;
CurrentState().fillRule = rule == FILL_RULE_WINDING ? gfx::FillRule::FILL_WINDING : gfx::FillRule::FILL_EVEN_ODD;
}
}
@ -2071,7 +2071,7 @@ gfxContext::FillAzure(Float aOpacity)
if (state.opIsClear) {
mDT->ClearRect(mRect);
} else if (op == OP_SOURCE) {
} else if (op == CompositionOp::OP_SOURCE) {
// Emulate cairo operator source which is bound by mask!
mDT->ClearRect(mRect);
mDT->FillRect(mRect, GeneralPattern(this), DrawOptions(aOpacity));
@ -2120,28 +2120,28 @@ gfxContext::PushClipsToDT(DrawTarget *aDT)
CompositionOp
gfxContext::GetOp()
{
if (CurrentState().op != OP_SOURCE) {
if (CurrentState().op != CompositionOp::OP_SOURCE) {
return CurrentState().op;
}
AzureState &state = CurrentState();
if (state.pattern) {
if (state.pattern->IsOpaque()) {
return OP_OVER;
return CompositionOp::OP_OVER;
} else {
return OP_SOURCE;
return CompositionOp::OP_SOURCE;
}
} else if (state.sourceSurface) {
if (state.sourceSurface->GetFormat() == SurfaceFormat::B8G8R8X8) {
return OP_OVER;
return CompositionOp::OP_OVER;
} else {
return OP_SOURCE;
return CompositionOp::OP_SOURCE;
}
} else {
if (state.color.a > 0.999) {
return OP_OVER;
return CompositionOp::OP_OVER;
} else {
return OP_SOURCE;
return CompositionOp::OP_SOURCE;
}
}
}

View File

@ -731,12 +731,12 @@ private:
struct AzureState {
AzureState()
: op(mozilla::gfx::OP_OVER)
: op(mozilla::gfx::CompositionOp::OP_OVER)
, opIsClear(false)
, color(0, 0, 0, 1.0f)
, clipWasReset(false)
, fillRule(mozilla::gfx::FILL_WINDING)
, aaMode(mozilla::gfx::AA_SUBPIXEL)
, fillRule(mozilla::gfx::FillRule::FILL_WINDING)
, aaMode(mozilla::gfx::AntialiasMode::SUBPIXEL)
, patternTransformChanged(false)
{}

View File

@ -2216,13 +2216,13 @@ private:
static AntialiasMode Get2DAAMode(gfxFont::AntialiasOption aAAOption) {
switch (aAAOption) {
case gfxFont::kAntialiasSubpixel:
return AA_SUBPIXEL;
return AntialiasMode::SUBPIXEL;
case gfxFont::kAntialiasGrayscale:
return AA_GRAY;
return AntialiasMode::GRAY;
case gfxFont::kAntialiasNone:
return AA_NONE;
return AntialiasMode::NONE;
default:
return AA_DEFAULT;
return AntialiasMode::DEFAULT;
}
}
@ -2289,11 +2289,11 @@ struct GlyphBufferAzure {
// This relies on the returned Pattern not to be reused by
// others, but regenerated on GetPattern calls. This is true!
if (pat->GetType() == PATTERN_LINEAR_GRADIENT) {
if (pat->GetType() == PatternType::LINEAR_GRADIENT) {
mat = &static_cast<LinearGradientPattern*>(pat)->mMatrix;
} else if (pat->GetType() == PATTERN_RADIAL_GRADIENT) {
} else if (pat->GetType() == PatternType::RADIAL_GRADIENT) {
mat = &static_cast<RadialGradientPattern*>(pat)->mMatrix;
} else if (pat->GetType() == PATTERN_SURFACE) {
} else if (pat->GetType() == PatternType::SURFACE) {
mat = &static_cast<SurfacePattern*>(pat)->mMatrix;
}
@ -2312,7 +2312,7 @@ struct GlyphBufferAzure {
}
} else if (state.sourceSurface) {
aDT->FillGlyphs(aFont, buf, SurfacePattern(state.sourceSurface,
EXTEND_CLAMP,
ExtendMode::CLAMP,
state.surfTransform),
aDrawOptions, aOptions);
} else {

View File

@ -45,7 +45,7 @@ struct GradientCacheKey : public PLDHashEntryHdr {
PLDHashNumber hash = 0;
FloatUint32 convert;
hash = AddToHash(hash, int(aKey->mBackendType));
hash = AddToHash(hash, aKey->mExtend);
hash = AddToHash(hash, int(aKey->mExtend));
for (uint32_t i = 0; i < aKey->mStops.Length(); i++) {
hash = AddToHash(hash, aKey->mStops[i].color.ToABGR());
// Use the float bits as hash, except for the cases of 0.0 and -0.0 which both map to 0

View File

@ -121,8 +121,8 @@ gfxPattern::CacheColorStops(mozilla::gfx::DrawTarget *aDT)
mStops = gfxGradientCache::GetOrCreateGradientStops(aDT,
stops,
(cairo_pattern_get_extend(mPattern) == CAIRO_EXTEND_REPEAT)
? mozilla::gfx::EXTEND_REPEAT
: mozilla::gfx::EXTEND_CLAMP);
? mozilla::gfx::ExtendMode::REPEAT
: mozilla::gfx::ExtendMode::CLAMP);
}
}

View File

@ -54,7 +54,7 @@ class DrawEventRecorder;
inline uint32_t
BackendTypeBit(BackendType b)
{
return 1 << int(b);
return 1 << uint8_t(b);
}
}
}

View File

@ -156,7 +156,7 @@ NS_IMETHODIMP imgTools::EncodeScaledImage(imgIContainer *aContainer,
Rect(0, 0, aScaledWidth, aScaledHeight),
Rect(0, 0, frameWidth, frameHeight),
DrawSurfaceOptions(),
DrawOptions(1.0f, OP_SOURCE));
DrawOptions(1.0f, CompositionOp::OP_SOURCE));
} else {
gfxContext ctx(dest);

View File

@ -2281,7 +2281,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
mozilla::RefPtr<mozilla::gfx::GradientStops> gs =
gfxGradientCache::GetOrCreateGradientStops(ctx->GetDrawTarget(),
rawStops,
isRepeat ? gfx::EXTEND_REPEAT : gfx::EXTEND_CLAMP);
isRepeat ? gfx::ExtendMode::REPEAT : gfx::ExtendMode::CLAMP);
gradientPattern->SetColorStops(gs);
} else {
for (uint32_t i = 0; i < stops.Length(); i++) {

View File

@ -1142,7 +1142,7 @@ nsCSSBorderRenderer::CreateCornerGradient(mozilla::css::Corner aCorner,
rawStops[1].color = secondColor;
rawStops[1].offset = 0.5;
RefPtr<GradientStops> gs =
gfxGradientCache::GetGradientStops(aDT, rawStops, EXTEND_CLAMP);
gfxGradientCache::GetGradientStops(aDT, rawStops, ExtendMode::CLAMP);
if (!gs) {
// Having two corners, both with reversed color stops is pretty common
// for certain border types. Let's optimize it!
@ -1151,7 +1151,7 @@ nsCSSBorderRenderer::CreateCornerGradient(mozilla::css::Corner aCorner,
Point tmp = aPoint1;
aPoint1 = aPoint2;
aPoint2 = tmp;
gs = gfxGradientCache::GetOrCreateGradientStops(aDT, rawStops, EXTEND_CLAMP);
gs = gfxGradientCache::GetOrCreateGradientStops(aDT, rawStops, ExtendMode::CLAMP);
}
return gs;
}

View File

@ -2406,7 +2406,7 @@ nsChildView::MaybeDrawRoundedCorners(GLManager* aManager, const nsIntRect& aRect
RefPtr<gfx::Path> path = builder->Finish();
drawTarget->Fill(path,
gfx::ColorPattern(gfx::Color(1.0, 1.0, 1.0, 1.0)),
gfx::DrawOptions(1.0f, gfx::OP_SOURCE));
gfx::DrawOptions(1.0f, gfx::CompositionOp::OP_SOURCE));
});
// Use operator destination in: multiply all 4 channels with source alpha.
@ -2708,7 +2708,7 @@ RectTextureImage::UpdateFromCGContext(const nsIntSize& aNewSize,
gfx::SurfaceFormat::B8G8R8A8);
dt->DrawSurface(sourceSurface, rect, rect,
gfx::DrawSurfaceOptions(),
gfx::DrawOptions(1.0, gfx::OP_SOURCE));
gfx::DrawOptions(1.0, gfx::CompositionOp::OP_SOURCE));
dt->PopClip();
EndUpdate();
}
@ -2729,7 +2729,7 @@ RectTextureImage::UpdateFromDrawTarget(const nsIntSize& aNewSize,
gfxUtils::ClipToRegion(drawTarget, GetUpdateRegion());
drawTarget->DrawSurface(source, rect, rect,
gfx::DrawSurfaceOptions(),
gfx::DrawOptions(1.0, gfx::OP_SOURCE));
gfx::DrawOptions(1.0, gfx::CompositionOp::OP_SOURCE));
drawTarget->PopClip();
}
EndUpdate();

View File

@ -2284,7 +2284,7 @@ nsWindow::UpdateAlpha(gfxPattern* aPattern, nsIntRect aBoundsRect)
if (drawTarget) {
drawTarget->FillRect(Rect(0, 0, aBoundsRect.width, aBoundsRect.height),
*aPattern->GetPattern(drawTarget),
DrawOptions(1.0, OP_SOURCE));
DrawOptions(1.0, CompositionOp::OP_SOURCE));
}
UpdateTranslucentWindowAlphaInternal(aBoundsRect, imageBuffer, stride);
} else {