Chromium Code Reviews| Index: content/renderer/gpu/compositor_output_canvas_3d_to_2d_adapter.h |
| diff --git a/content/renderer/gpu/compositor_output_canvas_3d_to_2d_adapter.h b/content/renderer/gpu/compositor_output_canvas_3d_to_2d_adapter.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..33c9406f9be239eeb63d75ce67b4bd6a8678d259 |
| --- /dev/null |
| +++ b/content/renderer/gpu/compositor_output_canvas_3d_to_2d_adapter.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright (c) 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 CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_CANVAS_3D_TO_2D_ADAPTER_H_ |
| +#define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_CANVAS_3D_TO_2D_ADAPTER_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/threading/non_thread_safe.h" |
| +#include "third_party/skia/include/core/SkCanvas.h" |
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebImage.h" |
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutputCanvas2D.h" |
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" |
| +#include "ui/gfx/size.h" |
| + |
| +// This class can be created only on the main thread, but then becomes pinned |
| +// to a fixed thread when bindToClient is called. |
| +class CompositorOutputCanvas3DTo2DAdapter |
| + : NON_EXPORTED_BASE(public WebKit::WebCompositorOutputCanvas2D) |
| + , NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| +public: |
| + CompositorOutputCanvas3DTo2DAdapter(WebKit::WebGraphicsContext3D* context3d); |
| + virtual ~CompositorOutputCanvas3DTo2DAdapter(); |
| + |
| + virtual WebKit::WebImage* lock() OVERRIDE; |
| + virtual void unlockAndOutputFrame() OVERRIDE; |
| + |
| + virtual void viewportChanged(const WebKit::WebSize& size) OVERRIDE; |
| + |
| +private: |
| + void initGLAdapter(); |
|
piman
2012/08/28 03:31:58
nit: style. In Chrome, functions are CamelCase, fi
aelias_OOO_until_Jul13
2012/08/28 23:10:58
Done.
|
| + void textureGLAdapter(const gfx::Size& viewportSize); |
|
piman
2012/08/28 03:31:58
I don't know what this function does from the name
aelias_OOO_until_Jul13
2012/08/28 23:10:58
Done.
|
| + void frameDrawGLAdapter(void* pixels); |
|
piman
2012/08/28 03:31:58
Draw() ?
aelias_OOO_until_Jul13
2012/08/28 23:10:58
Done.
|
| + |
| + bool initialized_; |
| + int program_; |
| + int vertex_shader_; |
| + int fragment_shader_; |
| + int texture_uniform_; |
| + unsigned int vertex_buffer_; |
| + unsigned framebufferTextureId_; |
| + gfx::Size framebufferTextureSize_; |
| + |
| + scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
| + scoped_ptr<SkDevice> device_; |
| + WebKit::WebImage image_; |
| +}; |
| + |
| +#endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_CANVAS_3D_TO_2D_ADAPTER_H_ |