Loading core/jni/android/graphics/Paint.cpp +3 −7 Original line number Diff line number Diff line Loading @@ -366,26 +366,22 @@ public: NPE_CHECK_RETURN_ZERO(env, jpaint); NPE_CHECK_RETURN_ZERO(env, text); size_t textLength = env->GetStringLength(text); int count = end - start; if ((start | count) < 0) { if ((start | count) < 0 || (size_t)end > textLength) { doThrowAIOOBE(env); return 0; } if (count == 0) { return 0; } size_t textLength = env->GetStringLength(text); if ((size_t)count > textLength) { doThrowAIOOBE(env); return 0; } const jchar* textArray = env->GetStringChars(text, NULL); SkPaint* paint = GraphicsJNI::getNativePaint(env, jpaint); jfloat width = 0; #if RTL_USE_HARFBUZZ TextLayout::getTextRunAdvances(paint, textArray, start, count, end, TextLayout::getTextRunAdvances(paint, textArray, start, count, textLength, paint->getFlags(), NULL /* dont need all advances */, width); #else Loading core/jni/android/graphics/TextLayoutCache.cpp +13 −13 Original line number Diff line number Diff line Loading @@ -163,20 +163,20 @@ sp<TextLayoutCacheValue> TextLayoutCache::getValue(SkPaint* paint, // Update timing information for statistics value->setElapsedTime(endTime - startTime); LOGD("CACHE MISS: Added entry for text='%s' with start=%d, count=%d, " LOGD("CACHE MISS: Added entry with start=%d, count=%d, " "contextCount=%d, entry size %d bytes, remaining space %d bytes" " - Compute time in nanos: %d", String8(text, contextCount).string(), start, count, contextCount, size, mMaxSize - mSize, value->getElapsedTime()); " - Compute time in nanos: %d - Text='%s' ", start, count, contextCount, size, mMaxSize - mSize, value->getElapsedTime(), String8(text, contextCount).string()); } } else { if (mDebugEnabled) { LOGD("CACHE MISS: Calculated but not storing entry because it is too big " "for text='%s' with start=%d, count=%d, contextCount=%d, " "with start=%d, count=%d, contextCount=%d, " "entry size %d bytes, remaining space %d bytes" " - Compute time in nanos: %lld", String8(text, contextCount).string(), start, count, contextCount, size, mMaxSize - mSize, endTime); " - Compute time in nanos: %lld - Text='%s'", start, count, contextCount, size, mMaxSize - mSize, endTime, String8(text, contextCount).string()); } value.clear(); } Loading @@ -190,12 +190,12 @@ sp<TextLayoutCacheValue> TextLayoutCache::getValue(SkPaint* paint, if (value->getElapsedTime() > 0) { float deltaPercent = 100 * ((value->getElapsedTime() - elapsedTimeThruCacheGet) / ((float)value->getElapsedTime())); LOGD("CACHE HIT #%d for text='%s' with start=%d, count=%d, contextCount=%d " LOGD("CACHE HIT #%d with start=%d, count=%d, contextCount=%d " "- Compute time in nanos: %d - " "Cache get time in nanos: %lld - Gain in percent: %2.2f", mCacheHitCount, String8(text, contextCount).string(), start, count, contextCount, value->getElapsedTime(), elapsedTimeThruCacheGet, deltaPercent); "Cache get time in nanos: %lld - Gain in percent: %2.2f - Text='%s' ", mCacheHitCount, start, count, contextCount, value->getElapsedTime(), elapsedTimeThruCacheGet, deltaPercent, String8(text, contextCount).string()); } if (mCacheHitCount % DEFAULT_DUMP_STATS_CACHE_HIT_INTERVAL == 0) { dumpCacheStats(); Loading Loading
core/jni/android/graphics/Paint.cpp +3 −7 Original line number Diff line number Diff line Loading @@ -366,26 +366,22 @@ public: NPE_CHECK_RETURN_ZERO(env, jpaint); NPE_CHECK_RETURN_ZERO(env, text); size_t textLength = env->GetStringLength(text); int count = end - start; if ((start | count) < 0) { if ((start | count) < 0 || (size_t)end > textLength) { doThrowAIOOBE(env); return 0; } if (count == 0) { return 0; } size_t textLength = env->GetStringLength(text); if ((size_t)count > textLength) { doThrowAIOOBE(env); return 0; } const jchar* textArray = env->GetStringChars(text, NULL); SkPaint* paint = GraphicsJNI::getNativePaint(env, jpaint); jfloat width = 0; #if RTL_USE_HARFBUZZ TextLayout::getTextRunAdvances(paint, textArray, start, count, end, TextLayout::getTextRunAdvances(paint, textArray, start, count, textLength, paint->getFlags(), NULL /* dont need all advances */, width); #else Loading
core/jni/android/graphics/TextLayoutCache.cpp +13 −13 Original line number Diff line number Diff line Loading @@ -163,20 +163,20 @@ sp<TextLayoutCacheValue> TextLayoutCache::getValue(SkPaint* paint, // Update timing information for statistics value->setElapsedTime(endTime - startTime); LOGD("CACHE MISS: Added entry for text='%s' with start=%d, count=%d, " LOGD("CACHE MISS: Added entry with start=%d, count=%d, " "contextCount=%d, entry size %d bytes, remaining space %d bytes" " - Compute time in nanos: %d", String8(text, contextCount).string(), start, count, contextCount, size, mMaxSize - mSize, value->getElapsedTime()); " - Compute time in nanos: %d - Text='%s' ", start, count, contextCount, size, mMaxSize - mSize, value->getElapsedTime(), String8(text, contextCount).string()); } } else { if (mDebugEnabled) { LOGD("CACHE MISS: Calculated but not storing entry because it is too big " "for text='%s' with start=%d, count=%d, contextCount=%d, " "with start=%d, count=%d, contextCount=%d, " "entry size %d bytes, remaining space %d bytes" " - Compute time in nanos: %lld", String8(text, contextCount).string(), start, count, contextCount, size, mMaxSize - mSize, endTime); " - Compute time in nanos: %lld - Text='%s'", start, count, contextCount, size, mMaxSize - mSize, endTime, String8(text, contextCount).string()); } value.clear(); } Loading @@ -190,12 +190,12 @@ sp<TextLayoutCacheValue> TextLayoutCache::getValue(SkPaint* paint, if (value->getElapsedTime() > 0) { float deltaPercent = 100 * ((value->getElapsedTime() - elapsedTimeThruCacheGet) / ((float)value->getElapsedTime())); LOGD("CACHE HIT #%d for text='%s' with start=%d, count=%d, contextCount=%d " LOGD("CACHE HIT #%d with start=%d, count=%d, contextCount=%d " "- Compute time in nanos: %d - " "Cache get time in nanos: %lld - Gain in percent: %2.2f", mCacheHitCount, String8(text, contextCount).string(), start, count, contextCount, value->getElapsedTime(), elapsedTimeThruCacheGet, deltaPercent); "Cache get time in nanos: %lld - Gain in percent: %2.2f - Text='%s' ", mCacheHitCount, start, count, contextCount, value->getElapsedTime(), elapsedTimeThruCacheGet, deltaPercent, String8(text, contextCount).string()); } if (mCacheHitCount % DEFAULT_DUMP_STATS_CACHE_HIT_INTERVAL == 0) { dumpCacheStats(); Loading