aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/atlastext
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-07-27 16:23:27 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-30 14:06:55 +0000
commit13449ce2439044c06847c5f9487352d98931d11d (patch)
treef60163a7ba6794677aa9bd995a9b2b0cf615960d /src/atlastext
parent160e4dcc4ec8c17578b3800c8683981834b903cb (diff)
Make SkInternalAtlasTextTarget use glyph runs
Change-Id: I14f296c9d394288d2c28ab7f09b17c1a4d1ef49d Reviewed-on: https://skia-review.googlesource.com/144125 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Auto-Submit: Herb Derby <herb@google.com>
Diffstat (limited to 'src/atlastext')
-rw-r--r--src/atlastext/SkAtlasTextTarget.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp
index c70e47995a..4d7d65d746 100644
--- a/src/atlastext/SkAtlasTextTarget.cpp
+++ b/src/atlastext/SkAtlasTextTarget.cpp
@@ -14,6 +14,7 @@
#include "SkAtlasTextContext.h"
#include "SkAtlasTextFont.h"
#include "SkAtlasTextRenderer.h"
+#include "SkGlyphRun.h"
#include "SkGr.h"
#include "SkInternalAtlasTextContext.h"
#include "ops/GrAtlasTextOp.h"
@@ -152,10 +153,13 @@ void SkInternalAtlasTextTarget::drawText(const SkGlyphID glyphs[], const SkPoint
auto* grContext = this->context()->internal().grContext();
auto bounds = SkIRect::MakeWH(fWidth, fHeight);
auto atlasTextContext = grContext->contextPriv().drawingManager()->getTextContext();
- size_t byteLength = sizeof(SkGlyphID) * glyphCnt;
- const SkScalar* pos = &positions->fX;
- atlasTextContext->drawPosText(grContext, this, GrNoClip(), paint, this->ctm(), props,
- (const char*)glyphs, byteLength, pos, 2, {0, 0}, bounds);
+ SkGlyphRunBuilder builder;
+ builder.drawGlyphPos(paint, SkSpan<const SkGlyphID>{glyphs, SkTo<size_t>(glyphCnt)}, positions);
+ auto glyphRunList = builder.useGlyphRunList();
+ if (!glyphRunList.empty()) {
+ atlasTextContext->drawGlyphRunList(grContext, this, GrNoClip(), this->ctm(), props,
+ glyphRunList, bounds);
+ }
}
void SkInternalAtlasTextTarget::addDrawOp(const GrClip& clip, std::unique_ptr<GrAtlasTextOp> op) {