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

Side by Side Diff: content/browser/renderer_host/software_output_device_win.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 "content/browser/renderer_host/software_output_device.h"
6
7 #include "third_party/skia/include/core/SkBitmap.h"
8 #include "third_party/skia/include/core/SkDevice.h"
9 #include "ui/compositor/compositor.h"
10 #include "ui/gfx/gdi_util.h"
11
12 namespace content {
13
14 SoftwareOutputDevice::SoftwareOutputDevice(ui::Compositor* compositor)
15 : compositor_(compositor) {
16 hdc_ = ::GetWindowDC(compositor->widget());
17 }
18
19 SoftwareOutputDevice::~SoftwareOutputDevice() {
20 ::ReleaseDC(compositor_->widget(), hdc_);
21 }
22
23 void SoftwareOutputDevice::Resize(const gfx::Size& viewport_size) {
24 SoftwareOutputDeviceImpl::Resize(viewport_size);
25 gfx::CreateBitmapHeader(viewport_size_.width(),
26 viewport_size_.height(), &bitmap_header_);
27 }
28
29 void SoftwareOutputDevice::EndPaint(const gfx::Rect& damage_rect) {
30 if (!device_)
31 return;
32
33 const SkBitmap& bitmap = device_->accessBitmap(false);
34 gfx::StretchDIBits(hdc_,
35 damage_rect.x(), damage_rect.y(),
36 damage_rect.width(), damage_rect.height(),
37 damage_rect.x(), damage_rect.y(),
38 damage_rect.width(), damage_rect.height(),
39 bitmap.getPixels(),
40 reinterpret_cast<BITMAPINFO*>(&bitmap_header_));
41 }
42
43 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/software_output_device_linux.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698