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

Adele adele at opensource.apple.com
Tue Aug 16 14:25:29 PDT 2005


adele       05/08/16 14:25:29

  Modified:    .        Tag: Safari-2-0-branch ChangeLog
               WebCoreSupport.subproj Tag: Safari-2-0-branch WebImageData.m
                        WebImageRenderer.m WebTextRenderer.m
  Log:
          Merged fix from TOT to Safari-2-0-branch
  
      2005-08-15  Darin  <darin at apple.com>
  
          Reviewed by Beth.
  
  	This is a fix for <rdar://problem/4211631> tiled images tiled incorrectly when printing or
  	drawing offscreen.
  
  	Cayenne found there was a problem when they were trying to take screen shots of widgets, and
  	it was ultimately a problem with the way we tile images. Darin was able to fix the problem
  	by replacing some confusing hacked code with CG calls.
  
          * WebCoreSupport.subproj/WebImageData.m:
          (-[WebImageData tileInRect:fromPoint:context:]):
          * WebCoreSupport.subproj/WebImageRenderer.m:
          (-[WebInternalImage tileInRect:fromPoint:context:]):
          * WebCoreSupport.subproj/WebTextRenderer.m:
          (-[WebTextRenderer drawLineForMisspelling:withWidth:]):
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3118.4.45 +22 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3118.4.44
  retrieving revision 1.3118.4.45
  diff -u -r1.3118.4.44 -r1.3118.4.45
  --- ChangeLog	13 Aug 2005 17:25:37 -0000	1.3118.4.44
  +++ ChangeLog	16 Aug 2005 21:25:24 -0000	1.3118.4.45
  @@ -1,3 +1,25 @@
  +2005-08-16  Adele Peterson  <adele at apple.com>
  +
  +        Merged fix from TOT to Safari-2-0-branch
  +
  +    2005-08-15  Darin  <darin at apple.com>
  +	
  +        Reviewed by Beth.
  +
  +	This is a fix for <rdar://problem/4211631> tiled images tiled incorrectly when printing or 
  +	drawing offscreen.
  +
  +	Cayenne found there was a problem when they were trying to take screen shots of widgets, and
  +	it was ultimately a problem with the way we tile images. Darin was able to fix the problem
  +	by replacing some confusing hacked code with CG calls.
  +
  +        * WebCoreSupport.subproj/WebImageData.m:
  +        (-[WebImageData tileInRect:fromPoint:context:]):
  +        * WebCoreSupport.subproj/WebImageRenderer.m:
  +        (-[WebInternalImage tileInRect:fromPoint:context:]):
  +        * WebCoreSupport.subproj/WebTextRenderer.m:
  +        (-[WebTextRenderer drawLineForMisspelling:withWidth:]):
  +
   === Safari-416.1 ===
   
   2005-08-12  Adele Peterson  <adele at apple.com>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.32.8.3  +6 -14     WebKit/WebCoreSupport.subproj/WebImageData.m
  
  Index: WebImageData.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebImageData.m,v
  retrieving revision 1.32.8.2
  retrieving revision 1.32.8.3
  diff -u -r1.32.8.2 -r1.32.8.3
  --- WebImageData.m	22 Jul 2005 03:10:03 -0000	1.32.8.2
  +++ WebImageData.m	16 Aug 2005 21:25:28 -0000	1.32.8.3
  @@ -605,23 +605,15 @@
               return;
           }
   
  -        // Compute the appropriate phase relative to the top level view in the window.
  -        // Conveniently, the oneTileRect we computed above has the appropriate origin.
  -        NSPoint originInWindow = [[NSView focusView] convertPoint:oneTileRect.origin toView:nil];
  -
  -        // WebCore may translate the focus, and thus need an extra phase correction
  -        NSPoint extraPhase = [[WebGraphicsBridge sharedBridge] additionalPatternPhase];
  -        originInWindow.x += extraPhase.x;
  -        originInWindow.y += extraPhase.y;
  -        CGSize phase = CGSizeMake(fmodf(originInWindow.x, tileSize.width), fmodf(originInWindow.y, tileSize.height));
  -
  -        // Possible optimization:  We may want to cache the CGPatternRef    
  -        CGPatternRef pattern = CGPatternCreate(self, CGRectMake (0, 0, tileSize.width, tileSize.height), CGAffineTransformIdentity, tileSize.width, tileSize.height, 
  -            kCGPatternTilingConstantSpacing, true, &patternCallbacks);
  +        CGPatternRef pattern = CGPatternCreate(self, CGRectMake(0, 0, tileSize.width, tileSize.height),
  +        CGAffineTransformIdentity, tileSize.width, tileSize.height, 
  +        kCGPatternTilingConstantSpacing, TRUE, &patternCallbacks);
  +        
           if (pattern) {
               CGContextSaveGState (aContext);
   
  -            CGContextSetPatternPhase(aContext, phase);
  +            CGPoint transformedOrigin = CGPointApplyAffineTransform(rect.origin, CGContextGetCTM(aContext));
  +            CGContextSetPatternPhase(aContext, CGSizeMake(transformedOrigin.x, transformedOrigin.y));
   
               CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL);
               CGContextSetFillColorSpace(aContext, patternSpace);
  
  
  
  1.98.8.1  +3 -10     WebKit/WebCoreSupport.subproj/WebImageRenderer.m
  
  Index: WebImageRenderer.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebImageRenderer.m,v
  retrieving revision 1.98
  retrieving revision 1.98.8.1
  diff -u -r1.98 -r1.98.8.1
  --- WebImageRenderer.m	25 Feb 2005 01:33:07 -0000	1.98
  +++ WebImageRenderer.m	16 Aug 2005 21:25:28 -0000	1.98.8.1
  @@ -1086,15 +1086,6 @@
   //    oneTileRect.origin.y = rect.origin.y - fmodf(point.y, size.height);
       oneTileRect.size = size;
   
  -    // Compute the appropriate phase relative to the top level view in the window.
  -    // Conveniently, the oneTileRect we computed above has the appropriate origin.
  -    NSPoint originInWindow = [[NSView focusView] convertPoint:oneTileRect.origin toView:nil];
  -    // WebCore may translate the focus, and thus need an extra phase correction
  -    NSPoint extraPhase = [[WebGraphicsBridge sharedBridge] additionalPatternPhase];
  -    originInWindow.x += extraPhase.x;
  -    originInWindow.y += extraPhase.y;
  -    CGSize phase = CGSizeMake(fmodf(originInWindow.x, size.width), fmodf(originInWindow.y, size.height));
  -    
       // If the single image draw covers the whole area, then just draw once.
       if (NSContainsRect(oneTileRect, rect)) {
           NSRect fromRect;
  @@ -1129,7 +1120,9 @@
       
       [NSGraphicsContext saveGraphicsState];
       
  -    CGContextSetPatternPhase((CGContextRef)[[NSGraphicsContext currentContext] graphicsPort], phase);    
  +    CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
  +    CGPoint transformedOrigin = CGPointApplyAffineTransform(rect.origin, CGContextGetCTM(aContext));
  +    CGContextSetPatternPhase(context, CGSizeMake(transformedOrigin.x, transformedOrigin.y));    
       [patternColor set];
       [NSBezierPath fillRect:rect];
       
  
  
  
  1.165.8.6 +9 -11     WebKit/WebCoreSupport.subproj/WebTextRenderer.m
  
  Index: WebTextRenderer.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebTextRenderer.m,v
  retrieving revision 1.165.8.5
  retrieving revision 1.165.8.6
  diff -u -r1.165.8.5 -r1.165.8.6
  --- WebTextRenderer.m	12 Aug 2005 08:36:46 -0000	1.165.8.5
  +++ WebTextRenderer.m	16 Aug 2005 21:25:28 -0000	1.165.8.6
  @@ -664,21 +664,19 @@
               width -= widthMod;
       }
       
  -    // Compute the appropriate phase relative to the top level view in the window.
  -    NSPoint originInWindow = [[NSView focusView] convertPoint:point toView:nil];
  -    // WebCore may translate the focus, and thus need an extra phase correction
  -    NSPoint extraPhase = [[WebGraphicsBridge sharedBridge] additionalPatternPhase];
  -    originInWindow.x += extraPhase.x;
  -    originInWindow.y += extraPhase.y;
  -    CGSize phase = CGSizeMake(fmodf(originInWindow.x, patternWidth), fmodf(originInWindow.y, patternHeight));
  -
       // Draw underline
       NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
  -    [currentContext saveGraphicsState];
  +    CGContextRef context = (CGContextRef)[currentContext graphicsPort];
  +    CGContextSaveGState(context);
  +
       [spellingPatternColor set];
  -    CGContextSetPatternPhase((CGContextRef)[currentContext graphicsPort], phase);
  +
  +    CGPoint transformedOrigin = CGPointApplyAffineTransform(CGPointMake(point.x, point.y), CGContextGetCTM(context));
  +    CGContextSetPatternPhase(context, CGSizeMake(transformedOrigin.x, transformedOrigin.y));
  +
       NSRectFillUsingOperation(NSMakeRect(point.x, point.y, width, patternHeight), NSCompositeSourceOver);
  -    [currentContext restoreGraphicsState];
  +    
  +    CGContextRestoreGState(context);
   }
   
   - (int)pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x reversed:(BOOL)reversed includePartialGlyphs:(BOOL)includePartialGlyphs
  
  
  



More information about the webkit-changes mailing list