Merged r36175 from branch-0-13-0:

Fixed alpha blending in the UI dialogs by adding alpha
computation to the blendPixelPtr() function.  To minimize
impact, pre-multiplied alpha is assumed, meaning that the
blending of the R, G and B components is the same both
with and without hardware alpha.

svn-id: r36177
This commit is contained in:
Marcus Comstedt 2009-02-01 14:56:19 +00:00
parent 6438c40958
commit f90e4545c2
2 changed files with 5 additions and 2 deletions

View file

@ -390,7 +390,7 @@ void OSystem_Dreamcast::updateScreen(void)
TA_CMD_POLYGON_STRIPLENGTH_2|TA_CMD_POLYGON_PACKED_COLOUR|TA_CMD_POLYGON_TEXTURED;
mypoly.mode1 = TA_POLYMODE1_Z_ALWAYS|TA_POLYMODE1_NO_Z_UPDATE;
mypoly.mode2 =
TA_POLYMODE2_BLEND_SRC_ALPHA|TA_POLYMODE2_BLEND_DST_INVALPHA|
TA_POLYMODE2_BLEND_SRC/*_ALPHA*/|TA_POLYMODE2_BLEND_DST_INVALPHA|
TA_POLYMODE2_ENABLE_ALPHA|
TA_POLYMODE2_FOG_DISABLED|TA_POLYMODE2_TEXTURE_MODULATE_ALPHA|
TA_POLYMODE2_U_SIZE_512|TA_POLYMODE2_V_SIZE_512;

View file

@ -403,7 +403,10 @@ blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) {
(int)(idst & PixelFormat::kGreenMask)) * alpha) >> 8))) |
(PixelFormat::kBlueMask & ((idst & PixelFormat::kBlueMask) +
((int)(((int)(isrc & PixelFormat::kBlueMask) -
(int)(idst & PixelFormat::kBlueMask)) * alpha) >> 8))) );
(int)(idst & PixelFormat::kBlueMask)) * alpha) >> 8))) |
(PixelFormat::kAlphaMask & ((idst & PixelFormat::kAlphaMask) +
((alpha >> (8 - PixelFormat::kAlphaBits)) << PixelFormat::kAlphaShift) -
(((int)(idst & PixelFormat::kAlphaMask) * alpha) >> 8))));
}
template <typename PixelType, typename PixelFormat>