Handle rgb_to_a8 when kGenA8FromLCD_Flag is set.

git-svn-id: http://skia.googlecode.com/svn/trunk@4889 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bungeman@google.com 2012-08-01 15:36:46 +00:00
parent fce02aca62
commit 6385314686

View File

@ -954,11 +954,13 @@ static const uint8_t* getInverseGammaTableClearType() {
#include "SkColorPriv.h"
//Cannot assume that the input rgb is gray due to possible setting of kGenA8FromLCD_Flag.
template<bool APPLY_PREBLEND>
static inline uint8_t rgb_to_a8(SkGdiRGB rgb, const uint8_t* table8) {
SkASSERT( ((rgb >> 16) & 0xFF) == ((rgb >> 8) & 0xFF) &&
((rgb >> 16) & 0xFF) == ((rgb >> 0) & 0xFF) );
return sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 16) & 0xFF, table8);
U8CPU r = (rgb >> 16) & 0xFF;
U8CPU g = (rgb >> 8) & 0xFF;
U8CPU b = (rgb >> 0) & 0xFF;
return sk_apply_lut_if<APPLY_PREBLEND>((r + g + b) / 3, table8);
}
template<bool APPLY_PREBLEND>