Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: cc/output/software_output_device.cc

Issue 2399983003: cc: Make OutputSurface::Reshape abstract (Closed)
Patch Set: reshapeabstract: . Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/software_output_device.h ('k') | cc/test/fake_output_surface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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() = default;
14 } 14 SoftwareOutputDevice::~SoftwareOutputDevice() = default;
15
16 SoftwareOutputDevice::~SoftwareOutputDevice() {}
17 15
18 void SoftwareOutputDevice::Resize(const gfx::Size& viewport_pixel_size, 16 void SoftwareOutputDevice::Resize(const gfx::Size& viewport_pixel_size,
19 float scale_factor) { 17 float scale_factor) {
20 scale_factor_ = scale_factor;
21
22 if (viewport_pixel_size_ == viewport_pixel_size) 18 if (viewport_pixel_size_ == viewport_pixel_size)
23 return; 19 return;
24 20
25 SkImageInfo info = SkImageInfo::MakeN32(viewport_pixel_size.width(), 21 SkImageInfo info = SkImageInfo::MakeN32(viewport_pixel_size.width(),
26 viewport_pixel_size.height(), 22 viewport_pixel_size.height(),
27 kOpaque_SkAlphaType); 23 kOpaque_SkAlphaType);
28 viewport_pixel_size_ = viewport_pixel_size; 24 viewport_pixel_size_ = viewport_pixel_size;
29 surface_ = SkSurface::MakeRaster(info); 25 surface_ = SkSurface::MakeRaster(info);
30 } 26 }
31 27
32 SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) { 28 SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) {
33 damage_rect_ = damage_rect; 29 damage_rect_ = damage_rect;
34 return surface_ ? surface_->getCanvas() : nullptr; 30 return surface_ ? surface_->getCanvas() : nullptr;
35 } 31 }
36 32
37 void SoftwareOutputDevice::EndPaint() {} 33 void SoftwareOutputDevice::EndPaint() {}
38 34
39 gfx::VSyncProvider* SoftwareOutputDevice::GetVSyncProvider() { 35 gfx::VSyncProvider* SoftwareOutputDevice::GetVSyncProvider() {
40 return vsync_provider_.get(); 36 return vsync_provider_.get();
41 } 37 }
42 38
43 } // namespace cc 39 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/software_output_device.h ('k') | cc/test/fake_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698