Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Unified Diff: cc/test/FakeWebCompositorSoftwareOutputDevice.h

Issue 10918258: Add CC software renderer. (Closed) Base URL: http://git.chromium.org/chromium/src.git@gladapter
Patch Set: Fix license headers Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/FakeWebCompositorOutputSurface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/FakeWebCompositorSoftwareOutputDevice.h
diff --git a/cc/test/FakeWebCompositorSoftwareOutputDevice.h b/cc/test/FakeWebCompositorSoftwareOutputDevice.h
new file mode 100644
index 0000000000000000000000000000000000000000..f362719934146ea13a7d027cc4e63bba5832791d
--- /dev/null
+++ b/cc/test/FakeWebCompositorSoftwareOutputDevice.h
@@ -0,0 +1,45 @@
+// 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.
+
+#ifndef FakeWebCompositorSoftwareOutputDevice_h
+#define FakeWebCompositorSoftwareOutputDevice_h
+
+#include "SkDevice.h"
+#include <public/WebCompositorSoftwareOutputDevice.h>
+#include <public/WebImage.h>
+#include <public/WebSize.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+
+class FakeWebCompositorSoftwareOutputDevice : public WebCompositorSoftwareOutputDevice {
+public:
+ virtual WebImage* lock(bool forWrite) OVERRIDE
+ {
+ ASSERT(m_device);
+ m_image = m_device->accessBitmap(forWrite);
+ return &m_image;
+ }
+ virtual void unlock() OVERRIDE
+ {
+ m_image.reset();
+ }
+
+ virtual void didChangeViewportSize(WebSize size) OVERRIDE
+ {
+ if (m_device.get() && size.width == m_device->width() && size.height == m_device->height())
+ return;
+
+ m_device = adoptPtr(new SkDevice(SkBitmap::kARGB_8888_Config, size.width, size.height, true));
+ }
+
+private:
+ OwnPtr<SkDevice> m_device;
+ WebImage m_image;
+};
+
+} // namespace WebKit
+
+#endif // FakeWebCompositorSoftwareOutputDevice_h
« no previous file with comments | « cc/test/FakeWebCompositorOutputSurface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698