| 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_COMMON_GPU_CLIENT_GL_HELPER_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/atomicops.h" | 8 #include "base/atomicops.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // size of the texture. No post processing is applied to the pixels. The | 46 // size of the texture. No post processing is applied to the pixels. The |
| 47 // texture is assumed to have a format of GL_RGBA with a pixel type of | 47 // texture is assumed to have a format of GL_RGBA with a pixel type of |
| 48 // GL_UNSIGNED_BYTE. This is a blocking call that calls glReadPixels on this | 48 // GL_UNSIGNED_BYTE. This is a blocking call that calls glReadPixels on this |
| 49 // current context. | 49 // current context. |
| 50 void ReadbackTextureSync(WebKit::WebGLId texture, | 50 void ReadbackTextureSync(WebKit::WebGLId texture, |
| 51 const gfx::Size& size, | 51 const gfx::Size& size, |
| 52 unsigned char* out); | 52 unsigned char* out); |
| 53 | 53 |
| 54 // Creates a copy of the specified texture. |size| is the size of the texture. | 54 // Creates a copy of the specified texture. |size| is the size of the texture. |
| 55 WebKit::WebGLId CopyTexture(WebKit::WebGLId texture, | 55 WebKit::WebGLId CopyTexture(WebKit::WebGLId texture, |
| 56 const gfx::Size& size); | 56 const gfx::Size& size, |
| 57 WebKit::WebGLId texture_out = 0); |
| 57 | 58 |
| 58 // Creates a scaled copy of the specified texture. |src_size| is the size of | 59 // Creates a scaled copy of the specified texture. |src_size| is the size of |
| 59 // the texture and |dst_size| is the size of the resulting copy. | 60 // the texture and |dst_size| is the size of the resulting copy. |
| 60 WebKit::WebGLId CopyAndScaleTexture(WebKit::WebGLId texture, | 61 WebKit::WebGLId CopyAndScaleTexture(WebKit::WebGLId texture, |
| 61 const gfx::Size& src_size, | 62 const gfx::Size& src_size, |
| 62 const gfx::Size& dst_size); | 63 const gfx::Size& dst_size, |
| 64 WebKit::WebGLId texture_out = 0); |
| 63 | 65 |
| 64 // Returns the shader compiled from the source. | 66 // Returns the shader compiled from the source. |
| 65 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, | 67 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, |
| 66 WebKit::WGC3Denum type); | 68 WebKit::WGC3Denum type); |
| 67 | 69 |
| 68 private: | 70 private: |
| 69 class CopyTextureToImpl; | 71 class CopyTextureToImpl; |
| 70 | 72 |
| 71 // Creates |copy_texture_to_impl_| if NULL. | 73 // Creates |copy_texture_to_impl_| if NULL. |
| 72 void InitCopyTextToImpl(); | 74 void InitCopyTextToImpl(); |
| 73 | 75 |
| 74 WebKit::WebGraphicsContext3D* context_; | 76 WebKit::WebGraphicsContext3D* context_; |
| 75 WebKit::WebGraphicsContext3D* context_for_thread_; | 77 WebKit::WebGraphicsContext3D* context_for_thread_; |
| 76 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; | 78 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; |
| 77 | 79 |
| 78 // The number of all GLHelper instances. | 80 // The number of all GLHelper instances. |
| 79 static base::subtle::Atomic32 count_; | 81 static base::subtle::Atomic32 count_; |
| 80 | 82 |
| 81 DISALLOW_COPY_AND_ASSIGN(GLHelper); | 83 DISALLOW_COPY_AND_ASSIGN(GLHelper); |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 } // namespace content | 86 } // namespace content |
| 85 | 87 |
| 86 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 88 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
| OLD | NEW |