[webkit-changes] cvs commit: WebKit/WebCoreSupport.subproj WebTextRenderer.m

Eric eseidel at opensource.apple.com
Wed Oct 19 22:03:16 PDT 2005


eseidel     05/10/19 22:03:15

  Modified:    .        ChangeLog
               WebCoreSupport.subproj WebTextRenderer.m
  Log:
  Bug #: none
  Submitted by: timo
  Reviewed by: eseidel & darin
  	Changed some of the run measurement methods to C functions
          to avoid overhead associated with objc_msgSend().
  
          * WebCoreSupport.subproj/WebTextRenderer.m:
          (-[WebTextRenderer floatWidthForRun:style:widths:]):
  	Updated to call new run measurement functions instead
          of calling ObjC methods.
          (-[WebTextRenderer CG_drawRun:style:geometry:]): ditto
          (floatWidthForRun): ditto
          (CG_floatWidthForRun): ditto
          (ATSU_floatWidthForRun): ditto
          (widthForNextCharacter): ditto
  
  Revision  Changes    Path
  1.3353    +17 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3352
  retrieving revision 1.3353
  diff -u -r1.3352 -r1.3353
  --- ChangeLog	14 Oct 2005 20:31:39 -0000	1.3352
  +++ ChangeLog	20 Oct 2005 05:03:12 -0000	1.3353
  @@ -1,3 +1,20 @@
  +2005-10-19  Tim Omernick  <tomernick at apple.com>
  +
  +        Reviewed by eseidel & darin.
  +
  +	Changed some of the run measurement methods to C functions
  +        to avoid overhead associated with objc_msgSend().
  +		
  +        * WebCoreSupport.subproj/WebTextRenderer.m:
  +        (-[WebTextRenderer floatWidthForRun:style:widths:]):
  +	Updated to call new run measurement functions instead
  +        of calling ObjC methods.
  +        (-[WebTextRenderer CG_drawRun:style:geometry:]): ditto
  +        (floatWidthForRun): ditto
  +        (CG_floatWidthForRun): ditto
  +        (ATSU_floatWidthForRun): ditto
  +        (widthForNextCharacter): ditto
  +
   2005-10-14  Vicki Murley  <vicki at apple.com>
   
   	Changes by Mitz Pettel, reviewed by Maciej.
  
  
  
  1.197     +15 -24    WebKit/WebCoreSupport.subproj/WebTextRenderer.m
  
  Index: WebTextRenderer.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebTextRenderer.m,v
  retrieving revision 1.196
  retrieving revision 1.197
  diff -u -r1.196 -r1.197
  --- WebTextRenderer.m	6 Oct 2005 21:19:47 -0000	1.196
  +++ WebTextRenderer.m	20 Oct 2005 05:03:15 -0000	1.197
  @@ -132,11 +132,11 @@
   - (ATSGlyphRef)extendCharacterToGlyphMapToInclude:(UnicodeChar)c;
   - (void)updateGlyphEntryForCharacter:(UnicodeChar)c glyphID:(ATSGlyphRef)glyphID substituteRenderer:(WebTextRenderer *)substituteRenderer;
   
  -- (float)floatWidthForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style widths:(float *)widthBuffer substituteRenderers:(WebTextRenderer **)rendererBuffer glyphs:(CGGlyph *)glyphBuffer startPosition:(float *)startPosition numGlyphs:(int *)numGlyphs;
  -
   // Measuring runs.
  -- (float)CG_floatWidthForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style widths:(float *)widthBuffer substituteRenderers:(WebTextRenderer **)rendererBuffer glyphs:(CGGlyph *)glyphBuffer startPosition:(float *)startPosition numGlyphs:(int *)numGlyphs;
  -- (float)ATSU_floatWidthForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style;
  +static inline float floatWidthForRun(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, float *widthBuffer, WebTextRenderer **rendererBuffer,
  +    CGGlyph *glyphBuffer, float *startPosition, int *numGlyphs);
  +static float CG_floatWidthForRun(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, float *widthBuffer, WebTextRenderer **rendererBuffer, CGGlyph *glyphBuffer, float *startPosition, int *numGlyphsResult);
  +static float ATSU_floatWidthForRun(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style);
   
   // Drawing runs.
   - (void)CG_drawRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style geometry:(const WebCoreTextGeometry *)geometry;
  @@ -490,8 +490,7 @@
   
   - (float)floatWidthForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style widths:(float *)widthBuffer
   {
  -    return [self floatWidthForRun:run style:style widths:widthBuffer
  -        substituteRenderers:0 glyphs:0 startPosition:0 numGlyphs:0];
  +    return floatWidthForRun(self, run, style, widthBuffer, 0, 0, 0, 0);
   }
   
   - (void)drawLineForCharacters:(NSPoint)point yOffset:(float)yOffset width: (int)width color:(NSColor *)color thickness:(float)thickness
  @@ -935,13 +934,7 @@
           rendererBuffer = localRendererBuffer;
       }
   
  -    [self floatWidthForRun:run
  -        style:style
  -        widths:widthBuffer 
  -        substituteRenderers:rendererBuffer
  -        glyphs:glyphBuffer
  -        startPosition:&startX
  -        numGlyphs: &numGlyphs];
  +    floatWidthForRun(self, run, style, widthBuffer, rendererBuffer, glyphBuffer, &startX, &numGlyphs);
           
       // Eek.  We couldn't generate ANY glyphs for the run.
       if (numGlyphs <= 0)
  @@ -1016,17 +1009,16 @@
       }
   }
   
  -- (float)floatWidthForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style widths:(float *)widthBuffer substituteRenderers:(WebTextRenderer **)rendererBuffer
  -    glyphs:(CGGlyph *)glyphBuffer startPosition:(float *)startPosition numGlyphs:(int *)numGlyphs
  +static inline float floatWidthForRun(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, float *widthBuffer, WebTextRenderer **rendererBuffer,
  +    CGGlyph *glyphBuffer, float *startPosition, int *numGlyphs)
   {
       if (shouldUseATSU(run))
  -        return [self ATSU_floatWidthForRun:run style:style];
  +        return ATSU_floatWidthForRun(renderer, run, style);
       
  -    return [self CG_floatWidthForRun:run style:style widths:widthBuffer substituteRenderers:rendererBuffer glyphs:glyphBuffer startPosition:startPosition numGlyphs:numGlyphs];
  +    return CG_floatWidthForRun(renderer, run, style, widthBuffer, rendererBuffer, glyphBuffer, startPosition, numGlyphs);
   }
   
  -- (float)CG_floatWidthForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style widths:(float *)widthBuffer substituteRenderers:(WebTextRenderer **)rendererBuffer
  -    glyphs:(CGGlyph *)glyphBuffer startPosition:(float *)startPosition numGlyphs:(int *)numGlyphsResult
  +static float CG_floatWidthForRun(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style, float *widthBuffer, WebTextRenderer **rendererBuffer, CGGlyph *glyphBuffer, float *startPosition, int *numGlyphsResult)
   {
       float _nextWidth;
       CharacterWidthIterator widthIterator;
  @@ -1034,7 +1026,7 @@
       ATSGlyphRef glyphUsed;
       int numGlyphs = 0;
       
  -    initializeCharacterWidthIterator(&widthIterator, self, run, style);
  +    initializeCharacterWidthIterator(&widthIterator, renderer, run, style);
       if (startPosition)
           *startPosition = widthIterator.widthToStart;
       while (widthIterator.currentCharacter < (unsigned)widthIterator.run->to) {
  @@ -1352,11 +1344,11 @@
   }
   
   
  -- (float)ATSU_floatWidthForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style
  +static float ATSU_floatWidthForRun(WebTextRenderer *renderer, const WebCoreTextRun *run, const WebCoreTextStyle *style)
   {
       ATSTrapezoid oGlyphBounds;
       
  -    oGlyphBounds = [self trapezoidForRun:run style:style atPoint:NSMakePoint(0,0)];
  +    oGlyphBounds = [renderer trapezoidForRun:run style:style atPoint:NSMakePoint(0,0)];
       
       float width = 
           MAX(FixedToFloat(oGlyphBounds.upperRight.x), FixedToFloat(oGlyphBounds.lowerRight.x)) - 
  @@ -1869,8 +1861,7 @@
               
               int cNumGlyphs;
               ATSGlyphRef localGlyphBuffer[MAX_GLYPH_EXPANSION];            
  -            width = [substituteRenderer floatWidthForRun:&clusterRun style:&clusterStyle 
  -                widths:0 substituteRenderers:0 glyphs:localGlyphBuffer startPosition:0 numGlyphs:&cNumGlyphs];
  +            width = floatWidthForRun(substituteRenderer, &clusterRun, &clusterStyle, 0, 0, localGlyphBuffer, 0, &cNumGlyphs);
               if (cNumGlyphs == 1) {
                   glyph = localGlyphBuffer[0];
                   [renderer updateGlyphEntryForCharacter:c glyphID:glyph substituteRenderer:substituteRenderer];
  
  
  



More information about the webkit-changes mailing list