diff options
author | Ben Wagner <bungeman@google.com> | 2016-11-11 14:31:06 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-11 21:59:54 +0000 |
commit | 6e9ac12495f3b64b6ea8860bb9f99c43cd33aa08 (patch) | |
tree | 757e4c3fe61339400866c54d51d56eb38452ccfa /src/ports/SkFontHost_win.cpp | |
parent | bf7b620b1e44985b164a8bd68031a7613fe0bb9b (diff) |
Clean up glyph id handling.
Extract SkPackedID and its strongly typed subclasses SkPackedGlyphID and
SkPackedUnicharID out of SkGlyph. This simplifies the code handling
these types, as well as making it clearer that we wouuld eventually like
to get away from this scheme.
Changes SkScalerContext::getPath to take SkPackedGlyphID.
Changes SkScalerContext::generatePath to take SkGlyphID.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4722
Change-Id: I365c0c618b7ae0d348272155fac7761a69faa920
Reviewed-on: https://skia-review.googlesource.com/4722
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'src/ports/SkFontHost_win.cpp')
-rw-r--r-- | src/ports/SkFontHost_win.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 77465ceff4..9229be6d30 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -546,11 +546,11 @@ protected: void generateAdvance(SkGlyph* glyph) override; void generateMetrics(SkGlyph* glyph) override; void generateImage(const SkGlyph& glyph) override; - void generatePath(const SkGlyph& glyph, SkPath* path) override; + void generatePath(SkGlyphID glyph, SkPath* path) override; void generateFontMetrics(SkPaint::FontMetrics*) override; private: - DWORD getGDIGlyphPath(const SkGlyph& glyph, UINT flags, + DWORD getGDIGlyphPath(SkGlyphID glyph, UINT flags, SkAutoSTMalloc<BUFFERSIZE, uint8_t>* glyphbuf); HDCOffscreen fOffscreen; @@ -1589,22 +1589,22 @@ static bool sk_path_from_gdi_paths(SkPath* path, const uint8_t* glyphbuf, DWORD return true; } -DWORD SkScalerContext_GDI::getGDIGlyphPath(const SkGlyph& glyph, UINT flags, - SkAutoSTMalloc<BUFFERSIZE, uint8_t>* glyphbuf) +DWORD SkScalerContext_GDI::getGDIGlyphPath(SkGlyphID glyph, UINT flags, + SkAutoSTMalloc<BUFFERSIZE, uint8_t>* glyphbuf) { GLYPHMETRICS gm; - DWORD total_size = GetGlyphOutlineW(fDDC, glyph.getGlyphID(), flags, &gm, BUFFERSIZE, glyphbuf->get(), &fMat22); + DWORD total_size = GetGlyphOutlineW(fDDC, glyph, flags, &gm, BUFFERSIZE, glyphbuf->get(), &fMat22); // Sometimes GetGlyphOutlineW returns a number larger than BUFFERSIZE even if BUFFERSIZE > 0. // It has been verified that this does not involve a buffer overrun. if (GDI_ERROR == total_size || total_size > BUFFERSIZE) { // GDI_ERROR because the BUFFERSIZE was too small, or because the data was not accessible. // When the data is not accessable GetGlyphOutlineW fails rather quickly, // so just try to get the size. If that fails then ensure the data is accessible. - total_size = GetGlyphOutlineW(fDDC, glyph.getGlyphID(), flags, &gm, 0, nullptr, &fMat22); + total_size = GetGlyphOutlineW(fDDC, glyph, flags, &gm, 0, nullptr, &fMat22); if (GDI_ERROR == total_size) { LogFontTypeface::EnsureAccessible(this->getTypeface()); - total_size = GetGlyphOutlineW(fDDC, glyph.getGlyphID(), flags, &gm, 0, nullptr, &fMat22); + total_size = GetGlyphOutlineW(fDDC, glyph, flags, &gm, 0, nullptr, &fMat22); if (GDI_ERROR == total_size) { // GetGlyphOutlineW is known to fail for some characters, such as spaces. // In these cases, just return that the glyph does not have a shape. @@ -1614,10 +1614,10 @@ DWORD SkScalerContext_GDI::getGDIGlyphPath(const SkGlyph& glyph, UINT flags, glyphbuf->reset(total_size); - DWORD ret = GetGlyphOutlineW(fDDC, glyph.getGlyphID(), flags, &gm, total_size, glyphbuf->get(), &fMat22); + DWORD ret = GetGlyphOutlineW(fDDC, glyph, flags, &gm, total_size, glyphbuf->get(), &fMat22); if (GDI_ERROR == ret) { LogFontTypeface::EnsureAccessible(this->getTypeface()); - ret = GetGlyphOutlineW(fDDC, glyph.getGlyphID(), flags, &gm, total_size, glyphbuf->get(), &fMat22); + ret = GetGlyphOutlineW(fDDC, glyph, flags, &gm, total_size, glyphbuf->get(), &fMat22); if (GDI_ERROR == ret) { SkASSERT(false); return 0; @@ -1627,7 +1627,7 @@ DWORD SkScalerContext_GDI::getGDIGlyphPath(const SkGlyph& glyph, UINT flags, return total_size; } -void SkScalerContext_GDI::generatePath(const SkGlyph& glyph, SkPath* path) { +void SkScalerContext_GDI::generatePath(SkGlyphID glyph, SkPath* path) { SkASSERT(path); SkASSERT(fDDC); |