OLD | NEW |
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 Loading... |
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 } | |
145 if (false) { // re-record | 139 if (false) { // re-record |
146 SkPictureRecorder recorder; | 140 SkPictureRecorder recorder; |
147 pic->playback(recorder.beginRecording(pic->cullRect().width(), | 141 pic->playback(recorder.beginRecording(pic->cullRect().width(), |
148 pic->cullRect().height(), | 142 pic->cullRect().height(), |
149 NULL, 0)); | 143 NULL, 0)); |
150 SkAutoTUnref<SkPicture> p2(recorder.endRecording()); | 144 SkAutoTUnref<SkPicture> p2(recorder.endRecording()); |
151 | 145 |
152 SkString path2(path); | 146 SkString path2(path); |
153 path2.append(".new.skp"); | 147 path2.append(".new.skp"); |
154 SkFILEWStream writer(path2.c_str()); | 148 SkFILEWStream writer(path2.c_str()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 SampleView* CreateSamplePictFileView(const char filename[]) { | 189 SampleView* CreateSamplePictFileView(const char filename[]) { |
196 return new PictFileView(filename); | 190 return new PictFileView(filename); |
197 } | 191 } |
198 | 192 |
199 ////////////////////////////////////////////////////////////////////////////// | 193 ////////////////////////////////////////////////////////////////////////////// |
200 | 194 |
201 #if 0 | 195 #if 0 |
202 static SkView* MyFactory() { return new PictFileView; } | 196 static SkView* MyFactory() { return new PictFileView; } |
203 static SkViewRegister reg(MyFactory); | 197 static SkViewRegister reg(MyFactory); |
204 #endif | 198 #endif |
OLD | NEW |