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

Unified Diff: Source/core/paint/SVGShapePainter.cpp

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase 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/paint/SVGRootInlineBoxPainter.cpp ('k') | Source/core/paint/ScrollableAreaPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/SVGShapePainter.cpp
diff --git a/Source/core/paint/SVGShapePainter.cpp b/Source/core/paint/SVGShapePainter.cpp
index 3219d0d0039be14e802b5bd5ab85c00fefa145b8..81f154e2b22afe61ebfd19b85f611883ca9cadd5 100644
--- a/Source/core/paint/SVGShapePainter.cpp
+++ b/Source/core/paint/SVGShapePainter.cpp
@@ -57,57 +57,55 @@ void SVGShapePainter::paint(const PaintInfo& paintInfo)
TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_layoutSVGShape, m_layoutSVGShape.localTransform());
{
SVGPaintContext paintContext(m_layoutSVGShape, paintInfoBeforeFiltering);
- if (paintContext.applyClipMaskAndFilterIfNecessary()) {
+ if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintContext.paintInfo().context, m_layoutSVGShape, paintContext.paintInfo().phase)) {
LayoutObjectDrawingRecorder recorder(*paintContext.paintInfo().context, m_layoutSVGShape, paintContext.paintInfo().phase, boundingBox);
- if (!recorder.canUseCachedDrawing()) {
- const SVGComputedStyle& svgStyle = m_layoutSVGShape.style()->svgStyle();
+ const SVGComputedStyle& svgStyle = m_layoutSVGShape.style()->svgStyle();
- bool shouldAntiAlias = svgStyle.shapeRendering() != SR_CRISPEDGES;
+ bool shouldAntiAlias = svgStyle.shapeRendering() != SR_CRISPEDGES;
- for (int i = 0; i < 3; i++) {
- switch (svgStyle.paintOrderType(i)) {
- case PT_FILL: {
- SkPaint fillPaint;
- if (!SVGPaintContext::paintForLayoutObject(paintContext.paintInfo(), m_layoutSVGShape.styleRef(), m_layoutSVGShape, ApplyToFillMode, fillPaint))
- break;
- fillPaint.setAntiAlias(shouldAntiAlias);
- fillShape(paintContext.paintInfo().context, fillPaint, fillRuleFromStyle(paintContext.paintInfo(), svgStyle));
+ for (int i = 0; i < 3; i++) {
+ switch (svgStyle.paintOrderType(i)) {
+ case PT_FILL: {
+ SkPaint fillPaint;
+ if (!SVGPaintContext::paintForLayoutObject(paintContext.paintInfo(), m_layoutSVGShape.styleRef(), m_layoutSVGShape, ApplyToFillMode, fillPaint))
break;
- }
- case PT_STROKE:
- if (svgStyle.hasVisibleStroke()) {
- GraphicsContextStateSaver stateSaver(*paintContext.paintInfo().context, false);
- AffineTransform nonScalingTransform;
- const AffineTransform* additionalPaintServerTransform = 0;
-
- if (m_layoutSVGShape.hasNonScalingStroke()) {
- nonScalingTransform = m_layoutSVGShape.nonScalingStrokeTransform();
- if (!setupNonScalingStrokeContext(nonScalingTransform, stateSaver))
- return;
-
- // Non-scaling stroke needs to reset the transform back to the host transform.
- additionalPaintServerTransform = &nonScalingTransform;
- }
-
- SkPaint strokePaint;
- if (!SVGPaintContext::paintForLayoutObject(paintContext.paintInfo(), m_layoutSVGShape.styleRef(), m_layoutSVGShape, ApplyToStrokeMode, strokePaint, additionalPaintServerTransform))
- break;
- strokePaint.setAntiAlias(shouldAntiAlias);
-
- StrokeData strokeData;
- SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, m_layoutSVGShape.styleRef(), m_layoutSVGShape);
- strokeData.setupPaint(&strokePaint);
-
- strokeShape(paintContext.paintInfo().context, strokePaint);
+ fillPaint.setAntiAlias(shouldAntiAlias);
+ fillShape(paintContext.paintInfo().context, fillPaint, fillRuleFromStyle(paintContext.paintInfo(), svgStyle));
+ break;
+ }
+ case PT_STROKE:
+ if (svgStyle.hasVisibleStroke()) {
+ GraphicsContextStateSaver stateSaver(*paintContext.paintInfo().context, false);
+ AffineTransform nonScalingTransform;
+ const AffineTransform* additionalPaintServerTransform = 0;
+
+ if (m_layoutSVGShape.hasNonScalingStroke()) {
+ nonScalingTransform = m_layoutSVGShape.nonScalingStrokeTransform();
+ if (!setupNonScalingStrokeContext(nonScalingTransform, stateSaver))
+ return;
+
+ // Non-scaling stroke needs to reset the transform back to the host transform.
+ additionalPaintServerTransform = &nonScalingTransform;
}
- break;
- case PT_MARKERS:
- paintMarkers(paintContext.paintInfo(), boundingBox);
- break;
- default:
- ASSERT_NOT_REACHED();
- break;
+
+ SkPaint strokePaint;
+ if (!SVGPaintContext::paintForLayoutObject(paintContext.paintInfo(), m_layoutSVGShape.styleRef(), m_layoutSVGShape, ApplyToStrokeMode, strokePaint, additionalPaintServerTransform))
+ break;
+ strokePaint.setAntiAlias(shouldAntiAlias);
+
+ StrokeData strokeData;
+ SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, m_layoutSVGShape.styleRef(), m_layoutSVGShape);
+ strokeData.setupPaint(&strokePaint);
+
+ strokeShape(paintContext.paintInfo().context, strokePaint);
}
+ break;
+ case PT_MARKERS:
+ paintMarkers(paintContext.paintInfo(), boundingBox);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
}
}
}
« no previous file with comments | « Source/core/paint/SVGRootInlineBoxPainter.cpp ('k') | Source/core/paint/ScrollableAreaPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698