commit-bot@chromium.org | c4b21e6 | 2014-04-11 18:33:31 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
commit-bot@chromium.org | 18fd2b9 | 2014-04-10 23:30:59 +0000 | [diff] [blame] | 8 | #include "Test.h" |
| 9 | |
mtklein | 887f397 | 2014-06-17 12:08:15 -0700 | [diff] [blame] | 10 | #include "../include/record/SkRecording.h" |
commit-bot@chromium.org | 18fd2b9 | 2014-04-10 23:30:59 +0000 | [diff] [blame] | 11 | |
| 12 | // Minimally exercise the public SkRecording API. |
| 13 | |
tfarina | 9ea53f9 | 2014-06-24 06:50:39 -0700 | [diff] [blame] | 14 | DEF_TEST(SkRecording, r) { |
commit-bot@chromium.org | 732bd66 | 2014-04-24 15:22:55 +0000 | [diff] [blame] | 15 | EXPERIMENTAL::SkRecording recording(1920, 1080); |
commit-bot@chromium.org | 18fd2b9 | 2014-04-10 23:30:59 +0000 | [diff] [blame] | 16 | |
| 17 | // Some very exciting commands here. |
commit-bot@chromium.org | 732bd66 | 2014-04-24 15:22:55 +0000 | [diff] [blame] | 18 | recording.canvas()->clipRect(SkRect::MakeWH(320, 240)); |
commit-bot@chromium.org | 18fd2b9 | 2014-04-10 23:30:59 +0000 | [diff] [blame] | 19 | |
commit-bot@chromium.org | 732bd66 | 2014-04-24 15:22:55 +0000 | [diff] [blame] | 20 | SkAutoTDelete<const EXPERIMENTAL::SkPlayback> playback(recording.releasePlayback()); |
commit-bot@chromium.org | 18fd2b9 | 2014-04-10 23:30:59 +0000 | [diff] [blame] | 21 | |
| 22 | SkCanvas target; |
| 23 | playback->draw(&target); |
commit-bot@chromium.org | 732bd66 | 2014-04-24 15:22:55 +0000 | [diff] [blame] | 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)); |
commit-bot@chromium.org | 18fd2b9 | 2014-04-10 23:30:59 +0000 | [diff] [blame] | 29 | } |