OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/aura/software_output_device_win.h" | 5 #include "content/browser/aura/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 18 matching lines...) Expand all Loading... |
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(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, ui::SCALE_FACTOR_100P, 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); |
43 } | 43 } |
44 | 44 |
45 SkCanvas* SoftwareOutputDeviceWin::BeginPaint(gfx::Rect damage_rect) { | 45 SkCanvas* SoftwareOutputDeviceWin::BeginPaint(gfx::Rect damage_rect) { |
46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
47 DCHECK(contents_); | 47 DCHECK(contents_); |
48 | 48 |
49 damage_rect_ = damage_rect; | 49 damage_rect_ = damage_rect; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 void SoftwareOutputDeviceWin::CopyToBitmap( | 95 void SoftwareOutputDeviceWin::CopyToBitmap( |
96 gfx::Rect rect, SkBitmap* output) { | 96 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 |