Vincent Povirk : gdiplus: Don' t use gdi32 to scale or draw from outside bitmaps.
Alexandre Julliard
julliard at winehq.org
Fri Mar 11 10:23:37 CST 2011
Module: wine
Branch: master
Commit: 2302e80cc9083536e56724d77e1f03c101642b65
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2302e80cc9083536e56724d77e1f03c101642b65
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Thu Mar 10 11:37:14 2011 -0600
gdiplus: Don't use gdi32 to scale or draw from outside bitmaps.
---
dlls/gdiplus/graphics.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 07239e0..a5a040b 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -2465,10 +2465,18 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
else
return NotImplemented;
+ srcx = srcx * dx;
+ srcy = srcy * dy;
+ srcwidth = srcwidth * dx;
+ srcheight = srcheight * dy;
+
if (imageAttributes ||
(graphics->image && graphics->image->type == ImageTypeBitmap) ||
!((GpBitmap*)image)->hbitmap ||
- ptf[1].Y != ptf[0].Y || ptf[2].X != ptf[0].X)
+ ptf[1].Y != ptf[0].Y || ptf[2].X != ptf[0].X ||
+ ptf[1].X - ptf[0].X != srcwidth || ptf[2].Y - ptf[0].Y != srcheight ||
+ srcx < 0 || srcy < 0 ||
+ srcx + srcwidth > bitmap->width || srcy + srcheight > bitmap->height)
use_software = 1;
if (use_software)
@@ -2488,11 +2496,6 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
if (!imageAttributes)
imageAttributes = &defaultImageAttributes;
- srcx = srcx * dx;
- srcy = srcy * dy;
- srcwidth = srcwidth * dx;
- srcheight = srcheight * dy;
-
dst_area.left = dst_area.right = pti[0].x;
dst_area.top = dst_area.bottom = pti[0].y;
for (i=1; i<4; i++)
@@ -2672,12 +2675,12 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
bf.AlphaFormat = AC_SRC_ALPHA;
GdiAlphaBlend(graphics->hdc, pti[0].x, pti[0].y, pti[1].x-pti[0].x, pti[2].y-pti[0].y,
- hdc, srcx*dx, srcy*dy, srcwidth*dx, srcheight*dy, bf);
+ hdc, srcx, srcy, srcwidth, srcheight, bf);
}
else
{
StretchBlt(graphics->hdc, pti[0].x, pti[0].y, pti[1].x-pti[0].x, pti[2].y-pti[0].y,
- hdc, srcx*dx, srcy*dy, srcwidth*dx, srcheight*dy, SRCCOPY);
+ hdc, srcx, srcy, srcwidth, srcheight, SRCCOPY);
}
if (temp_hdc)
More information about the wine-cvs
mailing list