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_ozone.h" | 5 #include "content/browser/compositor/software_output_device_ozone.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ui/compositor/compositor.h" | 9 #include "ui/compositor/compositor.h" |
10 #include "ui/gfx/skia_util.h" | 10 #include "ui/gfx/skia_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 vsync_provider_ = surface_ozone_->CreateVSyncProvider(); | 40 vsync_provider_ = surface_ozone_->CreateVSyncProvider(); |
41 } | 41 } |
42 | 42 |
43 SoftwareOutputDeviceOzone::~SoftwareOutputDeviceOzone() { | 43 SoftwareOutputDeviceOzone::~SoftwareOutputDeviceOzone() { |
44 } | 44 } |
45 | 45 |
46 void SoftwareOutputDeviceOzone::Resize(const gfx::Size& viewport_pixel_size, | 46 void SoftwareOutputDeviceOzone::Resize(const gfx::Size& viewport_pixel_size, |
47 float scale_factor) { | 47 float scale_factor) { |
48 scale_factor_ = scale_factor; | |
49 | |
50 if (viewport_pixel_size_ == viewport_pixel_size) | 48 if (viewport_pixel_size_ == viewport_pixel_size) |
51 return; | 49 return; |
52 | 50 |
53 viewport_pixel_size_ = viewport_pixel_size; | 51 viewport_pixel_size_ = viewport_pixel_size; |
54 | 52 |
55 surface_ozone_->ResizeCanvas(viewport_pixel_size_); | 53 surface_ozone_->ResizeCanvas(viewport_pixel_size_); |
56 } | 54 } |
57 | 55 |
58 SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(const gfx::Rect& damage_rect) { | 56 SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(const gfx::Rect& damage_rect) { |
59 DCHECK(gfx::Rect(viewport_pixel_size_).Contains(damage_rect)); | 57 DCHECK(gfx::Rect(viewport_pixel_size_).Contains(damage_rect)); |
60 | 58 |
61 // Get canvas for next frame. | 59 // Get canvas for next frame. |
62 surface_ = surface_ozone_->GetSurface(); | 60 surface_ = surface_ozone_->GetSurface(); |
63 | 61 |
64 return SoftwareOutputDevice::BeginPaint(damage_rect); | 62 return SoftwareOutputDevice::BeginPaint(damage_rect); |
65 } | 63 } |
66 | 64 |
67 void SoftwareOutputDeviceOzone::EndPaint() { | 65 void SoftwareOutputDeviceOzone::EndPaint() { |
68 SoftwareOutputDevice::EndPaint(); | 66 SoftwareOutputDevice::EndPaint(); |
69 | 67 |
70 surface_ozone_->PresentCanvas(damage_rect_); | 68 surface_ozone_->PresentCanvas(damage_rect_); |
71 } | 69 } |
72 | 70 |
73 } // namespace content | 71 } // namespace content |
OLD | NEW |