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" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 .PaintOutline(outline_paint_info, LayoutPoint(bounding_box.Location())); | 55 .PaintOutline(outline_paint_info, LayoutPoint(bounding_box.Location())); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 void SVGImagePainter::PaintForeground(const PaintInfo& paint_info) { | 59 void SVGImagePainter::PaintForeground(const PaintInfo& paint_info) { |
60 const LayoutImageResource* image_resource = layout_svg_image_.ImageResource(); | 60 const LayoutImageResource* image_resource = layout_svg_image_.ImageResource(); |
61 IntSize image_viewport_size = ExpandedIntSize(ComputeImageViewportSize()); | 61 IntSize image_viewport_size = ExpandedIntSize(ComputeImageViewportSize()); |
62 if (image_viewport_size.IsEmpty()) | 62 if (image_viewport_size.IsEmpty()) |
63 return; | 63 return; |
64 | 64 |
65 RefPtr<Image> image = image_resource->GetImage( | 65 RefPtr<Image> image = image_resource->GetImage(image_viewport_size); |
66 image_viewport_size, layout_svg_image_.Style()->EffectiveZoom()); | |
67 FloatRect dest_rect = layout_svg_image_.ObjectBoundingBox(); | 66 FloatRect dest_rect = layout_svg_image_.ObjectBoundingBox(); |
68 FloatRect src_rect(0, 0, image->width(), image->height()); | 67 FloatRect src_rect(0, 0, image->width(), image->height()); |
69 | 68 |
70 SVGImageElement* image_element = | 69 SVGImageElement* image_element = |
71 toSVGImageElement(layout_svg_image_.GetElement()); | 70 toSVGImageElement(layout_svg_image_.GetElement()); |
72 image_element->preserveAspectRatio()->CurrentValue()->TransformRect(dest_rect, | 71 image_element->preserveAspectRatio()->CurrentValue()->TransformRect(dest_rect, |
73 src_rect); | 72 src_rect); |
74 | 73 |
75 InterpolationQuality interpolation_quality = kInterpolationDefault; | 74 InterpolationQuality interpolation_quality = kInterpolationDefault; |
76 interpolation_quality = ImageQualityController::GetImageQualityController() | 75 interpolation_quality = ImageQualityController::GetImageQualityController() |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 109 |
111 if (cached_image->GetImage()->IsSVGImage()) { | 110 if (cached_image->GetImage()->IsSVGImage()) { |
112 return ToSVGImage(cached_image->GetImage()) | 111 return ToSVGImage(cached_image->GetImage()) |
113 ->ConcreteObjectSize(layout_svg_image_.ObjectBoundingBox().Size()); | 112 ->ConcreteObjectSize(layout_svg_image_.ObjectBoundingBox().Size()); |
114 } | 113 } |
115 | 114 |
116 return FloatSize(cached_image->GetImage()->Size()); | 115 return FloatSize(cached_image->GetImage()->Size()); |
117 } | 116 } |
118 | 117 |
119 } // namespace blink | 118 } // namespace blink |
OLD | NEW |