[Scummvm-git-logs] scummvm master -> 3d02c3a83f815a7f7cb2ecf4333a60e042c72ea0
dreammaster
noreply at scummvm.org
Thu Oct 30 06:38:15 UTC 2025
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
0f3a216a8f BAGEL: MFC: Calling ShowWindow sets the window as active
f7c86e0844 BAGEL: MFC: Don't palette map for DCs with no logical palette set
3d02c3a83f BAGEL: MFC: WM_QUERYNEWPALETTE shouldn't trigger repaint
Commit: 0f3a216a8fad51819e065168d7bce87f68f3985c
https://github.com/scummvm/scummvm/commit/0f3a216a8fad51819e065168d7bce87f68f3985c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-29T23:38:04-07:00
Commit Message:
BAGEL: MFC: Calling ShowWindow sets the window as active
Changed paths:
engines/bagel/mfc/dc.cpp
engines/bagel/mfc/libs/event_loop.cpp
engines/bagel/mfc/wnd.cpp
diff --git a/engines/bagel/mfc/dc.cpp b/engines/bagel/mfc/dc.cpp
index 5f42524df49..c76ce4970e6 100644
--- a/engines/bagel/mfc/dc.cpp
+++ b/engines/bagel/mfc/dc.cpp
@@ -789,6 +789,7 @@ unsigned int CDC::Impl::realizePalette() {
if (!m_bForceBackground && pTopLevel == app->GetActiveWindow()) {
// This window is active - update the system palette
AfxGetApp()->setPalette(*pal);
+ _paletteRealized = true;
return 1; // number of entries changed - simplified
} else {
_paletteRealized = true;
diff --git a/engines/bagel/mfc/libs/event_loop.cpp b/engines/bagel/mfc/libs/event_loop.cpp
index 94a47087c88..010e6848ea7 100644
--- a/engines/bagel/mfc/libs/event_loop.cpp
+++ b/engines/bagel/mfc/libs/event_loop.cpp
@@ -52,6 +52,9 @@ void EventLoop::runEventLoop() {
void EventLoop::SetActiveWindow(CWnd *wnd) {
assert(_quitFlag == QUIT_NONE);
+ if (wnd == GetActiveWindow())
+ // Already the active window
+ return;
// If it's the first window added, and we don't have
// a main window defined, set it as the main window
diff --git a/engines/bagel/mfc/wnd.cpp b/engines/bagel/mfc/wnd.cpp
index 7ecc8a70c70..63a43310f75 100644
--- a/engines/bagel/mfc/wnd.cpp
+++ b/engines/bagel/mfc/wnd.cpp
@@ -246,10 +246,12 @@ void CWnd::ShowWindow(int nCmdShow) {
assert(nCmdShow == SW_SHOW || nCmdShow == SW_SHOWNORMAL ||
nCmdShow == SW_HIDE);
- if (nCmdShow == SW_SHOW || nCmdShow == SW_SHOWNORMAL)
+ if (nCmdShow == SW_SHOW || nCmdShow == SW_SHOWNORMAL) {
m_nStyle |= WS_VISIBLE;
- else
+ SetActiveWindow();
+ } else {
m_nStyle &= ~WS_VISIBLE;
+ }
Invalidate(false);
SendMessage(WM_SHOWWINDOW, (m_nStyle & WS_VISIBLE) != 0);
Commit: f7c86e0844db800b033aed2eee2c0b2678700cda
https://github.com/scummvm/scummvm/commit/f7c86e0844db800b033aed2eee2c0b2678700cda
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-29T23:38:04-07:00
Commit Message:
BAGEL: MFC: Don't palette map for DCs with no logical palette set
Changed paths:
engines/bagel/mfc/afxwin.h
engines/bagel/mfc/dc.cpp
diff --git a/engines/bagel/mfc/afxwin.h b/engines/bagel/mfc/afxwin.h
index 55655e53e3e..f4b46902d0c 100644
--- a/engines/bagel/mfc/afxwin.h
+++ b/engines/bagel/mfc/afxwin.h
@@ -750,7 +750,7 @@ public:
uint getPenColor() const;
uint getBrushColor() const;
- uint32 *getPaletteMap(const Graphics::Palette *srcPal, const Graphics::Palette *destPal);
+ uint32 *getPaletteMap(const CDC::Impl *srcImpl);
public:
HBITMAP _bitmap;
@@ -760,6 +760,7 @@ public:
HPALETTE _palette = nullptr;
CPalette *_cPalette = nullptr;
bool m_bForceBackground = false;
+ bool _hasLogicalPalette = false;
public:
Impl(CWnd *wndOwner = nullptr);
diff --git a/engines/bagel/mfc/dc.cpp b/engines/bagel/mfc/dc.cpp
index c76ce4970e6..9c3d348ad27 100644
--- a/engines/bagel/mfc/dc.cpp
+++ b/engines/bagel/mfc/dc.cpp
@@ -761,6 +761,7 @@ HPALETTE CDC::Impl::selectPalette(HPALETTE pal, bool bForceBackground) {
if (pal) {
_palette = pal;
+ _hasLogicalPalette = true;
CBitmap::Impl *bitmap = (CBitmap::Impl *)_bitmap;
auto *newPal = static_cast<CPalette::Impl *>(pal);
@@ -1021,13 +1022,8 @@ void CDC::Impl::bitBlt(int x, int y, int nWidth, int nHeight, CDC *pSrcDC,
auto *srcImpl = pSrcDC->impl();
src = srcImpl->getSurface();
- // If the source DC has a realized palette, we need to set up a palette map
- // so that palette indexes can be mapped to our own destination palette
- if (_paletteRealized) {
- const Graphics::Palette *srcPal = dynamic_cast<Graphics::Palette *>(srcImpl->_palette);
- const Graphics::Palette *destPal = dynamic_cast<Graphics::Palette *>(_palette);
- paletteMap = getPaletteMap(srcPal, destPal);
- }
+ // Get a palette map if necessary
+ paletteMap = getPaletteMap(srcImpl);
}
Gfx::Surface *dest = getSurface();
@@ -1047,21 +1043,24 @@ void CDC::Impl::stretchBlt(int x, int y, int nWidth, int nHeight, CDC *pSrcDC,
const Common::Rect srcRect(xSrc, ySrc, xSrc + nSrcWidth, ySrc + nSrcHeight);
const Common::Rect destRect(x, y, x + nWidth, y + nHeight);
uint bgColor = getBkPixel();
- uint32 *paletteMap = nullptr;
-
- if (pSrcDC && _paletteRealized) {
- const Graphics::Palette *srcPal = dynamic_cast<Graphics::Palette *>(srcImpl->_palette);
- const Graphics::Palette *destPal = dynamic_cast<Graphics::Palette *>(_palette);
- paletteMap = getPaletteMap(srcPal, destPal);
- }
+ uint32 *paletteMap = getPaletteMap(srcImpl);
Gfx::stretchBlit(src, dest, srcRect, destRect, bgColor, dwRop, nullptr);
delete[] paletteMap;
}
-uint32 *CDC::Impl::getPaletteMap(const Graphics::Palette *srcPal, const Graphics::Palette *destPal) {
+uint32 *CDC::Impl::getPaletteMap(const CDC::Impl *srcImpl) {
+ // If we haven't realized our palette locally, or the source bitmap hasn't had any
+ // palette at all set, then return null indicating no palette mapping will occur
+ if (!_paletteRealized || !srcImpl->_hasLogicalPalette)
+ return nullptr;
+
+ const Graphics::Palette *srcPal = dynamic_cast<Graphics::Palette *>(srcImpl->_palette);
+ const Graphics::Palette *destPal = dynamic_cast<Graphics::Palette *>(_palette);
assert(srcPal && destPal && srcPal->size() == destPal->size());
+
+ // Create the map
Graphics::PaletteLookup palLookup(srcPal->data(), srcPal->size());
return palLookup.createMap(destPal->data(), destPal->size());
}
Commit: 3d02c3a83f815a7f7cb2ecf4333a60e042c72ea0
https://github.com/scummvm/scummvm/commit/3d02c3a83f815a7f7cb2ecf4333a60e042c72ea0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-29T23:38:04-07:00
Commit Message:
BAGEL: MFC: WM_QUERYNEWPALETTE shouldn't trigger repaint
For Art Parts at least, necessary bitmaps aren't yet created
when the screen is first activated, causing a crash.
So it seems it's not correct for the MFC code to do so.
Changed paths:
engines/bagel/mfc/wnd.cpp
diff --git a/engines/bagel/mfc/wnd.cpp b/engines/bagel/mfc/wnd.cpp
index 63a43310f75..545b77b3298 100644
--- a/engines/bagel/mfc/wnd.cpp
+++ b/engines/bagel/mfc/wnd.cpp
@@ -1259,8 +1259,6 @@ HWND CWnd::Detach() {
}
bool CWnd::OnQueryNewPalette() {
- Invalidate();
- UpdateWindow();
return true;
}
More information about the Scummvm-git-logs
mailing list