From e7dae0e6bf48eaa57d81745a7ff6bdd642c4c7e9 Mon Sep 17 00:00:00 2001 From: Josh Juran Date: Thu, 3 Mar 2016 19:46:52 -0500 Subject: [PATCH] ams-qd: Add EqualRgn trap handler --- v68k/modules/ams-qd/Regions.cc | 20 ++++++++++++++++++++ v68k/modules/ams-qd/Regions.hh | 2 ++ v68k/modules/ams-qd/ams-qd.cc | 1 + 3 files changed, 23 insertions(+) diff --git a/v68k/modules/ams-qd/Regions.cc b/v68k/modules/ams-qd/Regions.cc index 1211f3d201..b645539076 100644 --- a/v68k/modules/ams-qd/Regions.cc +++ b/v68k/modules/ams-qd/Regions.cc @@ -226,6 +226,26 @@ pascal unsigned char RectInRgn_patch( const Rect* r, MacRegion** rgn ) return SectRect_patch( r, &rgn[0]->rgnBBox, &intersection ); } +pascal unsigned char EqualRgn_patch( MacRegion** a, MacRegion** b ) +{ + if ( a == b ) + { + return true; + } + + if ( a[0]->rgnSize != b[0]->rgnSize ) + { + return false; + } + + if ( EmptyRgn_patch( a ) && EmptyRgn_patch( b ) ) + { + return true; + } + + return fast_memcmp( *a, *b, a[0]->rgnSize ) == 0; +} + pascal unsigned char EmptyRgn_patch( MacRegion** rgn ) { /* diff --git a/v68k/modules/ams-qd/Regions.hh b/v68k/modules/ams-qd/Regions.hh index 533cda11cc..001a969298 100644 --- a/v68k/modules/ams-qd/Regions.hh +++ b/v68k/modules/ams-qd/Regions.hh @@ -41,6 +41,8 @@ pascal void RectRgn_patch( MacRegion** rgn, const Rect* r ); pascal unsigned char RectInRgn_patch( const Rect* r, MacRegion** rgn ); +pascal unsigned char EqualRgn_patch( MacRegion** a, MacRegion** b ); + pascal unsigned char EmptyRgn_patch( MacRegion** rgn ); #endif diff --git a/v68k/modules/ams-qd/ams-qd.cc b/v68k/modules/ams-qd/ams-qd.cc index 995e95e5a6..35d69281f7 100644 --- a/v68k/modules/ams-qd/ams-qd.cc +++ b/v68k/modules/ams-qd/ams-qd.cc @@ -222,6 +222,7 @@ static void install_QuickDraw() TBTRAP( OffsetRgn ); // A8E0 TBTRAP( InsetRgn ); // A8E1 TBTRAP( EmptyRgn ); // A8E2 + TBTRAP( EqualRgn ); // A8E3 TBTRAP( SectRgn ); // A8E4 TBTRAP( UnionRgn ); // A8E5 TBTRAP( DiffRgn ); // A8E6