Index: gm/bitmappremul.cpp |
diff --git a/gm/bitmappremul.cpp b/gm/bitmappremul.cpp |
index 172612ddb09f7d16463d92886ea5329a732353e1..27b98e7998e2d0ac52a49626806474d383ffad02 100644 |
--- a/gm/bitmappremul.cpp |
+++ b/gm/bitmappremul.cpp |
@@ -22,15 +22,16 @@ static const int SLIDE_SIZE = 256; |
static const int PIXEL_SIZE_8888 = SLIDE_SIZE / 256; |
static const int PIXEL_SIZE_4444 = SLIDE_SIZE / 16; |
-static void init_bitmap(SkColorType ct, SkBitmap* bitmap) { |
- bitmap->allocPixels(SkImageInfo::Make(SLIDE_SIZE, SLIDE_SIZE, ct, |
- kPremul_SkAlphaType)); |
- bitmap->eraseColor(SK_ColorWHITE); |
+static SkBitmap make_bitmap(SkColorType ct) { |
+ SkBitmap bitmap; |
+ bitmap.allocPixels(SkImageInfo::Make(SLIDE_SIZE, SLIDE_SIZE, ct, |
+ kPremul_SkAlphaType)); |
+ bitmap.eraseColor(SK_ColorWHITE); |
+ return skstd::move(bitmap); |
} |
static SkBitmap make_argb8888_gradient() { |
- SkBitmap bitmap; |
- init_bitmap(kN32_SkColorType, &bitmap); |
+ SkBitmap bitmap(make_bitmap(kN32_SkColorType)); |
uint8_t rowColor = 0; |
for (int y = 0; y < SLIDE_SIZE; y++) { |
uint32_t* dst = bitmap.getAddr32(0, y); |
@@ -42,12 +43,11 @@ static SkBitmap make_argb8888_gradient() { |
rowColor++; |
} |
} |
- return bitmap; |
+ return skstd::move(bitmap); |
} |
static SkBitmap make_argb4444_gradient() { |
- SkBitmap bitmap; |
- init_bitmap(kARGB_4444_SkColorType, &bitmap); |
+ SkBitmap bitmap(make_bitmap(kARGB_4444_SkColorType)); |
uint8_t rowColor = 0; |
for (int y = 0; y < SLIDE_SIZE; y++) { |
uint16_t* dst = bitmap.getAddr16(0, y); |
@@ -59,12 +59,11 @@ static SkBitmap make_argb4444_gradient() { |
rowColor++; |
} |
} |
- return bitmap; |
+ return skstd::move(bitmap); |
} |
static SkBitmap make_argb8888_stripes() { |
- SkBitmap bitmap; |
- init_bitmap(kN32_SkColorType, &bitmap); |
+ SkBitmap bitmap(make_bitmap(kN32_SkColorType)); |
uint8_t rowColor = 0; |
for (int y = 0; y < SLIDE_SIZE; y++) { |
uint32_t* dst = bitmap.getAddr32(0, y); |
@@ -78,12 +77,11 @@ static SkBitmap make_argb8888_stripes() { |
rowColor = 0; |
} |
} |
- return bitmap; |
+ return skstd::move(bitmap); |
} |
static SkBitmap make_argb4444_stripes() { |
- SkBitmap bitmap; |
- init_bitmap(kARGB_4444_SkColorType, &bitmap); |
+ SkBitmap bitmap(make_bitmap(kARGB_4444_SkColorType)); |
uint8_t rowColor = 0; |
for (int y = 0; y < SLIDE_SIZE; y++) { |
uint16_t* dst = bitmap.getAddr16(0, y); |
@@ -97,7 +95,7 @@ static SkBitmap make_argb4444_stripes() { |
rowColor = 0; |
} |
} |
- return bitmap; |
+ return skstd::move(bitmap); |
} |
namespace skiagm { |