add gpu to gm tool
add pass-through read/write pixels API to canvas
git-svn-id: http://skia.googlecode.com/svn/trunk@660 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 5c9dcab..17ed8e4 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -181,12 +181,13 @@
static const struct {
SkBitmap::Config fConfig;
- bool fUsePicture;
+ bool fUseGPU;
const char* fName;
} gRec[] = {
{ SkBitmap::kARGB_8888_Config, false, "8888" },
{ SkBitmap::kARGB_4444_Config, false, "4444" },
{ SkBitmap::kRGB_565_Config, false, "565" },
+ { SkBitmap::kARGB_8888_Config, true, "gpu" },
};
int main (int argc, char * const argv[]) {
@@ -242,12 +243,14 @@
bitmap.eraseColor(0);
SkCanvas canvas(bitmap);
- gm->draw(&canvas);
- {
+ if (gRec[i].fUseGPU) {
SkGpuCanvas gc(context);
gc.setDevice(gc.createDevice(bitmap.config(), bitmap.width(), bitmap.height(),
bitmap.isOpaque(), false))->unref();
gm->draw(&gc);
+ gc.readPixels(&bitmap); // overwrite our previous allocation
+ } else {
+ gm->draw(&canvas);
}
SkString name = make_name(gm->shortName(), gRec[i].fName);