Index: gm/all_bitmap_configs.cpp |
diff --git a/gm/all_bitmap_configs.cpp b/gm/all_bitmap_configs.cpp |
index 4cabf2ec9b5ae5527aac67fc65f6965a12870d2c..46c5d5eed5a432b6e1319564bfed9029dec067a8 100644 |
--- a/gm/all_bitmap_configs.cpp |
+++ b/gm/all_bitmap_configs.cpp |
@@ -190,3 +190,29 @@ DEF_SIMPLE_GM(all_bitmap_configs, canvas, SCALE, 6 * SCALE) { |
SkBitmap bitmapG8 = make_bitmap(kGray_8_SkColorType); |
draw(canvas, p, bitmapG8, kGray_8_SkColorType, "Gray 8"); |
} |
+ |
+// Works on Ganesh, fails on Raster. |
+SkImage* make_not_native32_color_wheel() { |
+ SkBitmap n32bitmap, notN32bitmap; |
+ n32bitmap.allocN32Pixels(SCALE, SCALE); |
+ n32bitmap.eraseColor(SK_ColorTRANSPARENT); |
+ SkCanvas n32canvas(n32bitmap); |
+ color_wheel_native(&n32canvas); |
+ n32canvas.flush(); |
+ #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) |
+ const SkColorType ct = kRGBA_8888_SkColorType; |
+ #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) |
+ const SkColorType ct = kBGRA_8888_SkColorType; |
+ #endif |
+ static_assert(ct != kN32_SkColorType, "BRGA!=RGBA"); |
+ SkAssertResult(n32bitmap.copyTo(¬N32bitmap, ct)); |
+ SkASSERT(notN32bitmap.colorType() == ct); |
+ return SkImage::NewFromBitmap(notN32bitmap); |
+} |
+ |
+DEF_SIMPLE_GM(not_native32_bitmap_config, canvas, SCALE, SCALE) { |
+ SkAutoTUnref<SkImage> notN32image(make_not_native32_color_wheel()); |
+ SkASSERT(notN32image); |
+ sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8); |
+ canvas->drawImage(notN32image, 0.0f, 0.0f); |
+} |