Changeset 2971

Show
Ignore:
Timestamp:
06/18/05 00:22:32 (4 years ago)
Author:
morris
Message:

Flip CG context if NSView if flipped

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Footagehead/trunk/FHImage.m

    r2959 r2971  
    246246                cgRect          = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); 
    247247 
     248                if(_flipped) { 
     249                        CGContextSaveGState(cgContext); 
     250                        CGContextTranslateCTM(cgContext, 0.0f, rect.origin.y + rect.origin.y + rect.size.height); 
     251                        CGContextScaleCTM(cgContext, 1.0f, -1.0f); 
     252                } 
     253                 
    248254                CGContextDrawImage(cgContext, cgRect, _CGImage); 
     255                 
     256                if(_flipped) 
     257                        CGContextRestoreGState(cgContext); 
    249258        } 
    250259        else if(_NSImage) { 
     
    254263                 
    255264                if(imageRep) { 
    256                         if([imageRep hasAlpha] || _flipped) { 
    257                                 [_NSImage setFlipped:_flipped]; 
     265                        [_NSImage setFlipped:_flipped]; 
     266 
     267                        if([imageRep hasAlpha] || _flipped) 
    258268                                [_NSImage drawInRect:rect fromRect:NSMakeRect(0.0, 0.0, _size.width, _size.height) operation:NSCompositeSourceOver fraction:1.0]; 
    259                         } else { 
     269                        else 
    260270                                [imageRep drawInRect:rect]; 
    261                         } 
    262271                } 
    263272        }