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/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 764e063..0761641 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -549,6 +549,31 @@
return device;
}
+bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
+ SkDevice* device = this->getDevice();
+ if (!device) {
+ return false;
+ }
+ return device->readPixels(srcRect, bitmap);
+}
+
+bool SkCanvas::readPixels(SkBitmap* bitmap) {
+ SkDevice* device = this->getDevice();
+ if (!device) {
+ return false;
+ }
+ SkIRect bounds;
+ bounds.set(0, 0, device->width(), device->height());
+ return this->readPixels(bounds, bitmap);
+}
+
+void SkCanvas::writePixels(const SkBitmap& bitmap, int x, int y) {
+ SkDevice* device = this->getDevice();
+ if (device) {
+ device->writePixels(bitmap, x, y);
+ }
+}
+
//////////////////////////////////////////////////////////////////////////////
bool SkCanvas::getViewport(SkIPoint* size) const {