Changeset 3882

Show
Ignore:
Timestamp:
03/05/06 22:30:00 (3 years ago)
Author:
morris
Message:

Adjust scaling when image is rotated 90 degrees

Files:

Legend:

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

    r3879 r3882  
    3838#import "FHSettings.h" 
    3939 
    40 static FHController             *sharedController; 
     40#define FHUnloadImageCount                      5 
     41#define FHPreloadImageCount                     10 
     42 
     43static FHController                                     *sharedController; 
    4144 
    4245 
     
    267270                        count = [files count]; 
    268271                         
    269                         // --- purge all but the last 5 images 
    270                         if(row > 5) { 
    271                                 for(i = 0; i < count && i < row - 5; i++) { 
     272                        // --- purge all but the last couple of images 
     273                        if(row > FHUnloadImageCount) { 
     274                                for(i = 0; i < count && i < row - FHUnloadImageCount; i++) { 
    272275                                        file = [files objectAtIndex:i]; 
    273276                                         
     
    283286                        } 
    284287                         
    285                         // --- load the next 10 images 
     288                        // --- load the next couple of images 
    286289                        for(i = row, images = 0; i < count; i++) { 
    287290                                file = [files objectAtIndex:i]; 
     
    290293                                        goto next; 
    291294                                 
    292                                 if(++images > 10
     295                                if(++images > FHPreloadImageCount
    293296                                        break; 
    294297                                 
  • Footagehead/trunk/FHImageView.m

    r3879 r3882  
    8282- (void)_adjustScaling { 
    8383        NSSize          contentSize, imageSize, frameSize; 
     84        float           size; 
    8485         
    8586        if(_scrollView) { 
    86                 [_scrollView setHasHorizontalScroller:NO]; 
    87                 [_scrollView setHasVerticalScroller:NO]; 
    8887                contentSize = [_scrollView contentSize]; 
    8988                 
    9089                if(_image && _imageScaling == NSScaleNone) { 
    9190                        imageSize = _image ? [_image size] : NSZeroSize; 
     91                         
     92                        if(ABS(_imageRotation) == 90.0 || ABS(_imageRotation) == 270.0) { 
     93                                size = imageSize.width; 
     94                                imageSize.width = imageSize.height; 
     95                                imageSize.height = size; 
     96                        } 
     97                         
    9298                        frameSize = NSMakeSize(MAX(contentSize.width, imageSize.width), MAX(contentSize.height, imageSize.height)); 
    9399                         
     
    98104                        [self scrollPoint:NSMakePoint(0.0, frameSize.height)]; 
    99105                } else { 
     106                        [_scrollView setHasHorizontalScroller:NO]; 
     107                        [_scrollView setHasVerticalScroller:NO]; 
     108 
    100109                        [self setFrameSize:contentSize]; 
    101110                } 
     
    184193        _imageRotation = imageRotation; 
    185194 
     195        [self _adjustScaling]; 
    186196        [self setNeedsDisplay:YES]; 
    187197} 
     
    304314                switch (_imageScaling) { 
    305315                        case NSScaleProportionally: 
    306                                 dx      = bounds.size.width  / rect.size.width; 
    307                                 dy      = bounds.size.height / rect.size.height; 
    308                                 d       = dx < dy ? dx : dy; 
     316                                if(ABS(_imageRotation) == 90.0 || ABS(_imageRotation) == 270.0) { 
     317                                        dx = bounds.size.width  / rect.size.height; 
     318                                        dy = bounds.size.height / rect.size.width; 
     319                                } else { 
     320                                        dx = bounds.size.width  / rect.size.width; 
     321                                        dy = bounds.size.height / rect.size.height; 
     322                                } 
     323                                 
     324                                d = dx < dy ? dx : dy; 
    309325                                 
    310326                                if(d < 1.0) {