| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_impl.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" | 12 |
| 13 class SkCanvas; |
| 14 class SkDevice; |
| 18 | 15 |
| 19 namespace content { | 16 namespace content { |
| 20 | 17 |
| 21 // This class can be created only on the main thread, but then becomes pinned | 18 // This class can be created only on the main thread, but then becomes pinned |
| 22 // to a fixed thread when bindToClient is called. | 19 // to a fixed thread when CompositorOutputSurface::bindToClient is called. |
| 23 class CompositorSoftwareOutputDeviceGLAdapter | 20 class CompositorSoftwareOutputDeviceGLAdapter |
| 24 : NON_EXPORTED_BASE(public cc::SoftwareOutputDevice), | 21 : NON_EXPORTED_BASE(public cc::SoftwareOutputDeviceImpl), |
| 25 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 22 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 26 public: | 23 public: |
| 27 CompositorSoftwareOutputDeviceGLAdapter( | 24 CompositorSoftwareOutputDeviceGLAdapter( |
| 28 WebKit::WebGraphicsContext3D* context3d); | 25 WebKit::WebGraphicsContext3D* context3d); |
| 29 virtual ~CompositorSoftwareOutputDeviceGLAdapter(); | 26 virtual ~CompositorSoftwareOutputDeviceGLAdapter(); |
| 30 | 27 |
| 31 // cc::SoftwareOutputDevice implementation | 28 virtual void Resize(const gfx::Size& size) OVERRIDE; |
| 32 virtual WebKit::WebImage* Lock(bool forWrite) OVERRIDE; | 29 virtual void EndPaint(const gfx::Rect& damage_rect) OVERRIDE; |
| 33 virtual void Unlock() OVERRIDE; | |
| 34 virtual void DidChangeViewportSize(gfx::Size size) OVERRIDE; | |
| 35 | 30 |
| 36 private: | 31 private: |
| 37 void Initialize(); | 32 void InitShaders(); |
| 38 void Destroy(); | |
| 39 void Resize(const gfx::Size& viewportSize); | |
| 40 void Draw(void* pixels); | |
| 41 | 33 |
| 42 bool initialized_; | 34 unsigned program_; |
| 43 int program_; | 35 unsigned vertex_shader_; |
| 44 int vertex_shader_; | 36 unsigned fragment_shader_; |
| 45 int fragment_shader_; | 37 unsigned vertex_buffer_; |
| 46 unsigned int vertex_buffer_; | 38 unsigned texture_id_; |
| 47 unsigned framebuffer_texture_id_; | |
| 48 gfx::Size framebuffer_texture_size_; | |
| 49 | |
| 50 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | 39 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
| 51 scoped_ptr<SkDevice> device_; | |
| 52 WebKit::WebImage image_; | |
| 53 bool locked_for_write_; | |
| 54 }; | 40 }; |
| 55 | 41 |
| 56 } // namespace content | 42 } // namespace content |
| 57 | 43 |
| 58 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_ | 44 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_ |
| OLD | NEW |