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 21 matching lines...) Expand all Loading... |
32 // scales it to |dst_size|, and writes it into |out|. | 32 // scales it to |dst_size|, and writes it into |out|. |
33 // |src_size| is the size of |src_texture|. |callback| is invoked with the | 33 // |src_size| is the size of |src_texture|. |callback| is invoked with the |
34 // copy result when the copy operation has completed. | 34 // copy result when the copy operation has completed. |
35 void CopyTextureTo(WebKit::WebGLId src_texture, | 35 void CopyTextureTo(WebKit::WebGLId src_texture, |
36 const gfx::Size& src_size, | 36 const gfx::Size& src_size, |
37 const gfx::Rect& src_subrect, | 37 const gfx::Rect& src_subrect, |
38 const gfx::Size& dst_size, | 38 const gfx::Size& dst_size, |
39 unsigned char* out, | 39 unsigned char* out, |
40 const base::Callback<void(bool)>& callback); | 40 const base::Callback<void(bool)>& callback); |
41 | 41 |
| 42 // Creates a copy of the specified texture. |size| is the size of the texture. |
| 43 WebKit::WebGLId CopyTexture(WebKit::WebGLId texture, |
| 44 const gfx::Size& size); |
| 45 |
42 // Returns the shader compiled from the source. | 46 // Returns the shader compiled from the source. |
43 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, | 47 WebKit::WebGLId CompileShaderFromSource(const WebKit::WGC3Dchar* source, |
44 WebKit::WGC3Denum type); | 48 WebKit::WGC3Denum type); |
45 | 49 |
46 private: | 50 private: |
47 class CopyTextureToImpl; | 51 class CopyTextureToImpl; |
48 | 52 |
| 53 // Creates |copy_texture_to_impl_| if NULL. |
| 54 void InitCopyTextToImpl(); |
| 55 |
49 WebKit::WebGraphicsContext3D* context_; | 56 WebKit::WebGraphicsContext3D* context_; |
50 WebKit::WebGraphicsContext3D* context_for_thread_; | 57 WebKit::WebGraphicsContext3D* context_for_thread_; |
51 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; | 58 scoped_ptr<CopyTextureToImpl> copy_texture_to_impl_; |
52 | 59 |
53 // The number of all GLHelper instances. | 60 // The number of all GLHelper instances. |
54 static base::subtle::Atomic32 count_; | 61 static base::subtle::Atomic32 count_; |
55 | 62 |
56 DISALLOW_COPY_AND_ASSIGN(GLHelper); | 63 DISALLOW_COPY_AND_ASSIGN(GLHelper); |
57 }; | 64 }; |
58 | 65 |
59 } // namespace content | 66 } // namespace content |
60 | 67 |
61 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ | 68 #endif // CONTENT_COMMON_GPU_CLIENT_GL_HELPER_H_ |
OLD | NEW |