[Scummvm-git-logs] scummvm branch-2-2 -> 5f9a0b8b3938ed6d98a7b368787d4ad8e5e5196c
yuv422
yuv422 at users.noreply.github.com
Sun Sep 13 05:38:29 UTC 2020
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:
5f9a0b8b39 DRAGONS: Fixed alpha blending for scaled sprites. Fixes #11689
Commit: 5f9a0b8b3938ed6d98a7b368787d4ad8e5e5196c
https://github.com/scummvm/scummvm/commit/5f9a0b8b3938ed6d98a7b368787d4ad8e5e5196c
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-09-13T15:38:09+10:00
Commit Message:
DRAGONS: Fixed alpha blending for scaled sprites. Fixes #11689
Changed paths:
engines/dragons/scene.cpp
engines/dragons/screen.cpp
engines/dragons/screen.h
diff --git a/engines/dragons/scene.cpp b/engines/dragons/scene.cpp
index 26e68acd95..37e150f5ec 100644
--- a/engines/dragons/scene.cpp
+++ b/engines/dragons/scene.cpp
@@ -388,7 +388,7 @@ void Scene::draw() {
debug(5, "Actor %d %s (%d, %d) w:%d h:%d Priority: %d Scale: %d", actor->_actorID, actor->_actorResource->getFilename(), x,
y,
s->w, s->h, actor->_priorityLayer, actor->_scale);
- _screen->copyRectToSurface8bpp(*s, actor->getPalette(), x, y, Common::Rect(s->w, s->h), (bool)(actor->_frame->flags & FRAME_FLAG_FLIP_X), actor->isFlagSet(ACTOR_FLAG_8000) ? NONE : NORMAL, actor->_scale);
+ _screen->copyRectToSurface8bpp(*s, actor->getPalette(), x, y, Common::Rect(s->w, s->h), (bool)(actor->_frame->flags & FRAME_FLAG_FLIP_X), actor->isFlagSet(ACTOR_FLAG_8000) ? NONE : NORMAL, actor->_scale);
if (_vm->isDebugMode()) {
_screen->drawRect(0x7fff, Common::Rect(x, y, x + s->w, y + s->h), actor->_actorID);
drawActorNumber(x + s->w, y + 8, actor->_actorID);
diff --git a/engines/dragons/screen.cpp b/engines/dragons/screen.cpp
index 3c3eb4487d..cca0a97ff5 100644
--- a/engines/dragons/screen.cpp
+++ b/engines/dragons/screen.cpp
@@ -205,7 +205,7 @@ void Screen::copyRectToSurface8bpp(const void *buffer, const byte* palette, int
}
void Screen::drawScaledSprite(Graphics::Surface *destSurface, const byte *source, int sourceWidth, int sourceHeight,
- int destX, int destY, int destWidth, int destHeight, const byte *palette, bool flipX, uint8 alpha) {
+ int destX, int destY, int destWidth, int destHeight, const byte *palette, bool flipX, AlphaBlendMode alpha) {
//TODO this logic is pretty messy. It should probably be re-written. It is trying to scale, clip, flip and blend at once.
// Based on the GNAP engine scaling code
@@ -245,11 +245,11 @@ void Screen::drawScaledSprite(Graphics::Surface *destSurface, const byte *source
byte colorIndex = *wsrc;
uint16 c = READ_LE_UINT16(&palette[colorIndex * 2]);
if (c != 0) {
- if (!(c & 0x8000) || alpha == 255) {
+ if (!(c & 0x8000u) || alpha == NONE) {
// only copy opaque pixels
WRITE_LE_UINT16(wdst, c & ~0x8000);
} else {
- WRITE_LE_UINT16(wdst, alphaBlendRGB555(c, READ_LE_INT16(wdst), alpha));
+ WRITE_LE_UINT16(wdst, alphaBlendRGB555(c & 0x7fffu, READ_LE_UINT16(wdst) & 0x7fffu, 128));
// semi-transparent pixels.
}
}
diff --git a/engines/dragons/screen.h b/engines/dragons/screen.h
index 310b8e78ce..b395f74f7b 100644
--- a/engines/dragons/screen.h
+++ b/engines/dragons/screen.h
@@ -96,7 +96,7 @@ public:
private:
void copyRectToSurface(const void *buffer, int srcPitch, int srcWidth, int srcXOffset, int destX, int destY, int width, int height, bool flipX, AlphaBlendMode alpha);
void copyRectToSurface8bpp(const void *buffer, const byte* palette, int srcPitch, int srcWidth, int srcXOffset, int destX, int destY, int width, int height, bool flipX, AlphaBlendMode alpha);
- void drawScaledSprite(Graphics::Surface *destSurface, const byte *source, int sourceWidth, int sourceHeight, int destX, int destY, int destWidth, int destHeight, const byte *palette, bool flipX, uint8 alpha);
+ void drawScaledSprite(Graphics::Surface *destSurface, const byte *source, int sourceWidth, int sourceHeight, int destX, int destY, int destWidth, int destHeight, const byte *palette, bool flipX, AlphaBlendMode alpha);
};
} // End of namespace Dragons
More information about the Scummvm-git-logs
mailing list