aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/mixedtextblobs.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-04-14 12:17:27 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-14 12:17:27 -0700
commit9e36c1a9306f052331550dab4728b9875127bfb5 (patch)
treedc081124538053c3d28376cb767527326da74d25 /gm/mixedtextblobs.cpp
parent8fe8fffdfa7464c6f7da773b8660a2043f4998e0 (diff)
Start canonicalizing color for all A8 textblobs
Diffstat (limited to 'gm/mixedtextblobs.cpp')
-rw-r--r--gm/mixedtextblobs.cpp26
1 files changed, 6 insertions, 20 deletions
diff --git a/gm/mixedtextblobs.cpp b/gm/mixedtextblobs.cpp
index 7aaaa52cf0..20b91accfd 100644
--- a/gm/mixedtextblobs.cpp
+++ b/gm/mixedtextblobs.cpp
@@ -16,21 +16,6 @@
namespace skiagm {
-static void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const SkPaint& origPaint,
- SkScalar x, SkScalar y) {
- SkPaint paint(origPaint);
- SkTDArray<uint16_t> glyphs;
-
- size_t len = strlen(text);
- glyphs.append(paint.textToGlyphs(text, len, NULL));
- paint.textToGlyphs(text, len, glyphs.begin());
-
- paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
- const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.count(), x, y,
- NULL);
- memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t));
-}
-
static void draw_blob(SkCanvas* canvas, const SkTextBlob* blob, const SkPaint& skPaint,
const SkRect& clipRect) {
SkPaint clipHairline;
@@ -91,7 +76,7 @@ protected:
paint.measureText(text, strlen(text), &bounds);
SkScalar yOffset = bounds.height();
- add_to_text_blob(&builder, text, paint, 10, yOffset);
+ sk_tool_utils::add_to_text_blob(&builder, text, paint, 10, yOffset);
SkScalar corruptedAx = bounds.width();
SkScalar corruptedAy = yOffset;
@@ -107,8 +92,8 @@ protected:
paint.setSubpixelText(true);
paint.setLCDRenderText(true);
paint.measureText(text, strlen(text), &bounds);
- add_to_text_blob(&builder, text, paint, xOffset - bounds.width() * 0.25f,
- yOffset - bounds.height() * 0.5f);
+ sk_tool_utils::add_to_text_blob(&builder, text, paint, xOffset - bounds.width() * 0.25f,
+ yOffset - bounds.height() * 0.5f);
yOffset += bounds.height();
// color emoji
@@ -117,13 +102,14 @@ protected:
paint.setTypeface(fEmojiTypeface);
text = fEmojiText;
paint.measureText(text, strlen(text), &bounds);
- add_to_text_blob(&builder, text, paint, xOffset - bounds.width() * 0.3f, yOffset);
+ sk_tool_utils::add_to_text_blob(&builder, text, paint, xOffset - bounds.width() * 0.3f,
+ yOffset);
// Corrupted font
paint.setTextSize(12);
text = "aA";
paint.setTypeface(fReallyBigATypeface);
- add_to_text_blob(&builder, text, paint, corruptedAx, corruptedAy);
+ sk_tool_utils::add_to_text_blob(&builder, text, paint, corruptedAx, corruptedAy);
fBlob.reset(builder.build());
}