mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 13:34:53 +00:00
[MSPAINT] Fix divide by zero in drawZoomFrame
CORE-14539 #resolve
This commit is contained in:
parent
ed1c6bb006
commit
8c726ae0d2
|
@ -41,8 +41,14 @@ void CImgAreaWindow::drawZoomFrame(int mouseX, int mouseY)
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
scrollboxWindow.GetClientRect(&clientRectScrollbox);
|
scrollboxWindow.GetClientRect(&clientRectScrollbox);
|
||||||
GetClientRect(&clientRectImageArea);
|
GetClientRect(&clientRectImageArea);
|
||||||
w = clientRectImageArea.right * clientRectScrollbox.right / (clientRectImageArea.right * 2);
|
w = clientRectImageArea.right * 2;
|
||||||
h = clientRectImageArea.bottom * clientRectScrollbox.bottom / (clientRectImageArea.bottom * 2);
|
h = clientRectImageArea.bottom * 2;
|
||||||
|
if (!w || !h)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
w = clientRectImageArea.right * clientRectScrollbox.right / w;
|
||||||
|
h = clientRectImageArea.bottom * clientRectScrollbox.bottom / h;
|
||||||
x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2));
|
x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2));
|
||||||
y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2));
|
y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue