Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2020-05-25 12:51:51 +0300
committerNiklas Haas <git@haasn.xyz>2020-05-25 12:54:24 +0300
commita1e7a329b2f87154f97630403a2708030447b6ae (patch)
tree2bccab2565a21b61796467f713bf67c9601380be /examples
parentdf40d36d84fbdd3aae827b36d1a15739efb9225b (diff)
dav1dplay: allow resizing the window
libplacebo v66 got helper functions that make preserving the aspect ratio in this case trivial. But we still need to make sure to clear the FBO to black if the image doesn't cover it fully.
Diffstat (limited to 'examples')
-rw-r--r--examples/dp_renderer_placebo.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/dp_renderer_placebo.c b/examples/dp_renderer_placebo.c
index 7e7771c..c7a2a11 100644
--- a/examples/dp_renderer_placebo.c
+++ b/examples/dp_renderer_placebo.c
@@ -80,7 +80,7 @@ static Dav1dPlayRendererPrivateContext*
placebo_renderer_create_common(int window_flags)
{
// Create Window
- SDL_Window *sdlwin = dp_create_sdl_window(window_flags);
+ SDL_Window *sdlwin = dp_create_sdl_window(window_flags | SDL_WINDOW_RESIZABLE);
if (sdlwin == NULL)
return NULL;
@@ -326,6 +326,12 @@ static void placebo_render(void *cookie, const Dav1dPlaySettings *settings)
.len = 0,
};
+#if PL_API_VER >= 66
+ pl_rect2df_aspect_copy(&target.dst_rect, &rd_priv_ctx->image.src_rect, 0.0);
+ if (pl_render_target_partial(&target))
+ pl_tex_clear(rd_priv_ctx->gpu, target.fbo, (float[4]){ 0.0 });
+#endif
+
if (!pl_render_image(rd_priv_ctx->renderer, &rd_priv_ctx->image, &target, &render_params)) {
fprintf(stderr, "Failed rendering frame!\n");
pl_tex_clear(rd_priv_ctx->gpu, target.fbo, (float[4]){ 1.0 });
@@ -366,6 +372,7 @@ static int placebo_upload_image(void *cookie, Dav1dPicture *dav1d_pic,
.num_planes = 3,
.width = width,
.height = height,
+ .src_rect = {0, 0, width, height},
.repr = {
.bits = {