From 48b958b7094d4a156c9bb8822a816b91f53de628 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Mon, 3 Dec 2018 13:09:02 -0500 Subject: [PATCH] change Run to store bool_aa instead of flags_only_aa Bug: skia:2664 Change-Id: Idf89a511ba1427bf7a1000ba400aeafa215a7258 Reviewed-on: https://skia-review.googlesource.com/c/173993 Commit-Queue: Mike Reed Reviewed-by: Jim Van Verth --- src/core/SkGlyphRunPainter.cpp | 2 +- src/gpu/text/GrTextBlob.cpp | 2 +- src/gpu/text/GrTextBlob.h | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/core/SkGlyphRunPainter.cpp b/src/core/SkGlyphRunPainter.cpp index b6c74fed9a..db8c31ad53 100644 --- a/src/core/SkGlyphRunPainter.cpp +++ b/src/core/SkGlyphRunPainter.cpp @@ -708,7 +708,7 @@ void GrTextBlob::generateFromGlyphRunList(GrGlyphCache* glyphCache, const SkPaint& runPaint = glyphRun.paint(); Run* run = this->pushBackRun(); - run->setRunPaintFlags(runPaint.getFlags()); + run->setRunFontAntiAlias(runPaint.isAntiAlias()); if (GrTextContext::CanDrawAsDistanceFields(runPaint, viewMatrix, props, shaderCaps.supportsDistanceFieldText(), options)) { diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp index 184ee7adab..48aed7a17c 100644 --- a/src/gpu/text/GrTextBlob.cpp +++ b/src/gpu/text/GrTextBlob.cpp @@ -237,7 +237,7 @@ void GrTextBlob::flush(GrTextTarget* target, const SkSurfaceProps& props, // first flush any path glyphs if (run.fPathGlyphs.count()) { SkPaint runPaint{paint}; - runPaint.setFlags((runPaint.getFlags() & ~Run::kPaintFlagsMask) | run.fPaintFlags); + runPaint.setAntiAlias(run.fAntiAlias); for (int i = 0; i < run.fPathGlyphs.count(); i++) { GrTextBlob::Run::PathGlyph& pathGlyph = run.fPathGlyphs[i]; diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h index 739a079195..9251fc87b2 100644 --- a/src/gpu/text/GrTextBlob.h +++ b/src/gpu/text/GrTextBlob.h @@ -396,9 +396,6 @@ private: * would greatly increase the memory of these cached items. */ struct Run { - // the only flags we need to set - static constexpr auto kPaintFlagsMask = SkPaint::kAntiAlias_Flag; - explicit Run(GrTextBlob* blob) : fBlob{blob} { // To ensure we always have one subrun, we push back a fresh run here @@ -440,8 +437,8 @@ private: SkScalerContextFlags scalerContextFlags, const SkMatrix& viewMatrix); - void setRunPaintFlags(uint16_t paintFlags) { - fPaintFlags = paintFlags & Run::kPaintFlagsMask; + void setRunFontAntiAlias(bool aa) { + fAntiAlias = aa; } // sets the last subrun of runIndex to use distance field text @@ -495,7 +492,7 @@ private: SkTArray fPathGlyphs; - uint16_t fPaintFlags{0}; // needed mainly for rendering paths + bool fAntiAlias{false}; // needed mainly for rendering paths bool fInitialized{false}; GrTextBlob* const fBlob;