Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: ui/gfx/skbitmap_operations.cc

Issue 1585013002: MacViews: Use Cocoa folder icons in tree views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/gfx/image/image_skia_operations.cc ('K') | « ui/gfx/skbitmap_operations.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/skbitmap_operations.cc
diff --git a/ui/gfx/skbitmap_operations.cc b/ui/gfx/skbitmap_operations.cc
index 3865916c9032e0b18d062a962e6582cec007f3e1..31b5eaa357ccaf7290a479c62c923a96b83fe4da 100644
--- a/ui/gfx/skbitmap_operations.cc
+++ b/ui/gfx/skbitmap_operations.cc
@@ -694,6 +694,26 @@ SkBitmap SkBitmapOperations::CreateTransposedBitmap(const SkBitmap& image) {
}
// static
+SkBitmap SkBitmapOperations::CreateMirroredBitmap(const SkBitmap& image) {
+ DCHECK(image.colorType() == kN32_SkColorType);
+
+ SkBitmap mirrored;
+ mirrored.allocN32Pixels(image.width(), image.height());
+
+ SkAutoLockPixels lock_image(image);
+ SkAutoLockPixels lock_mirrored(mirrored);
+
+ for (int y = 0; y < image.height(); ++y) {
+ uint32_t* image_row_src = image.getAddr32(0, y);
+ uint32_t* image_row_dst = mirrored.getAddr32(0, y);
+ for (int src_x = image.width() - 1, dst_x = 0; src_x >= 0; --src_x, ++dst_x)
+ image_row_dst[dst_x] = image_row_src[src_x];
+ }
+
+ return mirrored;
+}
+
+// static
SkBitmap SkBitmapOperations::CreateColorMask(const SkBitmap& bitmap,
SkColor c) {
DCHECK(bitmap.colorType() == kN32_SkColorType);
« ui/gfx/image/image_skia_operations.cc ('K') | « ui/gfx/skbitmap_operations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698