Index: ui/gl/android/gl_image_stream.h |
diff --git a/ui/gl/android/gl_image_stream.h b/ui/gl/android/gl_image_stream.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e318f3c739798c94c84bf88cd3b9bfab7a7fcba2 |
--- /dev/null |
+++ b/ui/gl/android/gl_image_stream.h |
@@ -0,0 +1,67 @@ |
+// 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 UI_GL_ANDROID_GL_IMAGE_STREAM_H_ |
+#define UI_GL_ANDROID_GL_IMAGE_STREAM_H_ |
+ |
+#include "base/callback.h" |
+#include "base/memory/weak_ptr.h" |
+#include "ui/gl/gl_image.h" |
+ |
+namespace gfx { |
+class Size; |
+class SurfaceTextureBridge; |
+ |
+class GLImageStream : public GLImage { |
+ public: |
+ GLImageStream(); |
+ virtual ~GLImageStream(); |
+ |
+ // GLImage implementation. |
+ virtual void Destroy() OVERRIDE; |
+ virtual gfx::Size GetSize() OVERRIDE; |
+ virtual void WillUseTexImage() OVERRIDE; |
+ virtual bool BindTexImage() OVERRIDE; |
+ virtual void ReleaseTexImage() OVERRIDE; |
+ |
+ virtual GLImageStream* AsGLImageStream() OVERRIDE; |
+ |
+ void SetSize(gfx::Size size) { size_ = size; } |
+ |
+ struct Matrix { |
+ float components[16]; |
+ }; |
+ typedef base::Callback<void(const Matrix&)> MatrixChangedCallBack; |
+ |
+ void SetMatrixChangedCallback(const MatrixChangedCallBack& callback) { |
+ matrix_callback_ = callback; |
+ } |
+ |
+ void SetFrameAvailableCallback(const base::Closure& callback); |
+ |
+ SurfaceTextureBridge* GetSurfaceTexture(); |
+ |
+ private: |
+ void OnFrameAvailable(); |
+ |
+ // Current transform matrix of the surface texture. |
+ Matrix current_matrix_; |
+ |
+ // Whether the surface texture has been updated. |
+ bool has_updated_; |
+ |
+ MatrixChangedCallBack matrix_callback_; |
+ base::Closure frame_callback_; |
+ |
+ gfx::Size size_; |
+ scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge_; |
+ |
+ base::WeakPtrFactory<GLImageStream> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GLImageStream); |
+}; |
+ |
+} // namespace gfx |
+ |
+#endif // UI_GL_ANDROID_GL_IMAGE_STREAM_H_ |