| 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/svg/LayoutSVGRoot.h" | 8 #include "core/layout/svg/LayoutSVGRoot.h" |
| 9 #include "core/layout/svg/SVGResources.h" | 9 #include "core/layout/svg/SVGResources.h" |
| 10 #include "core/layout/svg/SVGResourcesCache.h" | 10 #include "core/layout/svg/SVGResourcesCache.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // Don't paint if we don't have kids, except if we have filters we should pa
int those. | 37 // Don't paint if we don't have kids, except if we have filters we should pa
int those. |
| 38 if (!m_layoutSVGRoot.firstChild()) { | 38 if (!m_layoutSVGRoot.firstChild()) { |
| 39 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj
ect(&m_layoutSVGRoot); | 39 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj
ect(&m_layoutSVGRoot); |
| 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 ClipRecorder clipRecorder(*paintInfoBeforeFiltering.context, m_layoutSVGRoot
, paintInfoBeforeFiltering.displayItemTypeForClipping()); |
| 48 if (m_layoutSVGRoot.shouldApplyViewportClip()) | 48 if (m_layoutSVGRoot.shouldApplyViewportClip()) |
| 49 clipRecorder = adoptPtr(new ClipRecorder(*paintInfoBeforeFiltering.conte
xt, m_layoutSVGRoot, paintInfoBeforeFiltering.displayItemTypeForClipping(), Layo
utRect(pixelSnappedIntRect(m_layoutSVGRoot.overflowClipRect(paintOffset))))); | 49 clipRecorder.begin(LayoutRect(pixelSnappedIntRect(m_layoutSVGRoot.overfl
owClipRect(paintOffset)))); |
| 50 | 50 |
| 51 // Convert from container offsets (html layoutObjects) to a relative transfo
rm (svg layoutObjects). | 51 // Convert from container offsets (html layoutObjects) to a relative transfo
rm (svg layoutObjects). |
| 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_lay
outSVGRoot, AffineTransform::translation(adjustedPaintOffset.x(), adjustedPaintO
ffset.y()) * m_layoutSVGRoot.localToBorderBoxTransform()); | 54 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay
outSVGRoot, AffineTransform::translation(adjustedPaintOffset.x(), adjustedPaintO
ffset.y()) * m_layoutSVGRoot.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_layoutSVGRoot, paintInfoBeforeFiltering); | 59 SVGPaintContext paintContext(m_layoutSVGRoot, 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_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); | 63 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |