Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: ui/gl/android/surface_texture.h

Issue 2706653002: Added SurfaceTextureGLOwner to create / own GL objects. (Closed)
Patch Set: stopped including gl_initializer.h Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/gpu/surface_texture_gl_owner_unittest.cc ('k') | ui/gl/android/surface_texture.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GL_ANDROID_SURFACE_TEXTURE_H_ 5 #ifndef UI_GL_ANDROID_SURFACE_TEXTURE_H_
6 #define UI_GL_ANDROID_SURFACE_TEXTURE_H_ 6 #define UI_GL_ANDROID_SURFACE_TEXTURE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 28 matching lines...) Expand all
39 39
40 // Update the texture image to the most recent frame from the image stream. 40 // Update the texture image to the most recent frame from the image stream.
41 void UpdateTexImage(); 41 void UpdateTexImage();
42 42
43 // Retrieve the 4x4 texture coordinate transform matrix associated with the 43 // Retrieve the 4x4 texture coordinate transform matrix associated with the
44 // texture image set by the most recent call to updateTexImage. 44 // texture image set by the most recent call to updateTexImage.
45 void GetTransformMatrix(float mtx[16]); 45 void GetTransformMatrix(float mtx[16]);
46 46
47 // Attach the SurfaceTexture to the texture currently bound to 47 // Attach the SurfaceTexture to the texture currently bound to
48 // GL_TEXTURE_EXTERNAL_OES. 48 // GL_TEXTURE_EXTERNAL_OES.
49 void AttachToGLContext(); 49 virtual void AttachToGLContext();
50 50
51 // Detaches the SurfaceTexture from the context that owns its current GL 51 // Detaches the SurfaceTexture from the context that owns its current GL
52 // texture. Must be called with that context current on the calling thread. 52 // texture. Must be called with that context current on the calling thread.
53 void DetachFromGLContext(); 53 virtual void DetachFromGLContext();
54 54
55 // Creates a native render surface for this surface texture. 55 // Creates a native render surface for this surface texture.
56 // The caller must release the underlying reference when done with the handle 56 // The caller must release the underlying reference when done with the handle
57 // by calling ANativeWindow_release(). 57 // by calling ANativeWindow_release().
58 ANativeWindow* CreateSurface(); 58 ANativeWindow* CreateSurface();
59 59
60 // Release the SurfaceTexture back buffers. The SurfaceTexture is no longer 60 // Release the SurfaceTexture back buffers. The SurfaceTexture is no longer
61 // usable after calling this. Note that this is not called 'Release', like 61 // usable after calling this. Note that this is not called 'Release', like
62 // the android API, because scoped_refptr<> calls that quite a bit. 62 // the android API, because scoped_refptr<> calls that quite a bit.
63 void ReleaseSurfaceTexture(); 63 void ReleaseSurfaceTexture();
64 64
65 // Set the default buffer size for the surface texture. 65 // Set the default buffer size for the surface texture.
66 void SetDefaultBufferSize(int width, int height); 66 void SetDefaultBufferSize(int width, int height);
67 67
68 const base::android::JavaRef<jobject>& j_surface_texture() const { 68 const base::android::JavaRef<jobject>& j_surface_texture() const {
69 return j_surface_texture_; 69 return j_surface_texture_;
70 } 70 }
71 71
72 protected: 72 protected:
73 static base::android::ScopedJavaLocalRef<jobject> CreateJavaSurfaceTexture(
74 int texture_id);
75
73 explicit SurfaceTexture( 76 explicit SurfaceTexture(
74 const base::android::ScopedJavaLocalRef<jobject>& j_surface_texture); 77 const base::android::ScopedJavaLocalRef<jobject>& j_surface_texture);
75 78
79 virtual ~SurfaceTexture();
80
81 // Destroy |j_surface_texture| if it hasn't been destroyed already.
82 void DestroyJavaObject();
83
76 private: 84 private:
77 friend class base::RefCountedThreadSafe<SurfaceTexture>; 85 friend class base::RefCountedThreadSafe<SurfaceTexture>;
78 ~SurfaceTexture();
79 86
80 // Java SurfaceTexture instance. 87 // Java SurfaceTexture instance.
81 base::android::ScopedJavaGlobalRef<jobject> j_surface_texture_; 88 base::android::ScopedJavaGlobalRef<jobject> j_surface_texture_;
82 89
83 DISALLOW_COPY_AND_ASSIGN(SurfaceTexture); 90 DISALLOW_COPY_AND_ASSIGN(SurfaceTexture);
84 }; 91 };
85 92
86 } // namespace gl 93 } // namespace gl
87 94
88 #endif // UI_GL_ANDROID_SURFACE_TEXTURE_H_ 95 #endif // UI_GL_ANDROID_SURFACE_TEXTURE_H_
OLDNEW
« no previous file with comments | « media/gpu/surface_texture_gl_owner_unittest.cc ('k') | ui/gl/android/surface_texture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698