aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-05 15:07:25 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-05 15:07:25 +0000
commitd0b6a2dd821e879fc85e1ee645bd3e2ab111b53f (patch)
treedd63568c99ffec36c7fce5c61f3087194a6742af
parentc2099d2707abcc94e139627399aed4b8894b69bb (diff)
When guessing at the dest, use linear space instead of color space.
http://codereview.appspot.com/5732044/ --this line, and those below, will be ignored-- M src/ports/SkFontHost_FreeType.cpp git-svn-id: http://skia.googlecode.com/svn/trunk@3313 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/ports/SkFontHost_FreeType.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index da1040daa3..8494d38550 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -1068,7 +1068,7 @@ static void build_power_table(uint8_t table[], float ee) {
}
}
-static void build_gamma_table(uint8_t table[256], int src, int dst) {
+static void build_gamma_table(uint8_t table[256], int src) {
static bool gInit;
static uint8_t powTable[256], invPowTable[256];
if (!gInit) {
@@ -1079,7 +1079,9 @@ static void build_gamma_table(uint8_t table[256], int src, int dst) {
}
const int linSrc = powTable[src];
- const int linDst = powTable[dst];
+ const int linDst = 255 - linSrc;
+ const int dst = invPowTable[linDst];
+
// have our contrast value taper off to 0 as the src luminance becomes white
const int contrast = SK_GAMMA_CONTRAST * (255 - linSrc) / 255;
@@ -1105,10 +1107,10 @@ static const uint8_t* getGammaTable(U8CPU luminance) {
static uint8_t gGammaTables[4][256];
static bool gInited;
if (!gInited) {
- build_gamma_table(gGammaTables[0], 0x00, 0xFF);
- build_gamma_table(gGammaTables[1], 0x66, 0x99);
- build_gamma_table(gGammaTables[2], 0x99, 0x66);
- build_gamma_table(gGammaTables[3], 0xFF, 0x00);
+ build_gamma_table(gGammaTables[0], 0x00);
+ build_gamma_table(gGammaTables[1], 0x55);
+ build_gamma_table(gGammaTables[2], 0xAA);
+ build_gamma_table(gGammaTables[3], 0xFF);
gInited = true;
}