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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/canvas/CanvasStyle.h ('k') | Source/platform/graphics/DrawLooperBuilder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 break; 138 break;
139 case Gradient: 139 case Gradient:
140 context->setFillGradient(canvasGradient()->gradient()); 140 context->setFillGradient(canvasGradient()->gradient());
141 break; 141 break;
142 case ImagePattern: 142 case ImagePattern:
143 context->setFillPattern(canvasPattern()->pattern()); 143 context->setFillPattern(canvasPattern()->pattern());
144 break; 144 break;
145 } 145 }
146 } 146 }
147 147
148 SkShader* CanvasStyle::shader() const
149 {
150 switch (m_type) {
151 case ColorRGBA:
152 return nullptr;
153 case Gradient:
154 return canvasGradient()->gradient()->shader();
155 case ImagePattern:
156 return canvasPattern()->pattern()->shader();
157 default:
158 ASSERT_NOT_REACHED();
159 }
160 return nullptr;
161 }
162
163 RGBA32 CanvasStyle::paintColor() const
164 {
165 if (m_type == ColorRGBA)
166 return m_rgba;
167 ASSERT(m_type == Gradient || m_type == ImagePattern);
168 return Color::black;
169 }
170
148 DEFINE_TRACE(CanvasStyle) 171 DEFINE_TRACE(CanvasStyle)
149 { 172 {
150 visitor->trace(m_gradient); 173 visitor->trace(m_gradient);
151 visitor->trace(m_pattern); 174 visitor->trace(m_pattern);
152 } 175 }
153 176
154 } 177 }
OLDNEW
« 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