| 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 25 matching lines...) Expand all Loading... |
| 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, LayoutPoint())) { |
| 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, LayoutPoint())
; |
| 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 = PaintPhaseSelfOutline; | 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 } |
| 50 | 50 |
| 51 void SVGImagePainter::paintForeground(const PaintInfo& paintInfo) | 51 void SVGImagePainter::paintForeground(const PaintInfo& paintInfo) |
| 52 { | 52 { |
| 53 const LayoutImageResource* imageResource = m_layoutSVGImage.imageResource(); | 53 const LayoutImageResource* imageResource = m_layoutSVGImage.imageResource(); |
| 54 IntSize imageViewportSize = expandedIntSize(computeImageViewportSize()); | 54 IntSize imageViewportSize = expandedIntSize(computeImageViewportSize()); |
| 55 if (imageViewportSize.isEmpty()) | 55 if (imageViewportSize.isEmpty()) |
| 56 return; | 56 return; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 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 Length intrinsicWidth; | 87 Length intrinsicWidth; |
| 88 Length intrinsicHeight; | 88 Length intrinsicHeight; |
| 89 FloatSize intrinsicRatio; | 89 FloatSize intrinsicRatio; |
| 90 cachedImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int
rinsicRatio); | 90 cachedImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int
rinsicRatio); |
| 91 return intrinsicRatio; | 91 return intrinsicRatio; |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |