This patch implements the GRADIENT_FILL_RECT_{H|V} cases of GradientFill. This makes the eMule menu looks much better. a+ Max -- Maxime Bellengà <maxime.bellenge@laposte.net>
Index: wine/dlls/msimg32/Makefile.in =================================================================== RCS file: /home/wine/wine/dlls/msimg32/Makefile.in,v retrieving revision 1.6 diff -u -r1.6 Makefile.in --- wine/dlls/msimg32/Makefile.in 11 Oct 2002 04:20:07 -0000 1.6 +++ wine/dlls/msimg32/Makefile.in 5 Apr 2003 21:24:53 -0000 @@ -3,7 +3,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = msimg32.dll -IMPORTS = kernel32 +IMPORTS = kernel32 gdi32 LDDLLFLAGS = @LDDLLFLAGS@ SYMBOLFILE = $(MODULE).tmp.o 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 5 Apr 2003 21:24:53 -0000 @@ -30,9 +30,68 @@ 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); + 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; }