aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/SkDumpCanvas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/SkDumpCanvas.cpp')
-rw-r--r--src/utils/SkDumpCanvas.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index 737307c..4ff7a50 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -121,8 +121,7 @@ static void toString(const SkBitmap& bm, SkString* str) {
}
static void toString(const void* text, size_t len, SkPaint::TextEncoding enc,
- SkString* str, const SkPaint& paint,
- const SkScalar xpos[] = NULL) {
+ SkString* str) {
switch (enc) {
case SkPaint::kUTF8_TextEncoding:
str->printf("\"%.*s\"%s", SkMax32(len, 32), text,
@@ -132,21 +131,9 @@ static void toString(const void* text, size_t len, SkPaint::TextEncoding enc,
str->printf("\"%.*S\"%s", SkMax32(len, 32), text,
len > 64 ? "..." : "");
break;
- case SkPaint::kGlyphID_TextEncoding: {
- const uint16_t* glyphs = (const uint16_t*)text;
- const int max = 32;
- SkUnichar uni[max];
- int count = SkMin32(len >> 1, max);
- paint.glyphsToUnichars(glyphs, count, uni);
- str->append("\"");
- for (int i = 0; i < count; i++) {
- str->appendUnichar(uni[i]);
- }
- if ((size_t)count < (len >> 1)) {
- str->append("...");
- }
- str->append("\"");
- } break;
+ case SkPaint::kGlyphID_TextEncoding:
+ str->set("<glyphs>");
+ break;
}
}
@@ -331,7 +318,7 @@ void SkDumpCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
void SkDumpCanvas::drawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint) {
SkString str;
- toString(text, byteLength, paint.getTextEncoding(), &str, paint);
+ toString(text, byteLength, paint.getTextEncoding(), &str);
this->dump(kDrawText_Verb, &paint, "drawText(%s [%d] %g %g)", str.c_str(),
byteLength, SkScalarToFloat(x), SkScalarToFloat(y));
}
@@ -339,7 +326,7 @@ void SkDumpCanvas::drawText(const void* text, size_t byteLength, SkScalar x,
void SkDumpCanvas::drawPosText(const void* text, size_t byteLength,
const SkPoint pos[], const SkPaint& paint) {
SkString str;
- toString(text, byteLength, paint.getTextEncoding(), &str, paint);
+ toString(text, byteLength, paint.getTextEncoding(), &str);
this->dump(kDrawText_Verb, &paint, "drawPosText(%s [%d] %g %g ...)",
str.c_str(), byteLength, SkScalarToFloat(pos[0].fX),
SkScalarToFloat(pos[0].fY));
@@ -349,7 +336,7 @@ void SkDumpCanvas::drawPosTextH(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY,
const SkPaint& paint) {
SkString str;
- toString(text, byteLength, paint.getTextEncoding(), &str, paint, xpos);
+ toString(text, byteLength, paint.getTextEncoding(), &str);
this->dump(kDrawText_Verb, &paint, "drawPosTextH(%s [%d] %g %g ...)",
str.c_str(), byteLength, SkScalarToFloat(xpos[0]),
SkScalarToFloat(constY));
@@ -359,7 +346,7 @@ void SkDumpCanvas::drawTextOnPath(const void* text, size_t byteLength,
const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint) {
SkString str;
- toString(text, byteLength, paint.getTextEncoding(), &str, paint);
+ toString(text, byteLength, paint.getTextEncoding(), &str);
this->dump(kDrawText_Verb, &paint, "drawTextOnPath(%s [%d])",
str.c_str(), byteLength);
}