[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:57:54 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 99fcdafa34255095ab976b0966d283d815fe5ad5
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 19 22:57:00 2002 +0000

    iChanged float width cache to use shorts.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@783 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 108aa03..0fb2cd0 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,4 +1,12 @@
 2002-03-19  Richard Williamson  <rjw at apple.com>
+    
+        Changed float width cache to use shorts.
+
+	* src/kwq/KWQFontMetrics.mm: (-[KWQLayoutInfo _initializeCaches]),
+	(_rectForString):
+	* src/kwq/KWQMetrics.h:
+
+2002-03-19  Richard Williamson  <rjw at apple.com>
 
         Improved cache-miss case for non-latin1 characters.
         
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 108aa03..0fb2cd0 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,4 +1,12 @@
 2002-03-19  Richard Williamson  <rjw at apple.com>
+    
+        Changed float width cache to use shorts.
+
+	* src/kwq/KWQFontMetrics.mm: (-[KWQLayoutInfo _initializeCaches]),
+	(_rectForString):
+	* src/kwq/KWQMetrics.h:
+
+2002-03-19  Richard Williamson  <rjw at apple.com>
 
         Improved cache-miss case for non-latin1 characters.
         
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 108aa03..0fb2cd0 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,4 +1,12 @@
 2002-03-19  Richard Williamson  <rjw at apple.com>
+    
+        Changed float width cache to use shorts.
+
+	* src/kwq/KWQFontMetrics.mm: (-[KWQLayoutInfo _initializeCaches]),
+	(_rectForString):
+	* src/kwq/KWQMetrics.h:
+
+2002-03-19  Richard Williamson  <rjw at apple.com>
 
         Improved cache-miss case for non-latin1 characters.
         
diff --git a/WebCore/kwq/KWQFontMetrics.mm b/WebCore/kwq/KWQFontMetrics.mm
index 5ae38c8..78fa5d3 100644
--- a/WebCore/kwq/KWQFontMetrics.mm
+++ b/WebCore/kwq/KWQFontMetrics.mm
@@ -37,7 +37,9 @@
 
 #define FLOOR_TO_INT(x) (int)(floor(x))
 //#define ROUND_TO_INT(x) (int)(((x) > (floor(x) + .5)) ? ceil(x) : floor(x))
-#define ROUND_TO_INT(x) (int)(x+.5)
+#define ROUND_TO_INT(x) (unsigned int)(x+.5)
+#define ROUND_TO_UINT(x) (unsigned int)(x+.5)
+#define ROUND_TO_USHORT(x) (unsigned int)(x+.5)
 #ifdef FOOOOFOOO
 static inline int ROUND_TO_INT (float x)
 {
@@ -484,9 +486,13 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
         widthCache[i] = UNITIALIZED_GLYPH_WIDTH;
     }
     
-    errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], glyphsToCache, widthCache, [font pointSize]);
+    float *tempWidthCache = malloc (glyphsToCache * sizeof(float));
+    errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], glyphsToCache, tempWidthCache, [font pointSize]);
     if (errorResult == 0)
         [NSException raise:NSInternalInconsistencyException format:@"Optimization assumption violation:  unable to cache glyph advances - for %@ %f", self, [font displayName], [font pointSize]];
+    for (i = 0; i < glyphsToCache; i++)
+        widthCache[i] = (_IFGlyphWidth)(ROUND_TO_UINT(tempWidthCache[i]));
+    free (tempWidthCache);
 
     unsigned int latinCount = LAST_CACHE_CHARACTER - FIRST_CACHE_CHARACTER + 1;
     short unsigned int latinBuffer[LAST_CACHE_CHARACTER+1];
@@ -591,6 +597,7 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
                 short unsigned int sequentialGlyphs[INCREMENTAL_GLYPH_CACHE_BLOCK];
                 unsigned int blockStart, blockEnd, blockID;
                 int errorResult;
+                float tempWidthCache[INCREMENTAL_GLYPH_CACHE_BLOCK];
                 
                 blockStart = (glyphID / INCREMENTAL_GLYPH_CACHE_BLOCK) * INCREMENTAL_GLYPH_CACHE_BLOCK;
                 blockEnd = blockStart + INCREMENTAL_GLYPH_CACHE_BLOCK;
