| Index: src/core/SkDraw.cpp
|
| diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
|
| index d07bcb8fcf1e05364ea900a573081a32aabe1227..efacfda19c5e25435c7ca73f27589639a1867d29 100644
|
| --- a/src/core/SkDraw.cpp
|
| +++ b/src/core/SkDraw.cpp
|
| @@ -1556,6 +1556,10 @@ private:
|
|
|
| ////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
| +SkPaint::FakeGamma SkDraw::fakeGamma() const {
|
| + return fDevice->imageInfo().isLinear() ? SkPaint::FakeGamma::On : SkPaint::FakeGamma::Off;
|
| +}
|
| +
|
| void SkDraw::drawText(const char text[], size_t byteLength,
|
| SkScalar x, SkScalar y, const SkPaint& paint) const {
|
| SkASSERT(byteLength == 0 || text != nullptr);
|
| @@ -1574,17 +1578,16 @@ void SkDraw::drawText(const char text[], size_t byteLength,
|
| return;
|
| }
|
|
|
| - SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), fMatrix);
|
| - SkGlyphCache* cache = autoCache.getCache();
|
| + SkAutoGlyphCache cache(paint, &fDevice->surfaceProps(), this->fakeGamma(), fMatrix);
|
|
|
| // The Blitter Choose needs to be live while using the blitter below.
|
| SkAutoBlitterChoose blitterChooser(fDst, *fMatrix, paint);
|
| SkAAClipBlitterWrapper wrapper(*fRC, blitterChooser.get());
|
| - DrawOneGlyph drawOneGlyph(*this, paint, cache, wrapper.getBlitter());
|
| + DrawOneGlyph drawOneGlyph(*this, paint, cache.get(), wrapper.getBlitter());
|
|
|
| SkFindAndPlaceGlyph::ProcessText(
|
| paint.getTextEncoding(), text, byteLength,
|
| - {x, y}, *fMatrix, paint.getTextAlign(), cache, drawOneGlyph);
|
| + {x, y}, *fMatrix, paint.getTextAlign(), cache.get(), drawOneGlyph);
|
| }
|
|
|
| //////////////////////////////////////////////////////////////////////////////
|
| @@ -1604,8 +1607,7 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength,
|
| paint.setPathEffect(nullptr);
|
|
|
| SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
|
| - SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), nullptr);
|
| - SkGlyphCache* cache = autoCache.getCache();
|
| + SkAutoGlyphCache cache(paint, &fDevice->surfaceProps(), this->fakeGamma(), nullptr);
|
|
|
| const char* stop = text + byteLength;
|
| SkTextAlignProc alignProc(paint.getTextAlign());
|
| @@ -1616,7 +1618,7 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength,
|
| paint.setPathEffect(origPaint.getPathEffect());
|
|
|
| while (text < stop) {
|
| - const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0);
|
| + const SkGlyph& glyph = glyphCacheProc(cache.get(), &text, 0, 0);
|
| if (glyph.fWidth) {
|
| const SkPath* path = cache->findPath(glyph);
|
| if (path) {
|
| @@ -1656,18 +1658,17 @@ void SkDraw::drawPosText(const char text[], size_t byteLength,
|
| return;
|
| }
|
|
|
| - SkAutoGlyphCache autoCache(paint, &fDevice->surfaceProps(), fMatrix);
|
| - SkGlyphCache* cache = autoCache.getCache();
|
| + SkAutoGlyphCache cache(paint, &fDevice->surfaceProps(), this->fakeGamma(), fMatrix);
|
|
|
| // The Blitter Choose needs to be live while using the blitter below.
|
| SkAutoBlitterChoose blitterChooser(fDst, *fMatrix, paint);
|
| SkAAClipBlitterWrapper wrapper(*fRC, blitterChooser.get());
|
| - DrawOneGlyph drawOneGlyph(*this, paint, cache, wrapper.getBlitter());
|
| + DrawOneGlyph drawOneGlyph(*this, paint, cache.get(), wrapper.getBlitter());
|
| SkPaint::Align textAlignment = paint.getTextAlign();
|
|
|
| SkFindAndPlaceGlyph::ProcessPosText(
|
| paint.getTextEncoding(), text, byteLength,
|
| - offset, *fMatrix, pos, scalarsPerPosition, textAlignment, cache, drawOneGlyph);
|
| + offset, *fMatrix, pos, scalarsPerPosition, textAlignment, cache.get(), drawOneGlyph);
|
| }
|
|
|
| #if defined _WIN32 && _MSC_VER >= 1300
|
|
|