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/ImagePainter.h" | 5 #include "core/paint/ImagePainter.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 const LayoutRect& content_rect) { | 136 const LayoutRect& content_rect) { |
137 if (!layout_image_.ImageResource()->HasImage() || | 137 if (!layout_image_.ImageResource()->HasImage() || |
138 layout_image_.ImageResource()->ErrorOccurred()) | 138 layout_image_.ImageResource()->ErrorOccurred()) |
139 return; // FIXME: should we just ASSERT these conditions? (audit all | 139 return; // FIXME: should we just ASSERT these conditions? (audit all |
140 // callers). | 140 // callers). |
141 | 141 |
142 IntRect pixel_snapped_dest_rect = PixelSnappedIntRect(dest_rect); | 142 IntRect pixel_snapped_dest_rect = PixelSnappedIntRect(dest_rect); |
143 if (pixel_snapped_dest_rect.IsEmpty()) | 143 if (pixel_snapped_dest_rect.IsEmpty()) |
144 return; | 144 return; |
145 | 145 |
146 RefPtr<Image> image = layout_image_.ImageResource()->GetImage( | 146 RefPtr<Image> image = |
147 pixel_snapped_dest_rect.Size(), layout_image_.Style()->EffectiveZoom()); | 147 layout_image_.ImageResource()->GetImage(pixel_snapped_dest_rect.Size()); |
148 if (!image || image->IsNull()) | 148 if (!image || image->IsNull()) |
149 return; | 149 return; |
150 | 150 |
151 // FIXME: why is interpolation quality selection not included in the | 151 // FIXME: why is interpolation quality selection not included in the |
152 // Instrumentation reported cost of drawing an image? | 152 // Instrumentation reported cost of drawing an image? |
153 InterpolationQuality interpolation_quality = | 153 InterpolationQuality interpolation_quality = |
154 BoxPainter::ChooseInterpolationQuality( | 154 BoxPainter::ChooseInterpolationQuality( |
155 layout_image_, image.Get(), image.Get(), | 155 layout_image_, image.Get(), image.Get(), |
156 LayoutSize(pixel_snapped_dest_rect.Size())); | 156 LayoutSize(pixel_snapped_dest_rect.Size())); |
157 | 157 |
(...skipping 16 matching lines...) Expand all Loading... |
174 InterpolationQuality previous_interpolation_quality = | 174 InterpolationQuality previous_interpolation_quality = |
175 context.ImageInterpolationQuality(); | 175 context.ImageInterpolationQuality(); |
176 context.SetImageInterpolationQuality(interpolation_quality); | 176 context.SetImageInterpolationQuality(interpolation_quality); |
177 context.DrawImage( | 177 context.DrawImage( |
178 image.Get(), pixel_snapped_dest_rect, &src_rect, SkBlendMode::kSrcOver, | 178 image.Get(), pixel_snapped_dest_rect, &src_rect, SkBlendMode::kSrcOver, |
179 LayoutObject::ShouldRespectImageOrientation(&layout_image_)); | 179 LayoutObject::ShouldRespectImageOrientation(&layout_image_)); |
180 context.SetImageInterpolationQuality(previous_interpolation_quality); | 180 context.SetImageInterpolationQuality(previous_interpolation_quality); |
181 } | 181 } |
182 | 182 |
183 } // namespace blink | 183 } // namespace blink |
OLD | NEW |