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/SVGRootPainter.h" | 6 #include "core/paint/SVGRootPainter.h" |
7 | 7 |
8 #include "core/layout/PaintInfo.h" | 8 #include "core/layout/PaintInfo.h" |
9 #include "core/layout/svg/LayoutSVGRoot.h" | 9 #include "core/layout/svg/LayoutSVGRoot.h" |
10 #include "core/layout/svg/SVGResources.h" | 10 #include "core/layout/svg/SVGResources.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj
ect(&m_renderSVGRoot); | 39 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj
ect(&m_renderSVGRoot); |
40 if (!resources || !resources->filter()) | 40 if (!resources || !resources->filter()) |
41 return; | 41 return; |
42 } | 42 } |
43 | 43 |
44 PaintInfo paintInfoBeforeFiltering(paintInfo); | 44 PaintInfo paintInfoBeforeFiltering(paintInfo); |
45 | 45 |
46 // Apply initial viewport clip. | 46 // Apply initial viewport clip. |
47 OwnPtr<ClipRecorder> clipRecorder; | 47 OwnPtr<ClipRecorder> clipRecorder; |
48 if (m_renderSVGRoot.shouldApplyViewportClip()) | 48 if (m_renderSVGRoot.shouldApplyViewportClip()) |
49 clipRecorder = adoptPtr(new ClipRecorder(m_renderSVGRoot.displayItemClie
nt(), paintInfoBeforeFiltering.context, paintInfoBeforeFiltering.displayItemType
ForClipping(), pixelSnappedIntRect(m_renderSVGRoot.overflowClipRect(paintOffset)
))); | 49 clipRecorder = adoptPtr(new ClipRecorder(m_renderSVGRoot.displayItemClie
nt(), paintInfoBeforeFiltering.context, paintInfoBeforeFiltering.displayItemType
ForClipping(), LayoutRect(pixelSnappedIntRect(m_renderSVGRoot.overflowClipRect(p
aintOffset))))); |
50 | 50 |
51 // Convert from container offsets (html renderers) to a relative transform (
svg renderers). | 51 // Convert from container offsets (html renderers) to a relative transform (
svg renderers). |
52 // Transform from our paint container's coordinate system to our local coord
s. | 52 // Transform from our paint container's coordinate system to our local coord
s. |
53 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); | 53 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); |
54 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_ren
derSVGRoot.displayItemClient(), AffineTransform::translation(adjustedPaintOffset
.x(), adjustedPaintOffset.y()) * m_renderSVGRoot.localToBorderBoxTransform()); | 54 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_ren
derSVGRoot.displayItemClient(), AffineTransform::translation(adjustedPaintOffset
.x(), adjustedPaintOffset.y()) * m_renderSVGRoot.localToBorderBoxTransform()); |
55 | 55 |
56 // SVG doesn't use paintOffset internally but we need to bake it into the pa
int rect. | 56 // SVG doesn't use paintOffset internally but we need to bake it into the pa
int rect. |
57 paintInfoBeforeFiltering.rect.move(-adjustedPaintOffset.x(), -adjustedPaintO
ffset.y()); | 57 paintInfoBeforeFiltering.rect.move(-adjustedPaintOffset.x(), -adjustedPaintO
ffset.y()); |
58 | 58 |
59 SVGPaintContext paintContext(m_renderSVGRoot, paintInfoBeforeFiltering); | 59 SVGPaintContext paintContext(m_renderSVGRoot, paintInfoBeforeFiltering); |
60 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) | 60 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) |
61 return; | 61 return; |
62 | 62 |
63 BoxPainter(m_renderSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); | 63 BoxPainter(m_renderSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); |
64 } | 64 } |
65 | 65 |
66 } // namespace blink | 66 } // namespace blink |
OLD | NEW |