| Index: skia/ext/platform_picture_skia.cc
|
| diff --git a/skia/ext/platform_picture_skia.cc b/skia/ext/platform_picture_skia.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..278783503438852a8c1b05614c326a4b11fb3135
|
| --- /dev/null
|
| +++ b/skia/ext/platform_picture_skia.cc
|
| @@ -0,0 +1,48 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "skia/ext/platform_picture_skia.h"
|
| +
|
| +#include "skia/ext/recording_platform_device_skia.h"
|
| +#include "third_party/skia/include/utils/SkProxyCanvas.h"
|
| +
|
| +namespace skia {
|
| +
|
| +PlatformPictureSkia::PlatformPictureSkia() : record_(NULL) {
|
| +}
|
| +
|
| +PlatformPictureSkia::~PlatformPictureSkia() {
|
| + if (record_)
|
| + record_->unref();
|
| +}
|
| +
|
| +SkCanvas* PlatformPictureSkia::beginRecording(int width, int height) {
|
| + if (record_)
|
| + record_->unref();
|
| + record_ = new SkProxyCanvas;
|
| + record_->setProxy(picture_.beginRecording(width, height));
|
| +
|
| + // Set device to handle platform paint.
|
| + SkDevice* device = CreateRecordingPlatformDeviceSkia(
|
| + &picture_, width, height);
|
| + record_->setDevice(device);
|
| + device->unref(); // Created with refcount 1, and setDevice refs.
|
| +
|
| + return record_;
|
| +}
|
| +
|
| +void PlatformPictureSkia::endRecording() {
|
| + picture_.endRecording();
|
| +
|
| + if (record_) {
|
| + record_->unref();
|
| + record_ = NULL;
|
| + }
|
| +}
|
| +
|
| +void PlatformPictureSkia::drawInto(SkCanvas* canvas) {
|
| + canvas->drawPicture(picture_);
|
| +}
|
| +
|
| +} // namespace skia
|
|
|