Index: cc/software_output_device.cc |
diff --git a/cc/software_output_device.cc b/cc/software_output_device.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1e693e71b904548a9dcca2493d005600cabbce2c |
--- /dev/null |
+++ b/cc/software_output_device.cc |
@@ -0,0 +1,61 @@ |
+// 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.h" |
+ |
+#include "base/logging.h" |
+#include "cc/software_frame_data.h" |
+#include "third_party/skia/include/core/SkCanvas.h" |
+#include "third_party/skia/include/core/SkDevice.h" |
+ |
+namespace cc { |
+ |
+SoftwareOutputDevice::SoftwareOutputDevice() {} |
+ |
+SoftwareOutputDevice::~SoftwareOutputDevice() {} |
+ |
+void SoftwareOutputDevice::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())); |
+} |
+ |
+SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) { |
+ DCHECK(device_); |
+ damage_rect_ = damage_rect; |
+ return canvas_.get(); |
+} |
+ |
+void SoftwareOutputDevice::EndPaint(SoftwareFrameData* frame_data) { |
+ DCHECK(device_); |
+ if (frame_data) { |
+ frame_data->damage_rect = damage_rect_; |
+ frame_data->content_dib = TransportDIB::DefaultHandleValue(); |
+ } |
+} |
+ |
+void SoftwareOutputDevice::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 SoftwareOutputDevice::Scroll( |
+ const gfx::Vector2d& delta, const gfx::Rect& clip_rect) { |
+ NOTIMPLEMENTED(); |
Ken Russell (switch to Gerrit)
2013/03/01 23:17:09
Should there be some way to inform callers that th
|
+} |
+ |
+void SoftwareOutputDevice::ReclaimDIB(TransportDIB::Handle handle) { |
+ NOTIMPLEMENTED(); |
+} |
+ |
+} // namespace cc |