Index: content/common/gpu/media/gles2_external_texture_copier.h |
diff --git a/content/common/gpu/media/gles2_external_texture_copier.h b/content/common/gpu/media/gles2_external_texture_copier.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d0c460f71e2577cb76212740c9c9f08a374a63b8 |
--- /dev/null |
+++ b/content/common/gpu/media/gles2_external_texture_copier.h |
@@ -0,0 +1,56 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
+#define CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |
+ |
+#include "base/basictypes.h" |
+#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
+#include "ui/gl/gl_bindings.h" |
+ |
+namespace content { |
+ |
+// A utility class which copies the given external texture |
+// (GL_TEXTURE_EXTERNAL_OES) to the target texture (GL_TEXTURE_2D). |
+class Gles2ExternalTextureCopier { |
+ public: |
+ Gles2ExternalTextureCopier(int32 width, int32 height); |
+ virtual ~Gles2ExternalTextureCopier(); |
+ |
+ bool Copy(GLuint source_texture_id, GLuint destination_texture_id_); |
+ |
+ private: |
+ void SaveState(); |
+ void RestoreState(); |
+ void SaveStateForAttrib(GLuint attrib, int index); |
+ void RestoreStateForAttrib(GLuint attrib, int index); |
+ |
+ int32 width_; |
+ int32 height_; |
+ |
+ GLint previous_framebuffer_id_; |
+ GLint previous_renderbuffer_id_; |
+ GLint previous_texture_2d_id_; |
+ GLint previous_program_; |
+ GLint previous_viewport_[4]; |
+ GLint vertex_array_buffer_binding_; |
+ GLint index_array_buffer_binding_; |
+ |
+ struct { |
+ GLint enabled; |
+ GLint size; |
+ GLint type; |
+ GLint normalized; |
+ GLint stride; |
+ GLvoid* pointer; |
+ } previous_vertex_attrib_[2]; |
+ |
+ CopyTextureCHROMIUMResourceManager copier_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(Gles2ExternalTextureCopier); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_COMMON_GPU_MEDIA_GLES2_EXTERNAL_TEXTURE_COPIER_H_ |