When creating a software texture, synchronize the surface with the texture.
authorSam Lantinga <slouken@libsdl.org>
Fri, 30 Jan 2009 06:40:16 +0000
changeset 3053aa34d1180d30
parent 3052 b7197d7e8566
child 3054 8d93bfecb9dc
When creating a software texture, synchronize the surface with the texture.
When creating a texture from a surface, synchronize the texture with the surface.
src/video/SDL_renderer_sw.c
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_renderer_sw.c	Fri Jan 30 06:38:44 2009 +0000
     1.2 +++ b/src/video/SDL_renderer_sw.c	Fri Jan 30 06:40:16 2009 +0000
     1.3 @@ -380,6 +380,12 @@
     1.4          texture->driverdata =
     1.5              SDL_CreateRGBSurface(0, texture->w, texture->h, bpp, Rmask, Gmask,
     1.6                                   Bmask, Amask);
     1.7 +        SDL_SetSurfaceColorMod(texture->driverdata, texture->r, texture->g,
     1.8 +                               texture->b);
     1.9 +        SDL_SetSurfaceAlphaMod(texture->driverdata, texture->a);
    1.10 +        SDL_SetSurfaceBlendMode(texture->driverdata, texture->blendMode);
    1.11 +        SDL_SetSurfaceScaleMode(texture->driverdata, texture->scaleMode);
    1.12 +
    1.13          if (texture->access == SDL_TEXTUREACCESS_STATIC) {
    1.14              SDL_SetSurfaceRLE(texture->driverdata, 1);
    1.15          }
     2.1 --- a/src/video/SDL_video.c	Fri Jan 30 06:38:44 2009 +0000
     2.2 +++ b/src/video/SDL_video.c	Fri Jan 30 06:40:16 2009 +0000
     2.3 @@ -1635,6 +1635,24 @@
     2.4          }
     2.5      }
     2.6  
     2.7 +    {
     2.8 +        Uint8 r, g, b, a;
     2.9 +        int blendMode;
    2.10 +        int scaleMode;
    2.11 +
    2.12 +        SDL_GetSurfaceColorMod(surface, &r, &g, &b);
    2.13 +        SDL_SetTextureColorMod(textureID, r, g, b);
    2.14 +
    2.15 +        SDL_GetSurfaceAlphaMod(surface, &a);
    2.16 +        SDL_SetTextureAlphaMod(textureID, a);
    2.17 +
    2.18 +        SDL_GetSurfaceBlendMode(surface, &blendMode);
    2.19 +        SDL_SetTextureBlendMode(textureID, blendMode);
    2.20 +
    2.21 +        SDL_GetSurfaceScaleMode(surface, &scaleMode);
    2.22 +        SDL_SetTextureScaleMode(textureID, scaleMode);
    2.23 +    }
    2.24 +
    2.25      if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
    2.26          SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
    2.27                                fmt->palette->ncolors);