| 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 "core/paint/SVGImagePainter.h" | 5 #include "core/paint/SVGImagePainter.h" |
| 6 | 6 |
| 7 #include "core/layout/ImageQualityController.h" | 7 #include "core/layout/ImageQualityController.h" |
| 8 #include "core/layout/LayoutImageResource.h" | 8 #include "core/layout/LayoutImageResource.h" |
| 9 #include "core/layout/svg/LayoutSVGImage.h" | 9 #include "core/layout/svg/LayoutSVGImage.h" |
| 10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 11 #include "core/paint/ObjectPainter.h" | 11 #include "core/paint/ObjectPainter.h" |
| 12 #include "core/paint/PaintInfo.h" | 12 #include "core/paint/PaintInfo.h" |
| 13 #include "core/paint/SVGPaintContext.h" | 13 #include "core/paint/SVGPaintContext.h" |
| 14 #include "core/svg/SVGImageElement.h" | 14 #include "core/svg/SVGImageElement.h" |
| 15 #include "core/svg/graphics/SVGImage.h" | 15 #include "core/svg/graphics/SVGImage.h" |
| 16 #include "platform/graphics/GraphicsContext.h" | 16 #include "platform/graphics/GraphicsContext.h" |
| 17 #include "third_party/skia/include/core/SkPicture.h" | 17 #include "third_party/skia/include/core/SkPicture.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 void SVGImagePainter::paint(const PaintInfo& paintInfo) { | 21 void SVGImagePainter::paint(const PaintInfo& paintInfo) { |
| 22 if (paintInfo.phase != PaintPhaseForeground || | 22 if (paintInfo.phase != PaintPhaseForeground || |
| 23 m_layoutSVGImage.style()->visibility() != EVisibility::Visible || | 23 m_layoutSVGImage.style()->visibility() != EVisibility::kVisible || |
| 24 !m_layoutSVGImage.imageResource()->hasImage()) | 24 !m_layoutSVGImage.imageResource()->hasImage()) |
| 25 return; | 25 return; |
| 26 | 26 |
| 27 FloatRect boundingBox = m_layoutSVGImage.visualRectInLocalSVGCoordinates(); | 27 FloatRect boundingBox = m_layoutSVGImage.visualRectInLocalSVGCoordinates(); |
| 28 if (!paintInfo.cullRect().intersectsCullRect( | 28 if (!paintInfo.cullRect().intersectsCullRect( |
| 29 m_layoutSVGImage.localToSVGParentTransform(), boundingBox)) | 29 m_layoutSVGImage.localToSVGParentTransform(), boundingBox)) |
| 30 return; | 30 return; |
| 31 | 31 |
| 32 PaintInfo paintInfoBeforeFiltering(paintInfo); | 32 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 33 // Images cannot have children so do not call updateCullRect. | 33 // Images cannot have children so do not call updateCullRect. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 return FloatSize(); | 106 return FloatSize(); |
| 107 | 107 |
| 108 if (cachedImage->getImage()->isSVGImage()) | 108 if (cachedImage->getImage()->isSVGImage()) |
| 109 return toSVGImage(cachedImage->getImage()) | 109 return toSVGImage(cachedImage->getImage()) |
| 110 ->concreteObjectSize(m_layoutSVGImage.objectBoundingBox().size()); | 110 ->concreteObjectSize(m_layoutSVGImage.objectBoundingBox().size()); |
| 111 | 111 |
| 112 return FloatSize(cachedImage->getImage()->size()); | 112 return FloatSize(cachedImage->getImage()->size()); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace blink | 115 } // namespace blink |
| OLD | NEW |