gdiplus: Store transformation matrix directly in the objects.
This commit is contained in:
parent
0c8dc0090b
commit
39ec8ce67e
|
@ -78,13 +78,7 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
|
||||||
return stat;
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
stat = GdipCloneMatrix(src->transform, &dest->transform);
|
dest->transform = src->transform;
|
||||||
|
|
||||||
if(stat != Ok){
|
|
||||||
GdipDeletePath(dest->path);
|
|
||||||
GdipFree(dest);
|
|
||||||
return stat;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* blending */
|
/* blending */
|
||||||
count = src->blendcount;
|
count = src->blendcount;
|
||||||
|
@ -102,7 +96,6 @@ 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);
|
||||||
|
@ -184,7 +177,7 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
|
||||||
|
|
||||||
if (stat == Ok)
|
if (stat == Ok)
|
||||||
{
|
{
|
||||||
memcpy(new_texture->transform, texture->transform, sizeof(GpMatrix));
|
new_texture->transform = texture->transform;
|
||||||
*clone = (GpBrush*)new_texture;
|
*clone = (GpBrush*)new_texture;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -512,7 +505,6 @@ GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect
|
||||||
static GpStatus create_path_gradient(GpPath *path, ARGB centercolor, GpPathGradient **grad)
|
static GpStatus create_path_gradient(GpPath *path, ARGB centercolor, GpPathGradient **grad)
|
||||||
{
|
{
|
||||||
GpRectF bounds;
|
GpRectF bounds;
|
||||||
GpStatus stat;
|
|
||||||
|
|
||||||
if(!path || !grad)
|
if(!path || !grad)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
@ -528,18 +520,12 @@ static GpStatus create_path_gradient(GpPath *path, ARGB centercolor, GpPathGradi
|
||||||
return OutOfMemory;
|
return OutOfMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
stat = GdipCreateMatrix(&(*grad)->transform);
|
GdipSetMatrixElements(&(*grad)->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
||||||
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);
|
||||||
|
@ -792,9 +778,7 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((status = GdipCreateMatrix(&(*texture)->transform)) != Ok){
|
GdipSetMatrixElements(&(*texture)->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imageattr)
|
if (imageattr)
|
||||||
{
|
{
|
||||||
|
@ -821,7 +805,6 @@ exit:
|
||||||
{
|
{
|
||||||
if (*texture)
|
if (*texture)
|
||||||
{
|
{
|
||||||
GdipDeleteMatrix((*texture)->transform);
|
|
||||||
GdipDisposeImageAttributes((*texture)->imageattributes);
|
GdipDisposeImageAttributes((*texture)->imageattributes);
|
||||||
GdipFree(*texture);
|
GdipFree(*texture);
|
||||||
*texture = NULL;
|
*texture = NULL;
|
||||||
|
@ -920,7 +903,6 @@ 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);
|
||||||
|
@ -934,7 +916,6 @@ GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
|
||||||
GdipFree(((GpLineGradient*)brush)->pblendpos);
|
GdipFree(((GpLineGradient*)brush)->pblendpos);
|
||||||
break;
|
break;
|
||||||
case BrushTypeTextureFill:
|
case BrushTypeTextureFill:
|
||||||
GdipDeleteMatrix(((GpTexture*)brush)->transform);
|
|
||||||
GdipDisposeImage(((GpTexture*)brush)->image);
|
GdipDisposeImage(((GpTexture*)brush)->image);
|
||||||
GdipDisposeImageAttributes(((GpTexture*)brush)->imageattributes);
|
GdipDisposeImageAttributes(((GpTexture*)brush)->imageattributes);
|
||||||
GdipFree(((GpTexture*)brush)->bitmap_bits);
|
GdipFree(((GpTexture*)brush)->bitmap_bits);
|
||||||
|
@ -1226,7 +1207,7 @@ GpStatus WINGDIPAPI GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix)
|
||||||
if(!brush || !matrix)
|
if(!brush || !matrix)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
memcpy(matrix, brush->transform, sizeof(GpMatrix));
|
*matrix = brush->transform;
|
||||||
|
|
||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
@ -1257,7 +1238,7 @@ GpStatus WINGDIPAPI GdipMultiplyTextureTransform(GpTexture* brush,
|
||||||
if(!brush || !matrix)
|
if(!brush || !matrix)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
return GdipMultiplyMatrix(brush->transform, matrix, order);
|
return GdipMultiplyMatrix(&brush->transform, matrix, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -1270,7 +1251,7 @@ GpStatus WINGDIPAPI GdipResetTextureTransform(GpTexture* brush)
|
||||||
if(!brush)
|
if(!brush)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
return GdipSetMatrixElements(brush->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
return GdipSetMatrixElements(&brush->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -1284,7 +1265,7 @@ GpStatus WINGDIPAPI GdipScaleTextureTransform(GpTexture* brush,
|
||||||
if(!brush)
|
if(!brush)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
return GdipScaleMatrix(brush->transform, sx, sy, order);
|
return GdipScaleMatrix(&brush->transform, sx, sy, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
|
GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
|
||||||
|
@ -1758,7 +1739,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientTransform(GpPathGradient *grad,
|
||||||
if (!grad || !matrix)
|
if (!grad || !matrix)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
memcpy(grad->transform, matrix, sizeof(GpMatrix));
|
grad->transform = *matrix;
|
||||||
|
|
||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
@ -1771,7 +1752,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientTransform(GpPathGradient *grad,
|
||||||
if (!grad || !matrix)
|
if (!grad || !matrix)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
memcpy(matrix, grad->transform, sizeof(GpMatrix));
|
*matrix = grad->transform;
|
||||||
|
|
||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
@ -1784,7 +1765,7 @@ GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform(GpPathGradient *grad,
|
||||||
if (!grad)
|
if (!grad)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
return GdipMultiplyMatrix(grad->transform, matrix, order);
|
return GdipMultiplyMatrix(&grad->transform, matrix, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipResetPathGradientTransform(GpPathGradient *grad)
|
GpStatus WINGDIPAPI GdipResetPathGradientTransform(GpPathGradient *grad)
|
||||||
|
@ -1794,7 +1775,7 @@ GpStatus WINGDIPAPI GdipResetPathGradientTransform(GpPathGradient *grad)
|
||||||
if (!grad)
|
if (!grad)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
return GdipSetMatrixElements(grad->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
return GdipSetMatrixElements(&grad->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipRotatePathGradientTransform(GpPathGradient *grad,
|
GpStatus WINGDIPAPI GdipRotatePathGradientTransform(GpPathGradient *grad,
|
||||||
|
@ -1805,7 +1786,7 @@ GpStatus WINGDIPAPI GdipRotatePathGradientTransform(GpPathGradient *grad,
|
||||||
if (!grad)
|
if (!grad)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
return GdipRotateMatrix(grad->transform, angle, order);
|
return GdipRotateMatrix(&grad->transform, angle, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipScalePathGradientTransform(GpPathGradient *grad,
|
GpStatus WINGDIPAPI GdipScalePathGradientTransform(GpPathGradient *grad,
|
||||||
|
@ -1816,7 +1797,7 @@ GpStatus WINGDIPAPI GdipScalePathGradientTransform(GpPathGradient *grad,
|
||||||
if (!grad)
|
if (!grad)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
return GdipScaleMatrix(grad->transform, sx, sy, order);
|
return GdipScaleMatrix(&grad->transform, sx, sy, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipTranslatePathGradientTransform(GpPathGradient *grad,
|
GpStatus WINGDIPAPI GdipTranslatePathGradientTransform(GpPathGradient *grad,
|
||||||
|
@ -1827,7 +1808,7 @@ GpStatus WINGDIPAPI GdipTranslatePathGradientTransform(GpPathGradient *grad,
|
||||||
if (!grad)
|
if (!grad)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
return GdipTranslateMatrix(grad->transform, dx, dy, order);
|
return GdipTranslateMatrix(&grad->transform, dx, dy, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
|
GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
|
||||||
|
@ -1852,7 +1833,7 @@ GpStatus WINGDIPAPI GdipSetTextureTransform(GpTexture *texture,
|
||||||
if(!texture || !matrix)
|
if(!texture || !matrix)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
memcpy(texture->transform, matrix, sizeof(GpMatrix));
|
texture->transform = *matrix;
|
||||||
|
|
||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
@ -1912,7 +1893,7 @@ GpStatus WINGDIPAPI GdipRotateTextureTransform(GpTexture* brush, REAL angle,
|
||||||
if(!brush)
|
if(!brush)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
return GdipRotateMatrix(brush->transform, angle, order);
|
return GdipRotateMatrix(&brush->transform, angle, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus,
|
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus,
|
||||||
|
@ -2098,7 +2079,7 @@ GpStatus WINGDIPAPI GdipTranslateTextureTransform(GpTexture* brush, REAL dx, REA
|
||||||
if(!brush)
|
if(!brush)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
return GdipTranslateMatrix(brush->transform, dx, dy, order);
|
return GdipTranslateMatrix(&brush->transform, dx, dy, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient *brush, GpRectF *rect)
|
GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient *brush, GpRectF *rect)
|
||||||
|
|
|
@ -209,7 +209,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;
|
GpMatrix transform;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GpLineGradient{
|
struct GpLineGradient{
|
||||||
|
@ -231,7 +231,7 @@ struct GpLineGradient{
|
||||||
|
|
||||||
struct GpTexture{
|
struct GpTexture{
|
||||||
GpBrush brush;
|
GpBrush brush;
|
||||||
GpMatrix *transform;
|
GpMatrix transform;
|
||||||
GpImage *image;
|
GpImage *image;
|
||||||
GpImageAttributes *imageattributes;
|
GpImageAttributes *imageattributes;
|
||||||
BYTE *bitmap_bits; /* image bits converted to ARGB and run through imageattributes */
|
BYTE *bitmap_bits; /* image bits converted to ARGB and run through imageattributes */
|
||||||
|
|
|
@ -1095,7 +1095,6 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
|
||||||
GpTexture *fill = (GpTexture*)brush;
|
GpTexture *fill = (GpTexture*)brush;
|
||||||
GpPointF draw_points[3];
|
GpPointF draw_points[3];
|
||||||
GpStatus stat;
|
GpStatus stat;
|
||||||
GpMatrix *world_to_texture;
|
|
||||||
int x, y;
|
int x, y;
|
||||||
GpBitmap *bitmap;
|
GpBitmap *bitmap;
|
||||||
int src_stride;
|
int src_stride;
|
||||||
|
@ -1127,17 +1126,11 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
|
||||||
|
|
||||||
if (stat == Ok)
|
if (stat == Ok)
|
||||||
{
|
{
|
||||||
stat = GdipCloneMatrix(fill->transform, &world_to_texture);
|
GpMatrix world_to_texture = fill->transform;
|
||||||
}
|
|
||||||
|
|
||||||
if (stat == Ok)
|
|
||||||
{
|
|
||||||
stat = GdipInvertMatrix(world_to_texture);
|
|
||||||
|
|
||||||
|
stat = GdipInvertMatrix(&world_to_texture);
|
||||||
if (stat == Ok)
|
if (stat == Ok)
|
||||||
stat = GdipTransformMatrixPoints(world_to_texture, draw_points, 3);
|
stat = GdipTransformMatrixPoints(&world_to_texture, draw_points, 3);
|
||||||
|
|
||||||
GdipDeleteMatrix(world_to_texture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat == Ok && !fill->bitmap_bits)
|
if (stat == Ok && !fill->bitmap_bits)
|
||||||
|
@ -1246,7 +1239,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
|
||||||
if (!transform_fixme_once)
|
if (!transform_fixme_once)
|
||||||
{
|
{
|
||||||
BOOL is_identity=TRUE;
|
BOOL is_identity=TRUE;
|
||||||
GdipIsMatrixIdentity(fill->transform, &is_identity);
|
GdipIsMatrixIdentity(&fill->transform, &is_identity);
|
||||||
if (!is_identity)
|
if (!is_identity)
|
||||||
{
|
{
|
||||||
FIXME("path gradient transform not implemented\n");
|
FIXME("path gradient transform not implemented\n");
|
||||||
|
|
Loading…
Reference in New Issue