mirror of https://github.com/mpv-player/mpv
vo_gpu/context_android: Process surface resizes correctly
This commit is contained in:
parent
ff1ee66231
commit
3471e27efb
|
@ -33,7 +33,6 @@ struct priv {
|
||||||
EGLContext egl_context;
|
EGLContext egl_context;
|
||||||
EGLSurface egl_surface;
|
EGLSurface egl_surface;
|
||||||
ANativeWindow *native_window;
|
ANativeWindow *native_window;
|
||||||
int w, h;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void android_swap_buffers(struct ra_ctx *ctx)
|
static void android_swap_buffers(struct ra_ctx *ctx)
|
||||||
|
@ -106,12 +105,6 @@ static bool android_init(struct ra_ctx *ctx)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglQuerySurface(p->egl_display, p->egl_surface, EGL_WIDTH, &p->w) ||
|
|
||||||
!eglQuerySurface(p->egl_display, p->egl_surface, EGL_HEIGHT, &p->h)) {
|
|
||||||
MP_FATAL(ctx, "Failed to get height and width!\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
mpegl_load_functions(&p->gl, ctx->log);
|
mpegl_load_functions(&p->gl, ctx->log);
|
||||||
|
|
||||||
struct ra_gl_ctx_params params = {
|
struct ra_gl_ctx_params params = {
|
||||||
|
@ -130,9 +123,17 @@ fail:
|
||||||
static bool android_reconfig(struct ra_ctx *ctx)
|
static bool android_reconfig(struct ra_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct priv *p = ctx->priv;
|
struct priv *p = ctx->priv;
|
||||||
ctx->vo->dwidth = p->w;
|
int w, h;
|
||||||
ctx->vo->dheight = p->h;
|
|
||||||
ra_gl_ctx_resize(ctx->swapchain, p->w, p->h, 0);
|
if (!eglQuerySurface(p->egl_display, p->egl_surface, EGL_WIDTH, &w) ||
|
||||||
|
!eglQuerySurface(p->egl_display, p->egl_surface, EGL_HEIGHT, &h)) {
|
||||||
|
MP_FATAL(ctx, "Failed to get height and width!\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->vo->dwidth = w;
|
||||||
|
ctx->vo->dheight = h;
|
||||||
|
ra_gl_ctx_resize(ctx->swapchain, w, h, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue