diff options
author | Matthias Ringwald <mringwal@inf.ethz.ch> | 2008-10-30 21:57:36 +0100 |
---|---|---|
committer | Matthias Ringwald <mringwal@inf.ethz.ch> | 2008-10-30 21:57:36 +0100 |
commit | 9620f841cbb1aa8284b1c8aa40ddcb18611c056c (patch) | |
tree | c6da41d3159b3fc9acff6e883ccfc8737dbbdc1a | |
parent | a1a7416f7c6cac2dd7d5b7262e3b494dd2c451d3 (diff) | |
download | xine-lib-9620f841cbb1aa8284b1c8aa40ddcb18611c056c.tar.gz xine-lib-9620f841cbb1aa8284b1c8aa40ddcb18611c056c.tar.bz2 |
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.
--HG--
extra : transplant_source : %A6-%ADwyY%EE%C8%26%E2%5E%2A%83%0A%0B/%CBM%23%0F
-rw-r--r-- | src/video_out/video_out_directx.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index f1136eab0..529968bec 100644 --- a/src/video_out/video_out_directx.c +++ b/src/video_out/video_out_directx.c @@ -117,7 +117,7 @@ typedef struct { 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 @@ static boolean CreateSecondary( win32_driver_t * win32_driver, int width, int he 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 @@ static boolean CheckPixelFormat( win32_driver_t * win32_driver ) 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 @@ static boolean CheckPixelFormat( win32_driver_t * win32_driver ) win32_driver->mode = MODE_15_BGR; } + lprintf("win32 mode: %u\n", win32_driver->mode); return TRUE; } |