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

Side by Side Diff: Source/core/style/SVGComputedStyle.cpp

Issue 1252933003: Shrink SVG paint-order to take less bits (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Align with review comments Created 5 years, 4 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
« no previous file with comments | « Source/core/style/SVGComputedStyle.h ('k') | Source/core/style/SVGComputedStyleDefs.h » ('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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005, 2010 Rob Buis <buis@kde.org> 3 2004, 2005, 2010 Rob Buis <buis@kde.org>
4 Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 5
6 Based on khtml code by: 6 Based on khtml code by:
7 Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 7 Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
8 Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) 8 Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
9 Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org) 9 Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org)
10 Copyright (C) 2002 Apple Computer, Inc. 10 Copyright (C) 2002 Apple Computer, Inc.
(...skipping 13 matching lines...) Expand all
24 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 Boston, MA 02110-1301, USA. 25 Boston, MA 02110-1301, USA.
26 */ 26 */
27 27
28 #include "config.h" 28 #include "config.h"
29 29
30 #include "core/style/SVGComputedStyle.h" 30 #include "core/style/SVGComputedStyle.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 static const int kPaintOrderBitwidth = 2;
35
34 SVGComputedStyle::SVGComputedStyle() 36 SVGComputedStyle::SVGComputedStyle()
35 { 37 {
36 static SVGComputedStyle* initialStyle = new SVGComputedStyle(CreateInitial); 38 static SVGComputedStyle* initialStyle = new SVGComputedStyle(CreateInitial);
37 39
38 fill = initialStyle->fill; 40 fill = initialStyle->fill;
39 stroke = initialStyle->stroke; 41 stroke = initialStyle->stroke;
40 stops = initialStyle->stops; 42 stops = initialStyle->stops;
41 misc = initialStyle->misc; 43 misc = initialStyle->misc;
42 inheritedResources = initialStyle->inheritedResources; 44 inheritedResources = initialStyle->inheritedResources;
43 layout = initialStyle->layout; 45 layout = initialStyle->layout;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (stops != other->stops) 231 if (stops != other->stops)
230 return true; 232 return true;
231 233
232 // Changes of these flags only cause paint invalidations. 234 // Changes of these flags only cause paint invalidations.
233 if (svg_inherited_flags._colorRendering != other->svg_inherited_flags._color Rendering 235 if (svg_inherited_flags._colorRendering != other->svg_inherited_flags._color Rendering
234 || svg_inherited_flags._shapeRendering != other->svg_inherited_flags._sh apeRendering 236 || svg_inherited_flags._shapeRendering != other->svg_inherited_flags._sh apeRendering
235 || svg_inherited_flags._clipRule != other->svg_inherited_flags._clipRule 237 || svg_inherited_flags._clipRule != other->svg_inherited_flags._clipRule
236 || svg_inherited_flags._fillRule != other->svg_inherited_flags._fillRule 238 || svg_inherited_flags._fillRule != other->svg_inherited_flags._fillRule
237 || svg_inherited_flags._colorInterpolation != other->svg_inherited_flags ._colorInterpolation 239 || svg_inherited_flags._colorInterpolation != other->svg_inherited_flags ._colorInterpolation
238 || svg_inherited_flags._colorInterpolationFilters != other->svg_inherite d_flags._colorInterpolationFilters 240 || svg_inherited_flags._colorInterpolationFilters != other->svg_inherite d_flags._colorInterpolationFilters
239 || svg_inherited_flags._paintOrder != other->svg_inherited_flags._paintO rder) 241 || svg_inherited_flags.paintOrder != other->svg_inherited_flags.paintOrd er)
240 return true; 242 return true;
241 243
242 if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_fl ags.f.bufferedRendering) 244 if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_fl ags.f.bufferedRendering)
243 return true; 245 return true;
244 246
245 if (svg_noninherited_flags.f.maskType != other->svg_noninherited_flags.f.mas kType) 247 if (svg_noninherited_flags.f.maskType != other->svg_noninherited_flags.f.mas kType)
246 return true; 248 return true;
247 249
248 return false; 250 return false;
249 } 251 }
250 252
253 unsigned paintOrderSequence(EPaintOrderType first, EPaintOrderType second, EPain tOrderType third)
254 {
255 return (((third << kPaintOrderBitwidth) | second) << kPaintOrderBitwidth) | first;
256 }
257
251 EPaintOrderType SVGComputedStyle::paintOrderType(unsigned index) const 258 EPaintOrderType SVGComputedStyle::paintOrderType(unsigned index) const
252 { 259 {
260 unsigned pt = 0;
253 ASSERT(index < ((1 << kPaintOrderBitwidth)-1)); 261 ASSERT(index < ((1 << kPaintOrderBitwidth)-1));
254 unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaint OrderBitwidth) - 1); 262 switch (this->paintOrder()) {
263 case PaintOrderNormal:
264 case PaintOrderFillStrokeMarkers:
265 pt = paintOrderSequence(PT_FILL, PT_STROKE, PT_MARKERS);
266 break;
267 case PaintOrderFillMarkersStroke:
268 pt = paintOrderSequence(PT_FILL, PT_MARKERS, PT_STROKE);
269 break;
270 case PaintOrderStrokeFillMarkers:
271 pt = paintOrderSequence(PT_STROKE, PT_FILL, PT_MARKERS);
272 break;
273 case PaintOrderStrokeMarkersFill:
274 pt = paintOrderSequence(PT_STROKE, PT_MARKERS, PT_FILL);
275 break;
276 case PaintOrderMarkersFillStroke:
277 pt = paintOrderSequence(PT_MARKERS, PT_FILL, PT_STROKE);
278 break;
279 case PaintOrderMarkersStrokeFill:
280 pt = paintOrderSequence(PT_MARKERS, PT_STROKE, PT_FILL);
281 break;
282 }
283
284 pt = (pt >> (kPaintOrderBitwidth*index)) & ((1u << kPaintOrderBitwidth) - 1) ;
255 return (EPaintOrderType)pt; 285 return (EPaintOrderType)pt;
256 } 286 }
257 287
258 } 288 }
OLDNEW
« no previous file with comments | « Source/core/style/SVGComputedStyle.h ('k') | Source/core/style/SVGComputedStyleDefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698