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

Unified Diff: gm/all_bitmap_configs.cpp

Issue 1407063005: SkPDF: images support 32-but-not-N32 colortype (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-11-05 (Thursday) 18:17:20 EST Created 5 years, 1 month 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
« no previous file with comments | « no previous file | src/pdf/SkPDFBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(&notN32bitmap, 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);
+}
« no previous file with comments | « no previous file | src/pdf/SkPDFBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698