| 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/layout/svg/SVGLayoutSupport.h" | 10 #include "core/layout/svg/SVGLayoutSupport.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 FloatRect boundingBox = m_layoutSVGImage.paintInvalidationRectInLocalCoordin
ates(); | 29 FloatRect boundingBox = m_layoutSVGImage.paintInvalidationRectInLocalCoordin
ates(); |
| 30 if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGImage.localToParentT
ransform(), boundingBox)) | 30 if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGImage.localToParentT
ransform(), boundingBox)) |
| 31 return; | 31 return; |
| 32 | 32 |
| 33 PaintInfo paintInfoBeforeFiltering(paintInfo); | 33 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 34 // Images cannot have children so do not call updateCullRect. | 34 // Images cannot have children so do not call updateCullRect. |
| 35 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo
utSVGImage, m_layoutSVGImage.localToParentTransform()); | 35 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo
utSVGImage, m_layoutSVGImage.localToParentTransform()); |
| 36 { | 36 { |
| 37 SVGPaintContext paintContext(m_layoutSVGImage, paintInfoBeforeFiltering)
; | 37 SVGPaintContext paintContext(m_layoutSVGImage, paintInfoBeforeFiltering)
; |
| 38 if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDra
wingRecorder::useCachedDrawingIfPossible(paintContext.paintInfo().context, m_lay
outSVGImage, paintContext.paintInfo().phase, LayoutPoint())) { | 38 if (paintContext.applyClipMaskAndFilterIfNecessary() && !LayoutObjectDra
wingRecorder::useCachedDrawingIfPossible(paintContext.paintInfo().context, m_lay
outSVGImage, paintContext.paintInfo().phase)) { |
| 39 LayoutObjectDrawingRecorder recorder(paintContext.paintInfo().contex
t, m_layoutSVGImage, paintContext.paintInfo().phase, boundingBox, LayoutPoint())
; | 39 LayoutObjectDrawingRecorder recorder(paintContext.paintInfo().contex
t, m_layoutSVGImage, paintContext.paintInfo().phase, boundingBox); |
| 40 paintForeground(paintContext.paintInfo()); | 40 paintForeground(paintContext.paintInfo()); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 if (m_layoutSVGImage.style()->outlineWidth()) { | 44 if (m_layoutSVGImage.style()->outlineWidth()) { |
| 45 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering); | 45 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering); |
| 46 outlinePaintInfo.phase = PaintPhaseSelfOutlineOnly; | 46 outlinePaintInfo.phase = PaintPhaseSelfOutlineOnly; |
| 47 ObjectPainter(m_layoutSVGImage).paintOutline(outlinePaintInfo, LayoutPoi
nt(boundingBox.location())); | 47 ObjectPainter(m_layoutSVGImage).paintOutline(outlinePaintInfo, LayoutPoi
nt(boundingBox.location())); |
| 48 } | 48 } |
| 49 } | 49 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // scaling. This can be achieved by setting the image's container size to | 84 // scaling. This can be achieved by setting the image's container size to |
| 85 // its viewport size (i.e. if a viewBox is available - use that - else use i
ntrinsic size.) | 85 // its viewport size (i.e. if a viewBox is available - use that - else use i
ntrinsic size.) |
| 86 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The 'preserveAspectRa
tio' attribute. | 86 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The 'preserveAspectRa
tio' attribute. |
| 87 FloatSize intrinsicSize; | 87 FloatSize intrinsicSize; |
| 88 FloatSize intrinsicRatio; | 88 FloatSize intrinsicRatio; |
| 89 cachedImage->computeIntrinsicDimensions(intrinsicSize, intrinsicRatio); | 89 cachedImage->computeIntrinsicDimensions(intrinsicSize, intrinsicRatio); |
| 90 return intrinsicRatio; | 90 return intrinsicRatio; |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |