skia2/tests/RecordingTest.cpp
mtklein 887f3979f0 Add EXPERIMENTAL_beginRecording() for SkRecord-based recording.
The interesting stuff is in SkPictureRecorder.{h,cpp}.  The rest is mostly moving SkRecord from its own directories into core to avoid circular dependencies in GYP.

After plumbing SkRecord all the way through in Picture, I'll delete its old entry point include/record/SkRecording.h.  For now it and record.gypi need to stay where they are to keep Chrome building.

BUG=skia:
R=reed@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/331573004
2014-06-17 12:08:16 -07:00

30 lines
812 B
C++

/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "Test.h"
#include "../include/record/SkRecording.h"
// Minimally exercise the public SkRecording API.
DEF_TEST(RecordingTest, r) {
EXPERIMENTAL::SkRecording recording(1920, 1080);
// Some very exciting commands here.
recording.canvas()->clipRect(SkRect::MakeWH(320, 240));
SkAutoTDelete<const EXPERIMENTAL::SkPlayback> playback(recording.releasePlayback());
SkCanvas target;
playback->draw(&target);
// Here's another recording we never call releasePlayback().
// However pointless, this should be safe.
EXPERIMENTAL::SkRecording pointless(1920, 1080);
pointless.canvas()->clipRect(SkRect::MakeWH(320, 240));
}