gdiplus: Fix mismatched use of Begin/EndContainer and Save/RestoreGraphics.
Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8fbdd670ca
commit
cc8cc65f79
|
@ -1924,9 +1924,15 @@ GpStatus trace_path(GpGraphics *graphics, GpPath *path)
|
|||
return result;
|
||||
}
|
||||
|
||||
typedef enum GraphicsContainerType {
|
||||
BEGIN_CONTAINER,
|
||||
SAVE_GRAPHICS
|
||||
} GraphicsContainerType;
|
||||
|
||||
typedef struct _GraphicsContainerItem {
|
||||
struct list entry;
|
||||
GraphicsContainer contid;
|
||||
GraphicsContainerType type;
|
||||
|
||||
SmoothingMode smoothing;
|
||||
CompositingQuality compqual;
|
||||
|
@ -1943,7 +1949,7 @@ typedef struct _GraphicsContainerItem {
|
|||
} GraphicsContainerItem;
|
||||
|
||||
static GpStatus init_container(GraphicsContainerItem** container,
|
||||
GDIPCONST GpGraphics* graphics){
|
||||
GDIPCONST GpGraphics* graphics, GraphicsContainerType type){
|
||||
GpStatus sts;
|
||||
|
||||
*container = heap_alloc_zero(sizeof(GraphicsContainerItem));
|
||||
|
@ -1951,6 +1957,7 @@ static GpStatus init_container(GraphicsContainerItem** container,
|
|||
return OutOfMemory;
|
||||
|
||||
(*container)->contid = graphics->contid + 1;
|
||||
(*container)->type = type;
|
||||
|
||||
(*container)->smoothing = graphics->smoothing;
|
||||
(*container)->compqual = graphics->compqual;
|
||||
|
@ -5148,11 +5155,6 @@ GpStatus WINGDIPAPI GdipResetWorldTransform(GpGraphics *graphics)
|
|||
return GdipSetMatrixElements(&graphics->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipRestoreGraphics(GpGraphics *graphics, GraphicsState state)
|
||||
{
|
||||
return GdipEndContainer(graphics, state);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipRotateWorldTransform(GpGraphics *graphics, REAL angle,
|
||||
GpMatrixOrder order)
|
||||
{
|
||||
|
@ -5176,23 +5178,16 @@ GpStatus WINGDIPAPI GdipRotateWorldTransform(GpGraphics *graphics, REAL angle,
|
|||
return GdipRotateMatrix(&graphics->worldtrans, angle, order);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipSaveGraphics(GpGraphics *graphics, GraphicsState *state)
|
||||
{
|
||||
return GdipBeginContainer2(graphics, state);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipBeginContainer2(GpGraphics *graphics,
|
||||
GraphicsContainer *state)
|
||||
static GpStatus begin_container(GpGraphics *graphics,
|
||||
GraphicsContainerType type, GraphicsContainer *state)
|
||||
{
|
||||
GraphicsContainerItem *container;
|
||||
GpStatus sts;
|
||||
|
||||
TRACE("(%p, %p)\n", graphics, state);
|
||||
|
||||
if(!graphics || !state)
|
||||
return InvalidParameter;
|
||||
|
||||
sts = init_container(&container, graphics);
|
||||
sts = init_container(&container, graphics, type);
|
||||
if(sts != Ok)
|
||||
return sts;
|
||||
|
||||
|
@ -5202,6 +5197,19 @@ GpStatus WINGDIPAPI GdipBeginContainer2(GpGraphics *graphics,
|
|||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipSaveGraphics(GpGraphics *graphics, GraphicsState *state)
|
||||
{
|
||||
TRACE("(%p, %p)\n", graphics, state);
|
||||
return begin_container(graphics, SAVE_GRAPHICS, state);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipBeginContainer2(GpGraphics *graphics,
|
||||
GraphicsContainer *state)
|
||||
{
|
||||
TRACE("(%p, %p)\n", graphics, state);
|
||||
return begin_container(graphics, BEGIN_CONTAINER, state);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipBeginContainer(GpGraphics *graphics, GDIPCONST GpRectF *dstrect, GDIPCONST GpRectF *srcrect, GpUnit unit, GraphicsContainer *state)
|
||||
{
|
||||
FIXME("(%p, %p, %p, %d, %p): stub\n", graphics, dstrect, srcrect, unit, state);
|
||||
|
@ -5220,18 +5228,17 @@ GpStatus WINGDIPAPI GdipComment(GpGraphics *graphics, UINT sizeData, GDIPCONST B
|
|||
return NotImplemented;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipEndContainer(GpGraphics *graphics, GraphicsContainer state)
|
||||
static GpStatus end_container(GpGraphics *graphics, GraphicsContainerType type,
|
||||
GraphicsContainer state)
|
||||
{
|
||||
GpStatus sts;
|
||||
GraphicsContainerItem *container, *container2;
|
||||
|
||||
TRACE("(%p, %x)\n", graphics, state);
|
||||
|
||||
if(!graphics)
|
||||
return InvalidParameter;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(container, &graphics->containers, GraphicsContainerItem, entry){
|
||||
if(container->contid == state)
|
||||
if(container->contid == state && container->type == type)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5257,6 +5264,18 @@ GpStatus WINGDIPAPI GdipEndContainer(GpGraphics *graphics, GraphicsContainer sta
|
|||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipEndContainer(GpGraphics *graphics, GraphicsContainer state)
|
||||
{
|
||||
TRACE("(%p, %x)\n", graphics, state);
|
||||
return end_container(graphics, BEGIN_CONTAINER, state);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipRestoreGraphics(GpGraphics *graphics, GraphicsState state)
|
||||
{
|
||||
TRACE("(%p, %x)\n", graphics, state);
|
||||
return end_container(graphics, SAVE_GRAPHICS, state);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipScaleWorldTransform(GpGraphics *graphics, REAL sx,
|
||||
REAL sy, GpMatrixOrder order)
|
||||
{
|
||||
|
|
|
@ -335,7 +335,7 @@ static void test_save_restore(void)
|
|||
stat = GdipEndContainer(graphics1, state_a);
|
||||
expect(Ok, stat);
|
||||
GdipGetInterpolationMode(graphics1, &mode);
|
||||
todo_wine expect(InterpolationModeBicubic, mode);
|
||||
expect(InterpolationModeBicubic, mode);
|
||||
stat = GdipRestoreGraphics(graphics1, state_a);
|
||||
expect(Ok, stat);
|
||||
GdipGetInterpolationMode(graphics1, &mode);
|
||||
|
@ -353,7 +353,7 @@ static void test_save_restore(void)
|
|||
stat = GdipRestoreGraphics(graphics1, state_a);
|
||||
expect(Ok, stat);
|
||||
GdipGetInterpolationMode(graphics1, &mode);
|
||||
todo_wine expect(InterpolationModeBicubic, mode);
|
||||
expect(InterpolationModeBicubic, mode);
|
||||
stat = GdipEndContainer(graphics1, state_a);
|
||||
expect(Ok, stat);
|
||||
GdipGetInterpolationMode(graphics1, &mode);
|
||||
|
|
Loading…
Reference in New Issue