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

Unified Diff: src/gpu/GrAtlasTextContext.cpp

Issue 1189223002: Remove gamma field from SkDeviceProperties (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanup DistanceAdjustTable Created 5 years, 6 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
« no previous file with comments | « src/gpu/GrAtlasTextContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAtlasTextContext.cpp
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 900d681b50c1f0b43fccbccffe0704a5df20bea9..7252d76ca2acb65a1876a2a3ae8cbf8c2d34d108 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -99,7 +99,7 @@ GrAtlasTextContext::GrAtlasTextContext(GrContext* context,
GrDrawContext* drawContext,
const SkDeviceProperties& properties)
: INHERITED(context, drawContext, properties)
- , fDistanceAdjustTable(SkNEW_ARGS(DistanceAdjustTable, (properties.gamma()))) {
+ , fDistanceAdjustTable(SkNEW(DistanceAdjustTable)) {
// We overallocate vertices in our textblobs based on the assumption that A8 has the greatest
// vertexStride
SK_COMPILE_ASSERT(kGrayTextVASize >= kColorTextVASize && kGrayTextVASize >= kLCDTextVASize,
@@ -108,7 +108,7 @@ GrAtlasTextContext::GrAtlasTextContext(GrContext* context,
fCache = context->getTextBlobCache();
}
-void GrAtlasTextContext::DistanceAdjustTable::buildDistanceAdjustTable(float gamma) {
+void GrAtlasTextContext::DistanceAdjustTable::buildDistanceAdjustTable() {
// 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
@@ -153,8 +153,8 @@ void GrAtlasTextContext::DistanceAdjustTable::buildDistanceAdjustTable(float gam
#else
SkScalar contrast = 0.5f;
#endif
- SkScalar paintGamma = gamma;
- SkScalar deviceGamma = gamma;
+ SkScalar paintGamma = SK_GAMMA_EXPONENT;
+ SkScalar deviceGamma = SK_GAMMA_EXPONENT;
size = SkScalerContext::GetGammaLUTSize(contrast, paintGamma, deviceGamma,
&width, &height);
@@ -1450,9 +1450,9 @@ public:
GrBatchFontCache* fontCache,
DistanceAdjustTable* distanceAdjustTable,
SkColor filteredColor, bool useLCDText,
- bool useBGR, float gamma) {
+ bool useBGR) {
return SkNEW_ARGS(BitmapTextBatch, (maskFormat, glyphCount, fontCache, distanceAdjustTable,
- filteredColor, useLCDText, useBGR, gamma));
+ filteredColor, useLCDText, useBGR));
}
const char* name() const override { return "BitmapTextBatch"; }
@@ -1773,7 +1773,7 @@ private:
BitmapTextBatch(GrMaskFormat maskFormat, int glyphCount, GrBatchFontCache* fontCache,
DistanceAdjustTable* distanceAdjustTable, SkColor filteredColor,
- bool useLCDText, bool useBGR, float gamma)
+ bool useLCDText, bool useBGR)
: fMaskFormat(maskFormat)
, fPixelConfig(fontCache->getPixelConfig(maskFormat))
, fFontCache(fontCache)
@@ -1781,8 +1781,7 @@ private:
, fFilteredColor(filteredColor)
, fUseDistanceFields(true)
, fUseLCDText(useLCDText)
- , fUseBGR(useBGR)
- , fGamma(gamma) {
+ , fUseBGR(useBGR) {
this->initClassID<BitmapTextBatch>();
fBatch.fNumGlyphs = glyphCount;
fInstanceCount = 1;
@@ -1912,10 +1911,6 @@ private:
return false;
}
- if (fGamma != that->fGamma) {
- return false;
- }
-
// TODO see note above
if (fUseLCDText && this->color() != that->color()) {
return false;
@@ -1986,7 +1981,7 @@ private:
} else {
flags |= kColorAttr_DistanceFieldEffectFlag;
#ifdef SK_GAMMA_APPLY_TO_A8
- U8CPU lum = SkColorSpaceLuminance::computeLuminance(fGamma, filteredColor);
+ U8CPU lum = SkColorSpaceLuminance::computeLuminance(SK_GAMMA_EXPONENT, filteredColor);
float correction = (*fDistanceAdjustTable)[lum >> kDistanceAdjustLumShift];
return GrDistanceFieldA8TextGeoProc::Create(color,
viewMatrix,
@@ -2025,12 +2020,11 @@ private:
GrBatchFontCache* fFontCache;
// Distance field properties
- SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable;
+ SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable;
SkColor fFilteredColor;
bool fUseDistanceFields;
bool fUseLCDText;
bool fUseBGR;
- float fGamma;
};
void GrAtlasTextContext::flushRunAsPaths(GrRenderTarget* rt, const SkTextBlob::RunIterator& it,
@@ -2095,11 +2089,9 @@ GrAtlasTextContext::createBatch(BitmapTextBlob* cacheBlob, const PerSubRunInfo&
filteredColor = skPaint.getColor();
}
bool useBGR = SkPixelGeometryIsBGR(fDeviceProperties.pixelGeometry());
- float gamma = fDeviceProperties.gamma();
batch = BitmapTextBatch::Create(format, glyphCount, fContext->getBatchFontCache(),
fDistanceAdjustTable, filteredColor,
- info.fUseLCDText, useBGR,
- gamma);
+ info.fUseLCDText, useBGR);
} else {
batch = BitmapTextBatch::Create(format, glyphCount, fContext->getBatchFontCache());
}
« no previous file with comments | « src/gpu/GrAtlasTextContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698