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 "cc/output/software_output_device.h" | 5 #include "cc/output/software_output_device.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "cc/output/software_frame_data.h" | 8 #include "cc/output/software_frame_data.h" |
9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "ui/gfx/skia_util.h" | 10 #include "ui/gfx/skia_util.h" |
11 #include "ui/gfx/vsync_provider.h" | 11 #include "ui/gfx/vsync_provider.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 | 14 |
15 SoftwareOutputDevice::SoftwareOutputDevice() {} | 15 SoftwareOutputDevice::SoftwareOutputDevice() : scale_factor_(1.f) { |
| 16 } |
16 | 17 |
17 SoftwareOutputDevice::~SoftwareOutputDevice() {} | 18 SoftwareOutputDevice::~SoftwareOutputDevice() {} |
18 | 19 |
19 void SoftwareOutputDevice::Resize(const gfx::Size& viewport_size) { | 20 void SoftwareOutputDevice::Resize(const gfx::Size& viewport_pixel_size, |
20 if (viewport_size_ == viewport_size) | 21 float scale_factor) { |
| 22 scale_factor_ = scale_factor; |
| 23 |
| 24 if (viewport_size_ == viewport_pixel_size) |
21 return; | 25 return; |
22 | 26 |
23 SkImageInfo info = SkImageInfo::MakeN32( | 27 SkImageInfo info = SkImageInfo::MakeN32(viewport_pixel_size.width(), |
24 viewport_size.width(), viewport_size.height(), kOpaque_SkAlphaType); | 28 viewport_pixel_size.height(), |
25 viewport_size_ = viewport_size; | 29 kOpaque_SkAlphaType); |
| 30 viewport_size_ = viewport_pixel_size; |
26 canvas_ = skia::AdoptRef(SkCanvas::NewRaster(info)); | 31 canvas_ = skia::AdoptRef(SkCanvas::NewRaster(info)); |
27 } | 32 } |
28 | 33 |
29 SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) { | 34 SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) { |
30 DCHECK(canvas_); | 35 DCHECK(canvas_); |
31 damage_rect_ = damage_rect; | 36 damage_rect_ = damage_rect; |
32 return canvas_.get(); | 37 return canvas_.get(); |
33 } | 38 } |
34 | 39 |
35 void SoftwareOutputDevice::EndPaint(SoftwareFrameData* frame_data) { | 40 void SoftwareOutputDevice::EndPaint(SoftwareFrameData* frame_data) { |
(...skipping 16 matching lines...) Expand all Loading... |
52 | 57 |
53 void SoftwareOutputDevice::ReclaimSoftwareFrame(unsigned id) { | 58 void SoftwareOutputDevice::ReclaimSoftwareFrame(unsigned id) { |
54 NOTIMPLEMENTED(); | 59 NOTIMPLEMENTED(); |
55 } | 60 } |
56 | 61 |
57 gfx::VSyncProvider* SoftwareOutputDevice::GetVSyncProvider() { | 62 gfx::VSyncProvider* SoftwareOutputDevice::GetVSyncProvider() { |
58 return vsync_provider_.get(); | 63 return vsync_provider_.get(); |
59 } | 64 } |
60 | 65 |
61 } // namespace cc | 66 } // namespace cc |
OLD | NEW |