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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResource.cpp

Issue 637503003: Prefer using RenderSVGResourceMode when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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/paint/SVGInlineTextBoxPainter.cpp ('k') | no next file » | 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 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ASSERT(context); 135 ASSERT(context);
136 ASSERT(style); 136 ASSERT(style);
137 137
138 RenderSVGResourceMode resourceMode = static_cast<RenderSVGResourceMode>(reso urceModeFlags & (ApplyToFillMode | ApplyToStrokeMode)); 138 RenderSVGResourceMode resourceMode = static_cast<RenderSVGResourceMode>(reso urceModeFlags & (ApplyToFillMode | ApplyToStrokeMode));
139 ASSERT(resourceMode == ApplyToFillMode || resourceMode == ApplyToStrokeMode) ; 139 ASSERT(resourceMode == ApplyToFillMode || resourceMode == ApplyToStrokeMode) ;
140 140
141 if (SVGRenderSupport::isRenderingClipPathAsMaskImage(renderer)) { 141 if (SVGRenderSupport::isRenderingClipPathAsMaskImage(renderer)) {
142 // When rendering the mask for a RenderSVGResourceClipper, the stroke co de path is never hit. 142 // When rendering the mask for a RenderSVGResourceClipper, the stroke co de path is never hit.
143 ASSERT(resourceMode == ApplyToFillMode); 143 ASSERT(resourceMode == ApplyToFillMode);
144 context->setAlphaAsFloat(1); 144 context->setAlphaAsFloat(1);
145 if (resourceModeFlags & ApplyToTextMode)
146 context->setTextDrawingMode(TextModeFill);
147 return; 145 return;
148 } 146 }
149 147
150 const SVGRenderStyle& svgStyle = style->svgStyle(); 148 const SVGRenderStyle& svgStyle = style->svgStyle();
151 149
152 if (resourceMode == ApplyToFillMode) { 150 if (resourceMode == ApplyToFillMode) {
153 context->setAlphaAsFloat(svgStyle.fillOpacity()); 151 context->setAlphaAsFloat(svgStyle.fillOpacity());
154 context->setFillRule(svgStyle.fillRule()); 152 context->setFillRule(svgStyle.fillRule());
155 } else { 153 } else {
156 context->setAlphaAsFloat(svgStyle.strokeOpacity()); 154 context->setAlphaAsFloat(svgStyle.strokeOpacity());
157 SVGRenderSupport::applyStrokeStyleToContext(context, style, &renderer); 155 SVGRenderSupport::applyStrokeStyleToContext(context, style, &renderer);
158 } 156 }
159
160 if (resourceModeFlags & ApplyToTextMode)
161 context->setTextDrawingMode(resourceMode == ApplyToFillMode ? TextModeFi ll : TextModeStroke);
162 } 157 }
163 158
164 RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource() 159 RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource()
165 { 160 {
166 static RenderSVGResourceSolidColor* s_sharedSolidPaintingResource = 0; 161 static RenderSVGResourceSolidColor* s_sharedSolidPaintingResource = 0;
167 if (!s_sharedSolidPaintingResource) 162 if (!s_sharedSolidPaintingResource)
168 s_sharedSolidPaintingResource = new RenderSVGResourceSolidColor; 163 s_sharedSolidPaintingResource = new RenderSVGResourceSolidColor;
169 return s_sharedSolidPaintingResource; 164 return s_sharedSolidPaintingResource;
170 } 165 }
171 166
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // This will process the rest of the ancestors. 224 // This will process the rest of the ancestors.
230 toRenderSVGResourceContainer(current)->removeAllClientsFromCache(); 225 toRenderSVGResourceContainer(current)->removeAllClientsFromCache();
231 break; 226 break;
232 } 227 }
233 228
234 current = current->parent(); 229 current = current->parent();
235 } 230 }
236 } 231 }
237 232
238 } 233 }
OLDNEW
« no previous file with comments | « Source/core/paint/SVGInlineTextBoxPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698