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

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

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 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 | « ui/gl/android/surface_texture.h ('k') | ui/gl/gl_context_egl.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 #include "ui/gl/android/surface_texture.h" 5 #include "ui/gl/android/surface_texture.h"
6 6
7 #include <android/native_window_jni.h> 7 #include <android/native_window_jni.h>
8 8
9 // TODO(boliu): Remove this include when we move off ICS. 9 // TODO(boliu): Remove this include when we move off ICS.
10 #include "base/android/build_info.h" 10 #include "base/android/build_info.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 env, j_surface_texture_.obj(), jmatrix.obj()); 80 env, j_surface_texture_.obj(), jmatrix.obj());
81 81
82 jboolean is_copy; 82 jboolean is_copy;
83 jfloat* elements = env->GetFloatArrayElements(jmatrix.obj(), &is_copy); 83 jfloat* elements = env->GetFloatArrayElements(jmatrix.obj(), &is_copy);
84 for (int i = 0; i < 16; ++i) { 84 for (int i = 0; i < 16; ++i) {
85 mtx[i] = static_cast<float>(elements[i]); 85 mtx[i] = static_cast<float>(elements[i]);
86 } 86 }
87 env->ReleaseFloatArrayElements(jmatrix.obj(), elements, JNI_ABORT); 87 env->ReleaseFloatArrayElements(jmatrix.obj(), elements, JNI_ABORT);
88 } 88 }
89 89
90 void SurfaceTexture::SetDefaultBufferSize(int width, int height) {
91 JNIEnv* env = base::android::AttachCurrentThread();
92
93 if (width > 0 && height > 0) {
94 Java_SurfaceTexturePlatformWrapper_setDefaultBufferSize(
95 env, j_surface_texture_.obj(), static_cast<jint>(width),
96 static_cast<jint>(height));
97 } else {
98 LOG(WARNING) << "Not setting surface texture buffer size - "
99 "width or height is 0";
100 }
101 }
102
103 void SurfaceTexture::AttachToGLContext() { 90 void SurfaceTexture::AttachToGLContext() {
104 if (GlContextMethodsAvailable()) { 91 if (GlContextMethodsAvailable()) {
105 int texture_id; 92 int texture_id;
106 glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_id); 93 glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_id);
107 DCHECK(texture_id); 94 DCHECK(texture_id);
108 JNIEnv* env = base::android::AttachCurrentThread(); 95 JNIEnv* env = base::android::AttachCurrentThread();
109 Java_SurfaceTexturePlatformWrapper_attachToGLContext( 96 Java_SurfaceTexturePlatformWrapper_attachToGLContext(
110 env, j_surface_texture_.obj(), texture_id); 97 env, j_surface_texture_.obj(), texture_id);
111 } 98 }
112 } 99 }
(...skipping 21 matching lines...) Expand all
134 // static 121 // static
135 bool SurfaceTexture::IsSingleBufferModeSupported() { 122 bool SurfaceTexture::IsSingleBufferModeSupported() {
136 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; 123 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19;
137 } 124 }
138 125
139 bool SurfaceTexture::RegisterSurfaceTexture(JNIEnv* env) { 126 bool SurfaceTexture::RegisterSurfaceTexture(JNIEnv* env) {
140 return RegisterNativesImpl(env); 127 return RegisterNativesImpl(env);
141 } 128 }
142 129
143 } // namespace gfx 130 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/android/surface_texture.h ('k') | ui/gl/gl_context_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698