@@ -599,9 +606,12 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
                 KWQDEBUGLEVEL5 (KWQ_LOG_FONTCACHE, "width cache miss for glyph 0x%04x in %s, %.0f, filling block 0x%04x to 0x%04x\n", glyphID, [[font displayName] cString], [font pointSize], blockStart, blockEnd);
                 for (blockID = blockStart; blockID < blockEnd; blockID++)
                     sequentialGlyphs[blockID-blockStart] = blockID;
-                errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], blockEnd-blockStart, &widthCache[blockStart], [font pointSize]);
+
+                errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], blockEnd-blockStart, &tempWidthCache[0], [font pointSize]);
                 if (errorResult == 0)
                     [NSException raise:NSInternalInconsistencyException format:@"Optimization assumption violation:  unable to cache glyph widths - for %@ %f", self, [font displayName], [font pointSize]];
+                for (blockID = blockStart; blockID < blockEnd; blockID++)
+                	widthCache[blockID] = (_IFGlyphWidth)(ROUND_TO_UINT(tempWidthCache[blockID-blockStart]));
             }
         }
 
@@ -619,7 +629,7 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
     // the glyph widths as shorts would cut space in half.
     if (needCharToGlyphLookup){
         for (i = 0; i < numGlyphs; i++){
-            totalWidth += ROUND_TO_INT(widthCache[usedCharacterToGlyph[i]]);
+            totalWidth += widthCache[usedCharacterToGlyph[i]];
         }
         
         if (allocateCharacterToGlyph)
@@ -628,7 +638,7 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
     else {
         for (i = 0; i < numGlyphs; i++){
             index = internalBuffer[i]-FIRST_CACHE_CHARACTER;
-            totalWidth += ROUND_TO_INT(widthCache[usedCharacterToGlyph[index]]);
+            totalWidth += widthCache[usedCharacterToGlyph[index]];
         }
     }
     
diff --git a/WebCore/kwq/KWQMetrics.h b/WebCore/kwq/KWQMetrics.h
index 288af19..85f32d4 100644
--- a/WebCore/kwq/KWQMetrics.h
+++ b/WebCore/kwq/KWQMetrics.h
@@ -37,7 +37,7 @@
 #define INITIAL_GLYPH_CACHE_MAX 512
 #define INCREMENTAL_GLYPH_CACHE_BLOCK 512
 
-#define UNITIALIZED_GLYPH_WIDTH FLT_MAX
+#define UNITIALIZED_GLYPH_WIDTH 65535
 
 // These definitions are used to bound the character-to-glyph mapping cache.  The
 // range is limited to LATIN1.  When accessing the cache a check must be made to
@@ -72,7 +72,7 @@ CG_EXTERN size_t CGFontGetNumberOfGlyphs(CGFontRef font);
 
 }
 
-typedef float _IFGlyphWidth;
+typedef unsigned short _IFGlyphWidth;
 
 #endif
 
diff --git a/WebCore/src/kwq/KWQFontMetrics.mm b/WebCore/src/kwq/KWQFontMetrics.mm
index 5ae38c8..78fa5d3 100644
--- a/WebCore/src/kwq/KWQFontMetrics.mm
+++ b/WebCore/src/kwq/KWQFontMetrics.mm
@@ -37,7 +37,9 @@
 
 #define FLOOR_TO_INT(x) (int)(floor(x))
 //#define ROUND_TO_INT(x) (int)(((x) > (floor(x) + .5)) ? ceil(x) : floor(x))
-#define ROUND_TO_INT(x) (int)(x+.5)
+#define ROUND_TO_INT(x) (unsigned int)(x+.5)
+#define ROUND_TO_UINT(x) (unsigned int)(x+.5)
+#define ROUND_TO_USHORT(x) (unsigned int)(x+.5)
 #ifdef FOOOOFOOO
 static inline int ROUND_TO_INT (float x)
 {
@@ -484,9 +486,13 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
         widthCache[i] = UNITIALIZED_GLYPH_WIDTH;
     }
     
