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

Unified Diff: samplecode/SampleApp.cpp

Issue 159723006: add peekPixels to canvas (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months 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
Index: samplecode/SampleApp.cpp
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 53e15a5fdfd2ce40518767185fba9b00e13ce05d..15e56a3bb6eec63518cfaae08fe001585627bd78 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1128,8 +1128,9 @@ void SampleWindow::listTitles() {
static SkBitmap capture_bitmap(SkCanvas* canvas) {
SkBitmap bm;
- const SkBitmap& src = canvas->getDevice()->accessBitmap(false);
- src.copyTo(&bm, src.config());
+ if (bm.allocPixels(canvas->imageInfo())) {
+ canvas->readPixels(&bm, 0, 0);
+ }
return bm;
}

Powered by Google App Engine
This is Rietveld 408576698