GL: Rename getEglSurface to createEglSurface.

Per documentation, eglCreateWindowSurface creates a new EGL window surface.

getEglSurface suggests instead that a pre-existing surface is returned.

https://registry.khronos.org/EGL/sdk/docs/man/html/eglCreateWindowSurface.xhtml

PiperOrigin-RevId: 488377423
This commit is contained in:
huangdarwin 2022-11-14 16:47:50 +00:00 committed by Ian Baker
parent adc993dc57
commit 84a378415f
2 changed files with 12 additions and 17 deletions

View file

@ -256,7 +256,7 @@ public final class GlUtil {
}
/**
* Returns a new {@link EGLSurface} wrapping the specified {@code surface}.
* Creates a new {@link EGLSurface} wrapping the specified {@code surface}.
*
* <p>The {@link EGLSurface} will configure with {@link #EGL_CONFIG_ATTRIBUTES_RGBA_8888} and
* OpenGL ES 2.0.
@ -265,13 +265,13 @@ public final class GlUtil {
* @param surface The surface to wrap; must be a surface, surface texture or surface holder.
*/
@RequiresApi(17)
public static EGLSurface getEglSurface(EGLDisplay eglDisplay, Object surface) throws GlException {
return Api17.getEglSurface(
eglDisplay, surface, EGL_CONFIG_ATTRIBUTES_RGBA_8888, EGL_WINDOW_SURFACE_ATTRIBUTES_NONE);
public static EGLSurface createEglSurface(EGLDisplay eglDisplay, Object surface)
throws GlException {
return Api17.createEglSurface(eglDisplay, surface, EGL_CONFIG_ATTRIBUTES_RGBA_8888);
}
/**
* Returns a new {@link EGLSurface} wrapping the specified {@code surface}.
* Creates a new {@link EGLSurface} wrapping the specified {@code surface}.
*
* @param eglDisplay The {@link EGLDisplay} to attach the surface to.
* @param surface The surface to wrap; must be a surface, surface texture or surface holder.
@ -279,10 +279,9 @@ public final class GlUtil {
* #EGL_CONFIG_ATTRIBUTES_RGBA_1010102} and {@link #EGL_CONFIG_ATTRIBUTES_RGBA_8888}.
*/
@RequiresApi(17)
public static EGLSurface getEglSurface(
public static EGLSurface createEglSurface(
EGLDisplay eglDisplay, Object surface, int[] configAttributes) throws GlException {
return Api17.getEglSurface(
eglDisplay, surface, configAttributes, EGL_WINDOW_SURFACE_ATTRIBUTES_NONE);
return Api17.createEglSurface(eglDisplay, surface, configAttributes);
}
/**
@ -660,18 +659,14 @@ public final class GlUtil {
}
@DoNotInline
public static EGLSurface getEglSurface(
EGLDisplay eglDisplay,
Object surface,
int[] configAttributes,
int[] windowSurfaceAttributes)
throws GlException {
public static EGLSurface createEglSurface(
EGLDisplay eglDisplay, Object surface, int[] configAttributes) throws GlException {
EGLSurface eglSurface =
EGL14.eglCreateWindowSurface(
eglDisplay,
getEglConfig(eglDisplay, configAttributes),
surface,
windowSurfaceAttributes,
EGL_WINDOW_SURFACE_ATTRIBUTES_NONE,
/* offset= */ 0);
checkEglException("Error creating surface");
return eglSurface;

View file

@ -317,7 +317,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
boolean colorInfoIsHdr = ColorInfo.isTransferHdr(colorInfo);
outputEglSurface =
GlUtil.getEglSurface(
GlUtil.createEglSurface(
eglDisplay,
outputSurfaceInfo.surface,
colorInfoIsHdr
@ -445,7 +445,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
if (eglSurface == null) {
eglSurface =
GlUtil.getEglSurface(
GlUtil.createEglSurface(
eglDisplay,
surface,
useHdr