forked from Mirrors/wine-wine
gdiplus: Extend GdipDrawImagePointsRect.
parent
5cde960713
commit
6e0c574fb9
|
@ -1040,6 +1040,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
|
||||||
{
|
{
|
||||||
GpPointF ptf[3];
|
GpPointF ptf[3];
|
||||||
POINT pti[3];
|
POINT pti[3];
|
||||||
|
REAL dx, dy;
|
||||||
|
|
||||||
TRACE("%p %p %p %d %f %f %f %f %d %p %p %p\n", graphics, image, points, count,
|
TRACE("%p %p %p %d %f %f %f %f %d %p %p %p\n", graphics, image, points, count,
|
||||||
srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback,
|
srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback,
|
||||||
|
@ -1048,20 +1049,33 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
|
||||||
if(!graphics || !image || !points || !imageAttributes || count != 3)
|
if(!graphics || !image || !points || !imageAttributes || count != 3)
|
||||||
return InvalidParameter;
|
return InvalidParameter;
|
||||||
|
|
||||||
if(image->type != ImageTypeMetafile)
|
if(srcUnit == UnitInch)
|
||||||
return NotImplemented;
|
dx = dy = (REAL) INCH_HIMETRIC;
|
||||||
if((points[0].X != points[2].X) || (points[0].Y != points[1].Y))
|
else if(srcUnit == UnitPixel){
|
||||||
return NotImplemented;
|
dx = ((REAL) INCH_HIMETRIC) /
|
||||||
if(srcUnit != UnitInch)
|
((REAL) GetDeviceCaps(graphics->hdc, LOGPIXELSX));
|
||||||
|
dy = ((REAL) INCH_HIMETRIC) /
|
||||||
|
((REAL) GetDeviceCaps(graphics->hdc, LOGPIXELSY));
|
||||||
|
}
|
||||||
|
else
|
||||||
return NotImplemented;
|
return NotImplemented;
|
||||||
|
|
||||||
memcpy(ptf, points, 3 * sizeof(GpPointF));
|
memcpy(ptf, points, 3 * sizeof(GpPointF));
|
||||||
transform_and_round_points(graphics, pti, ptf, 3);
|
transform_and_round_points(graphics, pti, ptf, 3);
|
||||||
|
|
||||||
|
/* IPicture renders bitmaps with the y-axis reversed
|
||||||
|
* FIXME: flipping for unknown image type might not be correct. */
|
||||||
|
if(image->type != ImageTypeMetafile){
|
||||||
|
INT temp;
|
||||||
|
temp = pti[0].y;
|
||||||
|
pti[0].y = pti[2].y;
|
||||||
|
pti[2].y = temp;
|
||||||
|
}
|
||||||
|
|
||||||
if(IPicture_Render(image->picture, graphics->hdc,
|
if(IPicture_Render(image->picture, graphics->hdc,
|
||||||
pti[0].x, pti[0].y, pti[1].x - pti[0].x, pti[2].y - pti[0].y,
|
pti[0].x, pti[0].y, pti[1].x - pti[0].x, pti[2].y - pti[0].y,
|
||||||
srcx * INCH_HIMETRIC, srcy * INCH_HIMETRIC,
|
srcx * dx, srcy * dy,
|
||||||
srcwidth * INCH_HIMETRIC, srcheight * INCH_HIMETRIC,
|
srcwidth * dx, srcheight * dy,
|
||||||
NULL) != S_OK){
|
NULL) != S_OK){
|
||||||
if(callback)
|
if(callback)
|
||||||
callback(callbackData);
|
callback(callbackData);
|
||||||
|
|
Loading…
Reference in New Issue