From: Bartosz Kosiorek <gang65@poczta.onet.pl> --- dlls/gdiplus/graphics.c | 14 ++++++++++---- dlls/gdiplus/image.c | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 2419eea94db..dc9cbf9a8b0 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3062,14 +3062,17 @@ GpStatus WINGDIPAPI GdipDrawEllipseI(GpGraphics *graphics, GpPen *pen, INT x, GpStatus WINGDIPAPI GdipDrawImage(GpGraphics *graphics, GpImage *image, REAL x, REAL y) { UINT width, height; + GpStatus status; TRACE("(%p, %p, %.2f, %.2f)\n", graphics, image, x, y); if(!graphics || !image) return InvalidParameter; - GdipGetImageWidth(image, &width); - GdipGetImageHeight(image, &height); + status = GdipGetImageWidth(image, &width); + if (status != Ok) return status; + status = GdipGetImageHeight(image, &height); + if (status != Ok) return status; return GdipDrawImagePointRect(graphics, image, x, y, 0.0, 0.0, (REAL)width, (REAL)height, UnitPixel); @@ -3166,14 +3169,17 @@ GpStatus WINGDIPAPI GdipDrawImagePoints(GpGraphics *graphics, GpImage *image, GDIPCONST GpPointF *dstpoints, INT count) { UINT width, height; + GpStatus status; TRACE("(%p, %p, %p, %d)\n", graphics, image, dstpoints, count); if(!image) return InvalidParameter; - GdipGetImageWidth(image, &width); - GdipGetImageHeight(image, &height); + status = GdipGetImageWidth(image, &width); + if (status != Ok) return status; + status = GdipGetImageHeight(image, &height); + if (status != Ok) return status; return GdipDrawImagePointsRect(graphics, image, dstpoints, count, 0, 0, width, height, UnitPixel, NULL, NULL, NULL); diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index ee89b11ffc0..406288238e1 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -1551,8 +1551,18 @@ GpStatus WINGDIPAPI GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap, if (!bitmap || !hbmReturn) return InvalidParameter; if (!image_lock(&bitmap->image)) return ObjectBusy; - GdipGetImageWidth(&bitmap->image, &width); - GdipGetImageHeight(&bitmap->image, &height); + stat = GdipGetImageWidth(&bitmap->image, &width); + if (stat != Ok) + { + image_unlock(&bitmap->image); + return stat; + } + stat = GdipGetImageHeight(&bitmap->image, &height); + if (stat != Ok) + { + image_unlock(&bitmap->image); + return stat; + } bih.biSize = sizeof(bih); bih.biWidth = width; @@ -4704,8 +4714,12 @@ static GpStatus encode_frame_wic(IWICBitmapEncoder *encoder, GpImage *image) bitmap = (GpBitmap*)image; - GdipGetImageWidth(image, &width); - GdipGetImageHeight(image, &height); + stat = GdipGetImageWidth(image, &width); + if (stat != Ok) + return stat; + stat = GdipGetImageHeight(image, &height); + if (stat != Ok) + return stat; rc.X = 0; rc.Y = 0; @@ -5787,8 +5801,12 @@ GpStatus WINGDIPAPI GdipGetImageThumbnail(GpImage *image, UINT width, UINT heigh if (!width) width = 120; if (!height) height = 120; - GdipGetImageWidth(image, &srcwidth); - GdipGetImageHeight(image, &srcheight); + stat = GdipGetImageWidth(image, &srcwidth); + if (stat != Ok) + return stat; + stat = GdipGetImageHeight(image, &srcheight); + if (stat != Ok) + return stat; stat = GdipCreateBitmapFromScan0(width, height, 0, PixelFormat32bppPARGB, NULL, (GpBitmap**)ret_image); @@ -6011,6 +6029,7 @@ static void set_histogram_point_a(ARGB color, UINT *ch0, UINT *ch1, UINT *ch2, U GpStatus WINGDIPAPI GdipBitmapGetHistogram(GpBitmap *bitmap, HistogramFormat format, UINT num_of_entries, UINT *ch0, UINT *ch1, UINT *ch2, UINT *ch3) { + GpStatus stat; static void (* const set_histogram_point[])(ARGB color, UINT *ch0, UINT *ch1, UINT *ch2, UINT *ch3) = { set_histogram_point_argb, @@ -6063,8 +6082,12 @@ GpStatus WINGDIPAPI GdipBitmapGetHistogram(GpBitmap *bitmap, HistogramFormat for return InvalidParameter; } - GdipGetImageWidth(&bitmap->image, &width); - GdipGetImageHeight(&bitmap->image, &height); + stat = GdipGetImageWidth(&bitmap->image, &width); + if (stat != Ok) + return stat; + stat = GdipGetImageHeight(&bitmap->image, &height); + if (stat != Ok) + return stat; for (y = 0; y < height; y++) for (x = 0; x < width; x++) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10480