| Index: cc/software_output_device_impl.cc
|
| diff --git a/cc/software_output_device_impl.cc b/cc/software_output_device_impl.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e0a77beaa1ed1badb9f1460560cb88e5c97d7005
|
| --- /dev/null
|
| +++ b/cc/software_output_device_impl.cc
|
| @@ -0,0 +1,51 @@
|
| +// Copyright 2013 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 "cc/software_output_device_impl.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "third_party/skia/include/core/SkCanvas.h"
|
| +#include "third_party/skia/include/core/SkDevice.h"
|
| +
|
| +namespace cc {
|
| +
|
| +SoftwareOutputDeviceImpl::SoftwareOutputDeviceImpl() {}
|
| +
|
| +SoftwareOutputDeviceImpl::~SoftwareOutputDeviceImpl() {}
|
| +
|
| +SkCanvas* SoftwareOutputDeviceImpl::BeginPaint() {
|
| + DCHECK(device_);
|
| + return canvas_.get();
|
| +}
|
| +
|
| +void SoftwareOutputDeviceImpl::EndPaint(const gfx::Rect& damage_rect) {
|
| + DCHECK(device_);
|
| +}
|
| +
|
| +void SoftwareOutputDeviceImpl::Resize(const gfx::Size& viewport_size) {
|
| + if (viewport_size_ == viewport_size)
|
| + return;
|
| +
|
| + viewport_size_ = viewport_size;
|
| + device_ = skia::AdoptRef(new SkDevice(SkBitmap::kARGB_8888_Config,
|
| + viewport_size.width(), viewport_size.height(), true));
|
| + canvas_ = skia::AdoptRef(new SkCanvas(device_.get()));
|
| +}
|
| +
|
| +void SoftwareOutputDeviceImpl::CopyToBitmap(
|
| + const gfx::Rect& rect, SkBitmap* output) {
|
| + DCHECK(device_);
|
| + SkIRect invertRect = SkIRect::MakeXYWH(
|
| + rect.x(), viewport_size_.height() - rect.bottom(),
|
| + rect.width(), rect.height());
|
| + const SkBitmap& bitmap = device_->accessBitmap(false);
|
| + bitmap.extractSubset(output, invertRect);
|
| +}
|
| +
|
| +void SoftwareOutputDeviceImpl::Scroll(
|
| + const gfx::Vector2d& delta, const gfx::Rect& clip_rect) {
|
| + NOTIMPLEMENTED();
|
| +}
|
| +
|
| +} // namespace cc
|
|
|