gdiplus: Implement GdipGetPathGradientTransform.

This commit is contained in:
Vincent Povirk 2012-03-31 12:59:24 -05:00 committed by Alexandre Julliard
parent aed62dbff1
commit 52bf030b84
3 changed files with 37 additions and 5 deletions

View File

@ -78,6 +78,14 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
return stat;
}
stat = GdipCloneMatrix(src->transform, &dest->transform);
if(stat != Ok){
GdipDeletePath(dest->path);
GdipFree(dest);
return stat;
}
/* blending */
count = src->blendcount;
dest->blendcount = count;
@ -94,6 +102,7 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
if(!dest->blendfac || !dest->blendpos || !dest->surroundcolors ||
(pcount && (!dest->pblendcolor || !dest->pblendpos))){
GdipDeletePath(dest->path);
GdipDeleteMatrix(dest->transform);
GdipFree(dest->blendfac);
GdipFree(dest->blendpos);
GdipFree(dest->surroundcolors);
@ -503,6 +512,7 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect
static GpStatus create_path_gradient(GpPath *path, GpPathGradient **grad)
{
GpRectF bounds;
GpStatus stat;
if(!path || !grad)
return InvalidParameter;
@ -515,10 +525,18 @@ static GpStatus create_path_gradient(GpPath *path, GpPathGradient **grad)
return OutOfMemory;
}
stat = GdipCreateMatrix(&(*grad)->transform);
if (stat != Ok)
{
GdipFree(*grad);
return stat;
}
(*grad)->blendfac = GdipAlloc(sizeof(REAL));
(*grad)->blendpos = GdipAlloc(sizeof(REAL));
(*grad)->surroundcolors = GdipAlloc(sizeof(ARGB));
if(!(*grad)->blendfac || !(*grad)->blendpos || !(*grad)->surroundcolors){
GdipDeleteMatrix((*grad)->transform);
GdipFree((*grad)->blendfac);
GdipFree((*grad)->blendpos);
GdipFree((*grad)->surroundcolors);
@ -890,6 +908,7 @@ GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
{
case BrushTypePathGradient:
GdipDeletePath(((GpPathGradient*) brush)->path);
GdipDeleteMatrix(((GpPathGradient*) brush)->transform);
GdipFree(((GpPathGradient*) brush)->blendfac);
GdipFree(((GpPathGradient*) brush)->blendpos);
GdipFree(((GpPathGradient*) brush)->surroundcolors);
@ -1641,14 +1660,14 @@ GpStatus WINGDIPAPI GdipSetPathGradientTransform(GpPathGradient *grad,
GpStatus WINGDIPAPI GdipGetPathGradientTransform(GpPathGradient *grad,
GpMatrix *matrix)
{
static int calls;
TRACE("(%p,%p)\n", grad, matrix);
if(!(calls++))
FIXME("not implemented\n");
if (!grad || !matrix)
return InvalidParameter;
return NotImplemented;
memcpy(matrix, grad->transform, sizeof(GpMatrix));
return Ok;
}
GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform(GpPathGradient *grad,

View File

@ -201,6 +201,7 @@ struct GpPathGradient{
ARGB* pblendcolor; /* preset blend colors */
REAL* pblendpos; /* preset blend positions */
INT pblendcount;
GpMatrix *transform;
};
struct GpLineGradient{

View File

@ -1192,6 +1192,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
INT min_y, max_y, min_x, max_x;
INT x, y;
ARGB outer_color;
static int transform_fixme_once;
if (fill->focus.X != 0.0 || fill->focus.Y != 0.0)
{
@ -1221,6 +1222,17 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
FIXME("path gradient preset blend not implemented\n");
}
if (!transform_fixme_once)
{
BOOL is_identity=TRUE;
GdipIsMatrixIdentity(fill->transform, &is_identity);
if (!is_identity)
{
FIXME("path gradient transform not implemented\n");
transform_fixme_once = 1;
}
}
stat = GdipClonePath(fill->path, &flat_path);
if (stat != Ok)