summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/skia/GraphicsContextSkia.cpp')
-rw-r--r--WebCore/platform/graphics/skia/GraphicsContextSkia.cpp40
1 files changed, 16 insertions, 24 deletions
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 376fa4b..33ca23a 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -449,10 +449,8 @@ void GraphicsContext::drawConvexPolygon(size_t numPoints,
return;
SkPaint paint;
- if (fillColor().alpha() > 0) {
- platformContext()->setupPaintForFilling(&paint);
- platformContext()->canvas()->drawPath(path, paint);
- }
+ platformContext()->setupPaintForFilling(&paint);
+ platformContext()->canvas()->drawPath(path, paint);
if (strokeStyle() != NoStroke) {
paint.reset();
@@ -472,10 +470,8 @@ void GraphicsContext::drawEllipse(const IntRect& elipseRect)
return;
SkPaint paint;
- if (fillColor().alpha() > 0) {
- platformContext()->setupPaintForFilling(&paint);
- platformContext()->canvas()->drawOval(rect, paint);
- }
+ platformContext()->setupPaintForFilling(&paint);
+ platformContext()->canvas()->drawOval(rect, paint);
if (strokeStyle() != NoStroke) {
paint.reset();
@@ -685,9 +681,6 @@ void GraphicsContext::fillPath()
const GraphicsContextState& state = m_common->state;
ColorSpace colorSpace = state.fillColorSpace;
- if (colorSpace == SolidColorSpace && !fillColor().alpha())
- return;
-
path.setFillType(state.fillRule == RULE_EVENODD ?
SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
@@ -718,9 +711,6 @@ void GraphicsContext::fillRect(const FloatRect& rect)
const GraphicsContextState& state = m_common->state;
ColorSpace colorSpace = state.fillColorSpace;
- if (colorSpace == SolidColorSpace && !fillColor().alpha())
- return;
-
SkPaint paint;
platformContext()->setupPaintForFilling(&paint);
@@ -739,9 +729,6 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color)
if (paintingDisabled())
return;
- if (!color.alpha())
- return;
-
SkRect r = rect;
if (!isRectSkiaSafe(getCTM(), r)) {
// Special case when the rectangle overflows fixed point. This is a
@@ -907,8 +894,13 @@ void GraphicsContext::setLineDash(const DashArray& dashes, float dashOffset)
// FIXME: This is lifted directly off SkiaSupport, lines 49-74
// so it is not guaranteed to work correctly.
size_t dashLength = dashes.size();
- if (!dashLength)
+ if (!dashLength) {
+ // If no dash is set, revert to solid stroke
+ // FIXME: do we need to set NoStroke in some cases?
+ platformContext()->setStrokeStyle(SolidStroke);
+ platformContext()->setDashPathEffect(0);
return;
+ }
size_t count = (dashLength % 2) == 0 ? dashLength : dashLength * 2;
SkScalar* intervals = new SkScalar[count];
@@ -962,6 +954,12 @@ void GraphicsContext::setPlatformShadow(const IntSize& size,
if (paintingDisabled())
return;
+ // Detect when there's no effective shadow and clear the looper.
+ if (size.width() == 0 && size.height() == 0 && blurInt == 0) {
+ platformContext()->setDrawLooper(NULL);
+ return;
+ }
+
double width = size.width();
double height = size.height();
double blur = blurInt;
@@ -1076,9 +1074,6 @@ void GraphicsContext::strokePath()
const GraphicsContextState& state = m_common->state;
ColorSpace colorSpace = state.strokeColorSpace;
- if (colorSpace == SolidColorSpace && !strokeColor().alpha())
- return;
-
SkPaint paint;
platformContext()->setupPaintForStroking(&paint, 0, 0);
@@ -1103,9 +1098,6 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth)
const GraphicsContextState& state = m_common->state;
ColorSpace colorSpace = state.strokeColorSpace;
- if (colorSpace == SolidColorSpace && !strokeColor().alpha())
- return;
-
SkPaint paint;
platformContext()->setupPaintForStroking(&paint, 0, 0);
paint.setStrokeWidth(WebCoreFloatToSkScalar(lineWidth));