Remove a ctor from SkAutoGlyphCache; removal continues.

This change SkAutoGlyphCache with one remaining ctor, then
it's time to remove SkAutoGlyphCacheNoGamma, which is used
but Android.

Change-Id: I0f75ccb4139700d0b678492173f50ac0580d20cd
Reviewed-on: https://skia-review.googlesource.com/115007
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
Herb Derby 2018-03-19 10:38:42 -04:00 committed by Skia Commit-Bot
parent 2b41784855
commit c683dd12fe
2 changed files with 10 additions and 12 deletions

View File

@ -295,24 +295,20 @@ public:
: INHERITED(SkGlyphCache::FindOrCreateStrikeExclusive( : INHERITED(SkGlyphCache::FindOrCreateStrikeExclusive(
paint, surfaceProps, SkScalerContextFlags::kFakeGammaAndBoostContrast, matrix)) {} paint, surfaceProps, SkScalerContextFlags::kFakeGammaAndBoostContrast, matrix)) {}
SkAutoGlyphCache(const SkPaint& paint,
const SkSurfaceProps* surfaceProps,
SkScalerContextFlags scalerContextFlags,
const SkMatrix* matrix)
: INHERITED(SkGlyphCache::FindOrCreateStrikeExclusive(
paint, surfaceProps, scalerContextFlags, matrix)) {}
private: private:
using INHERITED = SkExclusiveStrikePtr; using INHERITED = SkExclusiveStrikePtr;
}; };
class SkAutoGlyphCacheNoGamma : public SkAutoGlyphCache { class SkAutoGlyphCacheNoGamma : public SkExclusiveStrikePtr {
public: public:
SkAutoGlyphCacheNoGamma(const SkPaint& paint, SkAutoGlyphCacheNoGamma(const SkPaint& paint,
const SkSurfaceProps* surfaceProps, const SkSurfaceProps* surfaceProps,
const SkMatrix* matrix) const SkMatrix* matrix)
: SkAutoGlyphCache(paint, surfaceProps, SkScalerContextFlags::kNone, matrix) : INHERITED(SkGlyphCache::FindOrCreateStrikeExclusive(
{} paint, surfaceProps, SkScalerContextFlags::kNone, matrix)) {}
private:
using INHERITED = SkExclusiveStrikePtr;
}; };
#define SkAutoGlyphCache(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCache) #define SkAutoGlyphCache(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCache)
#define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamma) #define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamma)

View File

@ -63,7 +63,8 @@ void SkOverdrawCanvas::onDrawText(const void* text, size_t byteLength, SkScalar
ProcessOneGlyphBounds processBounds(this); ProcessOneGlyphBounds processBounds(this);
SkSurfaceProps props(0, kUnknown_SkPixelGeometry); SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
this->getProps(&props); this->getProps(&props);
SkAutoGlyphCache cache(paint, &props, SkScalerContextFlags::kNone, &this->getTotalMatrix()); auto cache = SkGlyphCache::FindOrCreateStrikeExclusive(
paint, &props, SkScalerContextFlags::kNone, &this->getTotalMatrix());
SkFindAndPlaceGlyph::ProcessText(paint.getTextEncoding(), (const char*) text, byteLength, SkFindAndPlaceGlyph::ProcessText(paint.getTextEncoding(), (const char*) text, byteLength,
SkPoint::Make(x, y), SkMatrix(), paint.getTextAlign(), SkPoint::Make(x, y), SkMatrix(), paint.getTextAlign(),
cache.get(), processBounds); cache.get(), processBounds);
@ -75,7 +76,8 @@ void SkOverdrawCanvas::drawPosTextCommon(const void* text, size_t byteLength, co
ProcessOneGlyphBounds processBounds(this); ProcessOneGlyphBounds processBounds(this);
SkSurfaceProps props(0, kUnknown_SkPixelGeometry); SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
this->getProps(&props); this->getProps(&props);
SkAutoGlyphCache cache(paint, &props, SkScalerContextFlags::kNone, &this->getTotalMatrix()); auto cache = SkGlyphCache::FindOrCreateStrikeExclusive(
paint, &props, SkScalerContextFlags::kNone, &this->getTotalMatrix());
SkFindAndPlaceGlyph::ProcessPosText(paint.getTextEncoding(), (const char*) text, byteLength, SkFindAndPlaceGlyph::ProcessPosText(paint.getTextEncoding(), (const char*) text, byteLength,
SkPoint::Make(0, 0), SkMatrix(), (const SkScalar*) pos, 2, SkPoint::Make(0, 0), SkMatrix(), (const SkScalar*) pos, 2,
paint.getTextAlign(), cache.get(), processBounds); paint.getTextAlign(), cache.get(), processBounds);