OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_CANVAS_3D_TO_2D_ADAPTER_H_ | |
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_CANVAS_3D_TO_2D_ADAPTER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/threading/non_thread_safe.h" | |
13 #include "third_party/skia/include/core/SkCanvas.h" | |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebImage.h" | |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Canvas2D.h" | |
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" | |
17 #include "ui/gfx/size.h" | |
18 | |
19 // This class can be created only on the main thread, but then becomes pinned | |
20 // to a fixed thread when bindToClient is called. | |
21 class CompositorOutputCanvas3DTo2DAdapter | |
22 : NON_EXPORTED_BASE(public WebKit::WebCompositorOutputCanvas2D) | |
23 , NON_EXPORTED_BASE(public base::NonThreadSafe) { | |
24 public: | |
25 CompositorOutputCanvas3DTo2DAdapter(WebKit::WebGraphicsContext3D* context3d); | |
26 virtual ~CompositorOutputCanvas3DTo2DAdapter(); | |
27 | |
28 virtual WebKit::WebImage* lock() OVERRIDE; | |
29 virtual void unlockAndOutputFrame() OVERRIDE; | |
30 | |
31 virtual void viewportChanged(const WebKit::WebSize& size) OVERRIDE; | |
32 | |
33 private: | |
34 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.
| |
35 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.
| |
36 void frameDrawGLAdapter(void* pixels); | |
piman
2012/08/28 03:31:58
Draw() ?
aelias_OOO_until_Jul13
2012/08/28 23:10:58
Done.
| |
37 | |
38 bool initialized_; | |
39 int program_; | |
40 int vertex_shader_; | |
41 int fragment_shader_; | |
42 int texture_uniform_; | |
43 unsigned int vertex_buffer_; | |
44 unsigned framebufferTextureId_; | |
45 gfx::Size framebufferTextureSize_; | |
46 | |
47 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | |
48 scoped_ptr<SkDevice> device_; | |
49 WebKit::WebImage image_; | |
50 }; | |
51 | |
52 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_CANVAS_3D_TO_2D_ADAPTER_H_ | |
OLD | NEW |