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/base/layout.h" | 10 #include "ui/base/layout.h" |
11 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
12 #include "ui/gfx/image/canvas_image_source.h" | 12 #include "ui/gfx/image/canvas_image_source.h" |
13 #include "ui/gfx/image/image_skia.h" | 13 #include "ui/gfx/image/image_skia.h" |
14 #include "ui/gfx/image/image_skia_rep.h" | 14 #include "ui/gfx/image/image_skia_rep.h" |
15 #include "ui/gfx/image/image_skia_source.h" | 15 #include "ui/gfx/image/image_skia_source.h" |
16 #include "ui/gfx/insets.h" | 16 #include "ui/gfx/insets.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 #include "ui/gfx/rect_conversions.h" | 18 #include "ui/gfx/rect_conversions.h" |
19 #include "ui/gfx/size.h" | 19 #include "ui/gfx/size.h" |
20 #include "ui/gfx/size_conversions.h" | 20 #include "ui/gfx/size_conversions.h" |
21 #include "ui/gfx/skbitmap_operations.h" | 21 #include "ui/gfx/skbitmap_operations.h" |
22 #include "ui/gfx/skia_util.h" | 22 #include "ui/gfx/skia_util.h" |
23 #include "ui/gfx/switches.h" | 23 #include "ui/gfx/switches.h" |
24 | 24 |
25 namespace gfx { | 25 namespace gfx { |
26 namespace { | 26 namespace { |
27 | 27 |
28 bool ScalingEnabled() { | 28 bool ScalingEnabled() { |
29 static bool scale_images = !CommandLine::ForCurrentProcess()->HasSwitch( | 29 static bool scale_images = CommandLine::ForCurrentProcess()->HasSwitch( |
30 switches::kDisableScalingInImageSkiaOperations); | 30 switches::kEnableScalingInImageSkiaOperations); |
31 return scale_images; | 31 return scale_images; |
32 } | 32 } |
33 | 33 |
34 // Creates 2x scaled image of the give |source|. | 34 // Creates 2x scaled image of the give |source|. |
35 ImageSkiaRep Create2XImageSkiaRep(const ImageSkiaRep& source) { | 35 ImageSkiaRep Create2XImageSkiaRep(const ImageSkiaRep& source) { |
36 gfx::Size size(source.GetWidth() * 2.0f, source.GetHeight() * 2.0f); | 36 gfx::Size size(source.GetWidth() * 2.0f, source.GetHeight() * 2.0f); |
37 | 37 |
38 SkBitmap resized_bitmap; | 38 SkBitmap resized_bitmap; |
39 resized_bitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(), | 39 resized_bitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(), |
40 size.height()); | 40 size.height()); |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 const ImageSkia& source, | 496 const ImageSkia& source, |
497 SkBitmapOperations::RotationAmount rotation) { | 497 SkBitmapOperations::RotationAmount rotation) { |
498 return ImageSkia(new RotatedSource(source, rotation), | 498 return ImageSkia(new RotatedSource(source, rotation), |
499 SkBitmapOperations::ROTATION_180_CW == rotation ? | 499 SkBitmapOperations::ROTATION_180_CW == rotation ? |
500 source.size() : | 500 source.size() : |
501 gfx::Size(source.height(), source.width())); | 501 gfx::Size(source.height(), source.width())); |
502 | 502 |
503 } | 503 } |
504 | 504 |
505 } // namespace gfx | 505 } // namespace gfx |
OLD | NEW |