Index: third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp |
index 57f68b9485b00e8f027ca971d22ae6d628c7b789..1a82723e411aa95cd26cc0b4b0a54884c2876724 100644 |
--- a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp |
@@ -96,10 +96,9 @@ void GraphicsContext::save() |
{ |
if (contextDisabled()) |
return; |
+ ASSERT(m_canvas); |
m_paintState->incrementSaveCount(); |
- |
- ASSERT(m_canvas); |
m_canvas->save(); |
} |
@@ -107,6 +106,7 @@ void GraphicsContext::restore() |
{ |
if (contextDisabled()) |
return; |
+ ASSERT(m_canvas); |
if (!m_paintStateIndex && !m_paintState->saveCount()) { |
WTF_LOG_ERROR("ERROR void GraphicsContext::restore() stack is empty"); |
@@ -120,7 +120,6 @@ void GraphicsContext::restore() |
m_paintState = m_paintStateStack[m_paintStateIndex].get(); |
} |
- ASSERT(m_canvas); |
m_canvas->restore(); |
} |
@@ -142,7 +141,6 @@ void GraphicsContext::saveLayer(const SkRect* bounds, const SkPaint* paint) |
{ |
if (contextDisabled()) |
return; |
- |
ASSERT(m_canvas); |
m_canvas->saveLayer(bounds, paint); |
@@ -152,7 +150,6 @@ void GraphicsContext::restoreLayer() |
{ |
if (contextDisabled()) |
return; |
- |
ASSERT(m_canvas); |
m_canvas->restore(); |
@@ -177,6 +174,7 @@ void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient, float alp |
setStrokeColor(Color::black); |
return; |
} |
+ |
mutableState()->setStrokeGradient(gradient, alpha); |
} |
@@ -212,7 +210,7 @@ void GraphicsContext::setShadow(const FloatSize& offset, float blur, const Color |
return; |
} |
- drawLooperBuilder->addShadow(offset, blur, color, shadowTransformMode, shadowAlphaMode); |
+ drawLooperBuilder->addShadow(offset, blur, Color::toDeviceColor(color), shadowTransformMode, shadowAlphaMode); |
if (shadowMode == DrawShadowAndForeground) { |
drawLooperBuilder->addUnmodifiedContent(); |
} |
@@ -254,7 +252,6 @@ void GraphicsContext::concat(const SkMatrix& matrix) |
{ |
if (contextDisabled()) |
return; |
- |
ASSERT(m_canvas); |
m_canvas->concat(matrix); |
@@ -356,20 +353,20 @@ void GraphicsContext::fillPolygon(size_t numPoints, const FloatPoint* points, co |
setPathFromPoints(&path, numPoints, points); |
SkPaint paint(immutableState()->fillPaint()); |
+ paint.setColor(Color::toDeviceColor(color).rgb()); |
paint.setAntiAlias(shouldAntialias); |
- paint.setColor(color.rgb()); |
drawPath(path, paint); |
} |
void GraphicsContext::drawFocusRingPath(const SkPath& path, const Color& color, int width) |
{ |
- drawPlatformFocusRing(path, m_canvas, color.rgb(), width); |
+ drawPlatformFocusRing(path, m_canvas, Color::toDeviceColor(color).rgb(), width); |
} |
void GraphicsContext::drawFocusRingRect(const SkRect& rect, const Color& color, int width) |
{ |
- drawPlatformFocusRing(rect, m_canvas, color.rgb(), width); |
+ drawPlatformFocusRing(rect, m_canvas, Color::toDeviceColor(color).rgb(), width); |
} |
void GraphicsContext::drawFocusRing(const Path& focusRingPath, int width, int offset, const Color& color) |
@@ -471,9 +468,10 @@ void GraphicsContext::drawInnerShadow(const FloatRoundedRect& rect, const Color& |
} |
OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); |
- drawLooperBuilder->addShadow(FloatSize(shadowOffset), shadowBlur, shadowColor, |
+ drawLooperBuilder->addShadow(FloatSize(shadowOffset), shadowBlur, Color::toDeviceColor(shadowColor), |
DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder::ShadowIgnoresAlpha); |
setDrawLooper(drawLooperBuilder.release()); |
+ |
fillRectWithRoundedHole(outerRect, roundedHole, fillColor); |
} |
@@ -677,7 +675,7 @@ void GraphicsContext::drawLineForText(const FloatPoint& pt, float width, bool pr |
r.fBottom = r.fTop + SkIntToScalar(thickness); |
paint = immutableState()->fillPaint(); |
// Text lines are drawn using the stroke color. |
- paint.setColor(strokeColor().rgb()); |
+ paint.setColor(Color::toDeviceColor(strokeColor()).rgb()); |
drawRect(r, paint); |
return; |
} |
@@ -711,7 +709,7 @@ void GraphicsContext::drawRect(const IntRect& rect) |
&& immutableState()->strokeColor().alpha()) { |
// Stroke a width: 1 inset border |
SkPaint paint(immutableState()->fillPaint()); |
- paint.setColor(strokeColor().rgb()); |
+ paint.setColor(Color::toDeviceColor(strokeColor()).rgb()); |
paint.setStyle(SkPaint::kStroke_Style); |
paint.setStrokeWidth(1); |
@@ -801,7 +799,7 @@ void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const Float |
SkPaint imagePaint = immutableState()->fillPaint(); |
imagePaint.setXfermodeMode(op); |
- imagePaint.setColor(SK_ColorBLACK); |
+ imagePaint.setColor(SK_ColorBLACK); // FIXME: not color correct. |
imagePaint.setFilterQuality(computeFilterQuality(image, dest, src)); |
imagePaint.setAntiAlias(shouldAntialias()); |
image->draw(m_canvas, imagePaint, dest, src, shouldRespectImageOrientation, Image::ClampImageToSourceRect); |
@@ -918,9 +916,8 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, SkXfer |
return; |
SkPaint paint = immutableState()->fillPaint(); |
- paint.setColor(color.rgb()); |
+ paint.setColor(Color::toDeviceColor(color).rgb()); |
paint.setXfermodeMode(xferMode); |
- |
drawRect(rect, paint); |
} |
@@ -940,7 +937,7 @@ void GraphicsContext::fillRoundedRect(const FloatRoundedRect& rrect, const Color |
} |
SkPaint paint = immutableState()->fillPaint(); |
- paint.setColor(color.rgb()); |
+ paint.setColor(Color::toDeviceColor(color).rgb()); |
drawRRect(rrect, paint); |
} |
@@ -996,7 +993,7 @@ void GraphicsContext::fillDRRect(const FloatRoundedRect& outer, |
m_canvas->drawDRRect(outer, inner, immutableState()->fillPaint()); |
} else { |
SkPaint paint(immutableState()->fillPaint()); |
- paint.setColor(color.rgb()); |
+ paint.setColor(Color::toDeviceColor(color).rgb()); |
m_canvas->drawDRRect(outer, inner, paint); |
} |
@@ -1009,7 +1006,7 @@ void GraphicsContext::fillDRRect(const FloatRoundedRect& outer, |
strokeRRect.inset(strokeWidth / 2, strokeWidth / 2); |
SkPaint strokePaint(immutableState()->fillPaint()); |
- strokePaint.setColor(color.rgb()); |
+ strokePaint.setColor(Color::toDeviceColor(color).rgb()); |
strokePaint.setStyle(SkPaint::kStroke_Style); |
strokePaint.setStrokeWidth(strokeWidth); |
@@ -1211,7 +1208,7 @@ void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const Float |
return; |
SkPaint paint(immutableState()->fillPaint()); |
- paint.setColor(color.rgb()); |
+ paint.setColor(Color::toDeviceColor(color).rgb()); |
m_canvas->drawDRRect(SkRRect::MakeRect(rect), roundedHoleRect, paint); |
} |