mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
More work. Audio driver works enough to play music now.
This commit is contained in:
71
PortabilityLayer/QDState.cpp
Normal file
71
PortabilityLayer/QDState.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#include "QDState.h"
|
||||
|
||||
#include "PLQuickdraw.h"
|
||||
#include "QDStandardPalette.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
QDState::QDState()
|
||||
: m_fontID(applFont)
|
||||
, m_textSize(12)
|
||||
, m_textFace(0)
|
||||
, m_foreResolvedColor16(0)
|
||||
, m_backResolvedColor16(0)
|
||||
, m_foreResolvedColor8(0)
|
||||
, m_backResolvedColor8(0)
|
||||
, m_isForeResolved16(false)
|
||||
, m_isBackResolved16(false)
|
||||
, m_isForeResolved8(false)
|
||||
, m_isBackResolved8(false)
|
||||
, m_clipRegion(nullptr)
|
||||
{
|
||||
m_backUnresolvedColor.r = m_backUnresolvedColor.g = m_backUnresolvedColor.b = m_backUnresolvedColor.a = 255;
|
||||
m_foreUnresolvedColor.r = m_foreUnresolvedColor.g = m_foreUnresolvedColor.b = 0;
|
||||
m_foreUnresolvedColor.a = 255;
|
||||
}
|
||||
|
||||
void QDState::SetForeColor(const RGBAColor &color)
|
||||
{
|
||||
m_foreUnresolvedColor = color;
|
||||
m_isForeResolved16 = false;
|
||||
m_isForeResolved8 = false;
|
||||
}
|
||||
|
||||
void QDState::SetBackColor(const RGBAColor &color)
|
||||
{
|
||||
m_backUnresolvedColor = color;
|
||||
m_isBackResolved16 = false;
|
||||
m_isBackResolved8 = false;
|
||||
}
|
||||
|
||||
uint8_t QDState::ResolveForeColor8(const RGBAColor *palette, unsigned int numColors)
|
||||
{
|
||||
return ResolveColor8(m_foreUnresolvedColor, m_foreResolvedColor8, m_isForeResolved8, palette, numColors);
|
||||
}
|
||||
|
||||
uint8_t QDState::ResolveBackColor8(const RGBAColor *palette, unsigned int numColors)
|
||||
{
|
||||
return ResolveColor8(m_backUnresolvedColor, m_backResolvedColor8, m_isBackResolved8, palette, numColors);
|
||||
}
|
||||
|
||||
uint8_t QDState::ResolveColor8(const RGBAColor &color, uint8_t &cached, bool &isCached, const RGBAColor *palette, unsigned int numColors)
|
||||
{
|
||||
if (isCached)
|
||||
return cached;
|
||||
|
||||
if (palette)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint8_t resolvedColor = StandardPalette::GetInstance()->MapColorLUT(color);
|
||||
|
||||
isCached = true;
|
||||
cached = resolvedColor;
|
||||
|
||||
return resolvedColor;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user