| Index: src/gpu/text/GrDistanceFieldAdjustTable.cpp
|
| diff --git a/src/gpu/text/GrDistanceFieldAdjustTable.cpp b/src/gpu/text/GrDistanceFieldAdjustTable.cpp
|
| index 1c5aeceb80125a18159d3fad9eec87a93d1fcf24..c6da175e0b4df2da160661f00710fcb368709af2 100644
|
| --- a/src/gpu/text/GrDistanceFieldAdjustTable.cpp
|
| +++ b/src/gpu/text/GrDistanceFieldAdjustTable.cpp
|
| @@ -11,7 +11,7 @@
|
|
|
| SkDEBUGCODE(static const int kExpectedDistanceAdjustTableSize = 8;)
|
|
|
| -void GrDistanceFieldAdjustTable::buildDistanceAdjustTable() {
|
| +SkScalar* build_distance_adjust_table(SkScalar paintGamma, SkScalar deviceGamma) {
|
| // This is used for an approximation of the mask gamma hack, used by raster and bitmap
|
| // text. The mask gamma hack is based off of guessing what the blend color is going to
|
| // be, and adjusting the mask so that when run through the linear blend will
|
| @@ -55,14 +55,12 @@ void GrDistanceFieldAdjustTable::buildDistanceAdjustTable() {
|
| #else
|
| SkScalar contrast = 0.5f;
|
| #endif
|
| - SkScalar paintGamma = SK_GAMMA_EXPONENT;
|
| - SkScalar deviceGamma = SK_GAMMA_EXPONENT;
|
|
|
| size = SkScalerContext::GetGammaLUTSize(contrast, paintGamma, deviceGamma,
|
| &width, &height);
|
|
|
| SkASSERT(kExpectedDistanceAdjustTableSize == height);
|
| - fTable = new SkScalar[height];
|
| + SkScalar* table = new SkScalar[height];
|
|
|
| SkAutoTArray<uint8_t> data((int)size);
|
| SkScalerContext::GetGammaLUTData(contrast, paintGamma, deviceGamma, data.get());
|
| @@ -85,9 +83,16 @@ void GrDistanceFieldAdjustTable::buildDistanceAdjustTable() {
|
| const float kDistanceFieldAAFactor = 0.65f; // should match SK_DistanceFieldAAFactor
|
| float d = 2.0f*kDistanceFieldAAFactor*t - kDistanceFieldAAFactor;
|
|
|
| - fTable[row] = d;
|
| + table[row] = d;
|
| break;
|
| }
|
| }
|
| }
|
| +
|
| + return table;
|
| +}
|
| +
|
| +void GrDistanceFieldAdjustTable::buildDistanceAdjustTables() {
|
| + fTable = build_distance_adjust_table(SK_GAMMA_EXPONENT, SK_GAMMA_EXPONENT);
|
| + fSRGBTable = build_distance_adjust_table(SK_Scalar1, SK_Scalar1);
|
| }
|
|
|