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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 161733002: add peekPixels to SkCanvas and SkSurface (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkSurface.h ('k') | samplecode/SampleCircle.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SampleApp.h" 7 #include "SampleApp.h"
8 8
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 void SampleWindow::listTitles() { 1121 void SampleWindow::listTitles() {
1122 int count = fSamples.count(); 1122 int count = fSamples.count();
1123 SkDebugf("All Slides:\n"); 1123 SkDebugf("All Slides:\n");
1124 for (int i = 0; i < count; i++) { 1124 for (int i = 0; i < count; i++) {
1125 SkDebugf(" %s\n", getSampleTitle(i).c_str()); 1125 SkDebugf(" %s\n", getSampleTitle(i).c_str());
1126 } 1126 }
1127 } 1127 }
1128 1128
1129 static SkBitmap capture_bitmap(SkCanvas* canvas) { 1129 static SkBitmap capture_bitmap(SkCanvas* canvas) {
1130 SkBitmap bm; 1130 SkBitmap bm;
1131 const SkBitmap& src = canvas->getDevice()->accessBitmap(false); 1131 if (bm.allocPixels(canvas->imageInfo())) {
1132 src.copyTo(&bm, src.config()); 1132 canvas->readPixels(&bm, 0, 0);
1133 }
1133 return bm; 1134 return bm;
1134 } 1135 }
1135 1136
1136 static bool bitmap_diff(SkCanvas* canvas, const SkBitmap& orig, 1137 static bool bitmap_diff(SkCanvas* canvas, const SkBitmap& orig,
1137 SkBitmap* diff) { 1138 SkBitmap* diff) {
1138 const SkBitmap& src = canvas->getDevice()->accessBitmap(false); 1139 const SkBitmap& src = canvas->getDevice()->accessBitmap(false);
1139 1140
1140 SkAutoLockPixels alp0(src); 1141 SkAutoLockPixels alp0(src);
1141 SkAutoLockPixels alp1(orig); 1142 SkAutoLockPixels alp1(orig);
1142 for (int y = 0; y < src.height(); y++) { 1143 for (int y = 0; y < src.height(); y++) {
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2612 SkGraphics::Init(); 2613 SkGraphics::Init();
2613 SkEvent::Init(); 2614 SkEvent::Init();
2614 } 2615 }
2615 2616
2616 // FIXME: this should be in a header 2617 // FIXME: this should be in a header
2617 void application_term(); 2618 void application_term();
2618 void application_term() { 2619 void application_term() {
2619 SkEvent::Term(); 2620 SkEvent::Term();
2620 SkGraphics::Term(); 2621 SkGraphics::Term();
2621 } 2622 }
OLDNEW
« no previous file with comments | « include/core/SkSurface.h ('k') | samplecode/SampleCircle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698