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

Side by Side Diff: Source/core/paint/SVGShapePainter.cpp

Issue 900463002: Make SVG painting independent of GraphicsContext's alpha state (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address reviewer comments Created 5 years, 10 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/SVGShapePainter.h" 6 #include "core/paint/SVGShapePainter.h"
7 7
8 #include "core/paint/GraphicsContextAnnotator.h" 8 #include "core/paint/GraphicsContextAnnotator.h"
9 #include "core/paint/ObjectPainter.h" 9 #include "core/paint/ObjectPainter.h"
10 #include "core/paint/RenderDrawingRecorder.h" 10 #include "core/paint/RenderDrawingRecorder.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 { 48 {
49 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderSVGShape); 49 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderSVGShape);
50 if (paintInfo.phase != PaintPhaseForeground 50 if (paintInfo.phase != PaintPhaseForeground
51 || m_renderSVGShape.style()->visibility() == HIDDEN 51 || m_renderSVGShape.style()->visibility() == HIDDEN
52 || m_renderSVGShape.isShapeEmpty()) 52 || m_renderSVGShape.isShapeEmpty())
53 return; 53 return;
54 54
55 PaintInfo paintInfoBeforeFiltering(paintInfo); 55 PaintInfo paintInfoBeforeFiltering(paintInfo);
56 FloatRect boundingBox = m_renderSVGShape.paintInvalidationRectInLocalCoordin ates(); 56 FloatRect boundingBox = m_renderSVGShape.paintInvalidationRectInLocalCoordin ates();
57 57
58 // FIXME: Remove this state saver when SVGRenderSupport::updateGraphicsConte xt
59 // no longer affects the global alpha state. See crbug.com/453225
60 GraphicsContextStateSaver stateSaver(*paintInfoBeforeFiltering.context);
61
62 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_ren derSVGShape.displayItemClient(), m_renderSVGShape.localTransform()); 58 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_ren derSVGShape.displayItemClient(), m_renderSVGShape.localTransform());
63 { 59 {
64 SVGRenderingContext renderingContext(m_renderSVGShape, paintInfoBeforeFi ltering); 60 SVGRenderingContext renderingContext(m_renderSVGShape, paintInfoBeforeFi ltering);
65 if (renderingContext.applyClipMaskAndFilterIfNecessary()) { 61 if (renderingContext.applyClipMaskAndFilterIfNecessary()) {
66 RenderDrawingRecorder recorder(renderingContext.paintInfo().context, m_renderSVGShape, renderingContext.paintInfo().phase, boundingBox); 62 RenderDrawingRecorder recorder(renderingContext.paintInfo().context, m_renderSVGShape, renderingContext.paintInfo().phase, boundingBox);
67 if (!recorder.canUseCachedDrawing()) { 63 if (!recorder.canUseCachedDrawing()) {
68 const SVGRenderStyle& svgStyle = m_renderSVGShape.style()->svgSt yle(); 64 const SVGRenderStyle& svgStyle = m_renderSVGShape.style()->svgSt yle();
69 if (svgStyle.shapeRendering() == SR_CRISPEDGES) 65 if (svgStyle.shapeRendering() == SR_CRISPEDGES)
70 renderingContext.paintInfo().context->setShouldAntialias(fal se); 66 renderingContext.paintInfo().context->setShouldAntialias(fal se);
71 67
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 tempPath.clear(); 230 tempPath.clear();
235 if (m_renderSVGShape.style()->svgStyle().capStyle() == SquareCap) 231 if (m_renderSVGShape.style()->svgStyle().capStyle() == SquareCap)
236 tempPath.addRect(RenderSVGPath::zeroLengthSubpathRect(linecapPosition, m _renderSVGShape.strokeWidth())); 232 tempPath.addRect(RenderSVGPath::zeroLengthSubpathRect(linecapPosition, m _renderSVGShape.strokeWidth()));
237 else 233 else
238 tempPath.addEllipse(RenderSVGPath::zeroLengthSubpathRect(linecapPosition , m_renderSVGShape.strokeWidth())); 234 tempPath.addEllipse(RenderSVGPath::zeroLengthSubpathRect(linecapPosition , m_renderSVGShape.strokeWidth()));
239 235
240 return &tempPath; 236 return &tempPath;
241 } 237 }
242 238
243 } // namespace blink 239 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/SVGRootInlineBoxPainter.cpp ('k') | Source/core/rendering/svg/RenderSVGResourcePaintServer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698