Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Unified Diff: cc/software_output_device_impl.cc

Issue 11967033: [CLOSED] In-browser software compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the lack SkCanvas::clear scissoring. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/software_output_device_impl.h ('k') | cc/software_renderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « cc/software_output_device_impl.h ('k') | cc/software_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698