Skip to content

Commit

Permalink
Bug 958375 - 8/9 - Make remaining Moz2D enums typed - r=Bas
Browse files Browse the repository at this point in the history
Specifically:
  r=Bas for manual changes
  f=Bas for automatic changes
See attachments on the bug for the specific breakdown.
  • Loading branch information
Benoit Jacob committed Jan 10, 2014
1 parent 6660086 commit f447d87
Show file tree
Hide file tree
Showing 68 changed files with 628 additions and 557 deletions.
2 changes: 1 addition & 1 deletion content/canvas/src/CanvasGradient.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CanvasGradient : public nsWrapperCache
mStops =
gfx::gfxGradientCache::GetOrCreateGradientStops(aRT,
mRawStops,
gfx::EXTEND_CLAMP);
gfx::ExtendMode::CLAMP);

return mStops;
}
Expand Down
90 changes: 45 additions & 45 deletions content/canvas/src/CanvasRenderingContext2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ class CanvasGeneralPattern

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);
Expand Down Expand Up @@ -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;

Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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;

Expand All @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions content/canvas/src/CanvasRenderingContext2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ typedef HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement
{
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;
Expand Down Expand Up @@ -759,10 +759,10 @@ typedef HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement
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)
{ }

Expand Down
2 changes: 1 addition & 1 deletion content/svg/content/src/SVGPathData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/svg/content/src/nsSVGPathGeometryElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
Loading

0 comments on commit f447d87

Please sign in to comment.