diff options
Diffstat (limited to 'src/ports/SkFontHost_gamma.cpp')
-rw-r--r-- | src/ports/SkFontHost_gamma.cpp | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/src/ports/SkFontHost_gamma.cpp b/src/ports/SkFontHost_gamma.cpp index e4cd8f1..0d15414 100644 --- a/src/ports/SkFontHost_gamma.cpp +++ b/src/ports/SkFontHost_gamma.cpp @@ -1,3 +1,10 @@ + +/* + * Copyright 2011 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ #include "SkFontHost.h" #include <math.h> @@ -50,7 +57,7 @@ void skia_set_text_gamma(float blackGamma, float whiteGamma) { gBlackGammaCoeff = blackGamma; gWhiteGammaCoeff = whiteGamma; gGammaIsBuilt = false; - SkGraphics::SetFontCacheUsed(0); + SkGraphics::PurgeFontCache(); build_power_table(gBlackGamma, gBlackGammaCoeff); build_power_table(gWhiteGamma, gWhiteGammaCoeff); } @@ -98,29 +105,3 @@ void SkFontHost::GetGammaTables(const uint8_t* tables[2]) { tables[1] = gWhiteGamma; } -// If the luminance is <= this value, then apply the black gamma table -#define BLACK_GAMMA_THRESHOLD 0x40 - -// If the luminance is >= this value, then apply the white gamma table -#define WHITE_GAMMA_THRESHOLD 0xC0 - -int SkFontHost::ComputeGammaFlag(const SkPaint& paint) { - if (paint.getShader() == NULL) { - SkColor c = paint.getColor(); - int r = SkColorGetR(c); - int g = SkColorGetG(c); - int b = SkColorGetB(c); - int luminance = (r * 2 + g * 5 + b) >> 3; - - if (luminance <= BLACK_GAMMA_THRESHOLD) { - // printf("------ black gamma for [%d %d %d]\n", r, g, b); - return SkScalerContext::kGammaForBlack_Flag; - } - if (luminance >= WHITE_GAMMA_THRESHOLD) { - // printf("------ white gamma for [%d %d %d]\n", r, g, b); - return SkScalerContext::kGammaForWhite_Flag; - } - } - return 0; -} - |