indent
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403519
This commit is contained in:
parent
62dd3e61df
commit
a9ca68d613
3 changed files with 28 additions and 10 deletions
|
@ -50,9 +50,11 @@ SDL_PreMultiplyAlpha##fmt(int w, int h, Uint32 *pixels, int pitch) \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
DEFINE_PREMULTIPLY_FUNC(ARGB8888)
|
DEFINE_PREMULTIPLY_FUNC(ARGB8888)
|
||||||
DEFINE_PREMULTIPLY_FUNC(RGBA8888)
|
DEFINE_PREMULTIPLY_FUNC(RGBA8888)
|
||||||
DEFINE_PREMULTIPLY_FUNC(ABGR8888)
|
DEFINE_PREMULTIPLY_FUNC(ABGR8888)
|
||||||
DEFINE_PREMULTIPLY_FUNC(BGRA8888)
|
DEFINE_PREMULTIPLY_FUNC(BGRA8888)
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -26,10 +26,12 @@
|
||||||
void \
|
void \
|
||||||
SDL_PreMultiplyAlpha##fmt(int w, int h, Uint32 *pixels, int pitch);
|
SDL_PreMultiplyAlpha##fmt(int w, int h, Uint32 *pixels, int pitch);
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
DEFINE_PREMULTIPLY_FUNC(ARGB8888)
|
DEFINE_PREMULTIPLY_FUNC(ARGB8888)
|
||||||
DEFINE_PREMULTIPLY_FUNC(RGBA8888)
|
DEFINE_PREMULTIPLY_FUNC(RGBA8888)
|
||||||
DEFINE_PREMULTIPLY_FUNC(ABGR8888)
|
DEFINE_PREMULTIPLY_FUNC(ABGR8888)
|
||||||
DEFINE_PREMULTIPLY_FUNC(BGRA8888)
|
DEFINE_PREMULTIPLY_FUNC(BGRA8888)
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
#undef DEFINE_PREMULTIPLY_FUNC
|
#undef DEFINE_PREMULTIPLY_FUNC
|
||||||
|
|
||||||
|
|
|
@ -478,19 +478,27 @@ GDI_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
if (!data->premultiplied && data->pixels) {
|
if (!data->premultiplied && data->pixels) {
|
||||||
switch (texture->format) {
|
switch (texture->format) {
|
||||||
case SDL_PIXELFORMAT_ARGB8888:
|
case SDL_PIXELFORMAT_ARGB8888:
|
||||||
SDL_PreMultiplyAlphaARGB8888(texture->w, texture->h, (Uint32 *)data->pixels, data->pitch);
|
SDL_PreMultiplyAlphaARGB8888(texture->w, texture->h,
|
||||||
|
(Uint32 *) data->pixels,
|
||||||
|
data->pitch);
|
||||||
data->premultiplied = SDL_TRUE;
|
data->premultiplied = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
case SDL_PIXELFORMAT_RGBA8888:
|
case SDL_PIXELFORMAT_RGBA8888:
|
||||||
SDL_PreMultiplyAlphaRGBA8888(texture->w, texture->h, (Uint32 *)data->pixels, data->pitch);
|
SDL_PreMultiplyAlphaRGBA8888(texture->w, texture->h,
|
||||||
|
(Uint32 *) data->pixels,
|
||||||
|
data->pitch);
|
||||||
data->premultiplied = SDL_TRUE;
|
data->premultiplied = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
case SDL_PIXELFORMAT_ABGR8888:
|
case SDL_PIXELFORMAT_ABGR8888:
|
||||||
SDL_PreMultiplyAlphaABGR8888(texture->w, texture->h, (Uint32 *)data->pixels, data->pitch);
|
SDL_PreMultiplyAlphaABGR8888(texture->w, texture->h,
|
||||||
|
(Uint32 *) data->pixels,
|
||||||
|
data->pitch);
|
||||||
data->premultiplied = SDL_TRUE;
|
data->premultiplied = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
case SDL_PIXELFORMAT_BGRA8888:
|
case SDL_PIXELFORMAT_BGRA8888:
|
||||||
SDL_PreMultiplyAlphaBGRA8888(texture->w, texture->h, (Uint32 *)data->pixels, data->pitch);
|
SDL_PreMultiplyAlphaBGRA8888(texture->w, texture->h,
|
||||||
|
(Uint32 *) data->pixels,
|
||||||
|
data->pitch);
|
||||||
data->premultiplied = SDL_TRUE;
|
data->premultiplied = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -554,19 +562,25 @@ GDI_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
dst += data->pitch;
|
dst += data->pitch;
|
||||||
}
|
}
|
||||||
if (data->premultiplied) {
|
if (data->premultiplied) {
|
||||||
Uint32 *pixels = (Uint32 *) data->pixels + rect->y * (data->pitch / 4) + rect->x;
|
Uint32 *pixels =
|
||||||
|
(Uint32 *) data->pixels + rect->y * (data->pitch / 4) +
|
||||||
|
rect->x;
|
||||||
switch (texture->format) {
|
switch (texture->format) {
|
||||||
case SDL_PIXELFORMAT_ARGB8888:
|
case SDL_PIXELFORMAT_ARGB8888:
|
||||||
SDL_PreMultiplyAlphaARGB8888(rect->w, rect->h, pixels, data->pitch);
|
SDL_PreMultiplyAlphaARGB8888(rect->w, rect->h, pixels,
|
||||||
|
data->pitch);
|
||||||
break;
|
break;
|
||||||
case SDL_PIXELFORMAT_RGBA8888:
|
case SDL_PIXELFORMAT_RGBA8888:
|
||||||
SDL_PreMultiplyAlphaRGBA8888(rect->w, rect->h, pixels, data->pitch);
|
SDL_PreMultiplyAlphaRGBA8888(rect->w, rect->h, pixels,
|
||||||
|
data->pitch);
|
||||||
break;
|
break;
|
||||||
case SDL_PIXELFORMAT_ABGR8888:
|
case SDL_PIXELFORMAT_ABGR8888:
|
||||||
SDL_PreMultiplyAlphaABGR8888(rect->w, rect->h, pixels, data->pitch);
|
SDL_PreMultiplyAlphaABGR8888(rect->w, rect->h, pixels,
|
||||||
|
data->pitch);
|
||||||
break;
|
break;
|
||||||
case SDL_PIXELFORMAT_BGRA8888:
|
case SDL_PIXELFORMAT_BGRA8888:
|
||||||
SDL_PreMultiplyAlphaBGRA8888(rect->w, rect->h, pixels, data->pitch);
|
SDL_PreMultiplyAlphaBGRA8888(rect->w, rect->h, pixels,
|
||||||
|
data->pitch);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -745,7 +759,7 @@ GDI_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
SelectPalette(data->memory_hdc, texturedata->hpal, TRUE);
|
SelectPalette(data->memory_hdc, texturedata->hpal, TRUE);
|
||||||
RealizePalette(data->memory_hdc);
|
RealizePalette(data->memory_hdc);
|
||||||
}
|
}
|
||||||
if (texture->blendMode & (SDL_BLENDMODE_MASK|SDL_BLENDMODE_BLEND)) {
|
if (texture->blendMode & (SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND)) {
|
||||||
BLENDFUNCTION blendFunc = {
|
BLENDFUNCTION blendFunc = {
|
||||||
AC_SRC_OVER,
|
AC_SRC_OVER,
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue