[DDraw] Fix AoE2 font rendering (in most cases)
Oliver Stieber
oliver_stieber at yahoo.co.uk
Sun Nov 13 12:17:19 CST 2005
--- Lionel Ulmer <lionel.ulmer at free.fr> wrote:
> Hi all,
>
> AoE2 was rendering to a 8 bit off-screen DSurface using GetDC / ReleaseDC
> and that without having attached a palette to it... Our DIB engine did not
> like this at all which made all fonts come out black.
>
> The attached patch ('hack' :-) ) simply takes the palette of the front
> buffer (if any) and attach it to the DIB before rendering to it.
>
> Note that the proper fix would be in the DIB engine itself but I have no
> idea how to (nor the means to) fix it there (if possible using the X11
> engine we currently have).
Hi,
Does this fix bug http://bugs.winehq.org/show_bug.cgi?id=2666 including the problems with
warblade?
Oliver.
> Lionel
>
> Changelog:
> - use the front buffer palette for DC operations on off-screen buffers
>
> --
> Lionel Ulmer - http://www.bbrox.org/
> > Index: dlls/ddraw/surface_main.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/ddraw/surface_main.c,v
> retrieving revision 1.8
> diff -u -r1.8 surface_main.c
> --- dlls/ddraw/surface_main.c 10 Nov 2005 12:14:59 -0000 1.8
> +++ dlls/ddraw/surface_main.c 13 Nov 2005 14:08:56 -0000
> @@ -900,6 +900,31 @@
> }
>
> hr = This->get_dc(This, &This->hDC);
> +
> + if ((This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) &&
> + (This->palette == NULL)) {
> + IDirectDrawImpl *ddraw = This->ddraw_owner;
> + IDirectDrawSurfaceImpl *surf;
> +
> + for (surf = ddraw->surfaces; surf != NULL; surf = surf->next_ddraw) {
> + if (((surf->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER))
> == (DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER)) &&
> + (surf->palette != NULL)) {
> + RGBQUAD col[256];
> + IDirectDrawPaletteImpl *pal = surf->palette;
> + unsigned int n;
> + for (n=0; n<256; n++) {
> + col[n].rgbRed = pal->palents[n].peRed;
> + col[n].rgbGreen = pal->palents[n].peGreen;
> + col[n].rgbBlue = pal->palents[n].peBlue;
> + col[n].rgbReserved = 0;
> + }
> + SetDIBColorTable(This->hDC, 0, 256, col);
> + break;
> + }
> + }
> +
> + }
> +
> if (SUCCEEDED(hr))
> {
> TRACE("returning %p\n",This->hDC);
> >
>
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
More information about the wine-devel
mailing list