| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 subset_bounds_(subset_bounds) { | 282 subset_bounds_(subset_bounds) { |
| 283 } | 283 } |
| 284 | 284 |
| 285 virtual ~ExtractSubsetImageSource() { | 285 virtual ~ExtractSubsetImageSource() { |
| 286 } | 286 } |
| 287 | 287 |
| 288 // gfx::ImageSkiaSource overrides: | 288 // gfx::ImageSkiaSource overrides: |
| 289 virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE { | 289 virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE { |
| 290 ImageSkiaRep image_rep = image_.GetRepresentation(scale_factor); | 290 ImageSkiaRep image_rep = image_.GetRepresentation(scale_factor); |
| 291 SkIRect subset_bounds_in_pixel = RectToSkIRect( | 291 SkIRect subset_bounds_in_pixel = RectToSkIRect( |
| 292 ToEnclosingRect(subset_bounds_.Scale( | 292 ToFlooredRectDeprecated(subset_bounds_.Scale( |
| 293 ui::GetScaleFactorScale(image_rep.scale_factor())))); | 293 ui::GetScaleFactorScale(image_rep.scale_factor())))); |
| 294 SkBitmap dst; | 294 SkBitmap dst; |
| 295 bool success = image_rep.sk_bitmap().extractSubset(&dst, | 295 bool success = image_rep.sk_bitmap().extractSubset(&dst, |
| 296 subset_bounds_in_pixel); | 296 subset_bounds_in_pixel); |
| 297 DCHECK(success); | 297 DCHECK(success); |
| 298 return gfx::ImageSkiaRep(dst, image_rep.scale_factor()); | 298 return gfx::ImageSkiaRep(dst, image_rep.scale_factor()); |
| 299 } | 299 } |
| 300 | 300 |
| 301 private: | 301 private: |
| 302 const gfx::ImageSkia image_; | 302 const gfx::ImageSkia image_; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 const ImageSkia& source, | 464 const ImageSkia& source, |
| 465 const ShadowValues& shadows) { | 465 const ShadowValues& shadows) { |
| 466 const gfx::Insets shadow_padding = -gfx::ShadowValue::GetMargin(shadows); | 466 const gfx::Insets shadow_padding = -gfx::ShadowValue::GetMargin(shadows); |
| 467 gfx::Size shadow_image_size = source.size(); | 467 gfx::Size shadow_image_size = source.size(); |
| 468 shadow_image_size.Enlarge(shadow_padding.width(), | 468 shadow_image_size.Enlarge(shadow_padding.width(), |
| 469 shadow_padding.height()); | 469 shadow_padding.height()); |
| 470 return ImageSkia(new DropShadowSource(source, shadows), shadow_image_size); | 470 return ImageSkia(new DropShadowSource(source, shadows), shadow_image_size); |
| 471 } | 471 } |
| 472 | 472 |
| 473 } // namespace gfx | 473 } // namespace gfx |
| OLD | NEW |