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

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: applied review comments 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
« no previous file with comments | « Source/core/html/canvas/CanvasStyle.h ('k') | Source/platform/graphics/DrawLooperBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a6a433670208250818959c47780dfd3da0de6e85 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 Color::black;
+}
+
DEFINE_TRACE(CanvasStyle)
{
visitor->trace(m_gradient);
« no previous file with comments | « Source/core/html/canvas/CanvasStyle.h ('k') | Source/platform/graphics/DrawLooperBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698