Fixed the texture format for the software fallback
authorSam Lantinga <slouken@libsdl.org>
Sat, 29 Nov 2008 06:27:26 +0000
changeset 28038fe261aae1bb
parent 2802 c2834344ca44
child 2804 7af8c4ad427e
Fixed the texture format for the software fallback
src/SDL_compat.c
     1.1 --- a/src/SDL_compat.c	Sat Nov 29 00:11:35 2008 +0000
     1.2 +++ b/src/SDL_compat.c	Sat Nov 29 06:27:26 2008 +0000
     1.3 @@ -1355,6 +1355,7 @@
     1.4      SDL_SW_YUVTexture *sw;
     1.5  
     1.6      SDL_TextureID textureID;
     1.7 +    Uint32 texture_format;
     1.8  };
     1.9  
    1.10  SDL_Overlay *
    1.11 @@ -1449,14 +1450,16 @@
    1.12  
    1.13          /* Create a supported RGB format texture for display */
    1.14          SDL_GetCurrentDisplayMode(&current_mode);
    1.15 +        texture_format = current_mode.format;
    1.16          overlay->hwdata->textureID =
    1.17 -            SDL_CreateTexture(current_mode.format,
    1.18 +            SDL_CreateTexture(texture_format,
    1.19                                SDL_TEXTUREACCESS_STREAMING, w, h);
    1.20      }
    1.21      if (!overlay->hwdata->textureID) {
    1.22          SDL_FreeYUVOverlay(overlay);
    1.23          return NULL;
    1.24      }
    1.25 +    overlay->hwdata->texture_format = texture_format;
    1.26  
    1.27      return overlay;
    1.28  }
    1.29 @@ -1521,8 +1524,8 @@
    1.30              srcrect.w = overlay->w;
    1.31              srcrect.h = overlay->h;
    1.32              SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect,
    1.33 -                                SDL_PIXELFORMAT_RGB888, overlay->w,
    1.34 -                                overlay->h, pixels, pitch);
    1.35 +                                overlay->hwdata->texture_format,
    1.36 +                                overlay->w, overlay->h, pixels, pitch);
    1.37              SDL_UnlockTexture(overlay->hwdata->textureID);
    1.38          }
    1.39      } else {