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

Unified 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, 5 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
Index: Source/core/style/SVGComputedStyle.cpp
diff --git a/Source/core/style/SVGComputedStyle.cpp b/Source/core/style/SVGComputedStyle.cpp
index 36b237672bf134d7b8ec97ba5448eca2edf3e5b1..14e437c5d0f911bd158d5fe39e99fc02da0f5dbe 100644
--- a/Source/core/style/SVGComputedStyle.cpp
+++ b/Source/core/style/SVGComputedStyle.cpp
@@ -236,7 +236,7 @@ bool SVGComputedStyle::diffNeedsPaintInvalidation(const SVGComputedStyle* other)
|| svg_inherited_flags._fillRule != other->svg_inherited_flags._fillRule
|| svg_inherited_flags._colorInterpolation != other->svg_inherited_flags._colorInterpolation
|| svg_inherited_flags._colorInterpolationFilters != other->svg_inherited_flags._colorInterpolationFilters
- || svg_inherited_flags._paintOrder != other->svg_inherited_flags._paintOrder)
+ || svg_inherited_flags.paintOrder != other->svg_inherited_flags.paintOrder)
return true;
if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_flags.f.bufferedRendering)
@@ -250,8 +250,32 @@ bool SVGComputedStyle::diffNeedsPaintInvalidation(const SVGComputedStyle* other)
EPaintOrderType SVGComputedStyle::paintOrderType(unsigned index) const
{
+ const int kPaintOrderBitwidth = 2;
+ unsigned pt = 0;
ASSERT(index < ((1 << kPaintOrderBitwidth)-1));
- unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaintOrderBitwidth) - 1);
+ switch (this->paintOrder()) {
+ case PaintOrderNormal:
+ case PaintOrderFillStrokeMarkers:
+ pt = (((PT_MARKERS << kPaintOrderBitwidth) | PT_STROKE) << kPaintOrderBitwidth) | 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.
+ break;
+ case PaintOrderFillMarkersStroke:
+ pt = (((PT_STROKE << kPaintOrderBitwidth) | PT_MARKERS) << kPaintOrderBitwidth) | PT_FILL;
+ break;
+ case PaintOrderStrokeFillMarkers:
+ pt = (((PT_MARKERS << kPaintOrderBitwidth) | PT_FILL) << kPaintOrderBitwidth) | PT_STROKE;
+ break;
+ case PaintOrderStrokeMarkersFill:
+ pt = (((PT_FILL << kPaintOrderBitwidth) | PT_MARKERS) << kPaintOrderBitwidth) | PT_STROKE;
+ break;
+ case PaintOrderMarkersFillStroke:
+ pt = (((PT_STROKE << kPaintOrderBitwidth) | PT_FILL) << kPaintOrderBitwidth) | PT_MARKERS;
+ break;
+ case PaintOrderMarkersStrokeFill:
+ pt = (((PT_FILL << kPaintOrderBitwidth) | PT_STROKE) << kPaintOrderBitwidth) | PT_MARKERS;
+ break;
+ }
+
+ pt = (pt >> (kPaintOrderBitwidth*index)) & ((1u << kPaintOrderBitwidth) - 1);
return (EPaintOrderType)pt;
}

Powered by Google App Engine
This is Rietveld 408576698