Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Unified Diff: ui/gfx/image/image_skia_operations.cc

Issue 11017046: Use LANCZOS3 resize algorithm to generate missing image reps for extension action icons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/image/image_skia_operations.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..32a0cb33761b0c00932f1b5e7921d50782a896fe 100644
--- a/ui/gfx/image/image_skia_operations.cc
+++ b/ui/gfx/image/image_skia_operations.cc
@@ -320,14 +320,17 @@ 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_,
@@ -449,6 +452,14 @@ 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) {
« no previous file with comments | « ui/gfx/image/image_skia_operations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698