⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdl_quartzwindow.m

📁 MPEG-4编解码的实现(包括MPEG4视音频编解码)
💻 M
字号:
/* Subclass of NSWindow to allow customization if we need it */

@interface SDL_QuartzWindow : NSWindow
{}
- (void)miniaturize:(id)sender;
- (void)deminiaturize:(id)sender;
- (void)display;
@end

/**
 * Function to set the opacity of window's pixels to 100% 
 * The opacity is only used by the window server code that does the minimize effect
 **/
static void QZ_SetPortAlphaOpaque (CGrafPtr port, Uint32 noTitleBar) {
    
    Uint32 *pixels;
    Uint32  rowPixels;
    Uint32  width, height;
    Uint32  bpp;
    PixMapHandle pixMap;
    Rect bounds;
    int i, j;
    
    pixMap = GetPortPixMap ( port );
    bpp = GetPixDepth ( pixMap );
    
    if (bpp == 32) {
    
        GetPortBounds ( port, &bounds );
        width = bounds.right - bounds.left;
        height = bounds.bottom - bounds.top;
        
        LockPortBits (port);
        
        pixels = (Uint32*) GetPixBaseAddr ( pixMap );
        rowPixels = GetPixRowBytes ( pixMap ) / 4;
        
        if (! noTitleBar) {
        
            /* offset for title bar */
            pixels += rowPixels * 22;
        }
            
        for (i = 0; i < height; i++)
            for (j = 0; j < width; j++) {
        
                pixels[ (i * rowPixels) + j ] |= 0xFF000000;
            }
            
        UnlockPortBits (port);
    }
}

@implementation SDL_QuartzWindow

/* override these methods to fix the miniaturize animation/dock icon bug */
- (void)miniaturize:(id)sender
{
    
    if (SDL_VideoSurface->flags & SDL_OPENGL) {
    
        /* Grab framebuffer and put into NSImage */
        /* [ qz_window setMiniwindowImage:image ]; */
    }
    else {
        
        QZ_SetPortAlphaOpaque ([ [ self contentView ] qdPort ], 
                               [ self styleMask ] & NSBorderlessWindowMask);
    }
    
    [ super miniaturize:sender ];
}

/* this routine fires *after* deminiaturizing, so it might be useless to us */
- (void)deminiaturize:(id)sender
{
   [ super deminiaturize:sender ];
}

- (void)display
{
    /* Do nothing to keep pinstripe pattern from drawing */
}
@end

/* Delegate for our NSWindow to send SDLQuit() on close */
@interface SDL_QuartzWindowDelegate : NSObject
{}
- (BOOL)windowShouldClose:(id)sender;
@end

@implementation SDL_QuartzWindowDelegate
- (BOOL)windowShouldClose:(id)sender {

    SDL_PrivateQuit();
    return NO;
}

@end

/* empty class; probably could be used to fix bugs in the future */
@interface SDL_QuartzWindowView : NSQuickDrawView
{}
@end

@implementation SDL_QuartzWindowView

@end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -