|
@@ -69,7 +69,7 @@ static void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
|
|
@@ -79,22 +79,14 @@ static void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -121,7 +113,7 @@ static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
int srcy, srcx;
|
|
@@ -152,22 +144,14 @@ static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -281,7 +265,8 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
|
|
@@ -291,7 +276,7 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -299,9 +284,6 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -345,7 +327,8 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
int srcy, srcx;
|
|
@@ -376,7 +359,7 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -384,9 +367,6 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -469,7 +449,7 @@ static void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
|
|
@@ -479,22 +459,14 @@ static void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -521,7 +493,7 @@ static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
int srcy, srcx;
|
|
@@ -552,22 +524,14 @@ static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -681,7 +645,8 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
|
|
@@ -691,7 +656,7 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -699,9 +664,6 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -745,7 +707,8 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
int srcy, srcx;
|
|
@@ -776,7 +739,7 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -784,9 +747,6 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -825,7 +785,8 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info)
|
|
|
{
|
|
|
Uint32 pixel;
|
|
|
- Uint32 R, G, B, A;
|
|
|
+ const Uint32 A = 0xFF;
|
|
|
+ Uint32 R, G, B;
|
|
|
int srcy, srcx;
|
|
|
int posy, posx;
|
|
|
int incy, incx;
|
|
@@ -854,7 +815,7 @@ static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
pixel = *src;
|
|
|
- R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
|
|
|
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
|
|
|
pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
|
|
|
*dst = pixel;
|
|
|
posx += incx;
|
|
@@ -869,7 +830,7 @@ static void SDL_Blit_RGB888_ARGB8888_Blend(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB, dstA;
|
|
|
|
|
@@ -879,23 +840,15 @@ static void SDL_Blit_RGB888_ARGB8888_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
- dstA = srcA + ((255 - srcA) * dstA) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
+ dstA = 0xFF;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -922,7 +875,7 @@ static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB, dstA;
|
|
|
int srcy, srcx;
|
|
@@ -953,23 +906,15 @@ static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
- dstA = srcA + ((255 - srcA) * dstA) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
+ dstA = 0xFF;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -1000,7 +945,8 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 pixel;
|
|
|
- Uint32 R, G, B, A;
|
|
|
+ const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 R, G, B;
|
|
|
|
|
|
while (info->dst_h--) {
|
|
|
Uint32 *src = (Uint32 *)info->src;
|
|
@@ -1008,15 +954,12 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
pixel = *src;
|
|
|
- R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
|
|
|
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
|
R = (R * modulateR) / 255;
|
|
|
G = (G * modulateG) / 255;
|
|
|
B = (B * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- A = (A * modulateA) / 255;
|
|
|
- }
|
|
|
pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
|
|
|
*dst = pixel;
|
|
|
++src;
|
|
@@ -1035,7 +978,8 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 pixel;
|
|
|
- Uint32 R, G, B, A;
|
|
|
+ const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 R, G, B;
|
|
|
int srcy, srcx;
|
|
|
int posy, posx;
|
|
|
int incy, incx;
|
|
@@ -1064,15 +1008,12 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
pixel = *src;
|
|
|
- R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
|
|
|
+ R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
|
R = (R * modulateR) / 255;
|
|
|
G = (G * modulateG) / 255;
|
|
|
B = (B * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- A = (A * modulateA) / 255;
|
|
|
- }
|
|
|
pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
|
|
|
*dst = pixel;
|
|
|
posx += incx;
|
|
@@ -1091,7 +1032,8 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB, dstA;
|
|
|
|
|
@@ -1101,7 +1043,7 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -1109,9 +1051,6 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -1156,7 +1095,8 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB, dstA;
|
|
|
int srcy, srcx;
|
|
@@ -1187,7 +1127,7 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -1195,9 +1135,6 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -1281,7 +1218,7 @@ static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
|
|
@@ -1291,22 +1228,14 @@ static void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -1333,7 +1262,7 @@ static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
int srcy, srcx;
|
|
@@ -1364,22 +1293,14 @@ static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -1493,7 +1414,8 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
|
|
@@ -1503,7 +1425,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -1511,9 +1433,6 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -1557,7 +1476,8 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
int srcy, srcx;
|
|
@@ -1588,7 +1508,7 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -1596,9 +1516,6 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -1676,7 +1593,7 @@ static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
|
|
@@ -1686,22 +1603,14 @@ static void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -1728,7 +1637,7 @@ static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
int srcy, srcx;
|
|
@@ -1759,22 +1668,14 @@ static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -1888,7 +1789,8 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
|
|
@@ -1898,7 +1800,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -1906,9 +1808,6 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -1952,7 +1851,8 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB;
|
|
|
int srcy, srcx;
|
|
@@ -1983,7 +1883,7 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -1991,9 +1891,6 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -2032,7 +1929,8 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
static void SDL_Blit_BGR888_ARGB8888_Scale(SDL_BlitInfo *info)
|
|
|
{
|
|
|
Uint32 pixel;
|
|
|
- Uint32 R, G, B, A;
|
|
|
+ const Uint32 A = 0xFF;
|
|
|
+ Uint32 R, G, B;
|
|
|
int srcy, srcx;
|
|
|
int posy, posx;
|
|
|
int incy, incx;
|
|
@@ -2061,7 +1959,7 @@ static void SDL_Blit_BGR888_ARGB8888_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
pixel = *src;
|
|
|
- B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
|
|
|
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
|
|
|
pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
|
|
|
*dst = pixel;
|
|
|
posx += incx;
|
|
@@ -2076,7 +1974,7 @@ static void SDL_Blit_BGR888_ARGB8888_Blend(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB, dstA;
|
|
|
|
|
@@ -2086,23 +1984,15 @@ static void SDL_Blit_BGR888_ARGB8888_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
- dstA = srcA + ((255 - srcA) * dstA) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
+ dstA = 0xFF;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -2129,7 +2019,7 @@ static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
{
|
|
|
const int flags = info->flags;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB, dstA;
|
|
|
int srcy, srcx;
|
|
@@ -2160,23 +2050,15 @@ static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
|
|
|
- if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
- /* This goes away if we ever use premultiplied alpha */
|
|
|
- if (srcA < 255) {
|
|
|
- srcR = (srcR * srcA) / 255;
|
|
|
- srcG = (srcG * srcA) / 255;
|
|
|
- srcB = (srcB * srcA) / 255;
|
|
|
- }
|
|
|
- }
|
|
|
switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
|
|
case SDL_COPY_BLEND:
|
|
|
- dstR = srcR + ((255 - srcA) * dstR) / 255;
|
|
|
- dstG = srcG + ((255 - srcA) * dstG) / 255;
|
|
|
- dstB = srcB + ((255 - srcA) * dstB) / 255;
|
|
|
- dstA = srcA + ((255 - srcA) * dstA) / 255;
|
|
|
+ dstR = srcR;
|
|
|
+ dstG = srcG;
|
|
|
+ dstB = srcB;
|
|
|
+ dstA = 0xFF;
|
|
|
break;
|
|
|
case SDL_COPY_ADD:
|
|
|
dstR = srcR + dstR; if (dstR > 255) dstR = 255;
|
|
@@ -2207,7 +2089,8 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 pixel;
|
|
|
- Uint32 R, G, B, A;
|
|
|
+ const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 R, G, B;
|
|
|
|
|
|
while (info->dst_h--) {
|
|
|
Uint32 *src = (Uint32 *)info->src;
|
|
@@ -2215,15 +2098,12 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
pixel = *src;
|
|
|
- B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
|
|
|
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
|
R = (R * modulateR) / 255;
|
|
|
G = (G * modulateG) / 255;
|
|
|
B = (B * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- A = (A * modulateA) / 255;
|
|
|
- }
|
|
|
pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
|
|
|
*dst = pixel;
|
|
|
++src;
|
|
@@ -2242,7 +2122,8 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 pixel;
|
|
|
- Uint32 R, G, B, A;
|
|
|
+ const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 R, G, B;
|
|
|
int srcy, srcx;
|
|
|
int posy, posx;
|
|
|
int incy, incx;
|
|
@@ -2271,15 +2152,12 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
pixel = *src;
|
|
|
- B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
|
|
|
+ B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
|
R = (R * modulateR) / 255;
|
|
|
G = (G * modulateG) / 255;
|
|
|
B = (B * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- A = (A * modulateA) / 255;
|
|
|
- }
|
|
|
pixel = ((Uint32)A << 24) | ((Uint32)R << 16) | ((Uint32)G << 8) | B;
|
|
|
*dst = pixel;
|
|
|
posx += incx;
|
|
@@ -2298,7 +2176,8 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB, dstA;
|
|
|
|
|
@@ -2308,7 +2187,7 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
int n = info->dst_w;
|
|
|
while (n--) {
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -2316,9 +2195,6 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|
|
@@ -2363,7 +2239,8 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
const Uint32 modulateB = info->b;
|
|
|
const Uint32 modulateA = info->a;
|
|
|
Uint32 srcpixel;
|
|
|
- Uint32 srcR, srcG, srcB, srcA;
|
|
|
+ const Uint32 srcA = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF;
|
|
|
+ Uint32 srcR, srcG, srcB;
|
|
|
Uint32 dstpixel;
|
|
|
Uint32 dstR, dstG, dstB, dstA;
|
|
|
int srcy, srcx;
|
|
@@ -2394,7 +2271,7 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
|
|
|
}
|
|
|
srcpixel = *src;
|
|
|
- srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
|
|
|
+ srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
|
|
|
dstpixel = *dst;
|
|
|
dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = (Uint8)(dstpixel >> 24);
|
|
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
|
@@ -2402,9 +2279,6 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
|
|
srcG = (srcG * modulateG) / 255;
|
|
|
srcB = (srcB * modulateB) / 255;
|
|
|
}
|
|
|
- if (flags & SDL_COPY_MODULATE_ALPHA) {
|
|
|
- srcA = (srcA * modulateA) / 255;
|
|
|
- }
|
|
|
if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
|
|
|
/* This goes away if we ever use premultiplied alpha */
|
|
|
if (srcA < 255) {
|