Make EglBase an interface.

Bug: webrtc:8084
Change-Id: I50f57f81fe7148e2ed262e0672d5ab3a4f0f251e
Reviewed-on: https://webrtc-review.googlesource.com/26960
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21026}
This commit is contained in:
Sami Kalliomäki 2017-11-30 11:23:33 +01:00 committed by Commit Bot
parent 0af8370cb3
commit b9f3f9bdd7
3 changed files with 17 additions and 18 deletions

View File

@ -12,14 +12,13 @@ package org.webrtc;
import android.graphics.SurfaceTexture;
import android.view.Surface;
import javax.microedition.khronos.egl.EGL10;
/**
* Holds EGL state and utility methods for handling an egl 1.0 EGLContext, an EGLDisplay,
* and an EGLSurface.
*/
public abstract class EglBase {
public interface EglBase {
// EGL wrapper for an actual EGLContext.
public interface Context { long getNativeEglContext(); }
@ -140,34 +139,34 @@ public abstract class EglBase {
return new EglBase14(new EglBase14.Context(sharedContext), configAttributes);
}
public abstract void createSurface(Surface surface);
void createSurface(Surface surface);
// Create EGLSurface from the Android SurfaceTexture.
public abstract void createSurface(SurfaceTexture surfaceTexture);
void createSurface(SurfaceTexture surfaceTexture);
// Create dummy 1x1 pixel buffer surface so the context can be made current.
public abstract void createDummyPbufferSurface();
void createDummyPbufferSurface();
public abstract void createPbufferSurface(int width, int height);
void createPbufferSurface(int width, int height);
public abstract Context getEglBaseContext();
Context getEglBaseContext();
public abstract boolean hasSurface();
boolean hasSurface();
public abstract int surfaceWidth();
int surfaceWidth();
public abstract int surfaceHeight();
int surfaceHeight();
public abstract void releaseSurface();
void releaseSurface();
public abstract void release();
void release();
public abstract void makeCurrent();
void makeCurrent();
// Detach the current EGL context, so that it can be made current on another thread.
public abstract void detachCurrent();
void detachCurrent();
public abstract void swapBuffers();
void swapBuffers();
public abstract void swapBuffers(long presentationTimeStampNs);
void swapBuffers(long presentationTimeStampNs);
}

View File

@ -25,7 +25,7 @@ import javax.microedition.khronos.egl.EGLSurface;
* Holds EGL state and utility methods for handling an egl 1.0 EGLContext, an EGLDisplay,
* and an EGLSurface.
*/
class EglBase10 extends EglBase {
class EglBase10 implements EglBase {
// This constant is taken from EGL14.EGL_CONTEXT_CLIENT_VERSION.
private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;

View File

@ -27,7 +27,7 @@ import android.view.Surface;
*/
@SuppressWarnings("ReferenceEquality") // We want to compare to EGL14 constants.
@TargetApi(18)
class EglBase14 extends EglBase {
class EglBase14 implements EglBase {
private static final String TAG = "EglBase14";
private static final int EGLExt_SDK_VERSION = android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
private static final int CURRENT_SDK_VERSION = android.os.Build.VERSION.SDK_INT;