[Scummvm-git-logs] scummvm master -> b7ac5bc106eff3d1e8c5e80723fe874c1c4b8c1c
eriktorbjorn
noreply at scummvm.org
Fri Jan 3 11:50:31 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b7ac5bc106 SCUMM: MACGUI: Use Graphics::maskBlit() for masked blitting
Commit: b7ac5bc106eff3d1e8c5e80723fe874c1c4b8c1c
https://github.com/scummvm/scummvm/commit/b7ac5bc106eff3d1e8c5e80723fe874c1c4b8c1c
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2025-01-03T12:47:46+01:00
Commit Message:
SCUMM: MACGUI: Use Graphics::maskBlit() for masked blitting
Not that this is going to make any difference in performance, I think,
but it's a good way to test that the cicn loader is doing the right
thing when constructing that mask.
Changed paths:
engines/scumm/macgui/macgui_dialogwindow.cpp
diff --git a/engines/scumm/macgui/macgui_dialogwindow.cpp b/engines/scumm/macgui/macgui_dialogwindow.cpp
index 07ad2055a66..77702aa986a 100644
--- a/engines/scumm/macgui/macgui_dialogwindow.cpp
+++ b/engines/scumm/macgui/macgui_dialogwindow.cpp
@@ -22,6 +22,7 @@
#include "common/system.h"
#include "common/macresman.h"
+#include "graphics/blit.h"
#include "graphics/cursorman.h"
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/paletteman.h"
@@ -805,19 +806,24 @@ MacGuiImpl::MacWidget *MacGuiImpl::MacDialogWindow::getWidget(MacWidgetType type
}
void MacGuiImpl::MacDialogWindow::drawSprite(const MacImage *image, int x, int y) {
- const Graphics::Surface *surface = image->getImage();
- const Graphics::Surface *mask = image->getMask();
-
- if (mask) {
- for (int y1 = 0; y1 < mask->h; y1++) {
- for (int x1 = 0; x1 < mask->w; x1++) {
- if (mask->getPixel(x1, y1) == 255)
- _innerSurface.setPixel(x + x1, y + y1, surface->getPixel(x1, y1));
- }
- }
- markRectAsDirty(Common::Rect(x, y, x + surface->w, y + surface->h));
+ Graphics::Surface *dstSurface = innerSurface();
+ const Graphics::Surface *srcSurface = image->getImage();
+ const Graphics::Surface *maskSurface = image->getMask();
+
+ if (maskSurface) {
+ byte *dst = (byte*)dstSurface->getBasePtr(x, y);
+ const byte *src = (const byte *)srcSurface->getBasePtr(0, 0);
+ const byte *mask = (const byte *)maskSurface->getBasePtr(0, 0);
+
+ assert(srcSurface->format == dstSurface->format);
+
+ Graphics::maskBlit(dst, src, mask,
+ dstSurface->pitch, srcSurface->pitch, maskSurface->pitch,
+ srcSurface->w, srcSurface->h,
+ dstSurface->format.bytesPerPixel);
+ markRectAsDirty(Common::Rect(x, y, x + srcSurface->w, y + srcSurface->h));
} else
- drawSprite(image->getImage(), x, y);
+ drawSprite(srcSurface, x, y);
}
void MacGuiImpl::MacDialogWindow::drawSprite(const Graphics::Surface *sprite, int x, int y) {
More information about the Scummvm-git-logs
mailing list