mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Remove regions, add framing (fixes mirrors)
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#include "DialogUtils.h"
|
#include "DialogUtils.h"
|
||||||
#include "Environ.h"
|
#include "Environ.h"
|
||||||
#include "Externs.h"
|
#include "Externs.h"
|
||||||
|
#include "ScanlineMask.h"
|
||||||
|
|
||||||
|
|
||||||
static void HiLiteOkayButton (void);
|
static void HiLiteOkayButton (void);
|
||||||
@@ -21,7 +22,7 @@ static void UpdateMainPict (DialogPtr);
|
|||||||
static Boolean AboutFilter (DialogPtr, EventRecord *theEvent, short *hit);
|
static Boolean AboutFilter (DialogPtr, EventRecord *theEvent, short *hit);
|
||||||
|
|
||||||
|
|
||||||
static RgnHandle okayButtRgn;
|
static PortabilityLayer::ScanlineMask *okayButtScanlineMask;
|
||||||
static Rect okayButtonBounds, mainPICTBounds;
|
static Rect okayButtonBounds, mainPICTBounds;
|
||||||
static Boolean okayButtIsHiLit, clickedDownInOkay;
|
static Boolean okayButtIsHiLit, clickedDownInOkay;
|
||||||
|
|
||||||
@@ -63,6 +64,8 @@ void DoAbout (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetDialogItem(aboutDialog, kOkayButton, &itemType, &itemHandle, &okayButtonBounds);
|
GetDialogItem(aboutDialog, kOkayButton, &itemType, &itemHandle, &okayButtonBounds);
|
||||||
|
#if 0
|
||||||
|
PL_NotYetImplemented_TODO("Misc");
|
||||||
okayButtRgn = NewRgn(); // Create diagonal button region
|
okayButtRgn = NewRgn(); // Create diagonal button region
|
||||||
OpenRgn();
|
OpenRgn();
|
||||||
MoveTo(okayButtonBounds.left + 1, okayButtonBounds.top + 45);
|
MoveTo(okayButtonBounds.left + 1, okayButtonBounds.top + 45);
|
||||||
@@ -71,6 +74,7 @@ void DoAbout (void)
|
|||||||
Line(-44, 44);
|
Line(-44, 44);
|
||||||
Line(-16, -16);
|
Line(-16, -16);
|
||||||
CloseRgn(okayButtRgn);
|
CloseRgn(okayButtRgn);
|
||||||
|
#endif
|
||||||
okayButtIsHiLit = false; // Initially, button is not hilit
|
okayButtIsHiLit = false; // Initially, button is not hilit
|
||||||
clickedDownInOkay = false; // Initially, didn't click in okay button
|
clickedDownInOkay = false; // Initially, didn't click in okay button
|
||||||
GetDialogItem(aboutDialog, kPictItemMain, &itemType, &itemHandle, &mainPICTBounds);
|
GetDialogItem(aboutDialog, kPictItemMain, &itemType, &itemHandle, &mainPICTBounds);
|
||||||
@@ -79,10 +83,10 @@ void DoAbout (void)
|
|||||||
{
|
{
|
||||||
ModalDialog(aboutFilterUPP, &hit);
|
ModalDialog(aboutFilterUPP, &hit);
|
||||||
}
|
}
|
||||||
while ((hit != kOkayButton) && (okayButtRgn != nil));
|
while ((hit != kOkayButton) && (okayButtScanlineMask != nil));
|
||||||
|
|
||||||
if (okayButtRgn != nil)
|
if (okayButtScanlineMask != nil)
|
||||||
DisposeRgn(okayButtRgn); // Clean up!
|
okayButtScanlineMask->Destroy(); // Clean up!
|
||||||
DisposeDialog(aboutDialog);
|
DisposeDialog(aboutDialog);
|
||||||
DisposeModalFilterUPP(aboutFilterUPP);
|
DisposeModalFilterUPP(aboutFilterUPP);
|
||||||
|
|
||||||
@@ -175,7 +179,7 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
|||||||
if (Button() && clickedDownInOkay)
|
if (Button() && clickedDownInOkay)
|
||||||
{
|
{
|
||||||
GetMouse(&mousePt);
|
GetMouse(&mousePt);
|
||||||
if(PtInRgn(mousePt, okayButtRgn))
|
if(PointInScanlineMask(mousePt, okayButtScanlineMask))
|
||||||
HiLiteOkayButton();
|
HiLiteOkayButton();
|
||||||
else
|
else
|
||||||
UnHiLiteOkayButton();
|
UnHiLiteOkayButton();
|
||||||
@@ -203,7 +207,7 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
|||||||
case mouseDown:
|
case mouseDown:
|
||||||
mousePt = theEvent->where;
|
mousePt = theEvent->where;
|
||||||
GlobalToLocal(&mousePt);
|
GlobalToLocal(&mousePt);
|
||||||
if(PtInRgn(mousePt, okayButtRgn))
|
if(PointInScanlineMask(mousePt, okayButtScanlineMask))
|
||||||
{
|
{
|
||||||
clickedDownInOkay = true;
|
clickedDownInOkay = true;
|
||||||
handledIt = false;
|
handledIt = false;
|
||||||
@@ -215,7 +219,7 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
|||||||
case mouseUp:
|
case mouseUp:
|
||||||
mousePt = theEvent->where;
|
mousePt = theEvent->where;
|
||||||
GlobalToLocal(&mousePt);
|
GlobalToLocal(&mousePt);
|
||||||
if(PtInRgn(mousePt, okayButtRgn) && clickedDownInOkay)
|
if(PointInScanlineMask(mousePt, okayButtScanlineMask) && clickedDownInOkay)
|
||||||
{
|
{
|
||||||
UnHiLiteOkayButton();
|
UnHiLiteOkayButton();
|
||||||
*hit = kOkayButton;
|
*hit = kOkayButton;
|
||||||
|
@@ -209,17 +209,3 @@ void DkGrayForeColor (void)
|
|||||||
|
|
||||||
RGBForeColor(&color);
|
RGBForeColor(&color);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- RestoreColorsSlam
|
|
||||||
|
|
||||||
// This function forces the Macintosh to rebuild the palette. It is<69>
|
|
||||||
// called to restore a sense or normality after some serious munging<6E>
|
|
||||||
// with the palette.
|
|
||||||
|
|
||||||
void RestoreColorsSlam (void)
|
|
||||||
{
|
|
||||||
RestoreDeviceClut(nil);
|
|
||||||
PaintBehind(nil, GetGrayRgn());
|
|
||||||
DrawMenuBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
void DrawOnSplash (void);
|
void DrawOnSplash (void);
|
||||||
void SetPaletteToGrays (void);
|
void SetPaletteToGrays (void);
|
||||||
void HardDrawMainWindow (void);
|
void HardDrawMainWindow (void);
|
||||||
void RestoreColorsSlam (void);
|
|
||||||
|
|
||||||
|
|
||||||
CTabHandle theCTab;
|
CTabHandle theCTab;
|
||||||
@@ -132,18 +131,15 @@ void RedrawSplashScreen (void)
|
|||||||
void UpdateMainWindow (void)
|
void UpdateMainWindow (void)
|
||||||
{
|
{
|
||||||
Rect tempRect;
|
Rect tempRect;
|
||||||
RgnHandle dummyRgn;
|
|
||||||
|
|
||||||
dummyRgn = NewRgn();
|
|
||||||
GetPortVisibleRegion(GetWindowPort(mainWindow), dummyRgn);
|
|
||||||
SetPortWindowPort(mainWindow);
|
SetPortWindowPort(mainWindow);
|
||||||
|
|
||||||
if (theMode == kEditMode)
|
if (theMode == kEditMode)
|
||||||
{
|
{
|
||||||
PauseMarquee();
|
PauseMarquee();
|
||||||
CopyBitsConstrained((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
||||||
&mainWindowRect, &mainWindowRect, srcCopy, &(*dummyRgn)->rect);
|
&mainWindowRect, &mainWindowRect, srcCopy);
|
||||||
ResumeMarquee();
|
ResumeMarquee();
|
||||||
}
|
}
|
||||||
else if ((theMode == kSplashMode) || (theMode == kPlayMode))
|
else if ((theMode == kSplashMode) || (theMode == kPlayMode))
|
||||||
@@ -153,15 +149,14 @@ void UpdateMainWindow (void)
|
|||||||
QSetRect(&tempRect, 0, 0, 640, 460);
|
QSetRect(&tempRect, 0, 0, 640, 460);
|
||||||
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
||||||
LoadScaledGraphic(kSplash8BitPICT, &tempRect);
|
LoadScaledGraphic(kSplash8BitPICT, &tempRect);
|
||||||
CopyBitsConstrained((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
||||||
&workSrcRect, &mainWindowRect, srcCopy, &(*dummyRgn)->rect);
|
&workSrcRect, &mainWindowRect, srcCopy);
|
||||||
SetPortWindowPort(mainWindow);
|
SetPortWindowPort(mainWindow);
|
||||||
|
|
||||||
DrawOnSplash();
|
DrawOnSplash();
|
||||||
}
|
}
|
||||||
|
|
||||||
DisposeRgn(dummyRgn);
|
|
||||||
splashDrawn = true;
|
splashDrawn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -181,7 +181,7 @@ void LoadGraphicPlus (short resID, Rect *theRect)
|
|||||||
void RedrawMapContents (void)
|
void RedrawMapContents (void)
|
||||||
{
|
{
|
||||||
Rect newClip, aRoom, src;
|
Rect newClip, aRoom, src;
|
||||||
RgnHandle wasClip;
|
Rect wasClip;
|
||||||
short h, i, groundLevel;
|
short h, i, groundLevel;
|
||||||
short floor, suite, whoCares, type;
|
short floor, suite, whoCares, type;
|
||||||
char wasState;
|
char wasState;
|
||||||
@@ -199,12 +199,9 @@ void RedrawMapContents (void)
|
|||||||
newClip.bottom = mapWindowRect.bottom + 2 - kMapScrollBarWidth;
|
newClip.bottom = mapWindowRect.bottom + 2 - kMapScrollBarWidth;
|
||||||
|
|
||||||
SetPort((GrafPtr)mapWindow);
|
SetPort((GrafPtr)mapWindow);
|
||||||
wasClip = NewRgn();
|
|
||||||
if (wasClip != nil)
|
GetClip(&wasClip);
|
||||||
{
|
ClipRect(&newClip);
|
||||||
GetClip(wasClip);
|
|
||||||
ClipRect(&newClip);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < mapRoomsHigh; i++)
|
for (i = 0; i < mapRoomsHigh; i++)
|
||||||
{
|
{
|
||||||
@@ -285,11 +282,7 @@ void RedrawMapContents (void)
|
|||||||
InsetRect(&activeRoomRect, -1, -1);
|
InsetRect(&activeRoomRect, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wasClip != nil)
|
ClipRect(&wasClip);
|
||||||
{
|
|
||||||
SetClip(wasClip);
|
|
||||||
DisposeRgn(wasClip);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -656,7 +656,6 @@ void DrawDresser(Rect *dresser)
|
|||||||
#define kDresserSideSpare 14
|
#define kDresserSideSpare 14
|
||||||
Rect tempRect, dest;
|
Rect tempRect, dest;
|
||||||
long yellowC, brownC, dkGrayC, ltTanC, dkstRedC;
|
long yellowC, brownC, dkGrayC, ltTanC, dkstRedC;
|
||||||
RgnHandle shadowRgn;
|
|
||||||
short nRects, height, i;
|
short nRects, height, i;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
Pattern dummyPattern;
|
Pattern dummyPattern;
|
||||||
|
@@ -24,7 +24,6 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
|||||||
{
|
{
|
||||||
objectType thisObject;
|
objectType thisObject;
|
||||||
Rect whoCares, itsRect, rectA, rectB, testRect;
|
Rect whoCares, itsRect, rectA, rectB, testRect;
|
||||||
RgnHandle theRgn;
|
|
||||||
short i, legit, dynamicNum, n;
|
short i, legit, dynamicNum, n;
|
||||||
short floor, suite, room, obj;
|
short floor, suite, room, obj;
|
||||||
char wasState;
|
char wasState;
|
||||||
@@ -683,10 +682,7 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
|||||||
GetMovieBox(theMovie, &movieRect);
|
GetMovieBox(theMovie, &movieRect);
|
||||||
CenterRectInRect(&movieRect, &whoCares);
|
CenterRectInRect(&movieRect, &whoCares);
|
||||||
SetMovieBox(theMovie, &movieRect);
|
SetMovieBox(theMovie, &movieRect);
|
||||||
theRgn = NewRgn();
|
SetMovieDisplayClipRgn(theMovie, &whoCares);
|
||||||
RectRgn(theRgn, &whoCares);
|
|
||||||
SetMovieDisplayClipRgn(theMovie, theRgn);
|
|
||||||
DisposeRgn(theRgn);
|
|
||||||
tvOn = thisObject.data.g.state;
|
tvOn = thisObject.data.g.state;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -135,7 +135,6 @@ void AddRectToWorkRectsWhole (Rect *theRect)
|
|||||||
|
|
||||||
void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
|
void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
|
||||||
{
|
{
|
||||||
RgnHandle wasClip;
|
|
||||||
Rect src, dest;
|
Rect src, dest;
|
||||||
short which;
|
short which;
|
||||||
|
|
||||||
@@ -150,10 +149,6 @@ void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
|
|||||||
dest = thisGlider->dest;
|
dest = thisGlider->dest;
|
||||||
QOffsetRect(&dest, playOriginH - 20, playOriginV - 16);
|
QOffsetRect(&dest, playOriginH - 20, playOriginV - 16);
|
||||||
|
|
||||||
wasClip = NewRgn();
|
|
||||||
if (wasClip == nil)
|
|
||||||
return;
|
|
||||||
|
|
||||||
SetPort((GrafPtr)workSrcMap);
|
SetPort((GrafPtr)workSrcMap);
|
||||||
|
|
||||||
long numMirrorRects = GetHandleSize(reinterpret_cast<Handle>(mirrorRects)) / sizeof(Rect);
|
long numMirrorRects = GetHandleSize(reinterpret_cast<Handle>(mirrorRects)) / sizeof(Rect);
|
||||||
@@ -184,8 +179,6 @@ void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DisposeRgn(wasClip);
|
|
||||||
|
|
||||||
src =thisGlider->whole;
|
src =thisGlider->whole;
|
||||||
QOffsetRect(&src, playOriginH - 20, playOriginV - 16);
|
QOffsetRect(&src, playOriginH - 20, playOriginV - 16);
|
||||||
AddRectToWorkRects(&src);
|
AddRectToWorkRects(&src);
|
||||||
|
@@ -76,7 +76,6 @@ void WipeScreenOn (short direction, Rect *theRect)
|
|||||||
{
|
{
|
||||||
#define kWipeRectThick 4
|
#define kWipeRectThick 4
|
||||||
Rect wipeRect;
|
Rect wipeRect;
|
||||||
RgnHandle dummyRgn;
|
|
||||||
short hOffset, vOffset;
|
short hOffset, vOffset;
|
||||||
short i, count;
|
short i, count;
|
||||||
|
|
||||||
@@ -112,14 +111,11 @@ void WipeScreenOn (short direction, Rect *theRect)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dummyRgn = NewRgn();
|
|
||||||
GetPortVisibleRegion(GetWindowPort(mainWindow), dummyRgn);
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
CopyBitsConstrained((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
||||||
&wipeRect, &wipeRect, srcCopy, &(*dummyRgn)->rect);
|
&wipeRect, &wipeRect, srcCopy);
|
||||||
|
|
||||||
QOffsetRect(&wipeRect, hOffset, vOffset);
|
QOffsetRect(&wipeRect, hOffset, vOffset);
|
||||||
|
|
||||||
@@ -132,8 +128,6 @@ void WipeScreenOn (short direction, Rect *theRect)
|
|||||||
else if (wipeRect.bottom > theRect->bottom)
|
else if (wipeRect.bottom > theRect->bottom)
|
||||||
wipeRect.bottom = theRect->bottom;
|
wipeRect.bottom = theRect->bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisposeRgn(dummyRgn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DumpScreenOn
|
//-------------------------------------------------------------- DumpScreenOn
|
||||||
|
@@ -17,7 +17,7 @@ namespace PortabilityLayer
|
|||||||
EllipsePlotter::EllipsePlotter()
|
EllipsePlotter::EllipsePlotter()
|
||||||
: m_2center(0, 0)
|
: m_2center(0, 0)
|
||||||
, m_point(0, 0)
|
, m_point(0, 0)
|
||||||
#if PL_DEBUG_ELLIPSE_PLOTTER 1
|
#if PL_DEBUG_ELLIPSE_PLOTTER
|
||||||
, m_2offsetFromCenter(0, 0)
|
, m_2offsetFromCenter(0, 0)
|
||||||
#endif
|
#endif
|
||||||
, m_quadrant(Quadrant_PxPy)
|
, m_quadrant(Quadrant_PxPy)
|
||||||
|
@@ -55,7 +55,7 @@ namespace PortabilityLayer
|
|||||||
int32_t m_xChangeCostStaticFactor;
|
int32_t m_xChangeCostStaticFactor;
|
||||||
int32_t m_yChangeCostStaticFactor;
|
int32_t m_yChangeCostStaticFactor;
|
||||||
|
|
||||||
#if PL_DEBUG_ELLIPSE_PLOTTER 1
|
#if PL_DEBUG_ELLIPSE_PLOTTER
|
||||||
Vec2i m_2offsetFromCenter;
|
Vec2i m_2offsetFromCenter;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@@ -39,7 +39,6 @@ typedef unsigned char *StringPtr;
|
|||||||
|
|
||||||
class PLPasStr;
|
class PLPasStr;
|
||||||
struct CGraf;
|
struct CGraf;
|
||||||
struct Region;
|
|
||||||
struct Menu;
|
struct Menu;
|
||||||
|
|
||||||
typedef void *Ptr;
|
typedef void *Ptr;
|
||||||
@@ -169,14 +168,12 @@ typedef Cursor *CursPtr;
|
|||||||
typedef CCursor *CCrsrPtr;
|
typedef CCursor *CCrsrPtr;
|
||||||
typedef FSSpec *FSSpecPtr;
|
typedef FSSpec *FSSpecPtr;
|
||||||
typedef Menu *MenuPtr;
|
typedef Menu *MenuPtr;
|
||||||
typedef Region *RgnPtr;
|
|
||||||
typedef CInfoPBRec *CInfoPBPtr;
|
typedef CInfoPBRec *CInfoPBPtr;
|
||||||
typedef VersionRecord *VersRecPtr;
|
typedef VersionRecord *VersRecPtr;
|
||||||
|
|
||||||
typedef CursPtr *CursHandle;
|
typedef CursPtr *CursHandle;
|
||||||
typedef CCrsrPtr *CCrsrHandle;
|
typedef CCrsrPtr *CCrsrHandle;
|
||||||
typedef MenuPtr *MenuHandle;
|
typedef MenuPtr *MenuHandle;
|
||||||
typedef RgnPtr *RgnHandle;
|
|
||||||
typedef VersRecPtr *VersRecHndl;
|
typedef VersRecPtr *VersRecHndl;
|
||||||
|
|
||||||
typedef WindowPtr WindowRef; // wtf?
|
typedef WindowPtr WindowRef; // wtf?
|
||||||
|
@@ -134,7 +134,7 @@ void SetMovieBox(Movie movie, const Rect *rect)
|
|||||||
PL_NotYetImplemented();
|
PL_NotYetImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetMovieDisplayClipRgn(Movie movie, RgnHandle region)
|
void SetMovieDisplayClipRgn(Movie movie, const Rect *rect)
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented();
|
PL_NotYetImplemented();
|
||||||
}
|
}
|
||||||
|
@@ -59,6 +59,6 @@ void SetMovieActive(Movie movie, Boolean active);
|
|||||||
void StartMovie(Movie movie);
|
void StartMovie(Movie movie);
|
||||||
void MoviesTask(Movie movie, int unknown);
|
void MoviesTask(Movie movie, int unknown);
|
||||||
void SetMovieBox(Movie movie, const Rect *rect);
|
void SetMovieBox(Movie movie, const Rect *rect);
|
||||||
void SetMovieDisplayClipRgn(Movie movie, RgnHandle region);
|
void SetMovieDisplayClipRgn(Movie movie, const Rect *rect);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -22,7 +22,6 @@
|
|||||||
#include "WindowManager.h"
|
#include "WindowManager.h"
|
||||||
#include "QDGraf.h"
|
#include "QDGraf.h"
|
||||||
#include "QDPixMap.h"
|
#include "QDPixMap.h"
|
||||||
#include "QDUtils.h"
|
|
||||||
#include "Vec2i.h"
|
#include "Vec2i.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -154,16 +153,7 @@ static void PlotLine(PortabilityLayer::QDState *qdState, PortabilityLayer::QDPor
|
|||||||
|
|
||||||
Rect constrainedRect = qdPort->GetRect();
|
Rect constrainedRect = qdPort->GetRect();
|
||||||
|
|
||||||
if (qdState->m_clipRegion)
|
constrainedRect = constrainedRect.Intersect(qdState->m_clipRect);
|
||||||
{
|
|
||||||
const Region ®ion = **qdState->m_clipRegion;
|
|
||||||
|
|
||||||
if (region.size > sizeof(Region))
|
|
||||||
PL_NotYetImplemented();
|
|
||||||
|
|
||||||
constrainedRect = constrainedRect.Intersect(region.rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
constrainedRect = constrainedRect.Intersect(lineRect);
|
constrainedRect = constrainedRect.Intersect(lineRect);
|
||||||
|
|
||||||
if (!constrainedRect.IsValid())
|
if (!constrainedRect.IsValid())
|
||||||
@@ -508,17 +498,7 @@ void PaintRectWithPCR(const Rect &rect, PaintColorResolution pcr)
|
|||||||
Rect constrainedRect = rect;
|
Rect constrainedRect = rect;
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = qdPort->GetState();
|
PortabilityLayer::QDState *qdState = qdPort->GetState();
|
||||||
|
constrainedRect = constrainedRect.Intersect(qdState->m_clipRect);
|
||||||
if (qdState->m_clipRegion)
|
|
||||||
{
|
|
||||||
const Region ®ion = **qdState->m_clipRegion;
|
|
||||||
|
|
||||||
if (region.size > sizeof(Region))
|
|
||||||
PL_NotYetImplemented();
|
|
||||||
|
|
||||||
constrainedRect = constrainedRect.Intersect(region.rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
constrainedRect = constrainedRect.Intersect(qdPort->GetRect());
|
constrainedRect = constrainedRect.Intersect(qdPort->GetRect());
|
||||||
|
|
||||||
if (!constrainedRect.IsValid())
|
if (!constrainedRect.IsValid())
|
||||||
@@ -762,21 +742,52 @@ void FillScanlineMask(const PortabilityLayer::ScanlineMask *scanlineMask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetClip(Rect *rect)
|
||||||
|
{
|
||||||
|
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
||||||
|
*rect = qdState->m_clipRect;
|
||||||
|
}
|
||||||
|
|
||||||
void ClipRect(const Rect *rect)
|
void ClipRect(const Rect *rect)
|
||||||
{
|
{
|
||||||
if (!rect->IsValid())
|
if (!rect->IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
||||||
if (!qdState->m_clipRegion)
|
qdState->m_clipRect = *rect;
|
||||||
qdState->m_clipRegion = PortabilityLayer::QDUtils::CreateRegion(*rect);
|
|
||||||
else
|
|
||||||
PortabilityLayer::QDUtils::ResetRegionToRect(qdState->m_clipRegion, *rect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameRect(const Rect *rect)
|
void FrameRect(const Rect *rect)
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented_TODO("Rects");
|
if (!rect->IsValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint16_t width = rect->right - rect->left;
|
||||||
|
uint16_t height = rect->bottom - rect->top;
|
||||||
|
|
||||||
|
if (width <= 2 || height <= 2)
|
||||||
|
PaintRect(rect);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This is stupid, especially in the vertical case, but oh well
|
||||||
|
Rect edgeRect;
|
||||||
|
|
||||||
|
edgeRect = *rect;
|
||||||
|
edgeRect.right = edgeRect.left + 1;
|
||||||
|
PaintRect(&edgeRect);
|
||||||
|
|
||||||
|
edgeRect = *rect;
|
||||||
|
edgeRect.left = edgeRect.right - 1;
|
||||||
|
PaintRect(&edgeRect);
|
||||||
|
|
||||||
|
edgeRect = *rect;
|
||||||
|
edgeRect.bottom = edgeRect.top + 1;
|
||||||
|
PaintRect(&edgeRect);
|
||||||
|
|
||||||
|
edgeRect = *rect;
|
||||||
|
edgeRect.top = edgeRect.bottom - 1;
|
||||||
|
PaintRect(&edgeRect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameOval(const Rect *rect)
|
void FrameOval(const Rect *rect)
|
||||||
@@ -1097,79 +1108,18 @@ void CopyMaskConstrained(const BitMap *srcBitmap, const BitMap *maskBitmap, BitM
|
|||||||
CopyBitsComplete(srcBitmap, maskBitmap, destBitmap, srcRectBase, maskRectBase, destRectBase, constrainRect);
|
CopyBitsComplete(srcBitmap, maskBitmap, destBitmap, srcRectBase, maskRectBase, destRectBase, constrainRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyMask(const BitMap *srcBitmap, const BitMap *maskBitmap, BitMap *destBitmap, const Rect *srcRectBase, const Rect *maskRectBase, const Rect *destRectBase)
|
|
||||||
{
|
|
||||||
CopyBitsComplete(srcBitmap, maskBitmap, destBitmap, srcRectBase, maskRectBase, destRectBase, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
RgnHandle NewRgn()
|
bool PointInScanlineMask(Point point, PortabilityLayer::ScanlineMask *scanlineMask)
|
||||||
{
|
|
||||||
PortabilityLayer::MMHandleBlock *handle = PortabilityLayer::MemoryManager::GetInstance()->AllocHandle(sizeof(Region));
|
|
||||||
|
|
||||||
Region *rgn = static_cast<Region*>(handle->m_contents);
|
|
||||||
|
|
||||||
rgn->size = sizeof(Region);
|
|
||||||
rgn->rect = Rect::Create(0, 0, 0, 0);
|
|
||||||
|
|
||||||
return reinterpret_cast<Region**>(&handle->m_contents);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RectRgn(RgnHandle region, const Rect *rect)
|
|
||||||
{
|
|
||||||
Region *rgn = *region;
|
|
||||||
|
|
||||||
if (rgn->size != sizeof(Region))
|
|
||||||
{
|
|
||||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
|
||||||
PortabilityLayer::MMHandleBlock *hdlBlock = reinterpret_cast<PortabilityLayer::MMHandleBlock*>(region);
|
|
||||||
|
|
||||||
// OK if this fails, I guess
|
|
||||||
if (mm->ResizeHandle(hdlBlock, sizeof(Region)))
|
|
||||||
rgn = static_cast<Region*>(hdlBlock->m_contents);
|
|
||||||
|
|
||||||
rgn->size = sizeof(Region);
|
|
||||||
}
|
|
||||||
|
|
||||||
rgn->rect = *rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UnionRgn(RgnHandle regionA, RgnHandle regionB, RgnHandle regionC)
|
|
||||||
{
|
|
||||||
PL_NotYetImplemented_TODO("Polys");
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisposeRgn(RgnHandle rgn)
|
|
||||||
{
|
|
||||||
DisposeHandle(reinterpret_cast<Handle>(rgn));
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenRgn()
|
|
||||||
{
|
|
||||||
PL_NotYetImplemented_TODO("Polys");
|
|
||||||
}
|
|
||||||
|
|
||||||
void CloseRgn(RgnHandle rgn)
|
|
||||||
{
|
|
||||||
PL_NotYetImplemented_TODO("Polys");
|
|
||||||
}
|
|
||||||
|
|
||||||
Boolean PtInRgn(Point point, RgnHandle rgn)
|
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented();
|
PL_NotYetImplemented();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetClip(RgnHandle rgn)
|
void CopyMask(const BitMap *srcBitmap, const BitMap *maskBitmap, BitMap *destBitmap, const Rect *srcRectBase, const Rect *maskRectBase, const Rect *destRectBase)
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented_TODO("Polys");
|
CopyBitsComplete(srcBitmap, maskBitmap, destBitmap, srcRectBase, maskRectBase, destRectBase, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetClip(RgnHandle rgn)
|
|
||||||
{
|
|
||||||
PL_NotYetImplemented_TODO("Polys");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BitMap *GetPortBitMapForCopyBits(CGrafPtr grafPtr)
|
BitMap *GetPortBitMapForCopyBits(CGrafPtr grafPtr)
|
||||||
{
|
{
|
||||||
return *grafPtr->m_port.GetPixMap();
|
return *grafPtr->m_port.GetPixMap();
|
||||||
@@ -1180,14 +1130,6 @@ CGrafPtr GetWindowPort(WindowPtr window)
|
|||||||
return &window->m_graf;
|
return &window->m_graf;
|
||||||
}
|
}
|
||||||
|
|
||||||
RgnHandle GetPortVisibleRegion(CGrafPtr port, RgnHandle region)
|
|
||||||
{
|
|
||||||
const Rect rect = port->m_port.GetRect();
|
|
||||||
|
|
||||||
RectRgn(region, &rect);
|
|
||||||
return region;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Int32 DeltaPoint(Point pointA, Point pointB)
|
Int32 DeltaPoint(Point pointA, Point pointB)
|
||||||
{
|
{
|
||||||
@@ -1222,17 +1164,6 @@ void RestoreDeviceClut(void *unknown)
|
|||||||
PL_NotYetImplemented();
|
PL_NotYetImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintBehind(void *unknown, RgnHandle region)
|
|
||||||
{
|
|
||||||
PL_NotYetImplemented();
|
|
||||||
}
|
|
||||||
|
|
||||||
RgnHandle GetGrayRgn()
|
|
||||||
{
|
|
||||||
PL_NotYetImplemented();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BitMap::Init(const Rect &rect, GpPixelFormat_t pixelFormat, size_t pitch, void *dataPtr)
|
void BitMap::Init(const Rect &rect, GpPixelFormat_t pixelFormat, size_t pitch, void *dataPtr)
|
||||||
{
|
{
|
||||||
m_rect = rect;
|
m_rect = rect;
|
||||||
|
@@ -128,7 +128,9 @@ void PaintRect(const Rect *rect);
|
|||||||
void PaintOval(const Rect *rect);
|
void PaintOval(const Rect *rect);
|
||||||
void FillScanlineMask(const PortabilityLayer::ScanlineMask *scanlineMask);
|
void FillScanlineMask(const PortabilityLayer::ScanlineMask *scanlineMask);
|
||||||
|
|
||||||
void ClipRect(const Rect *rect); // Sets the clipping area
|
void ClipRect(const Rect *rect);
|
||||||
|
void GetClip(Rect *rect);
|
||||||
|
|
||||||
void FrameRect(const Rect *rect);
|
void FrameRect(const Rect *rect);
|
||||||
void FrameOval(const Rect *rect);
|
void FrameOval(const Rect *rect);
|
||||||
void FrameRoundRect(const Rect *rect, int w, int h);
|
void FrameRoundRect(const Rect *rect, int w, int h);
|
||||||
@@ -140,7 +142,7 @@ void PenNormal();
|
|||||||
void EraseRect(const Rect *rect);
|
void EraseRect(const Rect *rect);
|
||||||
void InvertRect(const Rect *rect);
|
void InvertRect(const Rect *rect);
|
||||||
void InsetRect(Rect *rect, int x, int y);
|
void InsetRect(Rect *rect, int x, int y);
|
||||||
void Line(int x, int y); // FIXME: Is this relative or absolute?
|
void Line(int x, int y);
|
||||||
Pattern *GetQDGlobalsGray(Pattern *pattern);
|
Pattern *GetQDGlobalsGray(Pattern *pattern);
|
||||||
Pattern *GetQDGlobalsBlack(Pattern *pattern);
|
Pattern *GetQDGlobalsBlack(Pattern *pattern);
|
||||||
|
|
||||||
@@ -155,20 +157,10 @@ void CopyBitsConstrained(const BitMap *srcBitmap, BitMap *destBitmap, const Rect
|
|||||||
void CopyMask(const BitMap *srcBitmap, const BitMap *maskBitmap, BitMap *destBitmap, const Rect *srcRect, const Rect *maskRect, const Rect *destRect);
|
void CopyMask(const BitMap *srcBitmap, const BitMap *maskBitmap, BitMap *destBitmap, const Rect *srcRect, const Rect *maskRect, const Rect *destRect);
|
||||||
void CopyMaskConstrained(const BitMap *srcBitmap, const BitMap *maskBitmap, BitMap *destBitmap, const Rect *srcRectBase, const Rect *maskRectBase, const Rect *destRectBase, const Rect *constraintRect);
|
void CopyMaskConstrained(const BitMap *srcBitmap, const BitMap *maskBitmap, BitMap *destBitmap, const Rect *srcRectBase, const Rect *maskRectBase, const Rect *destRectBase, const Rect *constraintRect);
|
||||||
|
|
||||||
RgnHandle NewRgn();
|
bool PointInScanlineMask(Point point, PortabilityLayer::ScanlineMask *scanlineMask);
|
||||||
void RectRgn(RgnHandle region, const Rect *rect);
|
|
||||||
void UnionRgn(RgnHandle regionA, RgnHandle regionB, RgnHandle regionC);
|
|
||||||
void DisposeRgn(RgnHandle rgn);
|
|
||||||
void OpenRgn();
|
|
||||||
void CloseRgn(RgnHandle rgn);
|
|
||||||
Boolean PtInRgn(Point point, RgnHandle rgn);
|
|
||||||
|
|
||||||
void GetClip(RgnHandle rgn);
|
|
||||||
void SetClip(RgnHandle rgn);
|
|
||||||
|
|
||||||
BitMap *GetPortBitMapForCopyBits(CGrafPtr grafPtr);
|
BitMap *GetPortBitMapForCopyBits(CGrafPtr grafPtr);
|
||||||
CGrafPtr GetWindowPort(WindowPtr window);
|
CGrafPtr GetWindowPort(WindowPtr window);
|
||||||
RgnHandle GetPortVisibleRegion(CGrafPtr port, RgnHandle region);
|
|
||||||
|
|
||||||
// Computes A - B and returns it packed?
|
// Computes A - B and returns it packed?
|
||||||
Int32 DeltaPoint(Point pointA, Point pointB);
|
Int32 DeltaPoint(Point pointA, Point pointB);
|
||||||
@@ -181,8 +173,5 @@ Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection);
|
|||||||
Boolean PtInRect(Point point, const Rect *rect);
|
Boolean PtInRect(Point point, const Rect *rect);
|
||||||
|
|
||||||
void RestoreDeviceClut(void *unknown);
|
void RestoreDeviceClut(void *unknown);
|
||||||
void PaintBehind(void *unknown, RgnHandle region);
|
|
||||||
|
|
||||||
RgnHandle GetGrayRgn(); // Returns the region not occupied by the menu bar
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -214,7 +214,6 @@
|
|||||||
<ClInclude Include="QDRegion.h" />
|
<ClInclude Include="QDRegion.h" />
|
||||||
<ClInclude Include="QDStandardPalette.h" />
|
<ClInclude Include="QDStandardPalette.h" />
|
||||||
<ClInclude Include="QDState.h" />
|
<ClInclude Include="QDState.h" />
|
||||||
<ClInclude Include="QDUtils.h" />
|
|
||||||
<ClInclude Include="RandomNumberGenerator.h" />
|
<ClInclude Include="RandomNumberGenerator.h" />
|
||||||
<ClInclude Include="Rect2i.h" />
|
<ClInclude Include="Rect2i.h" />
|
||||||
<ClInclude Include="RenderedFont.h" />
|
<ClInclude Include="RenderedFont.h" />
|
||||||
@@ -315,7 +314,6 @@
|
|||||||
<ClCompile Include="QDPort.cpp" />
|
<ClCompile Include="QDPort.cpp" />
|
||||||
<ClCompile Include="QDStandardPalette.cpp" />
|
<ClCompile Include="QDStandardPalette.cpp" />
|
||||||
<ClCompile Include="QDState.cpp" />
|
<ClCompile Include="QDState.cpp" />
|
||||||
<ClCompile Include="QDUtils.cpp" />
|
|
||||||
<ClCompile Include="RandomNumberGenerator.cpp" />
|
<ClCompile Include="RandomNumberGenerator.cpp" />
|
||||||
<ClCompile Include="ResourceCompiledRef.cpp" />
|
<ClCompile Include="ResourceCompiledRef.cpp" />
|
||||||
<ClCompile Include="ResourceFile.cpp" />
|
<ClCompile Include="ResourceFile.cpp" />
|
||||||
|
@@ -291,9 +291,6 @@
|
|||||||
<ClInclude Include="WindowManager.h">
|
<ClInclude Include="WindowManager.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="QDUtils.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="QDPort.h">
|
<ClInclude Include="QDPort.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -536,9 +533,6 @@
|
|||||||
<ClCompile Include="WindowManager.cpp">
|
<ClCompile Include="WindowManager.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="QDUtils.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="QDPort.cpp">
|
<ClCompile Include="QDPort.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@@ -17,7 +17,7 @@ namespace PortabilityLayer
|
|||||||
, m_isBackResolved16(false)
|
, m_isBackResolved16(false)
|
||||||
, m_isForeResolved8(false)
|
, m_isForeResolved8(false)
|
||||||
, m_isBackResolved8(false)
|
, m_isBackResolved8(false)
|
||||||
, m_clipRegion(nullptr)
|
, m_clipRect(Rect::Create(INT16_MIN, INT16_MIN, INT16_MAX, INT16_MAX))
|
||||||
, m_penInvert(false)
|
, m_penInvert(false)
|
||||||
, m_penMask(false)
|
, m_penMask(false)
|
||||||
, m_havePattern8x8(false)
|
, m_havePattern8x8(false)
|
||||||
|
@@ -3,8 +3,6 @@
|
|||||||
#include "RGBAColor.h"
|
#include "RGBAColor.h"
|
||||||
#include "SharedTypes.h"
|
#include "SharedTypes.h"
|
||||||
|
|
||||||
struct Region;
|
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
struct QDState
|
struct QDState
|
||||||
@@ -14,7 +12,7 @@ namespace PortabilityLayer
|
|||||||
int m_fontID;
|
int m_fontID;
|
||||||
int m_textFace;
|
int m_textFace;
|
||||||
int m_textSize;
|
int m_textSize;
|
||||||
Region **m_clipRegion;
|
Rect m_clipRect;
|
||||||
Point m_penPos;
|
Point m_penPos;
|
||||||
bool m_penInvert;
|
bool m_penInvert;
|
||||||
bool m_penMask;
|
bool m_penMask;
|
||||||
|
@@ -1,31 +0,0 @@
|
|||||||
#include "QDUtils.h"
|
|
||||||
#include "MemoryManager.h"
|
|
||||||
#include "SharedTypes.h"
|
|
||||||
|
|
||||||
namespace PortabilityLayer
|
|
||||||
{
|
|
||||||
Region **QDUtils::CreateRegion(const Rect &rect)
|
|
||||||
{
|
|
||||||
PL_STATIC_ASSERT(sizeof(Region) == 10);
|
|
||||||
|
|
||||||
Region **rgnHandle = MemoryManager::GetInstance()->NewHandle<Region>();
|
|
||||||
if (!rgnHandle)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
Region ®ion = (**rgnHandle);
|
|
||||||
region.rect = rect;
|
|
||||||
region.size = sizeof(Region);
|
|
||||||
|
|
||||||
return rgnHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QDUtils::ResetRegionToRect(Region **regionHdl, const Rect &rect)
|
|
||||||
{
|
|
||||||
if (MemoryManager::GetInstance()->ResizeHandle(reinterpret_cast<MMHandleBlock*>(regionHdl), sizeof(Region)))
|
|
||||||
{
|
|
||||||
Region ®ion = **regionHdl;
|
|
||||||
region.size = sizeof(Region);
|
|
||||||
region.rect = rect;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,14 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
struct Region;
|
|
||||||
struct Rect;
|
|
||||||
|
|
||||||
namespace PortabilityLayer
|
|
||||||
{
|
|
||||||
class QDUtils
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static Region **CreateRegion(const Rect &rect);
|
|
||||||
static void ResetRegionToRect(Region **region, const Rect &rect);
|
|
||||||
};
|
|
||||||
}
|
|
@@ -24,13 +24,6 @@ struct Rect
|
|||||||
static Rect Create(int16_t top, int16_t left, int16_t bottom, int16_t right);
|
static Rect Create(int16_t top, int16_t left, int16_t bottom, int16_t right);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Region
|
|
||||||
{
|
|
||||||
uint16_t size;
|
|
||||||
Rect rect;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct BERect
|
struct BERect
|
||||||
{
|
{
|
||||||
BEInt16_t top;
|
BEInt16_t top;
|
||||||
|
Reference in New Issue
Block a user