Changeset 58

Show
Ignore:
Timestamp:
11/30/06 09:54:26 (2 years ago)
Author:
mike
Message:

[new] Quartz: selective drawing code
[new] Quartz: is default now

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/changelog.txt

    r57 r58  
     1Q-0.8.2d58 
     2[new] Quartz: selective drawing code 
     3[new] Quartz: is default now 
     4 
    15Q-0.8.2d57 
    26[fix] FSToolbar: added localization 
  • trunk/host-cocoa/cocoaQemu.m

    r53 r58  
    10701070void cocoa_update(DisplayState *ds, int x, int y, int w, int h) 
    10711071{ 
    1072 //      NSLog(@"cocoa: update\n"); 
    1073  
    1074         [[pc contentView] drawContent:ds]; 
     1072//      NSLog(@"cocoa: update"); 
     1073 
     1074    if ([[[pc contentView] class] isEqual:[cocoaQemuQuartzView class]]) { 
     1075        /* new selective drawing code (draws only dirty rectangles) */ 
     1076        float dx; 
     1077        float dy; 
     1078         
     1079        dx = [[pc contentView] frame].size.width / (float)ds->width; 
     1080        dy = [[pc contentView] frame].size.height / (float)ds->height; 
     1081         
     1082        [[pc contentView] setNeedsDisplayInRect:NSMakeRect( 
     1083            x * dx, 
     1084            [[pc contentView] frame].size.height - (h + y) * dy, 
     1085            w * dx, 
     1086            h * dy 
     1087        )];     
     1088    } else { 
     1089     
     1090        /* old drawing code (draws everything) */ 
     1091        [[pc contentView] drawContent:ds]; 
     1092         
     1093    } 
    10751094} 
    10761095 
  • trunk/host-cocoa/cocoaQemuQuartzView.h

    r5 r58  
    4040- (id)initWithFrame:(NSRect)frameRect sender:(id)sender; 
    4141- (BOOL) toggleFullScreen; 
    42 - (void) drawContent:(DisplayState *)ds; 
    4342- (void) resizeContent:(DisplayState *)ds width:(int)w height:(int)h; 
    4443- (NSImage *) screenshot:(NSSize)size; 
  • trunk/host-cocoa/cocoaQemuQuartzView.m

    r53 r58  
    2727#import "cocoaQemuQuartzView.h" 
    2828 
     29#define cgrect(nsrect) (*(CGRect *)&(nsrect)) 
    2930 
    3031@implementation cocoaQemuQuartzView 
     
    9192                        kCGRenderingIntentDefault //intent 
    9293                ); 
    93                 CGContextDrawImage (viewContextRef, CGRectMake(0, 0, rect.size.width, rect.size.height), imageRef); 
     94         
     95        /* new selective drawing code */ 
     96        if (CGImageCreateWithImageInRect != NULL) { 
     97         
     98            /* new selective drawing code (draws only dirty rectangles) (Tiger) */ 
     99            const NSRect *rectList; 
     100            int rectCount; 
     101            int i; 
     102            CGImageRef clipImageRef; 
     103            CGRect clipRect; 
     104            float dx; 
     105            float dy; 
     106             
     107            dx = [self frame].size.width / current_ds.width; 
     108            dy = [self frame].size.height / current_ds.height; 
     109         
     110            [self getRectsBeingDrawn:&rectList count:&rectCount]; 
     111            for (i = 0; i < rectCount; i++) { 
     112                clipRect.origin.x = rectList[i].origin.x / dx; 
     113                clipRect.origin.y = current_ds.height - (rectList[i].origin.y + rectList[i].size.height) / dy; 
     114                clipRect.size.width = rectList[i].size.width / dx; 
     115                clipRect.size.height = rectList[i].size.height / dy; 
     116             
     117                clipImageRef = CGImageCreateWithImageInRect( 
     118                    imageRef, 
     119                    clipRect 
     120                ); 
     121                CGContextDrawImage (viewContextRef, cgrect(rectList[i]), clipImageRef); 
     122                CGImageRelease (clipImageRef); 
     123            } 
     124             
     125        } else { 
     126         
     127            /* old drawing code (draws everything) (Panther) */ 
     128            CGContextDrawImage (viewContextRef, CGRectMake(0, 0, [self bounds].size.width, [self bounds].size.height), imageRef); 
     129 
     130        } 
    94131                CGImageRelease (imageRef); 
    95132        } 
     
    203240 
    204241        return fullscreen; 
    205 } 
    206  
    207 - (void) drawContent:(DisplayState *)ds 
    208 { 
    209 //      NSLog(@"quartzView: drawcontent"); 
    210  
    211         [self display]; 
    212242} 
    213243 
     
    305335                so we can handle clicks on other GUI Items */ 
    306336        if(fullscreen) { 
    307         /* exception: if the user activated the toolbar, mouse grab is released; so when he clicks on fullscreen view we have to grab again */ 
    308            if([pc fullscreenController] && [[pc fullscreenController] showsToolbar]) { 
    309                [[pc fullscreenController] toggleToolbar]; 
    310                [pc grabMouse]; 
    311            } 
    312337        } else if([pc absolute_enabled]) { 
    313338        if (![pc tablet_enabled]) 
  • trunk/qcontrol/cocoaControlController.m

    r49 r58  
    3434        /* preferences */ 
    3535        [[NSUserDefaults standardUserDefaults] registerDefaults:[[NSDictionary alloc] initWithObjects:[NSArray arrayWithObjects: 
    36                 [NSString stringWithString:@"OpenGL"], /* enable OpenGL */ 
     36                [NSString stringWithString:@"Quartz"], /* enable Quartz by default */ 
    3737                [NSNumber numberWithBool:TRUE], /* enable search for updates */ 
    3838                [@"~/Documents/QEMU" stringByExpandingTildeInPath], /* standart path */