| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/image/image_skia_operations.h" | 5 #include "ui/gfx/image/image_skia_operations.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "skia/ext/image_operations.h" | 9 #include "skia/ext/image_operations.h" |
| 10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 // gfx::ImageSkiaSource overrides: | 321 // gfx::ImageSkiaSource overrides: |
| 322 virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE { | 322 virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE { |
| 323 const ImageSkiaRep& image_rep = source_.GetRepresentation(scale_factor); | 323 const ImageSkiaRep& image_rep = source_.GetRepresentation(scale_factor); |
| 324 if (image_rep.GetWidth() == target_dip_size_.width() && | 324 if (image_rep.GetWidth() == target_dip_size_.width() && |
| 325 image_rep.GetHeight() == target_dip_size_.height()) | 325 image_rep.GetHeight() == target_dip_size_.height()) |
| 326 return image_rep; | 326 return image_rep; |
| 327 | 327 |
| 328 const float scale = ui::GetScaleFactorScale(scale_factor); | 328 const float scale = ui::GetScaleFactorScale(scale_factor); |
| 329 const Size target_pixel_size = gfx::ToFlooredSize( | 329 const Size target_pixel_size = gfx::ToFlooredSize( |
| 330 target_dip_size_.Scale(scale)); | 330 gfx::ScaleSize(target_dip_size_, scale)); |
| 331 const SkBitmap resized = skia::ImageOperations::Resize( | 331 const SkBitmap resized = skia::ImageOperations::Resize( |
| 332 image_rep.sk_bitmap(), | 332 image_rep.sk_bitmap(), |
| 333 resize_method_, | 333 resize_method_, |
| 334 target_pixel_size.width(), | 334 target_pixel_size.width(), |
| 335 target_pixel_size.height()); | 335 target_pixel_size.height()); |
| 336 return ImageSkiaRep(resized, scale_factor); | 336 return ImageSkiaRep(resized, scale_factor); |
| 337 } | 337 } |
| 338 | 338 |
| 339 private: | 339 private: |
| 340 const ImageSkia source_; | 340 const ImageSkia source_; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 const ImageSkia& source, | 454 const ImageSkia& source, |
| 455 const ShadowValues& shadows) { | 455 const ShadowValues& shadows) { |
| 456 const gfx::Insets shadow_padding = -gfx::ShadowValue::GetMargin(shadows); | 456 const gfx::Insets shadow_padding = -gfx::ShadowValue::GetMargin(shadows); |
| 457 gfx::Size shadow_image_size = source.size(); | 457 gfx::Size shadow_image_size = source.size(); |
| 458 shadow_image_size.Enlarge(shadow_padding.width(), | 458 shadow_image_size.Enlarge(shadow_padding.width(), |
| 459 shadow_padding.height()); | 459 shadow_padding.height()); |
| 460 return ImageSkia(new DropShadowSource(source, shadows), shadow_image_size); | 460 return ImageSkia(new DropShadowSource(source, shadows), shadow_image_size); |
| 461 } | 461 } |
| 462 | 462 |
| 463 } // namespace gfx | 463 } // namespace gfx |
| OLD | NEW |