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 UI_GL_ANDROID_GL_IMAGE_STREAM_H_ |
| 6 #define UI_GL_ANDROID_GL_IMAGE_STREAM_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "ui/gl/gl_image.h" |
| 10 |
| 11 namespace gfx { |
| 12 class Size; |
| 13 class SurfaceTextureBridge; |
| 14 |
| 15 class GLImageStream : public GLImage { |
| 16 public: |
| 17 GLImageStream(uint32 texture_id); |
| 18 virtual ~GLImageStream(); |
| 19 |
| 20 // GLImage implementation. |
| 21 virtual void Destroy() OVERRIDE; |
| 22 virtual gfx::Size GetSize() OVERRIDE; |
| 23 virtual void UpdateTexImage() OVERRIDE; |
| 24 virtual GLImageStream* AsGLImageStream() OVERRIDE { return this; } |
| 25 |
| 26 bool BindTexImageExternal(); |
| 27 void ReleaseTexImageExternal(); |
| 28 |
| 29 void SetSize(gfx::Size size) { size_ = size; } |
| 30 |
| 31 struct Matrix { |
| 32 float components[16]; |
| 33 }; |
| 34 typedef base::Callback<void(const Matrix&)> MatrixChangedCallBack; |
| 35 |
| 36 void SetMatrixChangedCallback(const MatrixChangedCallBack& callback) { |
| 37 matrix_callback_ = callback; |
| 38 } |
| 39 |
| 40 void SetFrameAvailableCallback(const base::Closure& callback); |
| 41 |
| 42 SurfaceTextureBridge* GetSurfaceTexture(); |
| 43 |
| 44 private: |
| 45 void OnFrameAvailable(); |
| 46 |
| 47 // Current transform matrix of the surface texture. |
| 48 Matrix current_matrix_; |
| 49 |
| 50 // Whether the surface texture has been updated. |
| 51 bool has_updated_; |
| 52 |
| 53 MatrixChangedCallBack matrix_callback_; |
| 54 base::Closure frame_callback_; |
| 55 |
| 56 gfx::Size size_; |
| 57 scoped_refptr<gfx::SurfaceTextureBridge> surface_texture_bridge_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(GLImageStream); |
| 60 }; |
| 61 |
| 62 } // namespace gfx |
| 63 |
| 64 #endif // UI_GL_ANDROID_GL_IMAGE_STREAM_H_ |
OLD | NEW |