GRAPHICS: MACGUI: Create MacText border mask

This commit is contained in:
Eugene Sandulenko
2026-04-11 22:48:16 +02:00
parent b5e9e7aa1a
commit bfd65a257e
4 changed files with 14 additions and 5 deletions
+8
View File
@@ -287,6 +287,7 @@ MacText::~MacText() {
g_system->getTimerManager()->removeTimerProc(&cursorTimerHandler);
_borderSurface.free();
_borderMaskSurface.free();
delete _cursorRect;
delete _cursorSurface;
@@ -335,6 +336,13 @@ void MacText::resizeScrollBar(int w, int h) {
_borderSurface.clear(_wm->_colorGreen);
}
_scrollBorder.blitBorderInto(_borderSurface, kWindowBorderScrollbar | kWindowBorderActive);
_borderMaskSurface.free();
_borderMaskSurface.create(w, h, _wm->_pixelformat);
if (_wm->_pixelformat.bytesPerPixel == 1) {
_borderMaskSurface.clear(_wm->_colorGreen);
}
_scrollBorder.blitBorderInto(_borderMaskSurface, kWindowBorderScrollbar | kWindowBorderActive, true, 0xff);
}
// this func returns the fg color of the first character we met in text
+1
View File
@@ -235,6 +235,7 @@ protected:
bool _scrollBar;
MacWindowBorder _scrollBorder;
ManagedSurface _borderSurface;
ManagedSurface _borderMaskSurface;
int _selEnd;
int _selStart;
+4 -4
View File
@@ -314,7 +314,7 @@ void MacWindowBorder::loadInternalBorder(uint32 flags) {
}
}
void MacWindowBorder::blitBorderInto(ManagedSurface &destination, uint32 flags) {
void MacWindowBorder::blitBorderInto(ManagedSurface &destination, uint32 flags, bool maskOnly, uint32 maskColor) {
if (flags >= kWindowBorderMaxFlag) {
warning("Accessing non-existed border type");
return;
@@ -337,12 +337,12 @@ void MacWindowBorder::blitBorderInto(ManagedSurface &destination, uint32 flags)
setTitle(_title, destination.w);
}
src->blit(destination, 0, 0, destination.w, destination.h, _wm);
src->blit(destination, 0, 0, destination.w, destination.h, _wm, maskOnly, maskColor);
if (flags & kWindowBorderTitle)
if (flags & kWindowBorderTitle && !maskOnly)
drawTitle(&destination, src->getTitleOffset(), _border[flags]->getMinWidth());
if (flags & kWindowBorderScrollbar)
if (flags & kWindowBorderScrollbar && !maskOnly)
drawScrollBar(&destination);
}
+1 -1
View File
@@ -141,7 +141,7 @@ public:
* @param border type that you want to draw
* @param wm The window manager.
*/
void blitBorderInto(ManagedSurface &destination, uint32 flags);
void blitBorderInto(ManagedSurface &destination, uint32 flags, bool maskOnly = false, uint32 maskColor = 0);
void setTitle(const Common::String& title, int width);