OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 |
| 10 // XXX: apply the scheme for GL access. http://crbug.com/169433 |
| 11 #include "third_party/angle/include/GLES2/gl2.h" |
| 12 #include "third_party/angle/include/GLES2/gl2ext.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 // A utility class which copies the given external texture |
| 17 // (GL_TEXTURE_EXTERNAL_OES) to the target texture (GL_TEXTURE_2D) by using |
| 18 // framebuffer. |
| 19 class Gles2ExternalTextureCopier { |
| 20 public: |
| 21 Gles2ExternalTextureCopier(); |
| 22 virtual ~Gles2ExternalTextureCopier(); |
| 23 |
| 24 bool Init(int32 width, int32 height); |
| 25 |
| 26 bool Copy(GLuint source_texture_id, GLuint destination_texture_id, |
| 27 const float transfrom_matrix[16]); |
| 28 |
| 29 private: |
| 30 bool SetupGraphics(); |
| 31 void RenderFrame(int32 width, int32 height, GLuint texture_id, |
| 32 const float transfrom_matrix[16]); |
| 33 bool SetupFrameBuffer(); |
| 34 |
| 35 bool initialized_; |
| 36 int32 width_; |
| 37 int32 height_; |
| 38 GLuint framebuffer_id_; |
| 39 GLuint renderbuffer_id_; |
| 40 GLuint program_; |
| 41 GLuint position_handle_; |
| 42 GLuint st_matrix_handle_; |
| 43 GLuint mvp_matrix_handle_; |
| 44 GLuint texture_handle_; |
| 45 GLfloat st_matrix_[16]; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(Gles2ExternalTextureCopier); |
| 48 }; |
| 49 |
| 50 } // namespace content |
| 51 |
| 52 #endif // CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
OLD | NEW |