cc: Use worker context for one-copy tile initialization.
[chromium-blink-merge.git] / cc / output / software_output_device.cc
blob954c7b92079c5f6ff3a7caab2cdc18dfb94e0559
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
3 // found in the LICENSE file.
5 #include "cc/output/software_output_device.h"
7 #include "base/logging.h"
8 #include "cc/output/software_frame_data.h"
9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "ui/gfx/vsync_provider.h"
12 namespace cc {
14 SoftwareOutputDevice::SoftwareOutputDevice() : scale_factor_(1.f) {
17 SoftwareOutputDevice::~SoftwareOutputDevice() {}
19 void SoftwareOutputDevice::Resize(const gfx::Size& viewport_pixel_size,
20 float scale_factor) {
21 scale_factor_ = scale_factor;
23 if (viewport_pixel_size_ == viewport_pixel_size)
24 return;
26 SkImageInfo info = SkImageInfo::MakeN32(viewport_pixel_size.width(),
27 viewport_pixel_size.height(),
28 kOpaque_SkAlphaType);
29 viewport_pixel_size_ = viewport_pixel_size;
30 surface_ = skia::AdoptRef(SkSurface::NewRaster(info));
33 SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) {
34 damage_rect_ = damage_rect;
35 return surface_ ? surface_->getCanvas() : nullptr;
38 void SoftwareOutputDevice::EndPaint(SoftwareFrameData* frame_data) {
39 DCHECK(frame_data);
40 frame_data->id = 0;
41 frame_data->size = viewport_pixel_size_;
42 frame_data->damage_rect = damage_rect_;
45 void SoftwareOutputDevice::ReclaimSoftwareFrame(unsigned id) {
46 NOTIMPLEMENTED();
49 gfx::VSyncProvider* SoftwareOutputDevice::GetVSyncProvider() {
50 return vsync_provider_.get();
53 } // namespace cc