diff --git a/gfx/public/nsCompressedCharMap.h b/gfx/public/nsCompressedCharMap.h index d5bb37df72e7..1e2bdea17894 100644 --- a/gfx/public/nsCompressedCharMap.h +++ b/gfx/public/nsCompressedCharMap.h @@ -67,7 +67,12 @@ extern PRUint16* CreateEmptyCCMap(); extern PRUint16* MapToCCMap(PRUint32* aMap); extern PRUint16* MapperToCCMap(nsICharRepresentable *aMapper); extern void FreeCCMap(PRUint16* &aMap); +extern PRBool NextNonEmptyCCMapPage(PRUint16 *, PRUint16 *); extern PRBool IsSameCCMap(PRUint16* ccmap1, PRUint16* ccmap2); +#ifdef DEBUG +void printCCMap(PRUint16* aCCMap); +#endif + // surrogate support extension extern PRUint16* @@ -290,6 +295,7 @@ protected: #define CCMAP_TOTAL_PAGES CCMAP_POW2(CCMAP_BITS_PER_UPPER_LOG2 \ +CCMAP_BITS_PER_MID_LOG2) +#define CCMAP_BEGIN_AT_START_OF_MAP 0xFFFF // // Finally, build up the macro to test the bit for a given char diff --git a/gfx/src/nsCompressedCharMap.cpp b/gfx/src/nsCompressedCharMap.cpp index adbba7f06cb8..126451c77243 100644 --- a/gfx/src/nsCompressedCharMap.cpp +++ b/gfx/src/nsCompressedCharMap.cpp @@ -110,6 +110,55 @@ MapperToCCMap(nsICharRepresentable *aMapper) return ccMap; } +PRBool +NextNonEmptyCCMapPage(PRUint16* aCCMap, PRUint16 *aPageStart) +{ + int i, j; + unsigned int k; + + // + // Point to the next page + // + unsigned int upper_index; + unsigned int mid_index; + if (*aPageStart == CCMAP_BEGIN_AT_START_OF_MAP) { + upper_index = 0; + mid_index = 0; + } + else { + upper_index = CCMAP_UPPER_INDEX(*aPageStart); + mid_index = CCMAP_MID_INDEX(*aPageStart) + 1; + } + + + // walk thru the upper pointers + PRUint16 *upper = &aCCMap[0]; + for (i=upper_index; i