blob: 006655600207ed8b1173908ed5b134232d012852 [file] [log] [blame]
commit-bot@chromium.orgc4b21e62014-04-11 18:33:31 +00001/*
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.org18fd2b92014-04-10 23:30:59 +00008#include "Test.h"
9
mtklein887f3972014-06-17 12:08:15 -070010#include "../include/record/SkRecording.h"
commit-bot@chromium.org18fd2b92014-04-10 23:30:59 +000011
12// Minimally exercise the public SkRecording API.
13
tfarina9ea53f92014-06-24 06:50:39 -070014DEF_TEST(SkRecording, r) {
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000015 EXPERIMENTAL::SkRecording recording(1920, 1080);
commit-bot@chromium.org18fd2b92014-04-10 23:30:59 +000016
17 // Some very exciting commands here.
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000018 recording.canvas()->clipRect(SkRect::MakeWH(320, 240));
commit-bot@chromium.org18fd2b92014-04-10 23:30:59 +000019
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000020 SkAutoTDelete<const EXPERIMENTAL::SkPlayback> playback(recording.releasePlayback());
commit-bot@chromium.org18fd2b92014-04-10 23:30:59 +000021
22 SkCanvas target;
23 playback->draw(&target);
commit-bot@chromium.org732bd662014-04-24 15:22:55 +000024
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.org18fd2b92014-04-10 23:30:59 +000029}