gdiplus: Implement GdipTransformPointsI.
This commit is contained in:
parent
2af29ed916
commit
c486e8147d
|
@ -3662,9 +3662,34 @@ GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace
|
|||
GpStatus WINGDIPAPI GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace dst_space,
|
||||
GpCoordinateSpace src_space, GpPoint *points, INT count)
|
||||
{
|
||||
FIXME("(%p, %d, %d, %p, %d): stub\n", graphics, dst_space, src_space, points, count);
|
||||
GpPointF *pointsF;
|
||||
GpStatus ret;
|
||||
INT i;
|
||||
|
||||
return NotImplemented;
|
||||
TRACE("(%p, %d, %d, %p, %d)\n", graphics, dst_space, src_space, points, count);
|
||||
|
||||
if(count <= 0)
|
||||
return InvalidParameter;
|
||||
|
||||
pointsF = GdipAlloc(sizeof(GpPointF) * count);
|
||||
if(!pointsF)
|
||||
return OutOfMemory;
|
||||
|
||||
for(i = 0; i < count; i++){
|
||||
pointsF[i].X = (REAL)points[i].X;
|
||||
pointsF[i].Y = (REAL)points[i].Y;
|
||||
}
|
||||
|
||||
ret = GdipTransformPoints(graphics, dst_space, src_space, pointsF, count);
|
||||
|
||||
if(ret == Ok)
|
||||
for(i = 0; i < count; i++){
|
||||
points[i].X = roundr(pointsF[i].X);
|
||||
points[i].Y = roundr(pointsF[i].Y);
|
||||
}
|
||||
GdipFree(pointsF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
HPALETTE WINGDIPAPI GdipCreateHalftonePalette(void)
|
||||
|
|
|
@ -770,6 +770,7 @@ static void test_transformpoints(void)
|
|||
GpGraphics *graphics = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
GpPointF ptf[2];
|
||||
GpPoint pt[2];
|
||||
|
||||
status = GdipCreateFromHDC(hdc, &graphics);
|
||||
expect(Ok, status);
|
||||
|
@ -868,6 +869,17 @@ static void test_transformpoints(void)
|
|||
expectf(0.0, ptf[1].X);
|
||||
expectf(1.0, ptf[1].Y);
|
||||
|
||||
pt[0].X = 1;
|
||||
pt[0].Y = 0;
|
||||
pt[1].X = 0;
|
||||
pt[1].Y = 1;
|
||||
status = GdipTransformPointsI(graphics, CoordinateSpaceDevice, CoordinateSpaceWorld, pt, 2);
|
||||
expect(Ok, status);
|
||||
expect(18, pt[0].X);
|
||||
expect(15, pt[0].Y);
|
||||
expect(15, pt[1].X);
|
||||
expect(18, pt[1].Y);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue