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 |