Clean up some types in SkFont
Bug: skia: Change-Id: Ie0a3cc61f16e07619e69ff2d5dac566457572e80 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201681 Auto-Submit: Kevin Lubick <kjlubick@google.com> Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
3d42a0521d
commit
a4a76f3f4f
@ -361,12 +361,12 @@ public:
|
||||
@param widths returns text advances for each glyph; may be nullptr
|
||||
@param bounds returns bounds for each glyph relative to (0, 0); may be nullptr
|
||||
*/
|
||||
void getWidths(const uint16_t glyphs[], int count, SkScalar widths[], SkRect bounds[]) const {
|
||||
void getWidths(const SkGlyphID glyphs[], int count, SkScalar widths[], SkRect bounds[]) const {
|
||||
this->getWidthsBounds(glyphs, count, widths, bounds, nullptr);
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
void getWidths(const uint16_t glyphs[], int count, SkScalar widths[], std::nullptr_t) const {
|
||||
void getWidths(const SkGlyphID glyphs[], int count, SkScalar widths[], std::nullptr_t) const {
|
||||
this->getWidths(glyphs, count, widths);
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ public:
|
||||
@param count number of glyphs
|
||||
@param widths returns text advances for each glyph
|
||||
*/
|
||||
void getWidths(const uint16_t glyphs[], int count, SkScalar widths[]) const {
|
||||
void getWidths(const SkGlyphID glyphs[], int count, SkScalar widths[]) const {
|
||||
this->getWidthsBounds(glyphs, count, widths, nullptr, nullptr);
|
||||
}
|
||||
|
||||
@ -394,7 +394,7 @@ public:
|
||||
@param bounds returns bounds for each glyph relative to (0, 0); may be nullptr
|
||||
@param paint optional, specifies stroking, SkPathEffect and SkMaskFilter
|
||||
*/
|
||||
void getWidthsBounds(const uint16_t glyphs[], int count, SkScalar widths[], SkRect bounds[],
|
||||
void getWidthsBounds(const SkGlyphID glyphs[], int count, SkScalar widths[], SkRect bounds[],
|
||||
const SkPaint* paint) const;
|
||||
|
||||
|
||||
@ -407,7 +407,7 @@ public:
|
||||
@param bounds returns bounds for each glyph relative to (0, 0); may be nullptr
|
||||
@param paint optional, specifies stroking, SkPathEffect, and SkMaskFilter
|
||||
*/
|
||||
void getBounds(const uint16_t glyphs[], int count, SkRect bounds[],
|
||||
void getBounds(const SkGlyphID glyphs[], int count, SkRect bounds[],
|
||||
const SkPaint* paint) const {
|
||||
this->getWidthsBounds(glyphs, count, nullptr, bounds, paint);
|
||||
}
|
||||
@ -420,7 +420,7 @@ public:
|
||||
@param pos returns glyphs positions
|
||||
@param origin location of the first glyph. Defaults to {0, 0}.
|
||||
*/
|
||||
void getPos(const uint16_t glyphs[], int count, SkPoint pos[], SkPoint origin = {0, 0}) const;
|
||||
void getPos(const SkGlyphID glyphs[], int count, SkPoint pos[], SkPoint origin = {0, 0}) const;
|
||||
|
||||
/** Retrieves the x-positions for each glyph, beginning at the specified origin. The caller
|
||||
must allocated at least count number of elements in the xpos[] array.
|
||||
@ -430,7 +430,7 @@ public:
|
||||
@param xpos returns glyphs x-positions
|
||||
@param origin x-position of the first glyph. Defaults to 0.
|
||||
*/
|
||||
void getXPos(const uint16_t glyphs[], int count, SkScalar xpos[], SkScalar origin = 0) const;
|
||||
void getXPos(const SkGlyphID glyphs[], int count, SkScalar xpos[], SkScalar origin = 0) const;
|
||||
|
||||
/** Returns path corresponding to glyph outline.
|
||||
If glyph has an outline, copies outline to path and returns true.
|
||||
@ -441,7 +441,7 @@ public:
|
||||
@param path pointer to existing SkPath
|
||||
@return true if glyphID is described by path
|
||||
*/
|
||||
bool getPath(uint16_t glyphID, SkPath* path) const;
|
||||
bool getPath(SkGlyphID glyphID, SkPath* path) const;
|
||||
|
||||
/** Returns path corresponding to glyph array.
|
||||
|
||||
@ -450,7 +450,7 @@ public:
|
||||
@param glyphPathProc function returning one glyph description as path
|
||||
@param ctx function context
|
||||
*/
|
||||
void getPaths(const uint16_t glyphIDs[], int count,
|
||||
void getPaths(const SkGlyphID glyphIDs[], int count,
|
||||
void (*glyphPathProc)(const SkPath* pathOrNull, const SkMatrix& mx, void* ctx),
|
||||
void* ctx) const;
|
||||
|
||||
|
@ -171,7 +171,7 @@ SkGlyphID SkFont::unicharToGlyph(SkUnichar uni) const {
|
||||
}
|
||||
|
||||
int SkFont::textToGlyphs(const void* text, size_t byteLength, SkTextEncoding encoding,
|
||||
uint16_t glyphs[], int maxGlyphCount) const {
|
||||
SkGlyphID glyphs[], int maxGlyphCount) const {
|
||||
if (0 == byteLength) {
|
||||
return 0;
|
||||
}
|
||||
@ -250,7 +250,7 @@ SkScalar SkFont::measureText(const void* text, size_t length, SkTextEncoding enc
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
const uint16_t* glyphs = atg.glyphs();
|
||||
const SkGlyphID* glyphs = atg.glyphs();
|
||||
|
||||
auto cache = SkStrikeCache::FindOrCreateStrikeWithNoDeviceExclusive(font, canon.getPaint());
|
||||
|
||||
@ -293,7 +293,7 @@ static SkRect make_bounds(const SkGlyph& g, SkScalar scale) {
|
||||
}
|
||||
|
||||
template <typename HANDLER>
|
||||
void VisitGlyphs(const SkFont& origFont, const SkPaint* paint, const uint16_t glyphs[], int count,
|
||||
void VisitGlyphs(const SkFont& origFont, const SkPaint* paint, const SkGlyphID glyphs[], int count,
|
||||
HANDLER handler) {
|
||||
if (count <= 0) {
|
||||
return;
|
||||
@ -310,10 +310,10 @@ void VisitGlyphs(const SkFont& origFont, const SkPaint* paint, const uint16_t gl
|
||||
handler(cache.get(), glyphs, count, scale);
|
||||
}
|
||||
|
||||
void SkFont::getWidthsBounds(const uint16_t glyphs[], int count, SkScalar widths[], SkRect bounds[],
|
||||
void SkFont::getWidthsBounds(const SkGlyphID glyphs[], int count, SkScalar widths[], SkRect bounds[],
|
||||
const SkPaint* paint) const {
|
||||
VisitGlyphs(*this, paint, glyphs, count, [widths, bounds]
|
||||
(SkStrike* cache, const uint16_t glyphs[], int count, SkScalar scale) {
|
||||
(SkStrike* cache, const SkGlyphID glyphs[], int count, SkScalar scale) {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
const SkGlyph* g;
|
||||
if (bounds) {
|
||||
@ -329,9 +329,9 @@ void SkFont::getWidthsBounds(const uint16_t glyphs[], int count, SkScalar widths
|
||||
});
|
||||
}
|
||||
|
||||
void SkFont::getPos(const uint16_t glyphs[], int count, SkPoint pos[], SkPoint origin) const {
|
||||
void SkFont::getPos(const SkGlyphID glyphs[], int count, SkPoint pos[], SkPoint origin) const {
|
||||
VisitGlyphs(*this, nullptr, glyphs, count, [pos, origin]
|
||||
(SkStrike* cache, const uint16_t glyphs[], int count, SkScalar scale) {
|
||||
(SkStrike* cache, const SkGlyphID glyphs[], int count, SkScalar scale) {
|
||||
SkPoint loc = origin;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
pos[i] = loc;
|
||||
@ -340,9 +340,9 @@ void SkFont::getPos(const uint16_t glyphs[], int count, SkPoint pos[], SkPoint o
|
||||
});
|
||||
}
|
||||
|
||||
void SkFont::getXPos(const uint16_t glyphs[], int count, SkScalar xpos[], SkScalar origin) const {
|
||||
void SkFont::getXPos(const SkGlyphID glyphs[], int count, SkScalar xpos[], SkScalar origin) const {
|
||||
VisitGlyphs(*this, nullptr, glyphs, count, [xpos, origin]
|
||||
(SkStrike* cache, const uint16_t glyphs[], int count, SkScalar scale) {
|
||||
(SkStrike* cache, const SkGlyphID glyphs[], int count, SkScalar scale) {
|
||||
SkScalar x = origin;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
xpos[i] = x;
|
||||
@ -351,7 +351,7 @@ void SkFont::getXPos(const uint16_t glyphs[], int count, SkScalar xpos[], SkScal
|
||||
});
|
||||
}
|
||||
|
||||
void SkFont::getPaths(const uint16_t glyphs[], int count,
|
||||
void SkFont::getPaths(const SkGlyphID glyphs[], int count,
|
||||
void (*proc)(const SkPath*, const SkMatrix&, void*), void* ctx) const {
|
||||
SkFont font(*this);
|
||||
SkScalar scale = font.setupForAsPaths(nullptr);
|
||||
@ -368,7 +368,7 @@ void SkFont::getPaths(const uint16_t glyphs[], int count,
|
||||
}
|
||||
}
|
||||
|
||||
bool SkFont::getPath(uint16_t glyphID, SkPath* path) const {
|
||||
bool SkFont::getPath(SkGlyphID glyphID, SkPath* path) const {
|
||||
struct Pair {
|
||||
SkPath* fPath;
|
||||
bool fWasSet;
|
||||
@ -458,7 +458,7 @@ int SkFontPriv::CountTextElements(const void* text, size_t byteLength, SkTextEnc
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SkFontPriv::GlyphsToUnichars(const SkFont& font, const uint16_t glyphs[], int count,
|
||||
void SkFontPriv::GlyphsToUnichars(const SkFont& font, const SkGlyphID glyphs[], int count,
|
||||
SkUnichar uni[]) {
|
||||
font.glyphsToUnichars(glyphs, count, uni);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user