From 2fc4e65aa106fef8b2dfa7572269c525b50bc012 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Tue, 28 Apr 2009 18:25:59 -0500 Subject: [PATCH] gdiplus: implement GdipSetLineBlend --- dlls/gdiplus/brush.c | 30 +++++++++++++++++++++++++----- 1 files changed, 25 insertions(+), 5 deletions(-) diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c index 231fe36..2de175c 100644 --- a/dlls/gdiplus/brush.c +++ b/dlls/gdiplus/brush.c @@ -1114,15 +1114,35 @@ GpStatus WINGDIPAPI GdipScaleTextureTransform(GpTexture* brush, } GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush, - GDIPCONST REAL *blend, GDIPCONST REAL* positions, INT count) + GDIPCONST REAL *factors, GDIPCONST REAL* positions, INT count) { - static int calls; + REAL *new_blendfac, *new_blendpos; - if(!brush || !blend || !positions || count <= 0) + TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count); + + if(!brush || !factors || !positions || count <= 0 || + (count >= 2 && (positions[0] != 0.0f || positions[count-1] != 1.0f))) return InvalidParameter; - if(!(calls++)) - FIXME("not implemented\n"); + new_blendfac = GdipAlloc(count * sizeof(REAL)); + new_blendpos = GdipAlloc(count * sizeof(REAL)); + + if (!new_blendfac || !new_blendpos) + { + GdipFree(new_blendfac); + GdipFree(new_blendpos); + return OutOfMemory; + } + + memcpy(new_blendfac, factors, count * sizeof(REAL)); + memcpy(new_blendpos, positions, count * sizeof(REAL)); + + GdipFree(brush->blendfac); + GdipFree(brush->blendpos); + + brush->blendcount = count; + brush->blendfac = new_blendfac; + brush->blendpos = new_blendpos; return Ok; } -- 1.5.4.3