IndexedDB: fsync after transactions.
[chromium-blink-merge.git] / cc / output / software_output_device.cc
blob3e75e069f376f4ef038134e3a6806c50aad2e1d2
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/SkBitmapDevice.h"
10 #include "third_party/skia/include/core/SkCanvas.h"
11 #include "ui/gfx/skia_util.h"
12 #include "ui/gfx/vsync_provider.h"
14 namespace cc {
16 SoftwareOutputDevice::SoftwareOutputDevice() {}
18 SoftwareOutputDevice::~SoftwareOutputDevice() {}
20 void SoftwareOutputDevice::Resize(gfx::Size viewport_size) {
21 if (viewport_size_ == viewport_size)
22 return;
24 viewport_size_ = viewport_size;
25 device_ = skia::AdoptRef(new SkBitmapDevice(SkBitmap::kARGB_8888_Config,
26 viewport_size.width(), viewport_size.height(), true));
27 canvas_ = skia::AdoptRef(new SkCanvas(device_.get()));
30 SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) {
31 DCHECK(device_);
32 damage_rect_ = damage_rect;
33 return canvas_.get();
36 void SoftwareOutputDevice::EndPaint(SoftwareFrameData* frame_data) {
37 DCHECK(frame_data);
38 frame_data->id = 0;
39 frame_data->size = viewport_size_;
40 frame_data->damage_rect = damage_rect_;
41 frame_data->handle = base::SharedMemory::NULLHandle();
44 void SoftwareOutputDevice::CopyToBitmap(
45 const gfx::Rect& rect, SkBitmap* output) {
46 DCHECK(device_);
47 const SkBitmap& bitmap = device_->accessBitmap(false);
48 bitmap.extractSubset(output, gfx::RectToSkIRect(rect));
51 void SoftwareOutputDevice::Scroll(
52 gfx::Vector2d delta, const gfx::Rect& clip_rect) {
53 NOTIMPLEMENTED();
56 void SoftwareOutputDevice::ReclaimSoftwareFrame(unsigned id) {
57 NOTIMPLEMENTED();
60 gfx::VSyncProvider* SoftwareOutputDevice::GetVSyncProvider() {
61 return vsync_provider_.get();
64 } // namespace cc