[Scummvm-git-logs] scummvm master -> e7e75f0bb2094500e286bb2e5d112887ee0e6779

OMGPizzaGuy noreply at scummvm.org
Wed Nov 9 02:02:16 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e7e75f0bb2 ULTIMA8: Fix CheckClipped by checking for empty rect.


Commit: e7e75f0bb2094500e286bb2e5d112887ee0e6779
    https://github.com/scummvm/scummvm/commit/e7e75f0bb2094500e286bb2e5d112887ee0e6779
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2022-11-08T20:01:56-06:00

Commit Message:
ULTIMA8: Fix CheckClipped by checking for empty rect.

This is a large performance increase for the item sorter as previously every item would be sorted despite not being in the clip window. The degraded performance was first introduced by 6d68e93 where an empty rect became considered valid

Changed paths:
    engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
    engines/ultima/ultima8/misc/rect.h


diff --git a/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp b/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
index e89e7b8a204..813d9d1767c 100644
--- a/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
@@ -341,7 +341,7 @@ int16 BaseSoftRenderSurface::CheckClipped(const Rect &c) const {
 	r.clip(_clipWindow);
 
 	// Clipped away to the void
-	if (!r.isValidRect())
+	if (r.isEmpty())
 		return -1;
 	else if (r == c) return 0;
 	else return 1;
diff --git a/engines/ultima/ultima8/misc/rect.h b/engines/ultima/ultima8/misc/rect.h
index 29e77af9ddb..8f0062fd9a4 100644
--- a/engines/ultima/ultima8/misc/rect.h
+++ b/engines/ultima/ultima8/misc/rect.h
@@ -57,6 +57,11 @@ struct Rect {
 		bottom += offset;
 	}
 
+	// Check if the rectangle is empty (its width or length is 0) or invalid (its width or length are negative).
+	bool isEmpty() const {
+		return (left >= right || top >= bottom);
+	}
+
 	// Check to see if a Rectangle is 'valid'
 	bool isValidRect() const {
 		return (left <= right && top <= bottom);




More information about the Scummvm-git-logs mailing list