Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Unified Diff: src/gpu/text/GrDistanceFieldAdjustTable.cpp

Issue 1885613002: sRGB support for distance field text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Break long line Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
« src/gpu/effects/GrDistanceFieldGeoProc.cpp ('K') | « src/gpu/text/GrDistanceFieldAdjustTable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698