diff options
author | Brian Salomon <bsalomon@google.com> | 2017-11-20 13:13:01 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-20 18:33:38 +0000 |
commit | 0c1c2b39dd93100542236b23546ed0b855816a49 (patch) | |
tree | 2f84e885f100bab54a5dc60c5565a639fa12b8d5 /src/atlastext/SkAtlasTextTarget.cpp | |
parent | 999ec57291dc7cf1d8e3a745627670e6cadc1c12 (diff) |
Make SkAtlasTextTarget use glyph IDs
Bug: skia:
Change-Id: Idefd69f02f62fea22c41a3476676773221c3ae81
Reviewed-on: https://skia-review.googlesource.com/73700
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/atlastext/SkAtlasTextTarget.cpp')
-rw-r--r-- | src/atlastext/SkAtlasTextTarget.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp index 57ece37b4f..fa756fe327 100644 --- a/src/atlastext/SkAtlasTextTarget.cpp +++ b/src/atlastext/SkAtlasTextTarget.cpp @@ -50,7 +50,7 @@ public: /** SkAtlasTextTarget overrides */ - void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, uint32_t color, + void drawText(const SkGlyphID*, int glyphCnt, SkScalar x, SkScalar y, uint32_t color, const SkAtlasTextFont&) override; void flush() override; @@ -78,16 +78,14 @@ std::unique_ptr<SkAtlasTextTarget> SkAtlasTextTarget::Make(sk_sp<SkAtlasTextCont #include "GrContextPriv.h" #include "GrDrawingManager.h" -void SkInternalAtlasTextTarget::drawText(const void* text, size_t byteLength, SkScalar x, +void SkInternalAtlasTextTarget::drawText(const SkGlyphID* glyphs, int glyphCnt, SkScalar x, SkScalar y, uint32_t color, const SkAtlasTextFont& font) { SkPaint paint; paint.setAntiAlias(true); paint.setTypeface(font.refTypeface()); paint.setTextSize(font.size()); paint.setStyle(SkPaint::kFill_Style); - - // TODO: Figure out what if anything to do with these: - // Paint setTextEncoding? Font isEnableByteCodeHints()? Font isUseNonLinearMetrics()? + paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); // The atlas text context does munging of the paint color. We store the client's color here // and the context will write it into the final vertices given to the client's renderer. @@ -98,8 +96,9 @@ void SkInternalAtlasTextTarget::drawText(const void* text, size_t byteLength, Sk auto* grContext = this->context()->internal().grContext(); auto bounds = SkIRect::MakeWH(fWidth, fHeight); auto atlasTextContext = grContext->contextPriv().drawingManager()->getAtlasTextContext(); + size_t byteLength = sizeof(SkGlyphID) * glyphCnt; atlasTextContext->drawText(grContext, this, GrNoClip(), paint, SkMatrix::I(), props, - (const char*)text, byteLength, x, y, bounds); + (const char*)glyphs, byteLength, x, y, bounds); } void SkInternalAtlasTextTarget::addDrawOp(const GrClip& clip, std::unique_ptr<GrAtlasTextOp> op) { |