This patch implements the GRADIENT_FILL_RECT_{H|V} cases of GDI32.GdiGradientFill. It also makes a redirect from msimg32.GradientFill as noticed by Roderick Colenbrander. This makes the eMule menu looks much better. a+ Max Changelog: * Implements the GRADIENT_FILL_RECT{H|V} cases of GdiGradientFill -- Maxime Bellengà <maxime.bellenge@laposte.net>
Index: wine/dlls/gdi/gdi32.spec =================================================================== RCS file: /home/wine/wine/dlls/gdi/gdi32.spec,v retrieving revision 1.26 diff -u -r1.26 gdi32.spec --- wine/dlls/gdi/gdi32.spec 20 Mar 2003 03:53:15 -0000 1.26 +++ wine/dlls/gdi/gdi32.spec 7 Apr 2003 18:18:24 -0000 @@ -157,6 +157,7 @@ @ stub GdiGetLocalBrush @ stub GdiGetLocalDC @ stub GdiGetLocalFont +@ stdcall GdiGradientFill(long ptr long ptr long long) @ stub GdiIsMetaFileDC @ stub GdiPlayDCScript @ stub GdiPlayJournal Index: wine/graphics/painting.c =================================================================== RCS file: /home/wine/wine/graphics/painting.c,v retrieving revision 1.54 diff -u -r1.54 painting.c --- wine/graphics/painting.c 3 Dec 2002 19:18:42 -0000 1.54 +++ wine/graphics/painting.c 7 Apr 2003 18:19:36 -0000 @@ -1065,3 +1065,73 @@ TRACE("Produced %d points\n", *nPtsOut); return out; } + +/****************************************************************************** + * GradientFill (GDI32.@) + */ +BOOL WINAPI GdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert, + void * grad_array, ULONG ngrad, ULONG mode ) +{ + int i,j,y,x; + GRADIENT_RECT *rect; + double ired,igreen,iblue; + double red, green,blue; + + TRACE("vert_array:0x%08lx nvert:%ld grad_array:0x%08lx ngrad:%ld\n",(long)vert_array,nvert,(long)grad_array,ngrad); + + switch(mode) { + case GRADIENT_FILL_RECT_H: + for(i=0;i<ngrad;i++) { + rect = (GRADIENT_RECT*)((long)grad_array+i*sizeof(GRADIENT_RECT)); + y = vert_array[rect->UpperLeft].y; + /* Precompute some stuffs to speed up a little bit */ + ired = (double)(vert_array[rect->LowerRight].Red - vert_array[rect->UpperLeft].Red) / (double)(vert_array[rect->LowerRight].x - vert_array[rect->UpperLeft].x); + igreen = (double)(vert_array[rect->LowerRight].Green - vert_array[rect->UpperLeft].Green) / (double)(vert_array[rect->LowerRight].x - vert_array[rect->UpperLeft].x); + iblue = (double)(vert_array[rect->LowerRight].Blue - vert_array[rect->UpperLeft].Blue) / (double)(vert_array[rect->LowerRight].x - vert_array[rect->UpperLeft].x); + red = vert_array[rect->UpperLeft].Red; + green = vert_array[rect->UpperLeft].Green; + blue = vert_array[rect->UpperLeft].Blue; + /* Draw the first line */ + for (j=vert_array[rect->UpperLeft].x; j<=vert_array[rect->LowerRight].x; j++) { + SetPixel(hdc,j,y,RGB(((int)red)>>8,((int)green)>>8,((int)blue)>>8)); + red += ired; + green += igreen; + blue += iblue; + } + /* Extends to the correct size */ + StretchBlt(hdc,vert_array[rect->UpperLeft].x, y+1,(vert_array[rect->LowerRight].x - vert_array[rect->UpperLeft].x), (vert_array[rect->LowerRight].y - y - 1), + hdc,vert_array[rect->UpperLeft].x, y , (vert_array[rect->LowerRight].x - vert_array[rect->UpperLeft].x), 1, SRCCOPY); + } + break; + case GRADIENT_FILL_RECT_V: + for(i=0;i<ngrad;i++) { + rect = (GRADIENT_RECT*)((long)grad_array+i*sizeof(GRADIENT_RECT)); + x = vert_array[rect->UpperLeft].x; + /* Precompute some stuffs to speed up a little bit */ + ired = (double)(vert_array[rect->LowerRight].Red - vert_array[rect->UpperLeft].Red) / (double)(vert_array[rect->LowerRight].y - vert_array[rect->UpperLeft].y); + igreen = (double)(vert_array[rect->LowerRight].Green - vert_array[rect->UpperLeft].Green) / (double)(vert_array[rect->LowerRight].y - vert_array[rect->UpperLeft].y); + iblue = (double)(vert_array[rect->LowerRight].Blue - vert_array[rect->UpperLeft].Blue) / (double)(vert_array[rect->LowerRight].y - vert_array[rect->UpperLeft].y); + red = vert_array[rect->UpperLeft].Red; + green = vert_array[rect->UpperLeft].Green; + blue = vert_array[rect->UpperLeft].Blue; + /* Draw the first line */ + for (j=vert_array[rect->UpperLeft].y; j<=vert_array[rect->LowerRight].y; j++) { + SetPixel(hdc,x,j,RGB(((int)red)>>8,((int)green)>>8,((int)blue)>>8)); + red += ired; + green += igreen; + blue += iblue; + } + /* Extends to the correct size */ + StretchBlt(hdc,x+1,vert_array[rect->UpperLeft].y, + (vert_array[rect->LowerRight].x - vert_array[rect->UpperLeft].x) - 1, (vert_array[rect->LowerRight].y - vert_array[rect->UpperLeft].y), + hdc, x, vert_array[rect->UpperLeft].y, 1, (vert_array[rect->LowerRight].y - vert_array[rect->UpperLeft].y), SRCCOPY); + } + break; + case GRADIENT_FILL_TRIANGLE: + FIXME("GRADIENT_FILL_TRIANGLE stub\n"); + default: + return FALSE; + } + + return TRUE; +} Index: wine/dlls/msimg32/msimg32.spec =================================================================== RCS file: /home/wine/wine/dlls/msimg32/msimg32.spec,v retrieving revision 1.7 diff -u -r1.7 msimg32.spec --- wine/dlls/msimg32/msimg32.spec 20 Mar 2003 03:53:14 -0000 1.7 +++ wine/dlls/msimg32/msimg32.spec 7 Apr 2003 18:20:08 -0000 @@ -1,5 +1,5 @@ @ stdcall AlphaBlend(long long long long long long long long long long long) @ stub DllInitialize -@ stdcall GradientFill(long ptr long ptr long long) +@ stdcall GradientFill(long ptr long ptr long long) gdi32.GdiGradientFill @ stdcall TransparentBlt(long long long long long long long long long long long) @ stdcall vSetDdrawflag() Index: wine/dlls/msimg32/msimg32_main.c =================================================================== RCS file: /home/wine/wine/dlls/msimg32/msimg32_main.c,v retrieving revision 1.5 diff -u -r1.5 msimg32_main.c --- wine/dlls/msimg32/msimg32_main.c 18 Oct 2002 23:48:59 -0000 1.5 +++ wine/dlls/msimg32/msimg32_main.c 7 Apr 2003 18:20:08 -0000 @@ -23,19 +23,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msimg32); - -/****************************************************************************** - * GradientFill (MSIMG32.@) - */ -BOOL WINAPI GradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert, - void * grad_array, ULONG ngrad, ULONG mode ) -{ - FIXME("stub: %ld vertices %ld gradients mode %lx\n", nvert, ngrad, mode); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - /****************************************************************************** * AlphaBlend (MSIMG32.@) */