-    errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], glyphsToCache, widthCache, [font pointSize]);
+    float *tempWidthCache = malloc (glyphsToCache * sizeof(float));
+    errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], glyphsToCache, tempWidthCache, [font pointSize]);
     if (errorResult == 0)
         [NSException raise:NSInternalInconsistencyException format:@"Optimization assumption violation:  unable to cache glyph advances - for %@ %f", self, [font displayName], [font pointSize]];
+    for (i = 0; i < glyphsToCache; i++)
+        widthCache[i] = (_IFGlyphWidth)(ROUND_TO_UINT(tempWidthCache[i]));
+    free (tempWidthCache);
 
     unsigned int latinCount = LAST_CACHE_CHARACTER - FIRST_CACHE_CHARACTER + 1;
     short unsigned int latinBuffer[LAST_CACHE_CHARACTER+1];
@@ -591,6 +597,7 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
                 short unsigned int sequentialGlyphs[INCREMENTAL_GLYPH_CACHE_BLOCK];
                 unsigned int blockStart, blockEnd, blockID;
                 int errorResult;
+                float tempWidthCache[INCREMENTAL_GLYPH_CACHE_BLOCK];
                 
                 blockStart = (glyphID / INCREMENTAL_GLYPH_CACHE_BLOCK) * INCREMENTAL_GLYPH_CACHE_BLOCK;
                 blockEnd = blockStart + INCREMENTAL_GLYPH_CACHE_BLOCK;
@@ -599,9 +606,12 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
                 KWQDEBUGLEVEL5 (KWQ_LOG_FONTCACHE, "width cache miss for glyph 0x%04x in %s, %.0f, filling block 0x%04x to 0x%04x\n", glyphID, [[font displayName] cString], [font pointSize], blockStart, blockEnd);
                 for (blockID = blockStart; blockID < blockEnd; blockID++)
                     sequentialGlyphs[blockID-blockStart] = blockID;
-                errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], blockEnd-blockStart, &widthCache[blockStart], [font pointSize]);
+
+                errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], blockEnd-blockStart, &tempWidthCache[0], [font pointSize]);
                 if (errorResult == 0)
                     [NSException raise:NSInternalInconsistencyException format:@"Optimization assumption violation:  unable to cache glyph widths - for %@ %f", self, [font displayName], [font pointSize]];
+                for (blockID = blockStart; blockID < blockEnd; blockID++)
+                	widthCache[blockID] = (_IFGlyphWidth)(ROUND_TO_UINT(tempWidthCache[blockID-blockStart]));
             }
         }
 
@@ -619,7 +629,7 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
     // the glyph widths as shorts would cut space in half.
     if (needCharToGlyphLookup){
         for (i = 0; i < numGlyphs; i++){
-            totalWidth += ROUND_TO_INT(widthCache[usedCharacterToGlyph[i]]);
+            totalWidth += widthCache[usedCharacterToGlyph[i]];
         }
         
         if (allocateCharacterToGlyph)
@@ -628,7 +638,7 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
     else {
         for (i = 0; i < numGlyphs; i++){
             index = internalBuffer[i]-FIRST_CACHE_CHARACTER;
-            totalWidth += ROUND_TO_INT(widthCache[usedCharacterToGlyph[index]]);
+            totalWidth += widthCache[usedCharacterToGlyph[index]];
         }
     }
     
diff --git a/WebCore/src/kwq/KWQMetrics.h b/WebCore/src/kwq/KWQMetrics.h
index 288af19..85f32d4 100644
--- a/WebCore/src/kwq/KWQMetrics.h
+++ b/WebCore/src/kwq/KWQMetrics.h
@@ -37,7 +37,7 @@
 #define INITIAL_GLYPH_CACHE_MAX 512
 #define INCREMENTAL_GLYPH_CACHE_BLOCK 512
 
-#define UNITIALIZED_GLYPH_WIDTH FLT_MAX
+#define UNITIALIZED_GLYPH_WIDTH 65535
 
 // These definitions are used to bound the character-to-glyph mapping cache.  The
 // range is limited to LATIN1.  When accessing the cache a check must be made to
@@ -72,7 +72,7 @@ CG_EXTERN size_t CGFontGetNumberOfGlyphs(CGFontRef font);
 
 }
 
-typedef float _IFGlyphWidth;
+typedef unsigned short _IFGlyphWidth;
 
 #endif
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list