From 8e2b5e1f331c9b0843dfa54be0ac194d34d82780 Mon Sep 17 00:00:00 2001 From: Nomango <569629550@qq.com> Date: Fri, 6 Oct 2017 01:39:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86Image=E8=A3=81?= =?UTF-8?q?=E5=89=AA=E5=9B=BE=E7=89=87=E8=8C=83=E5=9B=B4=E8=B6=8A=E7=95=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=9B=BE=E7=89=87=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Easy2D/Object/Image.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Easy2D/Object/Image.cpp b/Easy2D/Object/Image.cpp index fd7409ec..005d70ce 100644 --- a/Easy2D/Object/Image.cpp +++ b/Easy2D/Object/Image.cpp @@ -116,8 +116,8 @@ bool Image::setImageFromRes(LPCTSTR pResName, int x, int y, int width, int heigh void Image::crop(int x, int y, int width, int height) { - width = min(max(width, 0), m_pCImage->GetWidth()); - height = min(max(height, 0), m_pCImage->GetHeight()); + width = min(max(width, 0), m_pCImage->GetWidth() - x); + height = min(max(height, 0), m_pCImage->GetHeight() - y); // 设置源矩形的位置和大小(用于裁剪) m_SrcRect.SetRect(x, y, x + width, y + height); // 设置目标矩形(即绘制到窗口的位置和大小)