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

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: small nits 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
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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (stops != other->stops) 229 if (stops != other->stops)
230 return true; 230 return true;
231 231
232 // Changes of these flags only cause paint invalidations. 232 // Changes of these flags only cause paint invalidations.
233 if (svg_inherited_flags._colorRendering != other->svg_inherited_flags._color Rendering 233 if (svg_inherited_flags._colorRendering != other->svg_inherited_flags._color Rendering
234 || svg_inherited_flags._shapeRendering != other->svg_inherited_flags._sh apeRendering 234 || svg_inherited_flags._shapeRendering != other->svg_inherited_flags._sh apeRendering
235 || svg_inherited_flags._clipRule != other->svg_inherited_flags._clipRule 235 || svg_inherited_flags._clipRule != other->svg_inherited_flags._clipRule
236 || svg_inherited_flags._fillRule != other->svg_inherited_flags._fillRule 236 || svg_inherited_flags._fillRule != other->svg_inherited_flags._fillRule
237 || svg_inherited_flags._colorInterpolation != other->svg_inherited_flags ._colorInterpolation 237 || svg_inherited_flags._colorInterpolation != other->svg_inherited_flags ._colorInterpolation
238 || svg_inherited_flags._colorInterpolationFilters != other->svg_inherite d_flags._colorInterpolationFilters 238 || svg_inherited_flags._colorInterpolationFilters != other->svg_inherite d_flags._colorInterpolationFilters
239 || svg_inherited_flags._paintOrder != other->svg_inherited_flags._paintO rder) 239 || svg_inherited_flags.paintOrder != other->svg_inherited_flags.paintOrd er)
240 return true; 240 return true;
241 241
242 if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_fl ags.f.bufferedRendering) 242 if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_fl ags.f.bufferedRendering)
243 return true; 243 return true;
244 244
245 if (svg_noninherited_flags.f.maskType != other->svg_noninherited_flags.f.mas kType) 245 if (svg_noninherited_flags.f.maskType != other->svg_noninherited_flags.f.mas kType)
246 return true; 246 return true;
247 247
248 return false; 248 return false;
249 } 249 }
250 250
251 EPaintOrderType SVGComputedStyle::paintOrderType(unsigned index) const 251 EPaintOrderType SVGComputedStyle::paintOrderType(unsigned index) const
252 { 252 {
253 const int kPaintOrderBitwidth = 2;
254 unsigned pt = 0;
253 ASSERT(index < ((1 << kPaintOrderBitwidth)-1)); 255 ASSERT(index < ((1 << kPaintOrderBitwidth)-1));
254 unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaint OrderBitwidth) - 1); 256 switch (this->paintOrder()) {
257 case PaintOrderNormal:
258 case PaintOrderFillStrokeMarkers:
259 pt = (((PT_MARKERS << kPaintOrderBitwidth) | PT_STROKE) << kPaintOrderBi twidth) | PT_FILL;
fs 2015/07/30 14:39:37 This doesn't read very well IMO, either a helper:
Shanmuga Pandi 2015/07/31 08:44:50 Done.
260 break;
261 case PaintOrderFillMarkersStroke:
262 pt = (((PT_STROKE << kPaintOrderBitwidth) | PT_MARKERS) << kPaintOrderBi twidth) | PT_FILL;
263 break;
264 case PaintOrderStrokeFillMarkers:
265 pt = (((PT_MARKERS << kPaintOrderBitwidth) | PT_FILL) << kPaintOrderBitw idth) | PT_STROKE;
266 break;
267 case PaintOrderStrokeMarkersFill:
268 pt = (((PT_FILL << kPaintOrderBitwidth) | PT_MARKERS) << kPaintOrderBitw idth) | PT_STROKE;
269 break;
270 case PaintOrderMarkersFillStroke:
271 pt = (((PT_STROKE << kPaintOrderBitwidth) | PT_FILL) << kPaintOrderBitwi dth) | PT_MARKERS;
272 break;
273 case PaintOrderMarkersStrokeFill:
274 pt = (((PT_FILL << kPaintOrderBitwidth) | PT_STROKE) << kPaintOrderBitwi dth) | PT_MARKERS;
275 break;
276 }
277
278 pt = (pt >> (kPaintOrderBitwidth*index)) & ((1u << kPaintOrderBitwidth) - 1) ;
255 return (EPaintOrderType)pt; 279 return (EPaintOrderType)pt;
256 } 280 }
257 281
258 } 282 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698