chrome.windows.create should return new window id in Guest mode
[chromium-blink-merge.git] / cc / output / software_output_device.cc
blob03f977e7426983a06389db7909d34dfda26a22d3
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"
13 namespace cc {
15 SoftwareOutputDevice::SoftwareOutputDevice() {}
17 SoftwareOutputDevice::~SoftwareOutputDevice() {}
19 void SoftwareOutputDevice::Resize(gfx::Size viewport_size) {
20 if (viewport_size_ == viewport_size)
21 return;
23 viewport_size_ = viewport_size;
24 device_ = skia::AdoptRef(new SkBitmapDevice(SkBitmap::kARGB_8888_Config,
25 viewport_size.width(), viewport_size.height(), true));
26 canvas_ = skia::AdoptRef(new SkCanvas(device_.get()));
29 SkCanvas* SoftwareOutputDevice::BeginPaint(gfx::Rect damage_rect) {
30 DCHECK(device_);
31 damage_rect_ = damage_rect;
32 return canvas_.get();
35 void SoftwareOutputDevice::EndPaint(SoftwareFrameData* frame_data) {
36 DCHECK(frame_data);
37 frame_data->id = 0;
38 frame_data->size = viewport_size_;
39 frame_data->damage_rect = damage_rect_;
40 frame_data->handle = base::SharedMemory::NULLHandle();
43 void SoftwareOutputDevice::CopyToBitmap(
44 gfx::Rect rect, SkBitmap* output) {
45 DCHECK(device_);
46 const SkBitmap& bitmap = device_->accessBitmap(false);
47 bitmap.extractSubset(output, gfx::RectToSkIRect(rect));
50 void SoftwareOutputDevice::Scroll(
51 gfx::Vector2d delta, gfx::Rect clip_rect) {
52 NOTIMPLEMENTED();
55 void SoftwareOutputDevice::ReclaimSoftwareFrame(unsigned id) {
56 NOTIMPLEMENTED();
59 } // namespace cc