[4/5] gdiplus: Implement GdipGetPathGradientTransform.
Vincent Povirk
madewokherd at gmail.com
Sat Mar 31 13:42:08 CDT 2012
-------------- next part --------------
From 9f864f3c79c218a2bae26a78f8a9fe30402aacc9 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Sat, 31 Mar 2012 12:59:24 -0500
Subject: [PATCH 4/8] gdiplus: Implement GdipGetPathGradientTransform.
---
dlls/gdiplus/brush.c | 29 ++++++++++++++++++++++++-----
dlls/gdiplus/gdiplus_private.h | 1 +
dlls/gdiplus/graphics.c | 12 ++++++++++++
3 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
index 07d32dc..aa02598 100644
--- a/dlls/gdiplus/brush.c
+++ b/dlls/gdiplus/brush.c
@@ -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,
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index c9853ec..5d5a92c 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -201,6 +201,7 @@ struct GpPathGradient{
ARGB* pblendcolor; /* preset blend colors */
REAL* pblendpos; /* preset blend positions */
INT pblendcount;
+ GpMatrix *transform;
};
struct GpLineGradient{
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 885d9a7..2c6c4b2 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -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)
--
1.7.2.5
More information about the wine-patches
mailing list