Skip to content

Commit

Permalink
GL: Rename getEglSurface to createEglSurface.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dway123 authored and icbaker committed Nov 14, 2022
1 parent 30b73c8 commit 095c52e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public static EGLContext createEglContext(EGLDisplay eglDisplay, int[] configAtt
}

/**
* 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.
Expand All @@ -264,24 +264,23 @@ public static EGLContext createEglContext(EGLDisplay eglDisplay, int[] configAtt
* @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.
* @param configAttributes The attributes to configure EGL with. Accepts {@link
* #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);
}

/**
Expand Down Expand Up @@ -659,18 +658,14 @@ public static EGLContext createEglContext(
}

@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ private synchronized boolean ensureConfigured(int inputWidth, int inputHeight)
boolean colorInfoIsHdr = ColorInfo.isTransferHdr(colorInfo);

outputEglSurface =
GlUtil.getEglSurface(
GlUtil.createEglSurface(
eglDisplay,
outputSurfaceInfo.surface,
colorInfoIsHdr
Expand Down Expand Up @@ -445,7 +445,7 @@ public synchronized void maybeRenderToSurfaceView(FrameProcessingTask renderingT

if (eglSurface == null) {
eglSurface =
GlUtil.getEglSurface(
GlUtil.createEglSurface(
eglDisplay,
surface,
useHdr
Expand Down

0 comments on commit 095c52e

Please sign in to comment.