| Index: Source/platform/graphics/GraphicsContext.cpp
|
| diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp
|
| index 5ae2e4c633c269a245d9763c64d4dd57af9c7b0e..d385c76d99d59e84296526deea4c0cfc76bf0c27 100644
|
| --- a/Source/platform/graphics/GraphicsContext.cpp
|
| +++ b/Source/platform/graphics/GraphicsContext.cpp
|
| @@ -1113,7 +1113,7 @@ void GraphicsContext::drawRRect(const SkRRect& rrect, const SkPaint& paint)
|
| m_canvas->drawRRect(rrect, paint);
|
| }
|
|
|
| -void GraphicsContext::fillPath(const Path& pathToFill)
|
| +void GraphicsContext::fillPath(const Path& pathToFill, const SkPaint* fillPaint)
|
| {
|
| if (contextDisabled() || pathToFill.isEmpty())
|
| return;
|
| @@ -1125,17 +1125,17 @@ void GraphicsContext::fillPath(const Path& pathToFill)
|
| SkPath::FillType temporaryFillType = WebCoreWindRuleToSkFillType(immutableState()->fillRule());
|
| path.setFillType(temporaryFillType);
|
|
|
| - drawPath(path, immutableState()->fillPaint());
|
| + drawPath(path, fillPaint ? *fillPaint : immutableState()->fillPaint());
|
|
|
| path.setFillType(previousFillType);
|
| }
|
|
|
| -void GraphicsContext::fillRect(const FloatRect& rect)
|
| +void GraphicsContext::fillRect(const FloatRect& rect, const SkPaint* fillPaint)
|
| {
|
| if (contextDisabled())
|
| return;
|
|
|
| - drawRect(rect, immutableState()->fillPaint());
|
| + drawRect(rect, fillPaint ? *fillPaint : immutableState()->fillPaint());
|
| }
|
|
|
| void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, SkXfermode::Mode xferMode)
|
| @@ -1215,22 +1215,22 @@ void GraphicsContext::fillRoundedRect(const FloatRect& rect, const FloatSize& to
|
| m_canvas->drawRRect(rr, paint);
|
| }
|
|
|
| -void GraphicsContext::fillEllipse(const FloatRect& ellipse)
|
| +void GraphicsContext::fillEllipse(const FloatRect& ellipse, const SkPaint* fillPaint)
|
| {
|
| if (contextDisabled())
|
| return;
|
|
|
| SkRect rect = ellipse;
|
| - drawOval(rect, immutableState()->fillPaint());
|
| + drawOval(rect, fillPaint ? *fillPaint : immutableState()->fillPaint());
|
| }
|
|
|
| -void GraphicsContext::strokePath(const Path& pathToStroke)
|
| +void GraphicsContext::strokePath(const Path& pathToStroke, const SkPaint* strokePaint)
|
| {
|
| if (contextDisabled() || pathToStroke.isEmpty())
|
| return;
|
|
|
| const SkPath& path = pathToStroke.skPath();
|
| - drawPath(path, immutableState()->strokePaint());
|
| + drawPath(path, strokePaint ? *strokePaint : immutableState()->strokePaint());
|
| }
|
|
|
| void GraphicsContext::strokeRect(const FloatRect& rect)
|
| @@ -1247,6 +1247,17 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth)
|
| paint.setStrokeWidth(WebCoreFloatToSkScalar(lineWidth));
|
| // Reset the dash effect to account for the width
|
| immutableState()->strokeData().setupPaintDashPathEffect(&paint, 0);
|
| +
|
| + strokeRect(rect, paint);
|
| +}
|
| +
|
| +void GraphicsContext::strokeRect(const FloatRect& rect, const SkPaint& strokePaint)
|
| +{
|
| + if (contextDisabled())
|
| + return;
|
| +
|
| + ASSERT(strokePaint.getStyle() == SkPaint::kStroke_Style);
|
| +
|
| // strokerect has special rules for CSS when the rect is degenerate:
|
| // if width==0 && height==0, do nothing
|
| // if width==0 || height==0, then just draw line for the other dimension
|
| @@ -1254,7 +1265,7 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth)
|
| bool validW = r.width() > 0;
|
| bool validH = r.height() > 0;
|
| if (validW && validH) {
|
| - drawRect(r, paint);
|
| + drawRect(r, strokePaint);
|
| } else if (validW || validH) {
|
| // we are expected to respect the lineJoin, so we can't just call
|
| // drawLine -- we have to create a path that doubles back on itself.
|
| @@ -1262,16 +1273,16 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth)
|
| path.moveTo(r.fLeft, r.fTop);
|
| path.lineTo(r.fRight, r.fBottom);
|
| path.close();
|
| - drawPath(path, paint);
|
| + drawPath(path, strokePaint);
|
| }
|
| }
|
|
|
| -void GraphicsContext::strokeEllipse(const FloatRect& ellipse)
|
| +void GraphicsContext::strokeEllipse(const FloatRect& ellipse, const SkPaint* strokePaint)
|
| {
|
| if (contextDisabled())
|
| return;
|
|
|
| - drawOval(ellipse, immutableState()->strokePaint());
|
| + drawOval(ellipse, strokePaint ? *strokePaint : immutableState()->strokePaint());
|
| }
|
|
|
| void GraphicsContext::clipRoundedRect(const FloatRoundedRect& rect, SkRegion::Op regionOp)
|
|
|