mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-13 19:49:36 +00:00
Remove port state, fix background not darkening in room editor
This commit is contained in:
@@ -116,10 +116,6 @@ void DrawBannerMessage (Point topLeft)
|
||||
Str255 bannerStr, subStr;
|
||||
short count;
|
||||
|
||||
DrawSurface *wasGWorld = GetGraphicsPort();
|
||||
|
||||
SetGraphicsPort(workSrcMap);
|
||||
|
||||
PasStringCopy((*thisHouse)->banner, bannerStr);
|
||||
|
||||
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||
@@ -157,8 +153,6 @@ void DrawBannerMessage (Point topLeft)
|
||||
GetLocalizedString(5, subStr);
|
||||
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr, redColor, appFont);
|
||||
}
|
||||
|
||||
SetGraphicsPort(wasGWorld);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- BringUpBanner
|
||||
|
||||
@@ -39,7 +39,6 @@ void BringUpDialog (Dialog **theDialog, short dialogID, const DialogTextSubstitu
|
||||
// CenterDialog(dialogID);
|
||||
if (*theDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetGraphicsPort((*theDialog)->GetWindow()->GetDrawSurface());
|
||||
ShowWindow((*theDialog)->GetWindow());
|
||||
DrawDefaultButton(*theDialog);
|
||||
}
|
||||
|
||||
@@ -384,7 +384,6 @@ void HandleIdleTask (void)
|
||||
HandleEditorResolutionChange();
|
||||
}
|
||||
|
||||
SetPort(mainWindow->GetDrawSurface());
|
||||
DoMarquee();
|
||||
|
||||
if ((autoRoomEdit) && (newRoomNow))
|
||||
|
||||
@@ -70,7 +70,6 @@ void DoGameOver (void)
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
playing = false;
|
||||
SetUpFinalScreen();
|
||||
SetPort(mainWindow->GetDrawSurface());
|
||||
ColorRect(surface, mainWindowRect, 244);
|
||||
DoGameOverStarAnimation();
|
||||
if (!TestHighScore())
|
||||
|
||||
@@ -270,7 +270,6 @@ void SpillGrease (short who, short index)
|
||||
|
||||
void RedrawAllGrease (void)
|
||||
{
|
||||
DrawSurface *wasCPort;
|
||||
Rect src;
|
||||
short i;
|
||||
|
||||
@@ -291,14 +290,10 @@ void RedrawAllGrease (void)
|
||||
|
||||
QOffsetRect(&src, playOriginH, playOriginV);
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
backSrcMap->FillRect(src, blackColorBack);
|
||||
|
||||
workSrcMap->FillRect(src, blackColorWork);
|
||||
AddRectToWorkRects(&src);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ void DoHighScores (void)
|
||||
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
||||
|
||||
SpinCursor(3);
|
||||
SetPort(workSrcMap);
|
||||
workSrcMap->FillRect(workSrcRect, blackColor);
|
||||
QSetRect(&tempRect, 0, 0, 640, 480);
|
||||
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
||||
|
||||
@@ -231,7 +231,6 @@ void DoHouseInfo (void)
|
||||
houseInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kHouseInfoDialogID, kPutInFront, &substitutions);
|
||||
if (houseInfoDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort(houseInfoDialog->GetWindow()->GetDrawSurface());
|
||||
ShowWindow(houseInfoDialog->GetWindow());
|
||||
|
||||
static_cast<PortabilityLayer::EditboxWidget*>(houseInfoDialog->GetItems()[kBannerTextItem - 1].GetWidget())->SetMultiLine(true);
|
||||
|
||||
@@ -205,7 +205,6 @@ void UpdateLinkWindow (void)
|
||||
if (linkWindow == nil)
|
||||
return;
|
||||
|
||||
SetPortWindowPort(linkWindow);
|
||||
UpdateLinkControl();
|
||||
#endif
|
||||
}
|
||||
@@ -379,7 +378,6 @@ void HandleLinkClick (Point wherePt)
|
||||
if (linkWindow == nil)
|
||||
return;
|
||||
|
||||
SetPortWindowPort(linkWindow);
|
||||
wherePt -= linkWindow->GetTopLeftCoord();
|
||||
|
||||
part = FindControl(wherePt, linkWindow, &theControl);
|
||||
|
||||
@@ -54,7 +54,6 @@ extern short toolSelected;
|
||||
extern Boolean noRoomAtAll, isUseSecondScreen;
|
||||
extern Boolean quickerTransitions, houseIsReadOnly;
|
||||
|
||||
|
||||
//============================================================== Functions
|
||||
//-------------------------------------------------------------- DrawOnSplash
|
||||
|
||||
@@ -114,8 +113,6 @@ void RedrawSplashScreen (void)
|
||||
LoadScaledGraphic(surface, kSplash8BitPICT, &tempRect);
|
||||
DrawOnSplash(surface);
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||
&workSrcRect, &workSrcRect, srcCopy);
|
||||
@@ -138,8 +135,6 @@ void UpdateMainWindow (void)
|
||||
{
|
||||
Rect tempRect;
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
if (theMode == kEditMode)
|
||||
{
|
||||
PauseMarquee();
|
||||
@@ -159,7 +154,6 @@ void UpdateMainWindow (void)
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
|
||||
&workSrcRect, &mainWindowRect, srcCopy);
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
DrawOnSplash(mainWindow->GetDrawSurface());
|
||||
}
|
||||
@@ -187,7 +181,7 @@ void OpenMainWindow (void)
|
||||
|
||||
if (theMode == kEditMode)
|
||||
{
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(51, 51, 102, 255);
|
||||
PortabilityLayer::WindowManager::GetInstance()->SetBackgroundColor(51, 51, 102);
|
||||
|
||||
QSetRect(&mainWindowRect, 0, 0, 512, 322);
|
||||
mainWindow = GetNewCWindow(kEditWindowID, nil, kPutInFront);
|
||||
@@ -213,9 +207,9 @@ void OpenMainWindow (void)
|
||||
else
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(0, 0, 0, 255);
|
||||
PortabilityLayer::WindowManager::GetInstance()->SetBackgroundColor(0, 0, 0);
|
||||
#else
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(51, 0, 0, 255);
|
||||
PortabilityLayer::WindowManager::GetInstance()->SetBackgroundColor(51, 0, 0);
|
||||
#endif
|
||||
|
||||
if (boardWindow == nil)
|
||||
@@ -248,7 +242,6 @@ void OpenMainWindow (void)
|
||||
MoveWindow(boardWindow, mainWindowLeft, 0, true);
|
||||
MoveWindow(mainWindow, mainWindowLeft, mainWindowTop, true); // thisMac.menuHigh
|
||||
ShowWindow(mainWindow);
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
||||
|
||||
@@ -275,7 +268,6 @@ void OpenMainWindow (void)
|
||||
// ForceCTSeed((CGrafPtr)mainWindow, wasSeed);
|
||||
// }
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
UpdateMainWindow();
|
||||
}
|
||||
|
||||
@@ -373,7 +365,6 @@ void HandleMainClick (Point wherePt, Boolean isDoubleClick)
|
||||
(!houseUnlocked))
|
||||
return;
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
wherePt -= mainWindow->GetTopLeftCoord();
|
||||
|
||||
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
||||
|
||||
@@ -327,7 +327,6 @@ void UpdateMapWindow (void)
|
||||
|
||||
mapWindow->DrawControls();
|
||||
|
||||
SetPortWindowPort(mapWindow);
|
||||
// PL_NotYetImplemented_TODO("Resize")
|
||||
RedrawMapContents();
|
||||
|
||||
@@ -411,7 +410,6 @@ void OpenMapWindow (void)
|
||||
PortabilityLayer::WindowManager::GetInstance()->ShowWindow(mapWindow);
|
||||
// FlagWindowFloating(mapWindow); TEMP - use flaoting windows
|
||||
|
||||
SetPort(mapWindow->GetDrawSurface());
|
||||
QSetRect(&mapHScrollRect, -1, mapRoomsHigh * kMapRoomHeight,
|
||||
mapRoomsWide * kMapRoomWidth + 1,
|
||||
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth);
|
||||
@@ -619,7 +617,6 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
|
||||
if (mapWindow == nil)
|
||||
return;
|
||||
|
||||
SetPortWindowPort(mapWindow);
|
||||
globalWhere = wherePt;
|
||||
wherePt -= mapWindow->GetTopLeftCoord();
|
||||
wherePt.h -= 1;
|
||||
@@ -645,7 +642,6 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
|
||||
|
||||
if (thisMac.hasDrag)
|
||||
{
|
||||
SetPortWindowPort(mainWindow);
|
||||
QSetRect(&aRoom, 0, 0, kMapRoomWidth, kMapRoomHeight);
|
||||
CenterRectOnPoint(&aRoom, globalWhere);
|
||||
// if (DragRoom(theEvent, &aRoom, itsNumber))
|
||||
|
||||
@@ -613,8 +613,7 @@ void DrawDresser(Rect *dresser)
|
||||
short nRects, height, i;
|
||||
Pattern dummyPattern;
|
||||
|
||||
DrawSurface *surface = reinterpret_cast<DrawSurface*>(PortabilityLayer::QDManager::GetInstance()->GetPort());
|
||||
//surface = backSrcMap;
|
||||
DrawSurface *surface = backSrcMap;
|
||||
|
||||
if (thisMac.isDepth == 4)
|
||||
{
|
||||
|
||||
@@ -1046,10 +1046,6 @@ void DrawCalendar (Rect *theRect)
|
||||
Rect bounds;
|
||||
THandle<BitmapImage> thePicture;
|
||||
Str255 monthStr;
|
||||
DrawSurface *wasCPort;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
thePicture = PortabilityLayer::ResourceManager::GetInstance()->GetAppResource('PICT', kCalendarPictID).StaticCast<BitmapImage>();
|
||||
if (thePicture == nil)
|
||||
|
||||
@@ -736,7 +736,6 @@ void DoBlowerObjectInfo (short what)
|
||||
infoDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kBlowerInfoDialogID, kPutInFront, &substitutions);
|
||||
if (infoDial == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort(infoDial->GetWindow()->GetDrawSurface());
|
||||
|
||||
newDirection = thisRoom->objects[objActive].data.a.vector & 0x0F;
|
||||
if (thisRoom->objects[objActive].data.a.initial)
|
||||
@@ -1353,7 +1352,6 @@ void DoLightObjectInfo (void)
|
||||
infoDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kLightInfoDialogID, kPutInFront, &substitutions);
|
||||
if (infoDial == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort(infoDial->GetWindow()->GetDrawSurface());
|
||||
|
||||
if (thisRoom->objects[objActive].data.f.initial)
|
||||
SetDialogItemValue(infoDial, kInitialStateCheckbox, 1);
|
||||
|
||||
@@ -247,7 +247,6 @@ void NewGame (short mode)
|
||||
StopTheMusic();
|
||||
}
|
||||
NilSavedMaps();
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
UpdateMenus(false);
|
||||
|
||||
|
||||
@@ -147,8 +147,6 @@ void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
|
||||
dest = thisGlider->dest;
|
||||
QOffsetRect(&dest, playOriginH - 20, playOriginV - 16);
|
||||
|
||||
SetPort(workSrcMap);
|
||||
|
||||
long numMirrorRects = GetHandleSize(mirrorRects.StaticCast<void>()) / sizeof(Rect);
|
||||
|
||||
for (long i = 0; i < numMirrorRects; i++)
|
||||
|
||||
@@ -80,7 +80,6 @@ void ResetLocale (Boolean soft)
|
||||
|
||||
takingTheStairs = false;
|
||||
|
||||
DrawSurface *wasCPort = GetGraphicsPort();
|
||||
const short roomV = (*thisHouse)->rooms[thisRoomNumber].floor;
|
||||
|
||||
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
||||
@@ -138,8 +137,6 @@ void ResetLocale (Boolean soft)
|
||||
|
||||
if (soft)
|
||||
RedrawAllGrease();
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- LoadGraphicSpecial
|
||||
|
||||
@@ -457,7 +457,6 @@ void DoRoomInfo(void)
|
||||
roomInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kRoomInfoDialogID, kPutInFront, &substitutions);
|
||||
if (roomInfoDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort(roomInfoDialog->GetWindow()->GetDrawSurface());
|
||||
|
||||
{
|
||||
PortabilityLayer::WidgetBasicState state;
|
||||
|
||||
@@ -492,7 +492,6 @@ void DoControlPrefs (void)
|
||||
prefDlg = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kControlPrefsDialID, kPutInFront, nullptr);
|
||||
if (prefDlg == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
GetDialogItemRect(prefDlg, i + kRightControl, &controlRects[i]);
|
||||
@@ -1277,20 +1276,17 @@ void DoSettingsMain (void)
|
||||
case kDisplayButton:
|
||||
FlashSettingsButton(surface, 0);
|
||||
DoDisplayPrefs();
|
||||
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||
break;
|
||||
|
||||
case kSoundButton:
|
||||
FlashSettingsButton(surface, 1);
|
||||
DoSoundPrefs();
|
||||
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||
FlushEvents();
|
||||
break;
|
||||
|
||||
case kControlsButton:
|
||||
FlashSettingsButton(surface, 2);
|
||||
DoControlPrefs();
|
||||
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||
break;
|
||||
|
||||
case kBrainsButton:
|
||||
@@ -1302,7 +1298,6 @@ void DoSettingsMain (void)
|
||||
}
|
||||
FlashSettingsButton(surface, 3);
|
||||
DoBrainsPrefs();
|
||||
SetGraphicsPort(prefDlg->GetWindow()->GetDrawSurface());
|
||||
break;
|
||||
|
||||
case kAllDefaultsButton:
|
||||
|
||||
@@ -63,7 +63,6 @@ void InitScoreboardMap(void)
|
||||
{
|
||||
Rect bounds;
|
||||
THandle<BitmapImage> thePicture;
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
short hOffset;
|
||||
|
||||
@@ -265,11 +264,8 @@ void InitBlowers (void)
|
||||
|
||||
void InitFurniture (void)
|
||||
{
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&furnitureSrcRect, 0, 0, 64, 278); // 17856 pixels
|
||||
theErr = CreateOffScreenGWorld(&furnitureSrcMap, &furnitureSrcRect);
|
||||
LoadGraphic(furnitureSrcMap, kFurniturePictID);
|
||||
@@ -300,8 +296,6 @@ void InitFurniture (void)
|
||||
|
||||
QSetRect(&deckSrc, 0, 0, 64, 21);
|
||||
QOffsetRect(&deckSrc, 0, 162);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitPrizes
|
||||
|
||||
@@ -119,8 +119,6 @@ PLError_t RecreateOffscreens(void)
|
||||
{
|
||||
PLError_t theErr;
|
||||
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(nullptr);
|
||||
|
||||
if (workSrcMap)
|
||||
DisposeGWorld(workSrcMap);
|
||||
|
||||
|
||||
@@ -198,8 +198,6 @@ void EraseSelectedTool (void)
|
||||
if (toolsWindow == nil)
|
||||
return;
|
||||
|
||||
SetPort(toolsWindow->GetDrawSurface());
|
||||
|
||||
toolIcon = toolSelected;
|
||||
if ((toolMode == kBlowerMode) && (toolIcon >= 7))
|
||||
{
|
||||
@@ -470,7 +468,6 @@ void HandleToolsClick (Point wherePt)
|
||||
if (toolsWindow == nil)
|
||||
return;
|
||||
|
||||
SetPortWindowPort(toolsWindow);
|
||||
wherePt -= toolsWindow->GetTopLeftCoord();
|
||||
|
||||
part = FindControl(wherePt, toolsWindow, &theControl);
|
||||
|
||||
@@ -65,10 +65,7 @@ void GetWindowRect (WindowPtr theWindow, Rect *bounds)
|
||||
void GetLocalWindowRect (WindowPtr theWindow, Rect *bounds)
|
||||
{
|
||||
if (theWindow != nil)
|
||||
{
|
||||
SetPortWindowPort(theWindow);
|
||||
*bounds = theWindow->GetDrawSurface()->m_port.GetRect();
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- FlagWindowFloating
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
virtual void UpdatePalette(const void *paletteData) = 0;
|
||||
|
||||
virtual void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) = 0;
|
||||
virtual void SetBackgroundDarkenEffect(bool isDark) = 0;
|
||||
|
||||
virtual void RequestToggleFullScreen(uint32_t timestamp) = 0;
|
||||
virtual void RequestResetVirtualResolution() = 0;
|
||||
|
||||
@@ -606,7 +606,18 @@ GpDisplayDriverTickStatus_t GpDisplayDriverD3D11::PresentFrameAndSync()
|
||||
{
|
||||
SynchronizeCursors();
|
||||
|
||||
m_deviceContext->ClearRenderTargetView(m_virtualScreenTextureRTV, m_bgColor);
|
||||
FLOAT bgColor[4];
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
bgColor[i] = m_bgColor[i];
|
||||
|
||||
if (m_bgIsDark)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
bgColor[i] *= 0.25f;
|
||||
}
|
||||
|
||||
m_deviceContext->ClearRenderTargetView(m_virtualScreenTextureRTV, bgColor);
|
||||
|
||||
//ID3D11RenderTargetView *const rtv = m_backBufferRTV;
|
||||
ID3D11RenderTargetView *const vsRTV = m_virtualScreenTextureRTV;
|
||||
@@ -1413,6 +1424,11 @@ void GpDisplayDriverD3D11::SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, u
|
||||
m_bgColor[3] = static_cast<float>(a) / 255.0f;
|
||||
}
|
||||
|
||||
void GpDisplayDriverD3D11::SetBackgroundDarkenEffect(bool isDark)
|
||||
{
|
||||
m_bgIsDark = isDark;
|
||||
}
|
||||
|
||||
void GpDisplayDriverD3D11::RequestToggleFullScreen(uint32_t timestamp)
|
||||
{
|
||||
// Alt-Enter gets re-sent after a full-screen toggle, so we ignore toggle requests until half a second has elapsed
|
||||
@@ -1462,6 +1478,7 @@ GpDisplayDriverD3D11::GpDisplayDriverD3D11(const GpDisplayDriverProperties &prop
|
||||
, m_isFullScreenDesired(false)
|
||||
, m_isResolutionResetDesired(false)
|
||||
, m_lastFullScreenToggleTimeStamp(0)
|
||||
, m_bgIsDark(false)
|
||||
{
|
||||
memset(&m_syncTimeBase, 0, sizeof(m_syncTimeBase));
|
||||
memset(&m_windowModeRevertRect, 0, sizeof(m_windowModeRevertRect));
|
||||
@@ -1474,10 +1491,10 @@ GpDisplayDriverD3D11::GpDisplayDriverD3D11(const GpDisplayDriverProperties &prop
|
||||
m_ibeamCursor = reinterpret_cast<HCURSOR>(LoadImageW(nullptr, MAKEINTRESOURCEW(OCR_IBEAM), IMAGE_CURSOR, 0, 0, LR_SHARED));
|
||||
m_waitCursor = reinterpret_cast<HCURSOR>(LoadImageW(nullptr, MAKEINTRESOURCEW(OCR_WAIT), IMAGE_CURSOR, 0, 0, LR_SHARED));
|
||||
|
||||
m_bgColor[0] = 0;
|
||||
m_bgColor[1] = 0;
|
||||
m_bgColor[2] = 0;
|
||||
m_bgColor[3] = 255;
|
||||
m_bgColor[0] = 0.0f;
|
||||
m_bgColor[1] = 0.0f;
|
||||
m_bgColor[2] = 0.0f;
|
||||
m_bgColor[3] = 1.0f;
|
||||
}
|
||||
|
||||
GpDisplayDriverD3D11::~GpDisplayDriverD3D11()
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
void UpdatePalette(const void *paletteData) override;
|
||||
|
||||
void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) override;
|
||||
void SetBackgroundDarkenEffect(bool isDark) override;
|
||||
|
||||
void RequestToggleFullScreen(uint32_t timestamp) override;
|
||||
void RequestResetVirtualResolution() override;
|
||||
@@ -175,4 +176,5 @@ private:
|
||||
HCURSOR m_ibeamCursor;
|
||||
|
||||
float m_bgColor[4];
|
||||
bool m_bgIsDark;
|
||||
};
|
||||
|
||||
@@ -845,10 +845,6 @@ namespace PortabilityLayer
|
||||
|
||||
RefreshMenuBarLayout();
|
||||
|
||||
DrawSurface *oldGraf = GetGraphicsPort();
|
||||
|
||||
SetGraphicsPort(m_menuBarGraf);
|
||||
|
||||
ResolveCachingColor barMidColor = gs_barMidColor;
|
||||
|
||||
graf->FillRect(menuRect, barMidColor);
|
||||
@@ -976,8 +972,6 @@ namespace PortabilityLayer
|
||||
}
|
||||
}
|
||||
|
||||
SetGraphicsPort(oldGraf);
|
||||
|
||||
m_menuBarGraf->m_port.SetDirty(QDPortDirtyFlag_Contents);
|
||||
}
|
||||
|
||||
@@ -1406,10 +1400,6 @@ namespace PortabilityLayer
|
||||
|
||||
DrawSurface *surface = m_menuGraf;
|
||||
|
||||
DrawSurface *oldGraf = GetGraphicsPort();
|
||||
|
||||
SetGraphicsPort(m_menuGraf);
|
||||
|
||||
ResolveCachingColor barMidColor = gs_barMidColor;
|
||||
|
||||
{
|
||||
@@ -1514,8 +1504,6 @@ namespace PortabilityLayer
|
||||
}
|
||||
|
||||
m_menuGraf->m_port.SetDirty(QDPortDirtyFlag_Contents);
|
||||
|
||||
SetGraphicsPort(oldGraf);
|
||||
}
|
||||
|
||||
MenuManager *MenuManager::GetInstance()
|
||||
|
||||
@@ -43,13 +43,3 @@ void OffsetRect(Rect *rect, int right, int down)
|
||||
rect->top += down;
|
||||
rect->bottom += down;
|
||||
}
|
||||
|
||||
DrawSurface *GetGraphicsPort()
|
||||
{
|
||||
return PortabilityLayer::QDManager::GetInstance()->GetPort();
|
||||
}
|
||||
|
||||
void SetGraphicsPort(DrawSurface *gw)
|
||||
{
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(gw);
|
||||
}
|
||||
|
||||
@@ -24,8 +24,5 @@ PixMapHandle GetGWorldPixMap(DrawSurface *gworld);
|
||||
|
||||
void OffsetRect(Rect *rect, int right, int down);
|
||||
|
||||
DrawSurface *GetGraphicsPort();
|
||||
void SetGraphicsPort(DrawSurface *gw);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,11 +48,6 @@ static inline void InvertPixel32(uint8_t *pixel)
|
||||
pixel[3] = 255;
|
||||
}
|
||||
|
||||
void SetPort(DrawSurface *graf)
|
||||
{
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(graf);
|
||||
}
|
||||
|
||||
void EndUpdate(WindowPtr graf)
|
||||
{
|
||||
graf->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||
@@ -66,12 +61,6 @@ void SetRect(Rect *rect, short left, short top, short right, short bottom)
|
||||
rect->right = right;
|
||||
}
|
||||
|
||||
void SetPortWindowPort(WindowPtr window)
|
||||
{
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(window->GetDrawSurface());
|
||||
}
|
||||
|
||||
static void PlotLine(DrawSurface *surface, const PortabilityLayer::Vec2i &pointA, const PortabilityLayer::Vec2i &pointB, PortabilityLayer::ResolveCachingColor &foreColor)
|
||||
{
|
||||
const Rect lineRect = Rect::Create(
|
||||
|
||||
@@ -61,10 +61,6 @@ typedef CIconPtr *CIconHandle;
|
||||
|
||||
typedef Byte Pattern[8];
|
||||
|
||||
void SetPortWindowPort(WindowPtr window);
|
||||
|
||||
|
||||
void SetPort(DrawSurface *graf);
|
||||
void EndUpdate(WindowPtr graf);
|
||||
|
||||
void SetRect(Rect *rect, short left, short top, short right, short bottom);
|
||||
|
||||
@@ -15,21 +15,16 @@ namespace PortabilityLayer
|
||||
QDManagerImpl();
|
||||
|
||||
void Init() override;
|
||||
DrawSurface *GetPort() const override;
|
||||
void SetPort(DrawSurface *gw) override;
|
||||
PLError_t NewGWorld(DrawSurface **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable) override;
|
||||
void DisposeGWorld(DrawSurface *gw) override;
|
||||
|
||||
static QDManagerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
DrawSurface *m_port;
|
||||
|
||||
static QDManagerImpl ms_instance;
|
||||
};
|
||||
|
||||
QDManagerImpl::QDManagerImpl()
|
||||
: m_port(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -37,21 +32,6 @@ namespace PortabilityLayer
|
||||
{
|
||||
}
|
||||
|
||||
DrawSurface *QDManagerImpl::GetPort() const
|
||||
{
|
||||
return m_port;
|
||||
}
|
||||
|
||||
void QDManagerImpl::SetPort(DrawSurface *gw)
|
||||
{
|
||||
#if GP_DEBUG_CONFIG
|
||||
if (gw)
|
||||
gw->m_port.CheckPortSentinel();
|
||||
#endif
|
||||
|
||||
m_port = gw;
|
||||
}
|
||||
|
||||
PLError_t QDManagerImpl::NewGWorld(DrawSurface **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable)
|
||||
{
|
||||
void *grafStorage = MemoryManager::GetInstance()->Alloc(sizeof(DrawSurface));
|
||||
|
||||
@@ -15,8 +15,6 @@ namespace PortabilityLayer
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual DrawSurface *GetPort() const = 0;
|
||||
virtual void SetPort(DrawSurface *gw) = 0;
|
||||
virtual PLError_t NewGWorld(DrawSurface **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable) = 0;
|
||||
virtual void DisposeGWorld(DrawSurface *gw) = 0;
|
||||
|
||||
|
||||
@@ -196,6 +196,8 @@ namespace PortabilityLayer
|
||||
|
||||
void HandleScreenResolutionChange(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight) override;
|
||||
|
||||
void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b) override;
|
||||
|
||||
Window *GetPutInFrontSentinel() const override;
|
||||
|
||||
static WindowManagerImpl *GetInstance();
|
||||
@@ -1163,9 +1165,6 @@ namespace PortabilityLayer
|
||||
|
||||
DetachWindow(window);
|
||||
|
||||
if (PortabilityLayer::QDManager::GetInstance()->GetPort() == windowImpl->GetDrawSurface())
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(nullptr);
|
||||
|
||||
windowImpl->~WindowImpl();
|
||||
PortabilityLayer::MemoryManager::GetInstance()->Release(windowImpl);
|
||||
}
|
||||
@@ -1290,9 +1289,16 @@ namespace PortabilityLayer
|
||||
|
||||
void WindowManagerImpl::SwapExclusiveWindow(Window *& windowRef)
|
||||
{
|
||||
const bool hadExclusiveWindow = (m_exclusiveWindow != nullptr);
|
||||
|
||||
Window *temp = m_exclusiveWindow;
|
||||
m_exclusiveWindow = static_cast<WindowImpl*>(windowRef);
|
||||
windowRef = temp;
|
||||
|
||||
const bool haveExclusiveWindow = (m_exclusiveWindow != nullptr);
|
||||
|
||||
if (hadExclusiveWindow != haveExclusiveWindow)
|
||||
HostDisplayDriver::GetInstance()->SetBackgroundDarkenEffect(haveExclusiveWindow);
|
||||
}
|
||||
|
||||
void WindowManagerImpl::FlickerWindowIn(Window *window, int32_t velocity)
|
||||
@@ -1472,6 +1478,11 @@ namespace PortabilityLayer
|
||||
}
|
||||
}
|
||||
|
||||
void WindowManagerImpl::SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
HostDisplayDriver::GetInstance()->SetBackgroundColor(r, g, b, 255);
|
||||
}
|
||||
|
||||
void WindowManagerImpl::ResizeWindow(Window *window, int width, int height)
|
||||
{
|
||||
static_cast<WindowImpl*>(window)->Resize(width, height);
|
||||
|
||||
@@ -50,6 +50,8 @@ namespace PortabilityLayer
|
||||
|
||||
virtual void HandleScreenResolutionChange(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight) = 0;
|
||||
|
||||
virtual void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b) = 0;
|
||||
|
||||
static WindowManager *GetInstance();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user