From 25849d1eaad0e09c7acc624522160a0258dd6eba Mon Sep 17 00:00:00 2001 From: Tim Felgentreff <timfelgentreff@gmail.com> Date: Sun, 28 Jun 2020 03:53:08 +0200 Subject: [PATCH] if we cannot read pixels from the render target, render the movie as completely transparent image --- src/video/movie.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/video/movie.cpp b/src/video/movie.cpp index 5467493ad..8dfdeb8da 100644 --- a/src/video/movie.cpp +++ b/src/video/movie.cpp @@ -453,6 +453,7 @@ static void RenderToSurface(SDL_Surface *surface, SDL_Texture *yuv_overlay, SDL_ SDL_RenderCopy(TheRenderer, yuv_overlay, NULL, rect); if (SDL_RenderReadPixels(TheRenderer, rect, surface->format->format, surface->pixels, surface->pitch)) { fprintf(stderr, "Reading from renderer not supported\n"); + SDL_FillRect(surface, NULL, 0); // completely transparent } SDL_RenderSetLogicalSize(TheRenderer, w, h); free(yuv); @@ -477,10 +478,10 @@ int Movie::Load(const std::string &name, int w, int h) rect->h = h; surface = SDL_CreateRGBSurface(0, w, h, TheScreen->format->BitsPerPixel, - TheScreen->format->Rmask, - TheScreen->format->Gmask, - TheScreen->format->Bmask, - 0); + 0x00ff0000, + 0x0000ff00, + 0x000000ff, + 0xff000000); if (surface == NULL) { fprintf(stderr, "SDL_CreateRGBSurface: %s\n", SDL_GetError());