Revert "Fix bug #5332081 TextLayoutCache needs to be able to have more cache hits"
This reverts commit d686d76814f18061e06995df0d5de9feb9f70a7e
diff --git a/core/jni/android/graphics/TextLayoutCache.h b/core/jni/android/graphics/TextLayoutCache.h
index 964c647..0d8d71f 100644
--- a/core/jni/android/graphics/TextLayoutCache.h
+++ b/core/jni/android/graphics/TextLayoutCache.h
@@ -69,9 +69,8 @@
TextLayoutCacheKey();
TextLayoutCacheKey(const SkPaint* paint,
- const UChar* text, size_t contextCount, int dirFlags);
-
- TextLayoutCacheKey(const TextLayoutCacheKey& other);
+ const UChar* text, size_t start, size_t count,
+ size_t contextCount, int dirFlags);
bool operator<(const TextLayoutCacheKey& rhs) const;
@@ -87,8 +86,10 @@
size_t getSize();
private:
- const UChar* text; // if text is NULL, use textCopy
+ const UChar* text;
String16 textCopy;
+ size_t start;
+ size_t count;
size_t contextCount;
int dirFlags;
SkTypeface* typeface;
@@ -97,10 +98,6 @@
SkScalar textScaleX;
uint32_t flags;
SkPaint::Hinting hinting;
-
- inline const UChar* getText() const {
- return text ? text : textCopy.string();
- }
}; // TextLayoutCacheKey
/*
@@ -116,16 +113,14 @@
void setElapsedTime(uint32_t time);
uint32_t getElapsedTime();
- void computeValues(SkPaint* paint, const UChar* chars, size_t contextCount, int dirFlags);
+ void computeValues(SkPaint* paint, const UChar* chars, size_t start, size_t count,
+ size_t contextCount, int dirFlags);
- void getAdvances(size_t start, size_t count, jfloat* outAdvances);
-
- jfloat getTotalAdvance(size_t start, size_t count);
-
- void getGlyphsIndexAndCount(size_t start, size_t count, size_t* outStartIndex,
- size_t* outGlyphsCount);
-
- void getGlyphs(size_t startIndex, size_t count, jchar* outGlyphs);
+ inline const jfloat* getAdvances() const { return mAdvances; }
+ inline size_t getAdvancesCount() const { return mAdvancesCount; }
+ inline jfloat getTotalAdvance() const { return mTotalAdvance; }
+ inline const jchar* getGlyphs() const { return mGlyphs; }
+ inline size_t getGlyphsCount() const { return mGlyphsCount; }
/**
* Get the size of the Cache entry
@@ -133,15 +128,17 @@
size_t getSize();
static void setupShaperItem(HB_ShaperItem* shaperItem, HB_FontRec* font, FontData* fontData,
- SkPaint* paint, const UChar* chars, size_t contextCount, bool isRTL);
+ SkPaint* paint, const UChar* chars, size_t start, size_t count, size_t contextCount,
+ bool isRTL);
static void shapeWithHarfbuzz(HB_ShaperItem* shaperItem, HB_FontRec* font, FontData* fontData,
- SkPaint* paint, const UChar* chars, size_t contextCount, bool isRTL);
+ SkPaint* paint, const UChar* chars, size_t start, size_t count, size_t contextCount,
+ bool isRTL);
- static void computeValuesWithHarfbuzz(SkPaint* paint, const UChar* chars,
- size_t contextCount, int dirFlags,
+ static void computeValuesWithHarfbuzz(SkPaint* paint, const UChar* chars, size_t start,
+ size_t count, size_t contextCount, int dirFlags,
jfloat* outAdvances, jfloat* outTotalAdvance,
- jchar** outGlyphs, size_t* outGlyphsCount, unsigned short** outLogClusters);
+ jchar** outGlyphs, size_t* outGlyphsCount);
static void computeAdvancesWithICU(SkPaint* paint, const UChar* chars, size_t start,
size_t count, size_t contextCount, int dirFlags,
@@ -174,11 +171,6 @@
size_t mGlyphsCount;
/**
- * Harfbuzz Log Clusters
- */
- unsigned short* mLogClusters;
-
- /**
* Time for computing the values (in milliseconds)
*/
uint32_t mElapsedTime;
@@ -187,10 +179,10 @@
static void createGlyphArrays(HB_ShaperItem* shaperItem, int size);
static void resetGlyphArrays(HB_ShaperItem* shaperItem);
- static void computeRunValuesWithHarfbuzz(SkPaint* paint, const UChar* chars,
- size_t contextCount, bool isRTL,
+ static void computeRunValuesWithHarfbuzz(SkPaint* paint, const UChar* chars, size_t start,
+ size_t count, size_t contextCount, bool isRTL,
jfloat* outAdvances, jfloat* outTotalAdvance,
- jchar** outGlyphs, size_t* outGlyphsCount, unsigned short** outLogClusters);
+ jchar** outGlyphs, size_t* outGlyphsCount);
}; // TextLayoutCacheValue
/**
@@ -214,8 +206,8 @@
*/
void operator()(TextLayoutCacheKey& text, sp<TextLayoutCacheValue>& desc);
- sp<TextLayoutCacheValue> getValue(SkPaint* paint, const jchar* text, jint contextCount,
- jint dirFlags);
+ sp<TextLayoutCacheValue> getValue(SkPaint* paint,
+ const jchar* text, jint start, jint count, jint contextCount, jint dirFlags);
/**
* Clear the cache