1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Fix an error

This commit is contained in:
phoebus118
2008-03-03 11:18:23 +00:00
parent 5f4b582eab
commit ab3d7fccb5

View File

@@ -597,9 +597,12 @@ int CSDL_Ext::blit8bppAlphaTo24bpp(SDL_Surface * src, SDL_Rect * srcRect, SDL_Su
case 255:
break;
default:
p[0] = ((((Uint32)tbc.r-(Uint32)p[0])*(Uint32)tbc.unused) + p[0]) & 0xFF;
p[1] = ((((Uint32)tbc.g-(Uint32)p[1])*(Uint32)tbc.unused) + p[1]) & 0xFF;
p[2] = ((((Uint32)tbc.b-(Uint32)p[2])*(Uint32)tbc.unused) + p[2]) & 0xFF;
p[0] = ((((Uint32)tbc.r-(Uint32)p[0])*(Uint32)tbc.unused) >> 8 + p[0]) & 0xFF;
p[1] = ((((Uint32)tbc.g-(Uint32)p[1])*(Uint32)tbc.unused) >> 8 + p[1]) & 0xFF;
p[2] = ((((Uint32)tbc.b-(Uint32)p[2])*(Uint32)tbc.unused) >> 8 + p[2]) & 0xFF;
//p[0] = ((Uint32)tbc.unused*(Uint32)p[0] + (Uint32)tbc.r*(Uint32)(255-tbc.unused))>>8; //red
//p[1] = ((Uint32)tbc.unused*(Uint32)p[1] + (Uint32)tbc.g*(Uint32)(255-tbc.unused))>>8; //green
//p[2] = ((Uint32)tbc.unused*(Uint32)p[2] + (Uint32)tbc.b*(Uint32)(255-tbc.unused))>>8; //blue
break;
}
}
@@ -627,9 +630,12 @@ int CSDL_Ext::blit8bppAlphaTo24bpp(SDL_Surface * src, SDL_Rect * srcRect, SDL_Su
case 255:
break;
default:
p[2] = ((((Uint32)tbc.r-(Uint32)p[2])*(Uint32)tbc.unused) + p[2]) & 0xFF;
p[1] = ((((Uint32)tbc.g-(Uint32)p[1])*(Uint32)tbc.unused) + p[1]) & 0xFF;
p[0] = ((((Uint32)tbc.b-(Uint32)p[0])*(Uint32)tbc.unused) + p[0]) & 0xFF;
//p[2] = ((Uint32)tbc.unused*(Uint32)p[2] + (Uint32)tbc.r*(Uint32)(255-tbc.unused))>>8; //red
//p[1] = ((Uint32)tbc.unused*(Uint32)p[1] + (Uint32)tbc.g*(Uint32)(255-tbc.unused))>>8; //green
//p[0] = ((Uint32)tbc.unused*(Uint32)p[0] + (Uint32)tbc.b*(Uint32)(255-tbc.unused))>>8; //blue
p[2] = ((((Uint32)tbc.r-(Uint32)p[2])*(Uint32)tbc.unused) >> 8 + p[2]) & 0xFF;
p[1] = ((((Uint32)tbc.g-(Uint32)p[1])*(Uint32)tbc.unused) >> 8 + p[1]) & 0xFF;
p[0] = ((((Uint32)tbc.b-(Uint32)p[0])*(Uint32)tbc.unused) >> 8 + p[0]) & 0xFF;
break;
}
}