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

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: Align with review comments 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
« no previous file with comments | « Source/core/style/SVGComputedStyle.h ('k') | Source/core/style/SVGComputedStyleDefs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/style/SVGComputedStyle.cpp
diff --git a/Source/core/style/SVGComputedStyle.cpp b/Source/core/style/SVGComputedStyle.cpp
index 36b237672bf134d7b8ec97ba5448eca2edf3e5b1..8c282a2e820bfed377c49bf2a8720cc8ffe85172 100644
--- a/Source/core/style/SVGComputedStyle.cpp
+++ b/Source/core/style/SVGComputedStyle.cpp
@@ -31,6 +31,8 @@
namespace blink {
+static const int kPaintOrderBitwidth = 2;
+
SVGComputedStyle::SVGComputedStyle()
{
static SVGComputedStyle* initialStyle = new SVGComputedStyle(CreateInitial);
@@ -236,7 +238,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)
@@ -248,10 +250,38 @@ bool SVGComputedStyle::diffNeedsPaintInvalidation(const SVGComputedStyle* other)
return false;
}
+unsigned paintOrderSequence(EPaintOrderType first, EPaintOrderType second, EPaintOrderType third)
+{
+ return (((third << kPaintOrderBitwidth) | second) << kPaintOrderBitwidth) | first;
+}
+
EPaintOrderType SVGComputedStyle::paintOrderType(unsigned index) const
{
+ unsigned pt = 0;
ASSERT(index < ((1 << kPaintOrderBitwidth)-1));
- unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaintOrderBitwidth) - 1);
+ switch (this->paintOrder()) {
+ case PaintOrderNormal:
+ case PaintOrderFillStrokeMarkers:
+ pt = paintOrderSequence(PT_FILL, PT_STROKE, PT_MARKERS);
+ break;
+ case PaintOrderFillMarkersStroke:
+ pt = paintOrderSequence(PT_FILL, PT_MARKERS, PT_STROKE);
+ break;
+ case PaintOrderStrokeFillMarkers:
+ pt = paintOrderSequence(PT_STROKE, PT_FILL, PT_MARKERS);
+ break;
+ case PaintOrderStrokeMarkersFill:
+ pt = paintOrderSequence(PT_STROKE, PT_MARKERS, PT_FILL);
+ break;
+ case PaintOrderMarkersFillStroke:
+ pt = paintOrderSequence(PT_MARKERS, PT_FILL, PT_STROKE);
+ break;
+ case PaintOrderMarkersStrokeFill:
+ pt = paintOrderSequence(PT_MARKERS, PT_STROKE, PT_FILL);
+ break;
+ }
+
+ pt = (pt >> (kPaintOrderBitwidth*index)) & ((1u << kPaintOrderBitwidth) - 1);
return (EPaintOrderType)pt;
}
« 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