Funtion to say if an SkFont has anti aliasing.
This will be used in a couple of places in the glyph painter, best they all agree. Change-Id: I67079b000bdede437de8fdc0a09538593775ab41 Reviewed-on: https://skia-review.googlesource.com/c/177000 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Ravi Mistry <rmistry@google.com>
This commit is contained in:
parent
bff4e07398
commit
e9da1d6b19
@ -491,6 +491,7 @@ private:
|
||||
uint8_t fHinting;
|
||||
|
||||
SkScalar setupForAsPaths(SkPaint*);
|
||||
bool hasSomeAntiAliasing() const;
|
||||
|
||||
void glyphsToUnichars(const SkGlyphID glyphs[], int count, SkUnichar text[]) const;
|
||||
|
||||
|
@ -120,6 +120,12 @@ SkScalar SkFont::setupForAsPaths(SkPaint* paint) {
|
||||
return textSize / SkPaint::kCanonicalTextSizeForPaths;
|
||||
}
|
||||
|
||||
bool SkFont::hasSomeAntiAliasing() const {
|
||||
Edging edging = this->getEdging();
|
||||
return edging == SkFont::Edging::kAntiAlias
|
||||
|| edging == SkFont::Edging::kSubpixelAntiAlias;
|
||||
}
|
||||
|
||||
class SkCanonicalizeFont {
|
||||
public:
|
||||
SkCanonicalizeFont(const SkFont& font) : fFont(&font), fScale(0) {
|
||||
|
@ -203,9 +203,7 @@ void SkGlyphRunListPainter::drawForBitmapDevice(
|
||||
// The paint we draw paths with must have the same anti-aliasing state as the runFont
|
||||
// allowing the paths to have the same edging as the glyph masks.
|
||||
pathPaint = runPaint;
|
||||
bool isAntiAlias = runFont.getEdging() == SkFont::Edging::kAntiAlias
|
||||
|| runFont.getEdging() == SkFont::Edging::kSubpixelAntiAlias;
|
||||
pathPaint.setAntiAlias(isAntiAlias);
|
||||
pathPaint.setAntiAlias(runFont.hasSomeAntiAliasing());
|
||||
|
||||
bitmapDevice->paintPaths(
|
||||
SkSpan<const PathAndPos>{pathsAndPositions.begin(), pathsAndPositions.size()},
|
||||
|
Loading…
Reference in New Issue
Block a user