| OLD | NEW |
| 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/layout/svg/LayoutSVGPath.h" | 8 #include "core/layout/svg/LayoutSVGPath.h" |
| 9 #include "core/layout/svg/LayoutSVGResourceMarker.h" | 9 #include "core/layout/svg/LayoutSVGResourceMarker.h" |
| 10 #include "core/layout/svg/LayoutSVGShape.h" | 10 #include "core/layout/svg/LayoutSVGShape.h" |
| 11 #include "core/layout/svg/SVGLayoutSupport.h" | 11 #include "core/layout/svg/SVGLayoutSupport.h" |
| 12 #include "core/layout/svg/SVGMarkerData.h" | 12 #include "core/layout/svg/SVGMarkerData.h" |
| 13 #include "core/layout/svg/SVGResources.h" | 13 #include "core/layout/svg/SVGResources.h" |
| 14 #include "core/layout/svg/SVGResourcesCache.h" | 14 #include "core/layout/svg/SVGResourcesCache.h" |
| 15 #include "core/paint/GraphicsContextAnnotator.h" | |
| 16 #include "core/paint/LayoutObjectDrawingRecorder.h" | 15 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 17 #include "core/paint/ObjectPainter.h" | 16 #include "core/paint/ObjectPainter.h" |
| 18 #include "core/paint/PaintInfo.h" | 17 #include "core/paint/PaintInfo.h" |
| 19 #include "core/paint/SVGContainerPainter.h" | 18 #include "core/paint/SVGContainerPainter.h" |
| 20 #include "core/paint/SVGPaintContext.h" | 19 #include "core/paint/SVGPaintContext.h" |
| 21 #include "core/paint/TransformRecorder.h" | 20 #include "core/paint/TransformRecorder.h" |
| 22 #include "platform/graphics/paint/DisplayItemListContextRecorder.h" | 21 #include "platform/graphics/paint/DisplayItemListContextRecorder.h" |
| 23 #include "third_party/skia/include/core/SkPaint.h" | 22 #include "third_party/skia/include/core/SkPaint.h" |
| 24 #include "third_party/skia/include/core/SkPicture.h" | 23 #include "third_party/skia/include/core/SkPicture.h" |
| 25 | 24 |
| 26 namespace blink { | 25 namespace blink { |
| 27 | 26 |
| 28 static bool setupNonScalingStrokeContext(AffineTransform& strokeTransform, Graph
icsContextStateSaver& stateSaver) | 27 static bool setupNonScalingStrokeContext(AffineTransform& strokeTransform, Graph
icsContextStateSaver& stateSaver) |
| 29 { | 28 { |
| 30 if (!strokeTransform.isInvertible()) | 29 if (!strokeTransform.isInvertible()) |
| 31 return false; | 30 return false; |
| 32 | 31 |
| 33 stateSaver.save(); | 32 stateSaver.save(); |
| 34 stateSaver.context()->concatCTM(strokeTransform.inverse()); | 33 stateSaver.context()->concatCTM(strokeTransform.inverse()); |
| 35 return true; | 34 return true; |
| 36 } | 35 } |
| 37 | 36 |
| 38 static SkPath::FillType fillRuleFromStyle(const PaintInfo& paintInfo, const SVGC
omputedStyle& svgStyle) | 37 static SkPath::FillType fillRuleFromStyle(const PaintInfo& paintInfo, const SVGC
omputedStyle& svgStyle) |
| 39 { | 38 { |
| 40 return WebCoreWindRuleToSkFillType(paintInfo.isRenderingClipPathAsMaskImage(
) ? svgStyle.clipRule() : svgStyle.fillRule()); | 39 return WebCoreWindRuleToSkFillType(paintInfo.isRenderingClipPathAsMaskImage(
) ? svgStyle.clipRule() : svgStyle.fillRule()); |
| 41 } | 40 } |
| 42 | 41 |
| 43 void SVGShapePainter::paint(const PaintInfo& paintInfo) | 42 void SVGShapePainter::paint(const PaintInfo& paintInfo) |
| 44 { | 43 { |
| 45 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_layoutSVGShape); | |
| 46 if (paintInfo.phase != PaintPhaseForeground | 44 if (paintInfo.phase != PaintPhaseForeground |
| 47 || m_layoutSVGShape.style()->visibility() == HIDDEN | 45 || m_layoutSVGShape.style()->visibility() == HIDDEN |
| 48 || m_layoutSVGShape.isShapeEmpty()) | 46 || m_layoutSVGShape.isShapeEmpty()) |
| 49 return; | 47 return; |
| 50 | 48 |
| 51 PaintInfo paintInfoBeforeFiltering(paintInfo); | 49 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 52 FloatRect boundingBox = m_layoutSVGShape.paintInvalidationRectInLocalCoordin
ates(); | 50 FloatRect boundingBox = m_layoutSVGShape.paintInvalidationRectInLocalCoordin
ates(); |
| 53 | 51 |
| 54 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay
outSVGShape, m_layoutSVGShape.localTransform()); | 52 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay
outSVGShape, m_layoutSVGShape.localTransform()); |
| 55 { | 53 { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // This open-codes LayoutSVGShape::nonScalingStrokePath, because the | 245 // This open-codes LayoutSVGShape::nonScalingStrokePath, because the |
| 248 // requirements here differ (we have a temporary path that we can | 246 // requirements here differ (we have a temporary path that we can |
| 249 // mutate.) | 247 // mutate.) |
| 250 if (m_layoutSVGShape.hasNonScalingStroke()) | 248 if (m_layoutSVGShape.hasNonScalingStroke()) |
| 251 tempPath.transform(nonScalingTransform); | 249 tempPath.transform(nonScalingTransform); |
| 252 context->drawPath(tempPath.skPath(), fillPaint); | 250 context->drawPath(tempPath.skPath(), fillPaint); |
| 253 } | 251 } |
| 254 } | 252 } |
| 255 | 253 |
| 256 } // namespace blink | 254 } // namespace blink |
| OLD | NEW |