Commit 150cd1f8 authored by boliu's avatar boliu Committed by Commit bot

Remove ICS support from SurfaceTexture

We don't support API level 14 and 15 anymore. \o/

Also remove CreateSingleBuffered which is dead code not being used.

BUG=473837

Review URL: https://codereview.chromium.org/1060233002

Cr-Commit-Position: refs/heads/master@{#324145}
parent 045b8f6f
......@@ -4,9 +4,7 @@
package org.chromium.ui.gl;
import android.annotation.TargetApi;
import android.graphics.SurfaceTexture;
import android.os.Build;
import android.util.Log;
import org.chromium.base.CalledByNative;
......@@ -26,13 +24,6 @@ class SurfaceTexturePlatformWrapper {
return new SurfaceTexture(textureId);
}
@TargetApi(Build.VERSION_CODES.KITKAT)
@CalledByNative
private static SurfaceTexture createSingleBuffered(int textureId) {
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
return new SurfaceTexture(textureId, true);
}
@CalledByNative
private static void destroy(SurfaceTexture surfaceTexture) {
surfaceTexture.setOnFrameAvailableListener(null);
......@@ -55,29 +46,18 @@ class SurfaceTexturePlatformWrapper {
}
}
@TargetApi(Build.VERSION_CODES.KITKAT)
@CalledByNative
private static void releaseTexImage(SurfaceTexture surfaceTexture) {
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
surfaceTexture.releaseTexImage();
}
@CalledByNative
private static void getTransformMatrix(SurfaceTexture surfaceTexture, float[] matrix) {
surfaceTexture.getTransformMatrix(matrix);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@CalledByNative
private static void attachToGLContext(SurfaceTexture surfaceTexture, int texName) {
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
surfaceTexture.attachToGLContext(texName);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@CalledByNative
private static void detachFromGLContext(SurfaceTexture surfaceTexture) {
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
surfaceTexture.detachFromGLContext();
}
}
......@@ -6,8 +6,6 @@
#include <android/native_window_jni.h>
// TODO(boliu): Remove this include when we move off ICS.
#include "base/android/build_info.h"
#include "base/android/jni_android.h"
#include "base/logging.h"
#include "jni/SurfaceTexturePlatformWrapper_jni.h"
......@@ -15,14 +13,6 @@
#include "ui/gl/android/surface_texture_listener.h"
#include "ui/gl/gl_bindings.h"
// TODO(boliu): Remove this method when Chromium stops supporting ICS.
bool GlContextMethodsAvailable() {
bool available = base::android::BuildInfo::GetInstance()->sdk_int() >= 16;
if (!available)
LOG(WARNING) << "Running on unsupported device: rendering may not work";
return available;
}
namespace gfx {
scoped_refptr<SurfaceTexture> SurfaceTexture::Create(int texture_id) {
......@@ -31,14 +21,6 @@ scoped_refptr<SurfaceTexture> SurfaceTexture::Create(int texture_id) {
Java_SurfaceTexturePlatformWrapper_create(env, texture_id));
}
scoped_refptr<SurfaceTexture> SurfaceTexture::CreateSingleBuffered(
int texture_id) {
DCHECK(IsSingleBufferModeSupported());
JNIEnv* env = base::android::AttachCurrentThread();
return new SurfaceTexture(
Java_SurfaceTexturePlatformWrapper_createSingleBuffered(env, texture_id));
}
SurfaceTexture::SurfaceTexture(
const base::android::ScopedJavaLocalRef<jobject>& j_surface_texture) {
j_surface_texture_.Reset(j_surface_texture);
......@@ -64,13 +46,6 @@ void SurfaceTexture::UpdateTexImage() {
j_surface_texture_.obj());
}
void SurfaceTexture::ReleaseTexImage() {
DCHECK(IsSingleBufferModeSupported());
JNIEnv* env = base::android::AttachCurrentThread();
Java_SurfaceTexturePlatformWrapper_releaseTexImage(env,
j_surface_texture_.obj());
}
void SurfaceTexture::GetTransformMatrix(float mtx[16]) {
JNIEnv* env = base::android::AttachCurrentThread();
......@@ -88,22 +63,18 @@ void SurfaceTexture::GetTransformMatrix(float mtx[16]) {
}
void SurfaceTexture::AttachToGLContext() {
if (GlContextMethodsAvailable()) {
int texture_id;
glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_id);
DCHECK(texture_id);
JNIEnv* env = base::android::AttachCurrentThread();
Java_SurfaceTexturePlatformWrapper_attachToGLContext(
env, j_surface_texture_.obj(), texture_id);
}
int texture_id;
glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_id);
DCHECK(texture_id);
JNIEnv* env = base::android::AttachCurrentThread();
Java_SurfaceTexturePlatformWrapper_attachToGLContext(
env, j_surface_texture_.obj(), texture_id);
}
void SurfaceTexture::DetachFromGLContext() {
if (GlContextMethodsAvailable()) {
JNIEnv* env = base::android::AttachCurrentThread();
Java_SurfaceTexturePlatformWrapper_detachFromGLContext(
env, j_surface_texture_.obj());
}
JNIEnv* env = base::android::AttachCurrentThread();
Java_SurfaceTexturePlatformWrapper_detachFromGLContext(
env, j_surface_texture_.obj());
}
ANativeWindow* SurfaceTexture::CreateSurface() {
......@@ -118,11 +89,6 @@ ANativeWindow* SurfaceTexture::CreateSurface() {
return native_window;
}
// static
bool SurfaceTexture::IsSingleBufferModeSupported() {
return base::android::BuildInfo::GetInstance()->sdk_int() >= 19;
}
bool SurfaceTexture::RegisterSurfaceTexture(JNIEnv* env) {
return RegisterNativesImpl(env);
}
......
......@@ -23,8 +23,6 @@ class GL_EXPORT SurfaceTexture
public:
static scoped_refptr<SurfaceTexture> Create(int texture_id);
static scoped_refptr<SurfaceTexture> CreateSingleBuffered(int texture_id);
// Set the listener callback, which will be invoked on the same thread that
// is being called from here for registration.
// Note: Since callbacks come in from Java objects that might outlive objects
......@@ -35,13 +33,6 @@ class GL_EXPORT SurfaceTexture
// Update the texture image to the most recent frame from the image stream.
void UpdateTexImage();
// Release the texture content. This is needed only in single buffered mode
// to allow the image content producer to take ownership
// of the image buffer.
// This is *only* supported on SurfaceTexture instantiated via
// |CreateSingleBuffered(...)|.
void ReleaseTexImage();
// Retrieve the 4x4 texture coordinate transform matrix associated with the
// texture image set by the most recent call to updateTexImage.
void GetTransformMatrix(float mtx[16]);
......@@ -63,10 +54,6 @@ class GL_EXPORT SurfaceTexture
return j_surface_texture_;
}
// This should only be used to guard the SurfaceTexture instantiated via
// |CreateSingleBuffered(...)|
static bool IsSingleBufferModeSupported();
static bool RegisterSurfaceTexture(JNIEnv* env);
protected:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment