From: Matthias R. <mri...@in...> - 2008-10-30 21:00:21
|
# HG changeset patch # User Matthias Ringwald <mri...@in...> # Date 1225400256 -3600 # Node ID a8966d431c955ad70c121488492eddb354fd11de # Parent 15453fe24c4bd590d017d9cddd213e716eb947be Create secondary buffer with correct pixelformat If neither YV12 nor YUV2 format is supported by DirectX, a secondary buffer with the same pixelformat as the primary buffer is used. However, the pixel format of the primary was not passed to CreateSurface, instead a 16 bit pixelformat was created, which is the reason why the video was broken on 24bit or 32bit desktops. diff -r 15453fe24c4b -r a8966d431c95 src/video_out/video_out_directx.c --- a/src/video_out/video_out_directx.c Sun Oct 19 16:55:34 2008 +0200 +++ b/src/video_out/video_out_directx.c Thu Oct 30 21:57:36 2008 +0100 @@ -117,7 +117,7 @@ yuv2rgb_t *yuv2rgb; /* used for format conversion */ int mode; /* rgb mode */ int bytespp; /* rgb bits per pixel */ - + DDPIXELFORMAT primary_pixel_format; alphablend_t alphablend_extra_data; } win32_driver_t; @@ -367,8 +367,9 @@ lprintf("CreateSecondary() - Falling back to back buffer same as primary\n"); lprintf("CreateSecondary() - act_format = (NATIVE) %d\n", IMGFMT_NATIVE); - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; + ddsd.ddpfPixelFormat = win32_driver->primary_pixel_format; win32_driver->act_format = IMGFMT_NATIVE; if( IDirectDraw_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->secondary, 0 ) == DD_OK ) @@ -429,6 +430,10 @@ Error( 0, "IDirectDrawSurface_GetPixelFormat ( CheckPixelFormat ) : error 0x%lx", result ); return 0; } + + /* store pixel format for CreateSecondary */ + + win32_driver->primary_pixel_format = ddpf; /* TODO : support paletized video modes */ @@ -478,6 +483,7 @@ win32_driver->mode = MODE_15_BGR; } + lprintf("win32 mode: %u\n", win32_driver->mode); return TRUE; } |