Chromium Code Reviews| Index: ui/gfx/image/image_skia_operations.cc |
| diff --git a/ui/gfx/image/image_skia_operations.cc b/ui/gfx/image/image_skia_operations.cc |
| index 8afaf876eab4e777ab66f447b1b37bac9554ebb8..c36b353c49af4a238f1c9a7be88cb14c7f26ad05 100644 |
| --- a/ui/gfx/image/image_skia_operations.cc |
| +++ b/ui/gfx/image/image_skia_operations.cc |
| @@ -320,14 +320,19 @@ class ResizeSource : public ImageSkiaSource { |
| // gfx::ImageSkiaSource overrides: |
| virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE { |
| - const ImageSkiaRep& image_rep = source_.GetRepresentation(scale_factor); |
| - if (image_rep.GetWidth() == target_dip_size_.width() && |
| - image_rep.GetHeight() == target_dip_size_.height()) |
| - return image_rep; |
| - |
| const float scale = ui::GetScaleFactorScale(scale_factor); |
| const Size target_pixel_size = gfx::ToFlooredSize( |
| target_dip_size_.Scale(scale)); |
| + |
| + const ImageSkiaRep& image_rep = source_.GetRepresentation(scale_factor); |
| + |
| + if (image_rep.pixel_width() == target_pixel_size.width() && |
| + image_rep.pixel_height() == target_pixel_size.height()) { |
| + if (image_rep.scale_factor() == scale_factor) |
|
pkotwicz
2012/10/17 18:42:20
Nit: I think you can include this if as part of th
tbarzic
2012/10/17 19:00:46
yeah, but in that case we could call skia::ImageOp
pkotwicz
2012/10/17 19:13:29
Sorry I should have seen that. You can if you want
tbarzic
2012/10/17 19:15:42
ok, Done.
|
| + return image_rep; |
| + return ImageSkiaRep(image_rep.sk_bitmap(), scale_factor); |
| + } |
| + |
| const SkBitmap resized = skia::ImageOperations::Resize( |
| image_rep.sk_bitmap(), |
| resize_method_, |
| @@ -449,6 +454,14 @@ ImageSkia ImageSkiaOperations::CreateResizedImage( |
| } |
| // static |
| +ImageSkia ImageSkiaOperations::SetFallbackResizeMethod( |
| + const ImageSkia& source, |
| + skia::ImageOperations::ResizeMethod method) { |
| + return ImageSkia(new ResizeSource(source, method, source.size()), |
| + source.size()); |
| +} |
| + |
| +// static |
| ImageSkia ImageSkiaOperations::CreateImageWithDropShadow( |
| const ImageSkia& source, |
| const ShadowValues& shadows) { |