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

Unified Diff: src/core/SkPaint.cpp

Issue 323513005: Revert of Gamma correction for distance field text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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/core/SkMaskGamma.h ('k') | src/core/SkScalerContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPaint.cpp
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index b08b2c6da7471ebc72d5447b6f44f6ad6162d45e..78d947020b20442ac8bafcc63f14d752bf2f0c83 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1814,8 +1814,10 @@
/*
* ignoreGamma tells us that the caller just wants metrics that are unaffected
- * by gamma correction, so we set the rec to ignore preblend: i.e. gamma = 1,
- * contrast = 0, luminanceColor = transparent black.
+ * by gamma correction, so we jam the luminance field to 0 (most common value
+ * for black text) in hopes that we get a cache hit easier. A better solution
+ * would be for the fontcache lookup to know to ignore the luminance field
+ * entirely, but not sure how to do that and keep it fast.
*/
void SkPaint::descriptorProc(const SkDeviceProperties* deviceProperties,
const SkMatrix* deviceMatrix,
@@ -1825,7 +1827,7 @@
SkScalerContext::MakeRec(*this, deviceProperties, deviceMatrix, &rec);
if (ignoreGamma) {
- rec.ignorePreBlend();
+ rec.setLuminanceColor(0);
}
size_t descSize = sizeof(rec);
@@ -1949,10 +1951,9 @@
}
SkGlyphCache* SkPaint::detachCache(const SkDeviceProperties* deviceProperties,
- const SkMatrix* deviceMatrix,
- bool ignoreGamma) const {
+ const SkMatrix* deviceMatrix) const {
SkGlyphCache* cache;
- this->descriptorProc(deviceProperties, deviceMatrix, DetachDescProc, &cache, ignoreGamma);
+ this->descriptorProc(deviceProperties, deviceMatrix, DetachDescProc, &cache, false);
return cache;
}
@@ -1967,33 +1968,6 @@
rec.getDeviceGamma());
return maskGamma.preBlend(rec.getLuminanceColor());
}
-
-size_t SkScalerContext::GetGammaLUTSize(SkScalar contrast, SkScalar paintGamma,
- SkScalar deviceGamma, int* width, int* height) {
- SkAutoMutexAcquire ama(gMaskGammaCacheMutex);
- const SkMaskGamma& maskGamma = cachedMaskGamma(contrast,
- paintGamma,
- deviceGamma);
-
- maskGamma.getGammaTableDimensions(width, height);
- size_t size = (*width)*(*height)*sizeof(uint8_t);
-
- return size;
-}
-
-void SkScalerContext::GetGammaLUTData(SkScalar contrast, SkScalar paintGamma, SkScalar deviceGamma,
- void* data) {
- SkAutoMutexAcquire ama(gMaskGammaCacheMutex);
- const SkMaskGamma& maskGamma = cachedMaskGamma(contrast,
- paintGamma,
- deviceGamma);
- int width, height;
- maskGamma.getGammaTableDimensions(&width, &height);
- size_t size = width*height*sizeof(uint8_t);
- const uint8_t* gammaTables = maskGamma.getGammaTables();
- memcpy(data, gammaTables, size);
-}
-
///////////////////////////////////////////////////////////////////////////////
@@ -2583,7 +2557,7 @@
fPaint.setPathEffect(NULL);
}
- fCache = fPaint.detachCache(NULL, NULL, false);
+ fCache = fPaint.detachCache(NULL, NULL);
SkPaint::Style style = SkPaint::kFill_Style;
SkPathEffect* pe = NULL;
« no previous file with comments | « src/core/SkMaskGamma.h ('k') | src/core/SkScalerContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698