| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "skia/ext/platform_picture_skia.h" |
| 6 |
| 7 #include "skia/ext/recording_platform_device_skia.h" |
| 8 #include "third_party/skia/include/utils/SkProxyCanvas.h" |
| 9 |
| 10 namespace skia { |
| 11 |
| 12 PlatformPictureSkia::PlatformPictureSkia() { |
| 13 } |
| 14 |
| 15 PlatformPictureSkia::~PlatformPictureSkia() { |
| 16 } |
| 17 |
| 18 SkCanvas* PlatformPictureSkia::beginRecording(int width, int height) { |
| 19 record_ = new SkProxyCanvas; |
| 20 record_->unref(); // SkRefPtr and new both took a reference. |
| 21 record_->setProxy(picture_.beginRecording(width, height)); |
| 22 |
| 23 // Set device to handle platform paint. |
| 24 SkDevice* device = CreateRecordingPlatformDeviceSkia( |
| 25 &picture_, width, height); |
| 26 record_->setDevice(device); |
| 27 device->unref(); // Created with refcount 1, and setDevice refs. |
| 28 |
| 29 return record_.get(); |
| 30 } |
| 31 |
| 32 void PlatformPictureSkia::endRecording() { |
| 33 picture_.endRecording(); |
| 34 record_ = NULL; |
| 35 } |
| 36 |
| 37 void PlatformPictureSkia::drawPicture(SkCanvas* canvas) { |
| 38 canvas->drawPicture(picture_); |
| 39 } |
| 40 |
| 41 } // namespace skia |
| OLD | NEW |