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

Unified Diff: src/core/SkPaint.cpp

Issue 1711223003: Only use fake gamma with linear devices. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Formatting. Created 4 years, 10 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/SkGlyphCache.h ('k') | src/gpu/text/GrAtlasTextBlob.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 cea3d0fc8dde623e16bfa8a538166438a43ea264..d2ea8eeda09612835691c7093b6f561df05218ed 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1098,7 +1098,7 @@ SkScalar SkPaint::getFontMetrics(FontMetrics* metrics, SkScalar zoom) const {
metrics = &storage;
}
- paint.descriptorProc(nullptr, zoomPtr, FontMetricsDescProc, metrics, true);
+ paint.descriptorProc(nullptr, FakeGamma::Off, zoomPtr, FontMetricsDescProc, metrics);
if (scale) {
metrics->fTop = SkScalarMul(metrics->fTop, scale);
@@ -1690,12 +1690,13 @@ static void write_out_descriptor(SkDescriptor* desc, const SkScalerContext::Rec&
static size_t fill_out_rec(const SkPaint& paint, SkScalerContext::Rec* rec,
const SkSurfaceProps* surfaceProps,
- const SkMatrix* deviceMatrix, bool ignoreGamma,
+ bool fakeGamma,
+ const SkMatrix* deviceMatrix,
const SkPathEffect* pe, SkWriteBuffer* peBuffer,
const SkMaskFilter* mf, SkWriteBuffer* mfBuffer,
const SkRasterizer* ra, SkWriteBuffer* raBuffer) {
SkScalerContext::MakeRec(paint, surfaceProps, deviceMatrix, rec);
- if (ignoreGamma) {
+ if (!fakeGamma) {
rec->ignorePreBlend();
}
@@ -1785,7 +1786,8 @@ static void test_desc(const SkScalerContext::Rec& rec,
/* see the note on ignoreGamma on descriptorProc */
void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad,
const SkSurfaceProps& surfaceProps,
- const SkMatrix* deviceMatrix, bool ignoreGamma) const {
+ FakeGamma fakeGamma,
+ const SkMatrix* deviceMatrix) const {
SkScalerContext::Rec rec;
SkPathEffect* pe = this->getPathEffect();
@@ -1793,7 +1795,8 @@ void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad,
SkRasterizer* ra = this->getRasterizer();
SkWriteBuffer peBuffer, mfBuffer, raBuffer;
- size_t descSize = fill_out_rec(*this, &rec, &surfaceProps, deviceMatrix, ignoreGamma,
+ size_t descSize = fill_out_rec(*this, &rec,
+ &surfaceProps, FakeGamma::On == fakeGamma, deviceMatrix,
pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer);
ad->reset(descSize);
@@ -1814,9 +1817,10 @@ void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad,
* contrast = 0, luminanceColor = transparent black.
*/
void SkPaint::descriptorProc(const SkSurfaceProps* surfaceProps,
+ FakeGamma fakeGamma,
const SkMatrix* deviceMatrix,
void (*proc)(SkTypeface*, const SkDescriptor*, void*),
- void* context, bool ignoreGamma) const {
+ void* context) const {
SkScalerContext::Rec rec;
SkPathEffect* pe = this->getPathEffect();
@@ -1824,7 +1828,8 @@ void SkPaint::descriptorProc(const SkSurfaceProps* surfaceProps,
SkRasterizer* ra = this->getRasterizer();
SkWriteBuffer peBuffer, mfBuffer, raBuffer;
- size_t descSize = fill_out_rec(*this, &rec, surfaceProps, deviceMatrix, ignoreGamma,
+ size_t descSize = fill_out_rec(*this, &rec,
+ surfaceProps, FakeGamma::On == fakeGamma, deviceMatrix,
pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer);
SkAutoDescriptor ad(descSize);
@@ -1842,10 +1847,10 @@ void SkPaint::descriptorProc(const SkSurfaceProps* surfaceProps,
}
SkGlyphCache* SkPaint::detachCache(const SkSurfaceProps* surfaceProps,
- const SkMatrix* deviceMatrix,
- bool ignoreGamma) const {
+ FakeGamma fakeGamma,
+ const SkMatrix* deviceMatrix) const {
SkGlyphCache* cache;
- this->descriptorProc(surfaceProps, deviceMatrix, DetachDescProc, &cache, ignoreGamma);
+ this->descriptorProc(surfaceProps, fakeGamma, deviceMatrix, DetachDescProc, &cache);
return cache;
}
@@ -2417,7 +2422,7 @@ SkTextBaseIter::SkTextBaseIter(const char text[], size_t length,
fPaint.setPathEffect(nullptr);
}
- fCache = fPaint.detachCache(nullptr, nullptr, false);
+ fCache = fPaint.detachCache(nullptr, SkPaint::FakeGamma::On, nullptr);
SkPaint::Style style = SkPaint::kFill_Style;
SkPathEffect* pe = nullptr;
« no previous file with comments | « src/core/SkGlyphCache.h ('k') | src/gpu/text/GrAtlasTextBlob.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698