Quartz: Restore 1.2.14 behaviour of letting apps draw from background thread.
Strictly speaking, this isn't encouraged, but it's a regression. --HG-- branch : SDL-1.2 extra : rebase_source : a75c40b16b7f8f83ef36a66114de1e27e2435eb3
This commit is contained in:
parent
548fbf5264
commit
47e574b123
2 changed files with 10 additions and 5 deletions
|
@ -93,6 +93,7 @@ typedef struct SDL_PrivateVideoData {
|
||||||
const void *save_mode; /* original mode of the display */
|
const void *save_mode; /* original mode of the display */
|
||||||
CGDirectPaletteRef palette; /* palette of an 8-bit display */
|
CGDirectPaletteRef palette; /* palette of an 8-bit display */
|
||||||
NSOpenGLContext *gl_context; /* OpenGL rendering context */
|
NSOpenGLContext *gl_context; /* OpenGL rendering context */
|
||||||
|
NSGraphicsContext *nsgfx_context; /* Cocoa graphics context */
|
||||||
Uint32 width, height, bpp; /* frequently used data about the display */
|
Uint32 width, height, bpp; /* frequently used data about the display */
|
||||||
Uint32 flags; /* flags for current mode, for teardown purposes */
|
Uint32 flags; /* flags for current mode, for teardown purposes */
|
||||||
Uint32 video_set; /* boolean; indicates if video was set correctly */
|
Uint32 video_set; /* boolean; indicates if video was set correctly */
|
||||||
|
@ -132,6 +133,7 @@ typedef struct SDL_PrivateVideoData {
|
||||||
#define allow_screensaver (this->hidden->allow_screensaver)
|
#define allow_screensaver (this->hidden->allow_screensaver)
|
||||||
#define palette (this->hidden->palette)
|
#define palette (this->hidden->palette)
|
||||||
#define gl_context (this->hidden->gl_context)
|
#define gl_context (this->hidden->gl_context)
|
||||||
|
#define nsgfx_context (this->hidden->nsgfx_context)
|
||||||
#define device_width (this->hidden->width)
|
#define device_width (this->hidden->width)
|
||||||
#define device_height (this->hidden->height)
|
#define device_height (this->hidden->height)
|
||||||
#define device_bpp (this->hidden->bpp)
|
#define device_bpp (this->hidden->bpp)
|
||||||
|
|
|
@ -1149,9 +1149,8 @@ static SDL_Surface* QZ_SetVideoModeInternal (_THIS, SDL_Surface *current,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qz_window != nil) {
|
if (qz_window != nil) {
|
||||||
NSGraphicsContext *ctx;
|
nsgfx_context = [NSGraphicsContext graphicsContextWithWindow:qz_window];
|
||||||
ctx = [NSGraphicsContext graphicsContextWithWindow:qz_window];
|
[NSGraphicsContext setCurrentContext:nsgfx_context];
|
||||||
[NSGraphicsContext setCurrentContext:ctx];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the new pixel format */
|
/* Setup the new pixel format */
|
||||||
|
@ -1507,8 +1506,12 @@ static void QZ_UpdateRects (_THIS, int numRects, SDL_Rect *rects)
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
CGContextRef cgc = (CGContextRef)
|
NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
|
||||||
[[NSGraphicsContext currentContext] graphicsPort];
|
if (ctx != nsgfx_context) { /* uhoh, you might be rendering from another thread... */
|
||||||
|
[NSGraphicsContext setCurrentContext:nsgfx_context];
|
||||||
|
ctx = nsgfx_context;
|
||||||
|
}
|
||||||
|
CGContextRef cgc = (CGContextRef) [ctx graphicsPort];
|
||||||
QZ_DrawResizeIcon (this);
|
QZ_DrawResizeIcon (this);
|
||||||
CGContextFlush (cg_context);
|
CGContextFlush (cg_context);
|
||||||
CGImageRef image = CGBitmapContextCreateImage (cg_context);
|
CGImageRef image = CGBitmapContextCreateImage (cg_context);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue