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 #include "ui/gl/gl_bindings.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 // A utility class which copies the given external texture |
| 14 // (GL_TEXTURE_EXTERNAL_OES) to the target texture (GL_TEXTURE_2D) by using |
| 15 // framebuffer. |
| 16 // TODO(dwkang): consider using CopyTextureCHROMIUMResourceManager once it |
| 17 // supports GL_TEXTURE_EXTERNAL_OES. |
| 18 class Gles2ExternalTextureCopier { |
| 19 public: |
| 20 Gles2ExternalTextureCopier(); |
| 21 virtual ~Gles2ExternalTextureCopier(); |
| 22 |
| 23 bool Init(int32 width, int32 height); |
| 24 |
| 25 bool Copy(GLuint source_texture_id, GLuint destination_texture_id, |
| 26 const float transfrom_matrix[16]); |
| 27 |
| 28 private: |
| 29 bool SetupGraphics(); |
| 30 void RenderFrame(int32 width, int32 height, GLuint texture_id, |
| 31 const float transfrom_matrix[16]); |
| 32 bool SetupFrameBuffer(); |
| 33 |
| 34 void SaveState(); |
| 35 void RestoreState(); |
| 36 |
| 37 bool initialized_; |
| 38 int32 width_; |
| 39 int32 height_; |
| 40 GLuint framebuffer_id_; |
| 41 GLuint renderbuffer_id_; |
| 42 GLuint program_; |
| 43 GLuint position_handle_; |
| 44 GLuint st_matrix_handle_; |
| 45 GLuint mvp_matrix_handle_; |
| 46 GLuint texture_handle_; |
| 47 |
| 48 GLuint previous_framebuffer_id_; |
| 49 GLuint previous_renderbuffer_id_; |
| 50 GLuint previous_texture_id_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(Gles2ExternalTextureCopier); |
| 53 }; |
| 54 |
| 55 } // namespace content |
| 56 |
| 57 #endif // CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
OLD | NEW |