mirror of
https://github.com/reactos/wine.git
synced 2025-01-24 04:45:18 +00:00
winemac: Initialize window surface to Mac-standard window background color instead of black.
This commit is contained in:
parent
26a74c664d
commit
f37153ac7d
@ -1796,3 +1796,45 @@ void macdrv_remove_view_opengl_context(macdrv_view v, macdrv_opengl_context c)
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* macdrv_window_background_color
|
||||
*
|
||||
* Returns the standard Mac window background color as a 32-bit value of
|
||||
* the form 0x00rrggbb.
|
||||
*/
|
||||
uint32_t macdrv_window_background_color(void)
|
||||
{
|
||||
static uint32_t result;
|
||||
static dispatch_once_t once;
|
||||
|
||||
// Annoyingly, [NSColor windowBackgroundColor] refuses to convert to other
|
||||
// color spaces (RGB or grayscale). So, the only way to get RGB values out
|
||||
// of it is to draw with it.
|
||||
dispatch_once(&once, ^{
|
||||
OnMainThread(^{
|
||||
unsigned char rgbx[4];
|
||||
unsigned char *planes = rgbx;
|
||||
NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:&planes
|
||||
pixelsWide:1
|
||||
pixelsHigh:1
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:3
|
||||
hasAlpha:NO
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSCalibratedRGBColorSpace
|
||||
bitmapFormat:0
|
||||
bytesPerRow:4
|
||||
bitsPerPixel:32];
|
||||
[NSGraphicsContext saveGraphicsState];
|
||||
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]];
|
||||
[[NSColor windowBackgroundColor] set];
|
||||
NSRectFill(NSMakeRect(0, 0, 1, 1));
|
||||
[NSGraphicsContext restoreGraphicsState];
|
||||
[bitmap release];
|
||||
result = rgbx[0] << 16 | rgbx[1] << 8 | rgbx[2];
|
||||
});
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -347,6 +347,7 @@ extern void macdrv_dispose_view(macdrv_view v) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_set_view_window_and_frame(macdrv_view v, macdrv_window w, CGRect rect) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_add_view_opengl_context(macdrv_view v, macdrv_opengl_context c) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_remove_view_opengl_context(macdrv_view v, macdrv_opengl_context c) DECLSPEC_HIDDEN;
|
||||
extern uint32_t macdrv_window_background_color(void) DECLSPEC_HIDDEN;
|
||||
|
||||
|
||||
/* keyboard */
|
||||
|
@ -236,6 +236,7 @@ struct window_surface *create_surface(macdrv_window window, const RECT *rect,
|
||||
DWORD *colors;
|
||||
pthread_mutexattr_t attr;
|
||||
int err;
|
||||
DWORD window_background;
|
||||
|
||||
surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
FIELD_OFFSET(struct macdrv_window_surface, info.bmiColors[3]));
|
||||
@ -286,8 +287,10 @@ struct window_surface *create_surface(macdrv_window window, const RECT *rect,
|
||||
}
|
||||
update_blit_data(surface);
|
||||
surface->use_alpha = use_alpha;
|
||||
surface->bits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, surface->info.bmiHeader.biSizeImage);
|
||||
surface->bits = HeapAlloc(GetProcessHeap(), 0, surface->info.bmiHeader.biSizeImage);
|
||||
if (!surface->bits) goto failed;
|
||||
window_background = macdrv_window_background_color();
|
||||
memset_pattern4(surface->bits, &window_background, surface->info.bmiHeader.biSizeImage);
|
||||
|
||||
TRACE("created %p for %p %s bits %p-%p\n", surface, window, wine_dbgstr_rect(rect),
|
||||
surface->bits, surface->bits + surface->info.bmiHeader.biSizeImage);
|
||||
|
Loading…
x
Reference in New Issue
Block a user