| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_ | 5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_ |
| 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_ | 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
| 13 #include "cc/software_output_device.h" | 10 #include "cc/software_output_device.h" |
| 14 #include "third_party/skia/include/core/SkCanvas.h" | |
| 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebImage.h" | |
| 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 17 #include "ui/gfx/size.h" | |
| 18 | 12 |
| 19 namespace content { | 13 namespace content { |
| 20 | 14 |
| 21 // This class can be created only on the main thread, but then becomes pinned | 15 // This class can be created only on the main thread, but then becomes pinned |
| 22 // to a fixed thread when bindToClient is called. | 16 // to a fixed thread when bindToClient is called. |
| 23 class CompositorSoftwareOutputDeviceGLAdapter | 17 class CompositorSoftwareOutputDeviceGLAdapter |
| 24 : NON_EXPORTED_BASE(public cc::SoftwareOutputDevice), | 18 : NON_EXPORTED_BASE(public cc::SoftwareOutputDevice), |
| 25 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 19 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 26 public: | 20 public: |
| 27 CompositorSoftwareOutputDeviceGLAdapter( | 21 CompositorSoftwareOutputDeviceGLAdapter( |
| 28 WebKit::WebGraphicsContext3D* context3d); | 22 WebKit::WebGraphicsContext3D* context3d); |
| 29 virtual ~CompositorSoftwareOutputDeviceGLAdapter(); | 23 virtual ~CompositorSoftwareOutputDeviceGLAdapter(); |
| 30 | 24 |
| 31 // cc::SoftwareOutputDevice implementation | 25 virtual void Resize(const gfx::Size& size) OVERRIDE; |
| 32 virtual WebKit::WebImage* Lock(bool forWrite) OVERRIDE; | 26 virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE; |
| 33 virtual void Unlock() OVERRIDE; | |
| 34 virtual void DidChangeViewportSize(gfx::Size size) OVERRIDE; | |
| 35 | 27 |
| 36 private: | 28 private: |
| 37 void Initialize(); | 29 void InitShaders(); |
| 38 void Destroy(); | |
| 39 void Resize(const gfx::Size& viewportSize); | |
| 40 void Draw(void* pixels); | |
| 41 | 30 |
| 42 bool initialized_; | 31 unsigned program_; |
| 43 int program_; | 32 unsigned vertex_shader_; |
| 44 int vertex_shader_; | 33 unsigned fragment_shader_; |
| 45 int fragment_shader_; | 34 unsigned vertex_buffer_; |
| 46 unsigned int vertex_buffer_; | 35 unsigned texture_id_; |
| 47 unsigned framebuffer_texture_id_; | |
| 48 gfx::Size framebuffer_texture_size_; | |
| 49 | |
| 50 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | 36 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
| 51 scoped_ptr<SkDevice> device_; | |
| 52 WebKit::WebImage image_; | |
| 53 bool locked_for_write_; | |
| 54 }; | 37 }; |
| 55 | 38 |
| 56 } // namespace content | 39 } // namespace content |
| 57 | 40 |
| 58 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_ | 41 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_ |
| OLD | NEW |