Merge "Update TextLayout logging"

This commit is contained in:
Fabrice Di Meglio
2011-08-19 14:39:15 -07:00
committed by Android (Google) Code Review
4 changed files with 12 additions and 23 deletions

View File

@@ -770,11 +770,7 @@ public:
value->computeValues(paint, textArray, start, count, end, flags); value->computeValues(paint, textArray, start, count, end, flags);
#endif #endif
#if DEBUG_GLYPHS doDrawGlyphs(canvas, value->getGlyphs(), 0, value->getGlyphsCount(),
logGlyphs(value);
#endif
doDrawGlyphs(canvas, value->getGlyphs(), 0, value->getGlyphsCount(),
x, y, flags, paint); x, y, flags, paint);
} }
@@ -794,10 +790,6 @@ public:
value->computeValues(paint, textArray, start, count, contextCount, flags); value->computeValues(paint, textArray, start, count, contextCount, flags);
#endif #endif
#if DEBUG_GLYPHS
logGlyphs(value);
#endif
doDrawGlyphs(canvas, value->getGlyphs(), 0, value->getGlyphsCount(), doDrawGlyphs(canvas, value->getGlyphs(), 0, value->getGlyphsCount(),
x, y, flags, paint); x, y, flags, paint);
} }

View File

@@ -64,14 +64,6 @@ enum {
kDirection_Mask = 0x1 kDirection_Mask = 0x1
}; };
static void logGlyphs(sp<TextLayoutCacheValue> value) {
if (value == NULL) return;
LOGD("Got glyphs - count=%d", value->getGlyphsCount());
for (size_t i = 0; i < value->getGlyphsCount(); i++) {
LOGD(" glyphs[%d]=%d", i, value->getGlyphs()[i]);
}
}
class TextLayout { class TextLayout {
public: public:

View File

@@ -554,6 +554,15 @@ void TextLayoutCacheValue::computeValuesWithHarfbuzz(SkPaint* paint, const UChar
#endif #endif
} }
static void logGlyphs(HB_ShaperItem shaperItem) {
LOGD("Got glyphs - count=%d", shaperItem.num_glyphs);
for (size_t i = 0; i < shaperItem.num_glyphs; i++) {
LOGD(" glyphs[%d]=%d - offset.x=%f offset.y=%f", i, shaperItem.glyphs[i],
HBFixedToFloat(shaperItem.offsets[i].x),
HBFixedToFloat(shaperItem.offsets[i].y));
}
}
void TextLayoutCacheValue::computeRunValuesWithHarfbuzz(SkPaint* paint, const UChar* chars, void TextLayoutCacheValue::computeRunValuesWithHarfbuzz(SkPaint* paint, const UChar* chars,
size_t start, size_t count, size_t contextCount, bool isRTL, size_t start, size_t count, size_t contextCount, bool isRTL,
jfloat* outAdvances, jfloat* outTotalAdvance, jfloat* outAdvances, jfloat* outTotalAdvance,
@@ -570,6 +579,8 @@ void TextLayoutCacheValue::computeRunValuesWithHarfbuzz(SkPaint* paint, const UC
shaperItem.kerning_applied); shaperItem.kerning_applied);
LOGD(" -- string= '%s'", String8(chars + start, count).string()); LOGD(" -- string= '%s'", String8(chars + start, count).string());
LOGD(" -- isDevKernText=%d", paint->isDevKernText()); LOGD(" -- isDevKernText=%d", paint->isDevKernText());
logGlyphs(shaperItem);
#endif #endif
if (shaperItem.advances == NULL || shaperItem.num_glyphs == 0) { if (shaperItem.advances == NULL || shaperItem.num_glyphs == 0) {

View File

@@ -471,9 +471,6 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count,
#else #else
value = new TextLayoutCacheValue(); value = new TextLayoutCacheValue();
value->computeValues(paint, text, 0, count, count, flags); value->computeValues(paint, text, 0, count, count, flags);
#endif
#if DEBUG_GLYPHS
logGlyphs(value);
#endif #endif
const jchar* glyphArray = value->getGlyphs(); const jchar* glyphArray = value->getGlyphs();
int glyphCount = value->getGlyphsCount(); int glyphCount = value->getGlyphsCount();
@@ -504,9 +501,6 @@ static void renderTextRun(OpenGLRenderer* renderer, const jchar* text,
#else #else
value = new TextLayoutCacheValue(); value = new TextLayoutCacheValue();
value->computeValues(paint, text, start, count, contextCount, flags); value->computeValues(paint, text, start, count, contextCount, flags);
#endif
#if DEBUG_GLYPHS
logGlyphs(value);
#endif #endif
const jchar* glyphArray = value->getGlyphs(); const jchar* glyphArray = value->getGlyphs();
int glyphCount = value->getGlyphsCount(); int glyphCount = value->getGlyphsCount();