OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 canvas->save(); | 298 canvas->save(); |
299 this->drawPicture(canvas, 0); | 299 this->drawPicture(canvas, 0); |
300 canvas->restore(); | 300 canvas->restore(); |
301 | 301 |
302 { | 302 { |
303 SkPictureRecorder recorder; | 303 SkPictureRecorder recorder; |
304 { | 304 { |
305 SkCanvas* record = recorder.beginRecording(320, 480, nullptr, 0)
; | 305 SkCanvas* record = recorder.beginRecording(320, 480, nullptr, 0)
; |
306 this->drawPicture(record, 120); | 306 this->drawPicture(record, 120); |
307 } | 307 } |
308 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 308 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); |
309 | 309 |
310 canvas->translate(0, SkIntToScalar(120)); | 310 canvas->translate(0, SkIntToScalar(120)); |
311 | 311 |
312 SkRect clip; | 312 SkRect clip; |
313 clip.set(0, 0, SkIntToScalar(160), SkIntToScalar(160)); | 313 clip.set(0, 0, SkIntToScalar(160), SkIntToScalar(160)); |
314 do { | 314 do { |
315 canvas->save(); | 315 canvas->save(); |
316 canvas->clipRect(clip); | 316 canvas->clipRect(clip); |
317 picture->playback(canvas); | 317 picture->playback(canvas); |
318 canvas->restore(); | 318 canvas->restore(); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 private: | 566 private: |
567 SkPoint fClickPt; | 567 SkPoint fClickPt; |
568 SkBitmap fBug, fTb, fTx; | 568 SkBitmap fBug, fTb, fTx; |
569 typedef SampleView INHERITED; | 569 typedef SampleView INHERITED; |
570 }; | 570 }; |
571 | 571 |
572 ////////////////////////////////////////////////////////////////////////////// | 572 ////////////////////////////////////////////////////////////////////////////// |
573 | 573 |
574 static SkView* MyFactory() { return new DemoView; } | 574 static SkView* MyFactory() { return new DemoView; } |
575 static SkViewRegister reg(MyFactory); | 575 static SkViewRegister reg(MyFactory); |
OLD | NEW |