Commit d67835c3 authored by Sam Lantinga's avatar Sam Lantinga

When creating a software texture, synchronize the surface with the texture.

When creating a texture from a surface, synchronize the texture with the surface.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403517
parent d0b1ee8e
...@@ -380,6 +380,12 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -380,6 +380,12 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
texture->driverdata = texture->driverdata =
SDL_CreateRGBSurface(0, texture->w, texture->h, bpp, Rmask, Gmask, SDL_CreateRGBSurface(0, texture->w, texture->h, bpp, Rmask, Gmask,
Bmask, Amask); Bmask, Amask);
SDL_SetSurfaceColorMod(texture->driverdata, texture->r, texture->g,
texture->b);
SDL_SetSurfaceAlphaMod(texture->driverdata, texture->a);
SDL_SetSurfaceBlendMode(texture->driverdata, texture->blendMode);
SDL_SetSurfaceScaleMode(texture->driverdata, texture->scaleMode);
if (texture->access == SDL_TEXTUREACCESS_STATIC) { if (texture->access == SDL_TEXTUREACCESS_STATIC) {
SDL_SetSurfaceRLE(texture->driverdata, 1); SDL_SetSurfaceRLE(texture->driverdata, 1);
} }
......
...@@ -1635,6 +1635,24 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface) ...@@ -1635,6 +1635,24 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface)
} }
} }
{
Uint8 r, g, b, a;
int blendMode;
int scaleMode;
SDL_GetSurfaceColorMod(surface, &r, &g, &b);
SDL_SetTextureColorMod(textureID, r, g, b);
SDL_GetSurfaceAlphaMod(surface, &a);
SDL_SetTextureAlphaMod(textureID, a);
SDL_GetSurfaceBlendMode(surface, &blendMode);
SDL_SetTextureBlendMode(textureID, blendMode);
SDL_GetSurfaceScaleMode(surface, &scaleMode);
SDL_SetTextureScaleMode(textureID, scaleMode);
}
if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) { if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
SDL_SetTexturePalette(textureID, fmt->palette->colors, 0, SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
fmt->palette->ncolors); fmt->palette->ncolors);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment