Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1122)

Unified Diff: Source/core/html/canvas/CanvasStyle.cpp

Issue 1008173003: Move SkPaint mangement for 2D canvas into CanvasRenderingContext2DState (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/canvas/CanvasStyle.cpp
diff --git a/Source/core/html/canvas/CanvasStyle.cpp b/Source/core/html/canvas/CanvasStyle.cpp
index 4e450f7115a99a158054b678ad7da5adc603e890..6c0a35190b3a23daa8b9144bb27279262a75d5d3 100644
--- a/Source/core/html/canvas/CanvasStyle.cpp
+++ b/Source/core/html/canvas/CanvasStyle.cpp
@@ -145,6 +145,29 @@ void CanvasStyle::applyFillColor(GraphicsContext* context)
}
}
+SkShader* CanvasStyle::shader() const
+{
+ switch (m_type) {
+ case ColorRGBA:
+ return nullptr;
+ case Gradient:
+ return canvasGradient()->gradient()->shader();
+ case ImagePattern:
+ return canvasPattern()->pattern()->shader();
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ return nullptr;
+}
+
+RGBA32 CanvasStyle::paintColor() const
+{
+ if (m_type == ColorRGBA)
+ return m_rgba;
+ ASSERT(m_type == Gradient || m_type == ImagePattern);
+ return SK_ColorBLACK;
Stephen White 2015/03/18 22:09:35 Nit: this is an RGBA32 (Blink type) but you're ret
Justin Novosad 2015/03/19 14:32:21 Yeah... RGBA32 and SkColor are completely intercha
+}
+
DEFINE_TRACE(CanvasStyle)
{
visitor->trace(m_gradient);

Powered by Google App Engine
This is Rietveld 408576698