| 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 12 matching lines...) Expand all Loading... |
| 23 #include "ui/gfx/skia_util.h" | 23 #include "ui/gfx/skia_util.h" |
| 24 | 24 |
| 25 namespace gfx { | 25 namespace gfx { |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 gfx::Size DIPToPixelSize(gfx::Size dip_size, float scale) { | 28 gfx::Size DIPToPixelSize(gfx::Size dip_size, float scale) { |
| 29 return ScaleToCeiledSize(dip_size, scale); | 29 return ScaleToCeiledSize(dip_size, scale); |
| 30 } | 30 } |
| 31 | 31 |
| 32 gfx::Rect DIPToPixelBounds(gfx::Rect dip_bounds, float scale) { | 32 gfx::Rect DIPToPixelBounds(gfx::Rect dip_bounds, float scale) { |
| 33 return gfx::Rect(ToFlooredPoint(ScalePoint(dip_bounds.origin(), scale)), | 33 return gfx::Rect(ScaleToFlooredPoint(dip_bounds.origin(), scale), |
| 34 DIPToPixelSize(dip_bounds.size(), scale)); | 34 DIPToPixelSize(dip_bounds.size(), scale)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Returns an image rep for the ImageSkiaSource to return to visually indicate | 37 // Returns an image rep for the ImageSkiaSource to return to visually indicate |
| 38 // an error. | 38 // an error. |
| 39 ImageSkiaRep GetErrorImageRep(float scale, const gfx::Size& pixel_size) { | 39 ImageSkiaRep GetErrorImageRep(float scale, const gfx::Size& pixel_size) { |
| 40 SkBitmap bitmap; | 40 SkBitmap bitmap; |
| 41 bitmap.allocN32Pixels(pixel_size.width(), pixel_size.height()); | 41 bitmap.allocN32Pixels(pixel_size.width(), pixel_size.height()); |
| 42 bitmap.eraseColor(SK_ColorRED); | 42 bitmap.eraseColor(SK_ColorRED); |
| 43 return gfx::ImageSkiaRep(bitmap, scale); | 43 return gfx::ImageSkiaRep(bitmap, scale); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 return ImageSkia(); | 539 return ImageSkia(); |
| 540 | 540 |
| 541 return ImageSkia(new RotatedSource(source, rotation), | 541 return ImageSkia(new RotatedSource(source, rotation), |
| 542 SkBitmapOperations::ROTATION_180_CW == rotation ? | 542 SkBitmapOperations::ROTATION_180_CW == rotation ? |
| 543 source.size() : | 543 source.size() : |
| 544 gfx::Size(source.height(), source.width())); | 544 gfx::Size(source.height(), source.width())); |
| 545 | 545 |
| 546 } | 546 } |
| 547 | 547 |
| 548 } // namespace gfx | 548 } // namespace gfx |
| OLD | NEW |