| 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 "third_party/skia/include/core/SkCanvas.h" | 8 #include "third_party/skia/include/core/SkCanvas.h" |
| 9 #include "ui/gfx/vsync_provider.h" | 9 #include "ui/gfx/vsync_provider.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 SoftwareOutputDevice::SoftwareOutputDevice() : scale_factor_(1.f) { | 13 SoftwareOutputDevice::SoftwareOutputDevice() : scale_factor_(1.f) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 SoftwareOutputDevice::~SoftwareOutputDevice() {} | 16 SoftwareOutputDevice::~SoftwareOutputDevice() {} |
| 17 | 17 |
| 18 void SoftwareOutputDevice::Resize(const gfx::Size& viewport_pixel_size, | 18 void SoftwareOutputDevice::Resize(const gfx::Size& viewport_pixel_size, |
| 19 float scale_factor) { | 19 float scale_factor) { |
| 20 scale_factor_ = scale_factor; | 20 scale_factor_ = scale_factor; |
| 21 | 21 |
| 22 if (viewport_pixel_size_ == viewport_pixel_size) | 22 if (viewport_pixel_size_ == viewport_pixel_size) |
| 23 return; | 23 return; |
| 24 | 24 |
| 25 SkImageInfo info = SkImageInfo::MakeN32(viewport_pixel_size.width(), | 25 SkImageInfo info = SkImageInfo::MakeN32(viewport_pixel_size.width(), |
| 26 viewport_pixel_size.height(), | 26 viewport_pixel_size.height(), |
| 27 kOpaque_SkAlphaType); | 27 kOpaque_SkAlphaType); |
| 28 viewport_pixel_size_ = viewport_pixel_size; | 28 viewport_pixel_size_ = viewport_pixel_size; |
| 29 surface_ = skia::AdoptRef(SkSurface::NewRaster(info)); | 29 surface_ = SkSurface::MakeRaster(info); |
| 30 } | 30 } |
| 31 | 31 |
| 32 SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) { | 32 SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) { |
| 33 damage_rect_ = damage_rect; | 33 damage_rect_ = damage_rect; |
| 34 return surface_ ? surface_->getCanvas() : nullptr; | 34 return surface_ ? surface_->getCanvas() : nullptr; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void SoftwareOutputDevice::EndPaint() {} | 37 void SoftwareOutputDevice::EndPaint() {} |
| 38 | 38 |
| 39 gfx::VSyncProvider* SoftwareOutputDevice::GetVSyncProvider() { | 39 gfx::VSyncProvider* SoftwareOutputDevice::GetVSyncProvider() { |
| 40 return vsync_provider_.get(); | 40 return vsync_provider_.get(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace cc | 43 } // namespace cc |
| OLD | NEW |