| 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/skbitmap_operations.h" | 5 #include "ui/gfx/skbitmap_operations.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "skia/ext/refptr.h" | 11 #include "skia/ext/refptr.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
| 14 #include "third_party/skia/include/core/SkColorFilter.h" | 14 #include "third_party/skia/include/core/SkColorFilter.h" |
| 15 #include "third_party/skia/include/core/SkColorPriv.h" | 15 #include "third_party/skia/include/core/SkColorPriv.h" |
| 16 #include "third_party/skia/include/core/SkUnPreMultiply.h" | 16 #include "third_party/skia/include/core/SkUnPreMultiply.h" |
| 17 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 17 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| 18 #include "ui/gfx/insets.h" | 18 #include "ui/gfx/geometry/insets.h" |
| 19 #include "ui/gfx/point.h" | 19 #include "ui/gfx/geometry/point.h" |
| 20 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
| 21 | 21 |
| 22 // static | 22 // static |
| 23 SkBitmap SkBitmapOperations::CreateInvertedBitmap(const SkBitmap& image) { | 23 SkBitmap SkBitmapOperations::CreateInvertedBitmap(const SkBitmap& image) { |
| 24 DCHECK(image.colorType() == kN32_SkColorType); | 24 DCHECK(image.colorType() == kN32_SkColorType); |
| 25 | 25 |
| 26 SkAutoLockPixels lock_image(image); | 26 SkAutoLockPixels lock_image(image); |
| 27 | 27 |
| 28 SkBitmap inverted; | 28 SkBitmap inverted; |
| 29 inverted.allocN32Pixels(image.width(), image.height()); | 29 inverted.allocN32Pixels(image.width(), image.height()); |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 canvas.translate(SkFloatToScalar(result.width() * 0.5f), | 784 canvas.translate(SkFloatToScalar(result.width() * 0.5f), |
| 785 SkFloatToScalar(result.height() * 0.5f)); | 785 SkFloatToScalar(result.height() * 0.5f)); |
| 786 canvas.rotate(angle); | 786 canvas.rotate(angle); |
| 787 canvas.translate(-SkFloatToScalar(source.width() * 0.5f), | 787 canvas.translate(-SkFloatToScalar(source.width() * 0.5f), |
| 788 -SkFloatToScalar(source.height() * 0.5f)); | 788 -SkFloatToScalar(source.height() * 0.5f)); |
| 789 canvas.drawBitmap(source, 0, 0); | 789 canvas.drawBitmap(source, 0, 0); |
| 790 canvas.flush(); | 790 canvas.flush(); |
| 791 | 791 |
| 792 return result; | 792 return result; |
| 793 } | 793 } |
| OLD | NEW |