GRAPHICS: MACGUI: Use uint32 for color information

This commit is contained in:
Eugene Sandulenko 2022-08-20 22:12:29 +02:00
parent 0fc6a5e0f8
commit ba4a260e9e
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
3 changed files with 12 additions and 12 deletions

View File

@ -109,7 +109,7 @@ uint MacTextLine::getChunkNum(int *col) {
}
MacText::MacText(MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, const Common::U32String &s, const MacFont *macFont, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, int interlinear, uint16 border, uint16 gutter, uint16 boxShadow, uint16 textShadow, bool fixedDims) :
MacText::MacText(MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, const Common::U32String &s, const MacFont *macFont, uint32 fgcolor, uint32 bgcolor, int maxWidth, TextAlign textAlignment, int interlinear, uint16 border, uint16 gutter, uint16 boxShadow, uint16 textShadow, bool fixedDims) :
MacWidget(parent, x, y, w, h, wm, true, border, gutter, boxShadow),
_macFont(macFont), _maxWidth(maxWidth), _textAlignment(textAlignment), _interLinear(interlinear) {
@ -135,7 +135,7 @@ MacText::MacText(MacWidget *parent, int x, int y, int w, int h, MacWindowManager
}
// NOTE: This constructor and the one afterward are for MacText engines that don't use widgets. This is the classic was MacText was constructed.
MacText::MacText(const Common::U32String &s, MacWindowManager *wm, const MacFont *macFont, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, int interlinear, bool fixedDims) :
MacText::MacText(const Common::U32String &s, MacWindowManager *wm, const MacFont *macFont, uint32 fgcolor, uint32 bgcolor, int maxWidth, TextAlign textAlignment, int interlinear, bool fixedDims) :
MacWidget(nullptr, 0, 0, 0, 0, wm, false, 0, 0, 0),
_macFont(macFont), _maxWidth(maxWidth), _textAlignment(textAlignment), _interLinear(interlinear) {
@ -159,7 +159,7 @@ MacText::MacText(const Common::U32String &s, MacWindowManager *wm, const MacFont
}
// Working with plain Font
MacText::MacText(const Common::U32String &s, MacWindowManager *wm, const Font *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, int interlinear, bool fixedDims) :
MacText::MacText(const Common::U32String &s, MacWindowManager *wm, const Font *font, uint32 fgcolor, uint32 bgcolor, int maxWidth, TextAlign textAlignment, int interlinear, bool fixedDims) :
MacWidget(nullptr, 0, 0, 0, 0, wm, false, 0, 0, 0),
_macFont(nullptr), _maxWidth(maxWidth), _textAlignment(textAlignment), _interLinear(interlinear) {
@ -368,7 +368,7 @@ void MacText::setTextColor(uint32 color, uint32 line) {
return;
}
uint fgcol = _wm->findBestColor(color);
uint32 fgcol = _wm->findBestColor(color);
for (uint j = 0; j < _textLines[line].chunks.size(); j++) {
_textLines[line].chunks[j].fgcolor = fgcol;
}
@ -401,7 +401,7 @@ void setTextColorCallback(MacFontRun &macFontRun, int color) {
}
void MacText::setTextColor(uint32 color, uint32 start, uint32 end) {
uint col = _wm->findBestColor(color);
uint32 col = _wm->findBestColor(color);
setTextChunks(start, end, col, setTextColorCallback);
}
@ -507,7 +507,7 @@ int MacText::getTextSize(int start, int end) {
return getTextChunks(start, end).fontSize;
}
uint MacText::getTextColor(int start, int end) {
uint32 MacText::getTextColor(int start, int end) {
return getTextChunks(start, end).fgcolor;
}

View File

@ -48,7 +48,7 @@ struct MacFontRun {
uint16 palinfo1;
uint16 palinfo2;
uint16 palinfo3;
uint16 fgcolor;
uint32 fgcolor;
// to determine whether the next word is part of this one
bool wordContinuation;
const Font *font;
@ -157,12 +157,12 @@ struct SelectedText {
class MacText : public MacWidget {
public:
MacText(MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, const Common::U32String &s, const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment = kTextAlignLeft, int interlinear = 0, uint16 border = 0, uint16 gutter = 0, uint16 boxShadow = 0, uint16 textShadow = 0, bool fixedDims = true);
MacText(MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, const Common::U32String &s, const MacFont *font, uint32 fgcolor, uint32 bgcolor, int maxWidth, TextAlign textAlignment = kTextAlignLeft, int interlinear = 0, uint16 border = 0, uint16 gutter = 0, uint16 boxShadow = 0, uint16 textShadow = 0, bool fixedDims = true);
// 0 pixels between the lines by default
MacText(const Common::U32String &s, MacWindowManager *wm, const MacFont *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, int interlinear = 0, bool fixedDims = true);
MacText(const Common::U32String &s, MacWindowManager *wm, const MacFont *font, uint32 fgcolor, uint32 bgcolor, int maxWidth, TextAlign textAlignment, int interlinear = 0, bool fixedDims = true);
MacText(const Common::U32String &s, MacWindowManager *wm, const Font *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment, int interlinear = 0, bool fixedDims = true);
MacText(const Common::U32String &s, MacWindowManager *wm, const Font *font, uint32 fgcolor, uint32 bgcolor, int maxWidth, TextAlign textAlignment, int interlinear = 0, bool fixedDims = true);
virtual ~MacText();

View File

@ -323,8 +323,8 @@ public:
void setEngineRedrawCallback(void *engine, void (*redrawCallback)(void *engine));
void passPalette(const byte *palette, uint size);
uint findBestColor(byte cr, byte cg, byte cb);
uint findBestColor(uint32 color);
uint32 findBestColor(byte cr, byte cg, byte cb);
uint32 findBestColor(uint32 color);
void decomposeColor(uint32 color, byte &r, byte &g, byte &b);
void setDesktopColor(byte, byte, byte);