| 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 "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 virtual ~ResizeSource() {} | 350 virtual ~ResizeSource() {} |
| 351 | 351 |
| 352 // gfx::ImageSkiaSource overrides: | 352 // gfx::ImageSkiaSource overrides: |
| 353 virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { | 353 virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { |
| 354 const ImageSkiaRep& image_rep = source_.GetRepresentation(scale); | 354 const ImageSkiaRep& image_rep = source_.GetRepresentation(scale); |
| 355 if (image_rep.GetWidth() == target_dip_size_.width() && | 355 if (image_rep.GetWidth() == target_dip_size_.width() && |
| 356 image_rep.GetHeight() == target_dip_size_.height()) | 356 image_rep.GetHeight() == target_dip_size_.height()) |
| 357 return image_rep; | 357 return image_rep; |
| 358 | 358 |
| 359 const Size target_pixel_size = DIPToPixelSize(target_dip_size_, scale); | 359 const Size target_pixel_size = DIPToPixelSize(target_dip_size_, scale); |
| 360 DLOG(INFO) << "scale " << image_rep.GetWidth() << " -> " << target_pixel_siz
e.width() << " @" << scale; |
| 360 const SkBitmap resized = skia::ImageOperations::Resize( | 361 const SkBitmap resized = skia::ImageOperations::Resize( |
| 361 image_rep.sk_bitmap(), | 362 image_rep.sk_bitmap(), |
| 362 resize_method_, | 363 resize_method_, |
| 363 target_pixel_size.width(), | 364 target_pixel_size.width(), |
| 364 target_pixel_size.height()); | 365 target_pixel_size.height()); |
| 365 return ImageSkiaRep(resized, scale); | 366 return ImageSkiaRep(resized, scale); |
| 366 } | 367 } |
| 367 | 368 |
| 368 private: | 369 private: |
| 369 const ImageSkia source_; | 370 const ImageSkia source_; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 return ImageSkia(); | 551 return ImageSkia(); |
| 551 | 552 |
| 552 return ImageSkia(new RotatedSource(source, rotation), | 553 return ImageSkia(new RotatedSource(source, rotation), |
| 553 SkBitmapOperations::ROTATION_180_CW == rotation ? | 554 SkBitmapOperations::ROTATION_180_CW == rotation ? |
| 554 source.size() : | 555 source.size() : |
| 555 gfx::Size(source.height(), source.width())); | 556 gfx::Size(source.height(), source.width())); |
| 556 | 557 |
| 557 } | 558 } |
| 558 | 559 |
| 559 } // namespace gfx | 560 } // namespace gfx |
| OLD | NEW |