From a0daad8cd3a4f3422df767a795761f023da7e031 Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Wed, 7 Aug 2024 22:14:31 +0200 Subject: [PATCH 1/4] Apply Guichan's changes from 1ef71f95db45481409b06d4a66800144cea92df8 (Feb 8th 2008) A bug has been fixed where clip areas where incorrectly clamped. --- TODO | 2 +- src/graphics.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 2146dfb..4d96693 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -* Continue rebasing from 29eb696aaf7aa7a78cece7d25f27d0235e4559ed +* Continue rebasing from 0b68ba6b6d2f78cad10b206c579c553b77b47483 * Add a focus listener interface. * Make focus apply synchronously. * Graphics and input objects for DirectX. diff --git a/src/graphics.cpp b/src/graphics.cpp index 2d01167..be0ddef 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -106,14 +106,14 @@ namespace gcn carea.y = top.y; } - if (carea.width > top.width) + if (carea.x + carea.width > top.width) { - carea.width = top.width; + carea.width = top.width - carea.x; } - if (carea.height > top.height) + if (carea.y + carea.height > top.height) { - carea.height = top.height; + carea.height = top.height - carea.y; } bool result = carea.isIntersecting(top); From 1896c5c59a480680a6551b450b2555d8afbf0946 Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Wed, 7 Aug 2024 22:19:51 +0200 Subject: [PATCH 2/4] Apply Guichan's changes from 0b68ba6b6d2f78cad10b206c579c553b77b47483 (Feb 8th 2008) The latest commit has been reverted as it seems the problem seems to be more complex. --- TODO | 2 +- src/graphics.cpp | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 4d96693..5cdac45 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -* Continue rebasing from 0b68ba6b6d2f78cad10b206c579c553b77b47483 +* Continue rebasing from 3a484c66e38332bbf235ef48e8d78d884b6eafbc * Add a focus listener interface. * Make focus apply synchronously. * Graphics and input objects for DirectX. diff --git a/src/graphics.cpp b/src/graphics.cpp index be0ddef..f4cc087 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -81,11 +81,13 @@ namespace gcn carea.y = area.y; carea.width = area.width; carea.height = area.height; + carea.xOffset = area.x; + carea.yOffset = area.y; mClipStack.push(carea); return true; } - ClipRectangle top = mClipStack.top(); + const ClipRectangle& top = mClipStack.top(); ClipRectangle carea; carea = area; carea.xOffset = top.xOffset + carea.x; @@ -106,14 +108,14 @@ namespace gcn carea.y = top.y; } - if (carea.x + carea.width > top.width) + if (carea.width > top.width) { - carea.width = top.width - carea.x; + carea.width = top.width; } - if (carea.y + carea.height > top.height) + if (carea.height > top.height) { - carea.height = top.height - carea.y; + carea.height = top.height; } bool result = carea.isIntersecting(top); From 0cf684eb30def28cd7d9219ba27a8b24221d627b Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Wed, 7 Aug 2024 22:29:53 +0200 Subject: [PATCH 3/4] Apply Guichan's changes from 3a484c66e38332bbf235ef48e8d78d884b6eafbc (Feb 9th 2008) A bug has been fixed where clip areas where incorrectly clamped. --- TODO | 2 +- src/graphics.cpp | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 5cdac45..844b11a 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -* Continue rebasing from 3a484c66e38332bbf235ef48e8d78d884b6eafbc +* Continue rebasing from 628374cc0a02be7a7f30154ba4a1e40ec6e33c2b * Add a focus listener interface. * Make focus apply synchronously. * Graphics and input objects for DirectX. diff --git a/src/graphics.cpp b/src/graphics.cpp index f4cc087..dd640b9 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -98,24 +98,34 @@ namespace gcn // Clamp the pushed clip rectangle. if (carea.x < top.x) { - carea.width += carea.x - top.x; + // carea.width += carea.x - top.x; carea.x = top.x; } if (carea.y < top.y) { - carea.height += carea.y - top.y; + // carea.height += carea.y - top.y; carea.y = top.y; } - if (carea.width > top.width) + if (carea.x + carea.width > top.x + top.width) { - carea.width = top.width; + carea.width = top.x + top.width - carea.x; + + if (carea.width < 0) + { + carea.width = 0; + } } - if (carea.height > top.height) + if (carea.y + carea.height > top.y + top.height) { - carea.height = top.height; + carea.height = top.y + top.height - carea.y; + + if (carea.height < 0) + { + carea.height = 0; + } } bool result = carea.isIntersecting(top); From 6a70c1c70df74ecbf6ac3454a3d66878ad9a5508 Mon Sep 17 00:00:00 2001 From: Jarod42 Date: Wed, 7 Aug 2024 22:33:25 +0200 Subject: [PATCH 4/4] Apply Guichan's changes from 628374cc0a02be7a7f30154ba4a1e40ec6e33c2b (Feb 9th 2008) Unnecessary comments have been removed. --- TODO | 2 +- src/graphics.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/TODO b/TODO index 844b11a..3f0dc77 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -* Continue rebasing from 628374cc0a02be7a7f30154ba4a1e40ec6e33c2b +* Continue rebasing from 1d9590907eb3a8cc298f660c1436d0e90808d684 * Add a focus listener interface. * Make focus apply synchronously. * Graphics and input objects for DirectX. diff --git a/src/graphics.cpp b/src/graphics.cpp index dd640b9..8061b51 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -98,13 +98,11 @@ namespace gcn // Clamp the pushed clip rectangle. if (carea.x < top.x) { - // carea.width += carea.x - top.x; carea.x = top.x; } if (carea.y < top.y) { - // carea.height += carea.y - top.y; carea.y = top.y; }