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

Unified Diff: content/browser/renderer_host/software_output_device_win.cc

Issue 12340015: [CLOSED] Big patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « content/browser/renderer_host/software_output_device_linux.cc ('k') | content/common/cc_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/software_output_device_win.cc
diff --git a/content/browser/renderer_host/software_output_device_win.cc b/content/browser/renderer_host/software_output_device_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..097fbb9df051d3358599f5286833fc0dba6a617e
--- /dev/null
+++ b/content/browser/renderer_host/software_output_device_win.cc
@@ -0,0 +1,51 @@
+// Copyright (c) 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 "content/browser/renderer_host/software_output_device.h"
+
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/skia/include/core/SkDevice.h"
+#include "ui/compositor/compositor.h"
+#include "ui/gfx/gdi_util.h"
+
+namespace content {
+
+SoftwareOutputDevice::SoftwareOutputDevice(ui::Compositor* compositor)
+ : compositor_(compositor) {
+ hdc_ = ::GetWindowDC(compositor->widget());
+}
+
+SoftwareOutputDevice::~SoftwareOutputDevice() {
+ ::ReleaseDC(compositor_->widget(), hdc_);
+}
+
+void SoftwareOutputDevice::Resize(const gfx::Size& viewport_size) {
+ cc::SoftwareOutputDevice::Resize(viewport_size);
+ gfx::CreateBitmapHeader(viewport_size_.width(),
+ viewport_size_.height(), &bitmap_header_);
+}
+
+void SoftwareOutputDevice::EndPaint(cc::SoftwareFrameData* frame_data) {
+ DCHECK(device_);
+ DCHECK(frame_data == NULL);
+
+ if (!device_)
+ return;
+
+ gfx::Rect rect = damage_rect_;
+ rect.Intersect(gfx::Rect(viewport_size_));
+ if (rect.IsEmpty())
+ return;
+
+ const SkBitmap& bitmap = device_->accessBitmap(false);
+ gfx::StretchDIBits(hdc_,
+ rect.x(), rect.y(),
+ rect.width(), rect.height(),
+ rect.x(), rect.y(),
+ rect.width(), rect.height(),
+ bitmap.getPixels(),
+ reinterpret_cast<BITMAPINFO*>(&bitmap_header_));
+}
+
+} // namespace content
« no previous file with comments | « content/browser/renderer_host/software_output_device_linux.cc ('k') | content/common/cc_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698