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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 if (NULL == pic) { | 187 if (NULL == pic) { |
188 return NULL; | 188 return NULL; |
189 } | 189 } |
190 | 190 |
191 SkAutoTDelete<SkBBHFactory> factory; | 191 SkAutoTDelete<SkBBHFactory> factory; |
192 switch (bbox) { | 192 switch (bbox) { |
193 case kNo_BBoxType: | 193 case kNo_BBoxType: |
194 // no bbox playback necessary | 194 // no bbox playback necessary |
195 return pic.detach(); | 195 return pic.detach(); |
196 case kRTree_BBoxType: | 196 case kRTree_BBoxType: |
197 factory.reset(SkNEW(SkRTreeFactory)); | 197 factory.reset(new SkRTreeFactory); |
198 break; | 198 break; |
199 default: | 199 default: |
200 SkASSERT(false); | 200 SkASSERT(false); |
201 } | 201 } |
202 | 202 |
203 SkPictureRecorder recorder; | 203 SkPictureRecorder recorder; |
204 pic->playback(recorder.beginRecording(pic->cullRect().width(), | 204 pic->playback(recorder.beginRecording(pic->cullRect().width(), |
205 pic->cullRect().height(), | 205 pic->cullRect().height(), |
206 factory.get(), 0)); | 206 factory.get(), 0)); |
207 return recorder.endRecording(); | 207 return recorder.endRecording(); |
208 } | 208 } |
209 | 209 |
210 typedef SampleView INHERITED; | 210 typedef SampleView INHERITED; |
211 }; | 211 }; |
212 | 212 |
213 SampleView* CreateSamplePictFileView(const char filename[]); | 213 SampleView* CreateSamplePictFileView(const char filename[]); |
214 SampleView* CreateSamplePictFileView(const char filename[]) { | 214 SampleView* CreateSamplePictFileView(const char filename[]) { |
215 return new PictFileView(filename); | 215 return new PictFileView(filename); |
216 } | 216 } |
217 | 217 |
218 ////////////////////////////////////////////////////////////////////////////// | 218 ////////////////////////////////////////////////////////////////////////////// |
219 | 219 |
220 #if 0 | 220 #if 0 |
221 static SkView* MyFactory() { return new PictFileView; } | 221 static SkView* MyFactory() { return new PictFileView; } |
222 static SkViewRegister reg(MyFactory); | 222 static SkViewRegister reg(MyFactory); |
223 #endif | 223 #endif |
OLD | NEW |