OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "Test.h" | 8 #include "Test.h" |
9 | 9 |
10 #include "SkRecording.h" | 10 #include "SkRecording.h" |
11 | 11 |
12 // Minimally exercise the public SkRecording API. | 12 // Minimally exercise the public SkRecording API. |
13 | 13 |
14 DEF_TEST(RecordingTest, r) { | 14 DEF_TEST(RecordingTest, r) { |
15 EXPERIMENTAL::SkRecording* recording = EXPERIMENTAL::SkRecording::Create(192
0, 1080); | 15 EXPERIMENTAL::SkRecording recording(1920, 1080); |
16 | 16 |
17 // Some very exciting commands here. | 17 // Some very exciting commands here. |
18 recording->canvas()->clipRect(SkRect::MakeWH(320, 240)); | 18 recording.canvas()->clipRect(SkRect::MakeWH(320, 240)); |
19 | 19 |
20 SkAutoTDelete<const EXPERIMENTAL::SkPlayback> playback( | 20 SkAutoTDelete<const EXPERIMENTAL::SkPlayback> playback(recording.releasePlay
back()); |
21 EXPERIMENTAL::SkRecording::Delete(recording)); | |
22 | 21 |
23 SkCanvas target; | 22 SkCanvas target; |
24 playback->draw(&target); | 23 playback->draw(&target); |
| 24 |
| 25 // Here's another recording we never call releasePlayback(). |
| 26 // However pointless, this should be safe. |
| 27 EXPERIMENTAL::SkRecording pointless(1920, 1080); |
| 28 pointless.canvas()->clipRect(SkRect::MakeWH(320, 240)); |
25 } | 29 } |
OLD | NEW |