mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-24 07:06:36 +00:00
Refactor QD ports so they no longer need to be the first member of draw surfaces
This commit is contained in:
@@ -46,15 +46,10 @@ void OffsetRect(Rect *rect, int right, int down)
|
||||
|
||||
DrawSurface *GetGraphicsPort()
|
||||
{
|
||||
PortabilityLayer::QDPort *port = PortabilityLayer::QDManager::GetInstance()->GetPort();
|
||||
|
||||
DrawSurface *grafPtr = reinterpret_cast<DrawSurface *>(port);
|
||||
assert(&grafPtr->m_port == port);
|
||||
|
||||
return grafPtr;
|
||||
return PortabilityLayer::QDManager::GetInstance()->GetPort();
|
||||
}
|
||||
|
||||
void SetGraphicsPort(DrawSurface *gw)
|
||||
{
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(&gw->m_port);
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(gw);
|
||||
}
|
||||
|
@@ -38,13 +38,7 @@ static inline void InvertPixel8(uint8_t &pixel)
|
||||
pixel = 255 ^ pixel;
|
||||
}
|
||||
|
||||
|
||||
void GetPort(GrafPtr *graf)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void SetPort(GrafPtr graf)
|
||||
void SetPort(DrawSurface *graf)
|
||||
{
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(graf);
|
||||
}
|
||||
@@ -65,7 +59,7 @@ void SetRect(Rect *rect, short left, short top, short right, short bottom)
|
||||
void SetPortWindowPort(WindowPtr window)
|
||||
{
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(&window->GetDrawSurface()->m_port);
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(window->GetDrawSurface());
|
||||
}
|
||||
|
||||
void SetPortDialogPort(Dialog *dialog)
|
||||
|
@@ -58,16 +58,13 @@ private:
|
||||
typedef CIcon *CIconPtr;
|
||||
typedef CIconPtr *CIconHandle;
|
||||
|
||||
typedef PortabilityLayer::QDPort GrafPort;
|
||||
typedef GrafPort *GrafPtr;
|
||||
|
||||
typedef Byte Pattern[8];
|
||||
|
||||
void GetPort(GrafPtr *graf);
|
||||
void SetPort(GrafPtr graf);
|
||||
void SetPortWindowPort(WindowPtr window);
|
||||
void SetPortDialogPort(Dialog *dialog);
|
||||
|
||||
|
||||
void SetPort(DrawSurface *graf);
|
||||
void EndUpdate(WindowPtr graf);
|
||||
|
||||
void SetRect(Rect *rect, short left, short top, short right, short bottom);
|
||||
|
@@ -98,11 +98,10 @@ struct DrawSurface
|
||||
|
||||
PortabilityLayer::RenderedFont *ResolveFont(bool aa) const;
|
||||
|
||||
// Must be the first item
|
||||
PortabilityLayer::QDPort m_port;
|
||||
|
||||
IGpDisplayDriverSurface *m_ddSurface;
|
||||
|
||||
PortabilityLayer::AntiAliasTable *m_cachedAATable;
|
||||
PortabilityLayer::RGBAColor m_cachedAAColor;
|
||||
|
||||
PortabilityLayer::QDPort m_port;
|
||||
};
|
||||
|
@@ -16,8 +16,8 @@ namespace PortabilityLayer
|
||||
QDManagerImpl();
|
||||
|
||||
void Init() override;
|
||||
QDPort *GetPort() const override;
|
||||
void SetPort(QDPort *gw) 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;
|
||||
QDState *GetState() override;
|
||||
@@ -25,7 +25,7 @@ namespace PortabilityLayer
|
||||
static QDManagerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
QDPort *m_port;
|
||||
DrawSurface *m_port;
|
||||
|
||||
static QDManagerImpl ms_instance;
|
||||
};
|
||||
@@ -39,16 +39,16 @@ namespace PortabilityLayer
|
||||
{
|
||||
}
|
||||
|
||||
QDPort *QDManagerImpl::GetPort() const
|
||||
DrawSurface *QDManagerImpl::GetPort() const
|
||||
{
|
||||
return m_port;
|
||||
}
|
||||
|
||||
void QDManagerImpl::SetPort(QDPort *gw)
|
||||
void QDManagerImpl::SetPort(DrawSurface *gw)
|
||||
{
|
||||
#if GP_DEBUG_CONFIG
|
||||
if (gw)
|
||||
gw->CheckPortSentinel();
|
||||
gw->m_port.CheckPortSentinel();
|
||||
#endif
|
||||
|
||||
m_port = gw;
|
||||
@@ -83,7 +83,7 @@ namespace PortabilityLayer
|
||||
|
||||
QDState *QDManagerImpl::GetState()
|
||||
{
|
||||
return m_port->GetState();
|
||||
return m_port->m_port.GetState();
|
||||
}
|
||||
|
||||
QDManagerImpl *QDManagerImpl::GetInstance()
|
||||
|
@@ -16,8 +16,8 @@ namespace PortabilityLayer
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual QDPort *GetPort() const = 0;
|
||||
virtual void SetPort(QDPort *gw) = 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;
|
||||
|
||||
|
@@ -35,7 +35,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
#if GP_DEBUG_CONFIG
|
||||
// Detach the port BEFORE destroying it!!
|
||||
assert(PortabilityLayer::QDManager::GetInstance()->GetPort() != this);
|
||||
assert(&PortabilityLayer::QDManager::GetInstance()->GetPort()->m_port != this);
|
||||
#endif
|
||||
|
||||
DisposePixMap();
|
||||
|
@@ -1102,7 +1102,7 @@ namespace PortabilityLayer
|
||||
|
||||
DetachWindow(window);
|
||||
|
||||
if (PortabilityLayer::QDManager::GetInstance()->GetPort() == &windowImpl->GetDrawSurface()->m_port)
|
||||
if (PortabilityLayer::QDManager::GetInstance()->GetPort() == windowImpl->GetDrawSurface())
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(nullptr);
|
||||
|
||||
windowImpl->~WindowImpl();
|
||||
|
Reference in New Issue
Block a user