You should also update GdipCloneBrush so that it makes a copy of this new array.
On Sun, Mar 28, 2010 at 11:22 PM, Justin Chevrier <[email protected]> wrote: > Now taking a copy of the color array. Thanks Nikolay > --- > dlls/gdiplus/brush.c | 27 +++++++++++++++++++-------- > dlls/gdiplus/gdiplus_private.h | 2 ++ > dlls/gdiplus/tests/brush.c | 6 +++--- > 3 files changed, 24 insertions(+), 11 deletions(-) > > diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c > index 8994b87..7f5c8f7 100644 > --- a/dlls/gdiplus/brush.c > +++ b/dlls/gdiplus/brush.c > @@ -578,9 +578,10 @@ GpStatus WINGDIPAPI GdipCreatePathGradient(GDIPCONST > GpPointF* points, > GdipFree(*grad); > return OutOfMemory; > } > - (*grad)->blendfac[0] = 1.0; > - (*grad)->blendpos = NULL; > - (*grad)->blendcount = 1; > + (*grad)->blendfac[0] = 1.0; > + (*grad)->blendpos = NULL; > + (*grad)->blendcount = 1; > + (*grad)->surroundcolors = NULL; > > (*grad)->pathdata.Count = count; > (*grad)->pathdata.Points = GdipAlloc(count * sizeof(PointF)); > @@ -946,6 +947,7 @@ GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush) > GdipFree(((GpPathGradient*) brush)->pathdata.Types); > GdipFree(((GpPathGradient*) brush)->blendfac); > GdipFree(((GpPathGradient*) brush)->blendpos); > + GdipFree(((GpPathGradient*) brush)->surroundcolors); > break; > case BrushTypeSolidColor: > if (((GpSolidFill*)brush)->bmp) > @@ -1174,7 +1176,9 @@ GpStatus WINGDIPAPI > GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, > if (!brush || !count) > return InvalidParameter; > > - return NotImplemented; > + *count = brush->surroundcolorcount; > + > + return Ok; > } > > GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient *brush, > @@ -1544,7 +1548,7 @@ GpStatus WINGDIPAPI > GdipSetPathGradientSigmaBlend(GpPathGradient *grad, > GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient > *grad, GDIPCONST ARGB *argb, INT *count) > { > - static int calls; > + ARGB *new_colors; > > TRACE("(%p,%p,%p)\n", grad, argb, count); > > @@ -1552,10 +1556,17 @@ GpStatus WINGDIPAPI > GdipSetPathGradientSurroundColorsWithCount(GpPathGradient > (*count > grad->pathdata.Count)) > return InvalidParameter; > > - if(!(calls++)) > - FIXME("not implemented\n"); > + new_colors = GdipAlloc(*count * sizeof(ARGB)); > + if (!new_colors) return OutOfMemory; > > - return NotImplemented; > + memcpy(new_colors, argb, *count * sizeof(ARGB)); > + > + GdipFree(grad->surroundcolors); > + > + grad->surroundcolorcount = *count; > + grad->surroundcolors = new_colors; > + > + return Ok; > } > > GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient *grad, > diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h > index ca1cba6..eddde11 100644 > --- a/dlls/gdiplus/gdiplus_private.h > +++ b/dlls/gdiplus/gdiplus_private.h > @@ -151,6 +151,8 @@ struct GpPathGradient{ > GpBrush brush; > PathData pathdata; > ARGB centercolor; > + INT surroundcolorcount; > + ARGB* surroundcolors; > GpWrapMode wrap; > BOOL gamma; > GpPointF center; > diff --git a/dlls/gdiplus/tests/brush.c b/dlls/gdiplus/tests/brush.c > index 0effcf4..820cb4e 100644 > --- a/dlls/gdiplus/tests/brush.c > +++ b/dlls/gdiplus/tests/brush.c > @@ -683,7 +683,7 @@ static void test_gradientsurroundcolorcount(void) > } > > status = GdipSetPathGradientSurroundColorsWithCount(grad, color, &count); > - todo_wine expect(Ok, status); > + expect(Ok, status); > expect(2, count); > > status = GdipGetPathGradientSurroundColorCount(NULL, &count); > @@ -694,8 +694,8 @@ static void test_gradientsurroundcolorcount(void) > > count = 0; > status = GdipGetPathGradientSurroundColorCount(grad, &count); > - todo_wine expect(Ok, status); > - todo_wine expect(2, count); > + expect(Ok, status); > + expect(2, count); > > GdipFree(color); > GdipDeleteBrush((GpBrush*)grad); > -- > 1.6.5.rc1 > > > >
