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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 163823002: Revert of 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 if (bm.allocPixels(canvas->imageInfo())) { 1131 const SkBitmap& src = canvas->getDevice()->accessBitmap(false);
1132 canvas->readPixels(&bm, 0, 0); 1132 src.copyTo(&bm, src.config());
1133 }
1134 return bm; 1133 return bm;
1135 } 1134 }
1136 1135
1137 static bool bitmap_diff(SkCanvas* canvas, const SkBitmap& orig, 1136 static bool bitmap_diff(SkCanvas* canvas, const SkBitmap& orig,
1138 SkBitmap* diff) { 1137 SkBitmap* diff) {
1139 const SkBitmap& src = canvas->getDevice()->accessBitmap(false); 1138 const SkBitmap& src = canvas->getDevice()->accessBitmap(false);
1140 1139
1141 SkAutoLockPixels alp0(src); 1140 SkAutoLockPixels alp0(src);
1142 SkAutoLockPixels alp1(orig); 1141 SkAutoLockPixels alp1(orig);
1143 for (int y = 0; y < src.height(); y++) { 1142 for (int y = 0; y < src.height(); y++) {
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2613 SkGraphics::Init(); 2612 SkGraphics::Init();
2614 SkEvent::Init(); 2613 SkEvent::Init();
2615 } 2614 }
2616 2615
2617 // FIXME: this should be in a header 2616 // FIXME: this should be in a header
2618 void application_term(); 2617 void application_term();
2619 void application_term() { 2618 void application_term() {
2620 SkEvent::Term(); 2619 SkEvent::Term();
2621 SkGraphics::Term(); 2620 SkGraphics::Term();
2622 } 2621 }
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