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

Side by Side Diff: samplecode/SamplePictFile.cpp

Issue 791763002: Revert of remove (dumb) canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « include/core/SkSurface.h ('k') | src/core/SkCanvas.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 7
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkDumpCanvas.h" 9 #include "SkDumpCanvas.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 can->drawBitmap(bm, 0, 0, NULL); 129 can->drawBitmap(bm, 0, 0, NULL);
130 pic.reset(recorder.endRecording()); 130 pic.reset(recorder.endRecording());
131 } else { 131 } else {
132 SkFILEStream stream(path); 132 SkFILEStream stream(path);
133 if (stream.isValid()) { 133 if (stream.isValid()) {
134 pic.reset(SkPicture::CreateFromStream(&stream)); 134 pic.reset(SkPicture::CreateFromStream(&stream));
135 } else { 135 } else {
136 SkDebugf("coun't load picture at \"path\"\n", path); 136 SkDebugf("coun't load picture at \"path\"\n", path);
137 } 137 }
138 138
139 if (false) {
140 SkSurface* surf = SkSurface::NewRasterPMColor(SkScalarCeilToInt( pic->cullRect().width()),
141 SkScalarCeilToInt( pic->cullRect().height()));
142 surf->getCanvas()->drawPicture(pic);
143 surf->unref();
144 }
139 if (false) { // re-record 145 if (false) { // re-record
140 SkPictureRecorder recorder; 146 SkPictureRecorder recorder;
141 pic->playback(recorder.beginRecording(pic->cullRect().width(), 147 pic->playback(recorder.beginRecording(pic->cullRect().width(),
142 pic->cullRect().height(), 148 pic->cullRect().height(),
143 NULL, 0)); 149 NULL, 0));
144 SkAutoTUnref<SkPicture> p2(recorder.endRecording()); 150 SkAutoTUnref<SkPicture> p2(recorder.endRecording());
145 151
146 SkString path2(path); 152 SkString path2(path);
147 path2.append(".new.skp"); 153 path2.append(".new.skp");
148 SkFILEWStream writer(path2.c_str()); 154 SkFILEWStream writer(path2.c_str());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 SampleView* CreateSamplePictFileView(const char filename[]) { 195 SampleView* CreateSamplePictFileView(const char filename[]) {
190 return new PictFileView(filename); 196 return new PictFileView(filename);
191 } 197 }
192 198
193 ////////////////////////////////////////////////////////////////////////////// 199 //////////////////////////////////////////////////////////////////////////////
194 200
195 #if 0 201 #if 0
196 static SkView* MyFactory() { return new PictFileView; } 202 static SkView* MyFactory() { return new PictFileView; }
197 static SkViewRegister reg(MyFactory); 203 static SkViewRegister reg(MyFactory);
198 #endif 204 #endif
OLDNEW
« no previous file with comments | « include/core/SkSurface.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698