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