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

View File

@ -201,6 +201,7 @@ struct GpPathGradient{
ARGB* pblendcolor; /* preset blend colors */ ARGB* pblendcolor; /* preset blend colors */
REAL* pblendpos; /* preset blend positions */ REAL* pblendpos; /* preset blend positions */
INT pblendcount; INT pblendcount;
GpMatrix *transform;
}; };
struct GpLineGradient{ 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 min_y, max_y, min_x, max_x;
INT x, y; INT x, y;
ARGB outer_color; ARGB outer_color;
static int transform_fixme_once;
if (fill->focus.X != 0.0 || fill->focus.Y != 0.0) 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"); 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); stat = GdipClonePath(fill->path, &flat_path);
if (stat != Ok) if (stat != Ok)