mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-24 05:44:10 +00:00
Bug 1092222, part 1 - Get rid of gfxContext::GraphicsLineCap and gfxContext::GraphicsLineJoin. r=roc
This commit is contained in:
parent
e9bf8f637c
commit
70be113245
@ -177,59 +177,6 @@ inline gfxRGBA ThebesRGBA(const Color &aColor)
|
||||
return gfxRGBA(aColor.r, aColor.g, aColor.b, aColor.a);
|
||||
}
|
||||
|
||||
inline gfxContext::GraphicsLineCap ThebesLineCap(CapStyle aStyle)
|
||||
{
|
||||
switch (aStyle) {
|
||||
case CapStyle::BUTT:
|
||||
return gfxContext::LINE_CAP_BUTT;
|
||||
case CapStyle::ROUND:
|
||||
return gfxContext::LINE_CAP_ROUND;
|
||||
case CapStyle::SQUARE:
|
||||
return gfxContext::LINE_CAP_SQUARE;
|
||||
}
|
||||
MOZ_CRASH("Incomplete switch");
|
||||
}
|
||||
|
||||
inline CapStyle ToCapStyle(gfxContext::GraphicsLineCap aStyle)
|
||||
{
|
||||
switch (aStyle) {
|
||||
case gfxContext::LINE_CAP_BUTT:
|
||||
return CapStyle::BUTT;
|
||||
case gfxContext::LINE_CAP_ROUND:
|
||||
return CapStyle::ROUND;
|
||||
case gfxContext::LINE_CAP_SQUARE:
|
||||
return CapStyle::SQUARE;
|
||||
}
|
||||
MOZ_CRASH("Incomplete switch");
|
||||
}
|
||||
|
||||
inline gfxContext::GraphicsLineJoin ThebesLineJoin(JoinStyle aStyle)
|
||||
{
|
||||
switch (aStyle) {
|
||||
case JoinStyle::MITER:
|
||||
return gfxContext::LINE_JOIN_MITER;
|
||||
case JoinStyle::BEVEL:
|
||||
return gfxContext::LINE_JOIN_BEVEL;
|
||||
case JoinStyle::ROUND:
|
||||
return gfxContext::LINE_JOIN_ROUND;
|
||||
default:
|
||||
return gfxContext::LINE_JOIN_MITER;
|
||||
}
|
||||
}
|
||||
|
||||
inline JoinStyle ToJoinStyle(gfxContext::GraphicsLineJoin aStyle)
|
||||
{
|
||||
switch (aStyle) {
|
||||
case gfxContext::LINE_JOIN_MITER:
|
||||
return JoinStyle::MITER;
|
||||
case gfxContext::LINE_JOIN_BEVEL:
|
||||
return JoinStyle::BEVEL;
|
||||
case gfxContext::LINE_JOIN_ROUND:
|
||||
return JoinStyle::ROUND;
|
||||
}
|
||||
MOZ_CRASH("Incomplete switch");
|
||||
}
|
||||
|
||||
inline gfxImageFormat SurfaceFormatToImageFormat(SurfaceFormat aFormat)
|
||||
{
|
||||
switch (aFormat) {
|
||||
|
@ -613,27 +613,27 @@ gfxContext::CurrentOperator() const
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::SetLineCap(GraphicsLineCap cap)
|
||||
gfxContext::SetLineCap(CapStyle cap)
|
||||
{
|
||||
CurrentState().strokeOptions.mLineCap = ToCapStyle(cap);
|
||||
CurrentState().strokeOptions.mLineCap = cap;
|
||||
}
|
||||
|
||||
gfxContext::GraphicsLineCap
|
||||
CapStyle
|
||||
gfxContext::CurrentLineCap() const
|
||||
{
|
||||
return ThebesLineCap(CurrentState().strokeOptions.mLineCap);
|
||||
return CurrentState().strokeOptions.mLineCap;
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::SetLineJoin(GraphicsLineJoin join)
|
||||
gfxContext::SetLineJoin(JoinStyle join)
|
||||
{
|
||||
CurrentState().strokeOptions.mLineJoin = ToJoinStyle(join);
|
||||
CurrentState().strokeOptions.mLineJoin = join;
|
||||
}
|
||||
|
||||
gfxContext::GraphicsLineJoin
|
||||
JoinStyle
|
||||
gfxContext::CurrentLineJoin() const
|
||||
{
|
||||
return ThebesLineJoin(CurrentState().strokeOptions.mLineJoin);
|
||||
return CurrentState().strokeOptions.mLineJoin;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -43,6 +43,8 @@ struct RectCornerRadii;
|
||||
* as opposed to app units.
|
||||
*/
|
||||
class gfxContext MOZ_FINAL {
|
||||
typedef mozilla::gfx::CapStyle CapStyle;
|
||||
typedef mozilla::gfx::JoinStyle JoinStyle;
|
||||
typedef mozilla::gfx::FillRule FillRule;
|
||||
typedef mozilla::gfx::Path Path;
|
||||
typedef mozilla::gfx::Pattern Pattern;
|
||||
@ -393,28 +395,18 @@ public:
|
||||
*/
|
||||
gfxFloat CurrentLineWidth() const;
|
||||
|
||||
enum GraphicsLineCap {
|
||||
LINE_CAP_BUTT,
|
||||
LINE_CAP_ROUND,
|
||||
LINE_CAP_SQUARE
|
||||
};
|
||||
/**
|
||||
* Sets the line caps, i.e. how line endings are drawn.
|
||||
*/
|
||||
void SetLineCap(GraphicsLineCap cap);
|
||||
GraphicsLineCap CurrentLineCap() const;
|
||||
void SetLineCap(CapStyle cap);
|
||||
CapStyle CurrentLineCap() const;
|
||||
|
||||
enum GraphicsLineJoin {
|
||||
LINE_JOIN_MITER,
|
||||
LINE_JOIN_ROUND,
|
||||
LINE_JOIN_BEVEL
|
||||
};
|
||||
/**
|
||||
* Sets the line join, i.e. how the connection between two lines is
|
||||
* drawn.
|
||||
*/
|
||||
void SetLineJoin(GraphicsLineJoin join);
|
||||
GraphicsLineJoin CurrentLineJoin() const;
|
||||
void SetLineJoin(JoinStyle join);
|
||||
JoinStyle CurrentLineJoin() const;
|
||||
|
||||
void SetMiterLimit(gfxFloat limit);
|
||||
gfxFloat CurrentMiterLimit() const;
|
||||
|
@ -944,7 +944,7 @@ nsCSSBorderRenderer::DrawDashedSide(mozilla::css::Side aSide)
|
||||
dash[0] = dashWidth;
|
||||
dash[1] = dashWidth;
|
||||
|
||||
mContext->SetLineCap(gfxContext::LINE_CAP_BUTT);
|
||||
mContext->SetLineCap(CapStyle::BUTT);
|
||||
} else if (style == NS_STYLE_BORDER_STYLE_DOTTED) {
|
||||
dashWidth = gfxFloat(borderWidth * DOT_LENGTH);
|
||||
|
||||
@ -952,7 +952,7 @@ nsCSSBorderRenderer::DrawDashedSide(mozilla::css::Side aSide)
|
||||
dash[0] = 0.0;
|
||||
dash[1] = dashWidth * 2.0;
|
||||
|
||||
mContext->SetLineCap(gfxContext::LINE_CAP_ROUND);
|
||||
mContext->SetLineCap(CapStyle::ROUND);
|
||||
} else {
|
||||
dash[0] = dashWidth;
|
||||
dash[1] = dashWidth;
|
||||
|
@ -1493,13 +1493,13 @@ nsSVGUtils::SetupCairoStrokeGeometry(nsIFrame* aFrame,
|
||||
|
||||
switch (style->mStrokeLinecap) {
|
||||
case NS_STYLE_STROKE_LINECAP_BUTT:
|
||||
aContext->SetLineCap(gfxContext::LINE_CAP_BUTT);
|
||||
aContext->SetLineCap(CapStyle::BUTT);
|
||||
break;
|
||||
case NS_STYLE_STROKE_LINECAP_ROUND:
|
||||
aContext->SetLineCap(gfxContext::LINE_CAP_ROUND);
|
||||
aContext->SetLineCap(CapStyle::ROUND);
|
||||
break;
|
||||
case NS_STYLE_STROKE_LINECAP_SQUARE:
|
||||
aContext->SetLineCap(gfxContext::LINE_CAP_SQUARE);
|
||||
aContext->SetLineCap(CapStyle::SQUARE);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1507,13 +1507,13 @@ nsSVGUtils::SetupCairoStrokeGeometry(nsIFrame* aFrame,
|
||||
|
||||
switch (style->mStrokeLinejoin) {
|
||||
case NS_STYLE_STROKE_LINEJOIN_MITER:
|
||||
aContext->SetLineJoin(gfxContext::LINE_JOIN_MITER);
|
||||
aContext->SetLineJoin(JoinStyle::MITER);
|
||||
break;
|
||||
case NS_STYLE_STROKE_LINEJOIN_ROUND:
|
||||
aContext->SetLineJoin(gfxContext::LINE_JOIN_ROUND);
|
||||
aContext->SetLineJoin(JoinStyle::ROUND);
|
||||
break;
|
||||
case NS_STYLE_STROKE_LINEJOIN_BEVEL:
|
||||
aContext->SetLineJoin(gfxContext::LINE_JOIN_BEVEL);
|
||||
aContext->SetLineJoin(JoinStyle::BEVEL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user