diff options
Diffstat (limited to 'ui/gfx')
-rw-r--r-- | ui/gfx/image/image_skia_operations.cc | 21 | ||||
-rw-r--r-- | ui/gfx/image/image_skia_operations.h | 11 |
2 files changed, 5 insertions, 27 deletions
diff --git a/ui/gfx/image/image_skia_operations.cc b/ui/gfx/image/image_skia_operations.cc index 32a0cb3..8afaf87 100644 --- a/ui/gfx/image/image_skia_operations.cc +++ b/ui/gfx/image/image_skia_operations.cc @@ -320,17 +320,14 @@ 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()) { - return ImageSkiaRep(image_rep.sk_bitmap(), scale_factor); - } - const SkBitmap resized = skia::ImageOperations::Resize( image_rep.sk_bitmap(), resize_method_, @@ -452,14 +449,6 @@ ImageSkia ImageSkiaOperations::CreateResizedImage( } // static -ImageSkia ImageSkiaOperations::CreateImageWithCustomResizeMethod( - 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) { diff --git a/ui/gfx/image/image_skia_operations.h b/ui/gfx/image/image_skia_operations.h index 10131e6..80326b6 100644 --- a/ui/gfx/image/image_skia_operations.h +++ b/ui/gfx/image/image_skia_operations.h @@ -79,21 +79,10 @@ class UI_EXPORT ImageSkiaOperations { const gfx::Rect& subset_bounds); // Creates an image by resizing |source| to given |target_dip_size|. - // If |source| is missing the representation for a required scale factor, the - // representation for the scale factor will be generated by resizing one of - // |source|'s existing representations' bitmap to the target pixel size. - // The bitmap will be resized using resize method |methd|. static ImageSkia CreateResizedImage(const ImageSkia& source, skia::ImageOperations::ResizeMethod methd, const Size& target_dip_size); - // Creates an image which inherits image representations from |source|. - // Image representations for the scale factors not containted in |source| are - // generated by resizing existing representations using |method|. - static ImageSkia CreateImageWithCustomResizeMethod( - const ImageSkia& source, - skia::ImageOperations::ResizeMethod method); - // Creates an image with drop shadow defined in |shadows| for |source|. static ImageSkia CreateImageWithDropShadow(const ImageSkia& source, const ShadowValues& shadows); |