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_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_ |
| 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_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/WebCompositorSoftwa
reOutputDevice.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 CompositorSoftwareOutputDeviceGLAdapter |
| 22 : NON_EXPORTED_BASE(public WebKit::WebCompositorSoftwareOutputDevice), |
| 23 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 24 public: |
| 25 CompositorSoftwareOutputDeviceGLAdapter( |
| 26 WebKit::WebGraphicsContext3D* context3d); |
| 27 virtual ~CompositorSoftwareOutputDeviceGLAdapter(); |
| 28 |
| 29 virtual WebKit::WebImage* lock(bool forWrite) OVERRIDE; |
| 30 virtual void unlock() OVERRIDE; |
| 31 |
| 32 virtual void didChangeViewportSize(WebKit::WebSize size) OVERRIDE; |
| 33 |
| 34 private: |
| 35 void Initialize(); |
| 36 void Destroy(); |
| 37 void Resize(const gfx::Size& viewportSize); |
| 38 void Draw(void* pixels); |
| 39 |
| 40 bool initialized_; |
| 41 int program_; |
| 42 int vertex_shader_; |
| 43 int fragment_shader_; |
| 44 unsigned int vertex_buffer_; |
| 45 unsigned framebuffer_texture_id_; |
| 46 gfx::Size framebuffer_texture_size_; |
| 47 |
| 48 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; |
| 49 scoped_ptr<SkDevice> device_; |
| 50 WebKit::WebImage image_; |
| 51 bool locked_for_write_; |
| 52 }; |
| 53 |
| 54 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_GL_ADAPTER_H_ |
OLD | NEW |