OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/compositor/software_output_device_win.h" | 5 #include "content/browser/compositor/software_output_device_win.h" |
6 | 6 |
7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "third_party/skia/include/core/SkDevice.h" | 9 #include "third_party/skia/include/core/SkDevice.h" |
10 #include "ui/compositor/compositor.h" | 10 #include "ui/compositor/compositor.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 22 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
23 | 23 |
24 LONG style = GetWindowLong(hwnd_, GWL_EXSTYLE); | 24 LONG style = GetWindowLong(hwnd_, GWL_EXSTYLE); |
25 is_hwnd_composited_ = !!(style & WS_EX_COMPOSITED); | 25 is_hwnd_composited_ = !!(style & WS_EX_COMPOSITED); |
26 } | 26 } |
27 | 27 |
28 SoftwareOutputDeviceWin::~SoftwareOutputDeviceWin() { | 28 SoftwareOutputDeviceWin::~SoftwareOutputDeviceWin() { |
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
30 } | 30 } |
31 | 31 |
32 void SoftwareOutputDeviceWin::Resize(gfx::Size viewport_size) { | 32 void SoftwareOutputDeviceWin::Resize(const gfx::Size& viewport_size) { |
33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
34 | 34 |
35 if (viewport_size_ == viewport_size) | 35 if (viewport_size_ == viewport_size) |
36 return; | 36 return; |
37 | 37 |
38 viewport_size_ = viewport_size; | 38 viewport_size_ = viewport_size; |
39 contents_.reset(new gfx::Canvas(viewport_size, 1.0f, true)); | 39 contents_.reset(new gfx::Canvas(viewport_size, 1.0f, true)); |
40 memset(&bitmap_info_, 0, sizeof(bitmap_info_)); | 40 memset(&bitmap_info_, 0, sizeof(bitmap_info_)); |
41 gfx::CreateBitmapHeader(viewport_size_.width(), viewport_size_.height(), | 41 gfx::CreateBitmapHeader(viewport_size_.width(), viewport_size_.height(), |
42 &bitmap_info_.bmiHeader); | 42 &bitmap_info_.bmiHeader); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 void SoftwareOutputDeviceWin::CopyToBitmap( | 95 void SoftwareOutputDeviceWin::CopyToBitmap( |
96 const gfx::Rect& rect, SkBitmap* output) { | 96 const gfx::Rect& rect, SkBitmap* output) { |
97 DCHECK(contents_); | 97 DCHECK(contents_); |
98 SkBaseDevice* device = contents_->sk_canvas()->getDevice(); | 98 SkBaseDevice* device = contents_->sk_canvas()->getDevice(); |
99 const SkBitmap& bitmap = device->accessBitmap(false); | 99 const SkBitmap& bitmap = device->accessBitmap(false); |
100 bitmap.extractSubset(output, gfx::RectToSkIRect(rect)); | 100 bitmap.extractSubset(output, gfx::RectToSkIRect(rect)); |
101 } | 101 } |
102 | 102 |
103 } // namespace content | 103 } // namespace content |
OLD | NEW |