2 * Copyright 2014 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #include "SkPictureRecorder.h"
10 #include "SkRecordDraw.h"
11 #include "SkRecorder.h"
14 SkPictureRecorder::SkPictureRecorder() {}
16 SkPictureRecorder::~SkPictureRecorder() {}
18 SkCanvas* SkPictureRecorder::beginRecording(SkScalar width, SkScalar height,
19 SkBBHFactory* bbhFactory /* = NULL */,
20 uint32_t recordFlags /* = 0 */) {
25 fBBH.reset((*bbhFactory)(width, height));
29 fRecord.reset(SkNEW(SkRecord));
30 fRecorder.reset(SkNEW_ARGS(SkRecorder, (fRecord.get(), width, height)));
31 return this->getRecordingCanvas();
34 SkCanvas* SkPictureRecorder::getRecordingCanvas() {
35 return fRecorder.get();
38 SkPicture* SkPictureRecorder::endRecording() {
39 return SkNEW_ARGS(SkPicture, (fCullWidth, fCullHeight, fRecord.detach(), fBBH.get()));
42 void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
46 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/);