blob: 3e75e069f376f4ef038134e3a6806c50aad2e1d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/output/software_output_device.h"
#include "base/logging.h"
#include "cc/output/software_frame_data.h"
#include "third_party/skia/include/core/SkBitmapDevice.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/gfx/skia_util.h"
#include "ui/gfx/vsync_provider.h"
namespace cc {
SoftwareOutputDevice::SoftwareOutputDevice() {}
SoftwareOutputDevice::~SoftwareOutputDevice() {}
void SoftwareOutputDevice::Resize(gfx::Size viewport_size) {
if (viewport_size_ == viewport_size)
return;
viewport_size_ = viewport_size;
device_ = skia::AdoptRef(new SkBitmapDevice(SkBitmap::kARGB_8888_Config,
viewport_size.width(), viewport_size.height(), true));
canvas_ = skia::AdoptRef(new SkCanvas(device_.get()));
}
SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) {
DCHECK(device_);
damage_rect_ = damage_rect;
return canvas_.get();
}
void SoftwareOutputDevice::EndPaint(SoftwareFrameData* frame_data) {
DCHECK(frame_data);
frame_data->id = 0;
frame_data->size = viewport_size_;
frame_data->damage_rect = damage_rect_;
frame_data->handle = base::SharedMemory::NULLHandle();
}
void SoftwareOutputDevice::CopyToBitmap(
const gfx::Rect& rect, SkBitmap* output) {
DCHECK(device_);
const SkBitmap& bitmap = device_->accessBitmap(false);
bitmap.extractSubset(output, gfx::RectToSkIRect(rect));
}
void SoftwareOutputDevice::Scroll(
gfx::Vector2d delta, const gfx::Rect& clip_rect) {
NOTIMPLEMENTED();
}
void SoftwareOutputDevice::ReclaimSoftwareFrame(unsigned id) {
NOTIMPLEMENTED();
}
gfx::VSyncProvider* SoftwareOutputDevice::GetVSyncProvider() {
return vsync_provider_.get();
}
} // namespace cc
|