diff options
Diffstat (limited to 'cc/test/fake_software_output_device.cc')
-rw-r--r-- | cc/test/fake_software_output_device.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cc/test/fake_software_output_device.cc b/cc/test/fake_software_output_device.cc new file mode 100644 index 0000000..eebf2b9 --- /dev/null +++ b/cc/test/fake_software_output_device.cc @@ -0,0 +1,33 @@ +// Copyright 2012 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/test/fake_software_output_device.h" + +namespace cc { + +FakeSoftwareOutputDevice::FakeSoftwareOutputDevice() {} + +FakeSoftwareOutputDevice::~FakeSoftwareOutputDevice() {} + +WebKit::WebImage* FakeSoftwareOutputDevice::Lock(bool forWrite) { + DCHECK(device_); + image_ = device_->accessBitmap(forWrite); + return &image_; +} + +void FakeSoftwareOutputDevice::Unlock() { + image_.reset(); +} + +void FakeSoftwareOutputDevice::DidChangeViewportSize(gfx::Size size) { + if (device_.get() && + size.width() == device_->width() && + size.height() == device_->height()) + return; + + device_ = skia::AdoptRef(new SkDevice( + SkBitmap::kARGB_8888_Config, size.width(), size.height(), true)); +} + +} // namespace cc |