OLD | NEW |
| (Empty) |
1 // Copyright 2012 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. | |
4 | |
5 #include "cc/test/fake_software_output_device.h" | |
6 | |
7 namespace cc { | |
8 | |
9 FakeSoftwareOutputDevice::FakeSoftwareOutputDevice() {} | |
10 | |
11 FakeSoftwareOutputDevice::~FakeSoftwareOutputDevice() {} | |
12 | |
13 WebKit::WebImage* FakeSoftwareOutputDevice::Lock(bool forWrite) { | |
14 DCHECK(device_); | |
15 image_ = device_->accessBitmap(forWrite); | |
16 return &image_; | |
17 } | |
18 | |
19 void FakeSoftwareOutputDevice::Unlock() { | |
20 image_.reset(); | |
21 } | |
22 | |
23 void FakeSoftwareOutputDevice::DidChangeViewportSize(gfx::Size size) { | |
24 if (device_.get() && | |
25 size.width() == device_->width() && | |
26 size.height() == device_->height()) | |
27 return; | |
28 | |
29 device_ = skia::AdoptRef(new SkDevice( | |
30 SkBitmap::kARGB_8888_Config, size.width(), size.height(), true)); | |
31 } | |
32 | |
33 } // namespace cc | |
OLD | NEW |