[Scummvm-git-logs] scummvm master -> f09620b42347b1a828250fce20f18fbc58f059d4
criezy
criezy at scummvm.org
Fri Mar 5 23:49:22 UTC 2021
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
02761dfe29 AGS: Fix wrong alpha shift for 32 bit colors
1f5a068a0f AGS: Remove obsolete TODO
f09620b423 AGS: Remove workaround in source alpha blnder for fully transparent sprites
Commit: 02761dfe2968ee327f8b042fda5a3a1be43e22cd
https://github.com/scummvm/scummvm/commit/02761dfe2968ee327f8b042fda5a3a1be43e22cd
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-03-05T23:49:12Z
Commit Message:
AGS: Fix wrong alpha shift for 32 bit colors
The color component shifts in allegro were not initialized
properly and were all set to 0 instead of the default allegro
shifts. And as AGS engine_setup_color_conversions() doesn't
set the alpha shift (as it uses the default allegro value)
it was 0 instead of 24. As a result makecol32 was setting
the alpha in the blue component. This meant that opaque
black was for example fully transparent blue instead.
Changed paths:
engines/ags/lib/allegro/aintern.h
engines/ags/lib/allegro/color.cpp
diff --git a/engines/ags/lib/allegro/aintern.h b/engines/ags/lib/allegro/aintern.h
index 338805ba04..c85f2beab2 100644
--- a/engines/ags/lib/allegro/aintern.h
+++ b/engines/ags/lib/allegro/aintern.h
@@ -26,6 +26,21 @@
#include "ags/lib/allegro/base.h"
#include "ags/lib/allegro/color.h"
+/* default truecolor pixel format */
+#define DEFAULT_RGB_R_SHIFT_15 0
+#define DEFAULT_RGB_G_SHIFT_15 5
+#define DEFAULT_RGB_B_SHIFT_15 10
+#define DEFAULT_RGB_R_SHIFT_16 0
+#define DEFAULT_RGB_G_SHIFT_16 5
+#define DEFAULT_RGB_B_SHIFT_16 11
+#define DEFAULT_RGB_R_SHIFT_24 0
+#define DEFAULT_RGB_G_SHIFT_24 8
+#define DEFAULT_RGB_B_SHIFT_24 16
+#define DEFAULT_RGB_R_SHIFT_32 0
+#define DEFAULT_RGB_G_SHIFT_32 8
+#define DEFAULT_RGB_B_SHIFT_32 16
+#define DEFAULT_RGB_A_SHIFT_32 24
+
namespace AGS3 {
extern int _color_depth;
diff --git a/engines/ags/lib/allegro/color.cpp b/engines/ags/lib/allegro/color.cpp
index 79638b0a05..fc4bc7977d 100644
--- a/engines/ags/lib/allegro/color.cpp
+++ b/engines/ags/lib/allegro/color.cpp
@@ -33,19 +33,19 @@ namespace AGS3 {
#define VGA_COLOR_TRANS(x) ((x) * 255 / 63)
-int _rgb_r_shift_15 = 0;
-int _rgb_g_shift_15 = 0;
-int _rgb_b_shift_15 = 0;
-int _rgb_r_shift_16 = 0;
-int _rgb_g_shift_16 = 0;
-int _rgb_b_shift_16 = 0;
-int _rgb_r_shift_24 = 0;
-int _rgb_g_shift_24 = 0;
-int _rgb_b_shift_24 = 0;
-int _rgb_r_shift_32 = 0;
-int _rgb_g_shift_32 = 0;
-int _rgb_b_shift_32 = 0;
-int _rgb_a_shift_32 = 0;
+int _rgb_r_shift_15 = DEFAULT_RGB_R_SHIFT_15; /* truecolor pixel format */
+int _rgb_g_shift_15 = DEFAULT_RGB_G_SHIFT_15;
+int _rgb_b_shift_15 = DEFAULT_RGB_B_SHIFT_15;
+int _rgb_r_shift_16 = DEFAULT_RGB_R_SHIFT_16;
+int _rgb_g_shift_16 = DEFAULT_RGB_G_SHIFT_16;
+int _rgb_b_shift_16 = DEFAULT_RGB_B_SHIFT_16;
+int _rgb_r_shift_24 = DEFAULT_RGB_R_SHIFT_24;
+int _rgb_g_shift_24 = DEFAULT_RGB_G_SHIFT_24;
+int _rgb_b_shift_24 = DEFAULT_RGB_B_SHIFT_24;
+int _rgb_r_shift_32 = DEFAULT_RGB_R_SHIFT_32;
+int _rgb_g_shift_32 = DEFAULT_RGB_G_SHIFT_32;
+int _rgb_b_shift_32 = DEFAULT_RGB_B_SHIFT_32;
+int _rgb_a_shift_32 = DEFAULT_RGB_A_SHIFT_32;
RGB_MAP *rgb_map;
COLOR_MAP *color_map;
@@ -153,35 +153,31 @@ int getb16(int c) {
}
int getr24(int c) {
- error("TODO: getr24");
+ return ((c >> _rgb_r_shift_24) & 0xFF);
}
int getg24(int c) {
- error("TODO: getg24");
+ return ((c >> _rgb_g_shift_24) & 0xFF);
}
int getb24(int c) {
- error("TODO: getb24");
-}
-
-int geta24(int c) {
- error("TODO: geta24");
+ return ((c >> _rgb_b_shift_24) & 0xFF);
}
int getr32(int c) {
- error("TODO: getr32");
+ return ((c >> _rgb_r_shift_32) & 0xFF);
}
int getg32(int c) {
- error("TODO: getg32");
+ return ((c >> _rgb_g_shift_32) & 0xFF);
}
int getb32(int c) {
- error("TODO: getb32");
+ return ((c >> _rgb_b_shift_32) & 0xFF);
}
int geta32(int c) {
- error("TODO: geta32");
+ return ((c >> _rgb_a_shift_32) & 0xFF);
}
int makecol(byte r, byte g, byte b) {
Commit: 1f5a068a0f1f18a56baf08fb935ca5ef06902d37
https://github.com/scummvm/scummvm/commit/1f5a068a0f1f18a56baf08fb935ca5ef06902d37
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-03-05T23:49:12Z
Commit Message:
AGS: Remove obsolete TODO
We did need to skip transparent colors for paletted bitmaps
and this was fixed in a previous commit.
Changed paths:
engines/ags/lib/allegro/surface.cpp
diff --git a/engines/ags/lib/allegro/surface.cpp b/engines/ags/lib/allegro/surface.cpp
index 7dadf35715..fd32f252b3 100644
--- a/engines/ags/lib/allegro/surface.cpp
+++ b/engines/ags/lib/allegro/surface.cpp
@@ -161,7 +161,6 @@ void BITMAP::draw(const BITMAP *srcBitmap, const Common::Rect &srcRect,
byte *destVal = (byte *)&destP[destX * format.bytesPerPixel];
if (src.format.bytesPerPixel == 1 && format.bytesPerPixel == 1) {
- // TODO: Need to skip transparent color if skip_trans is true?
if (!skipTrans || *srcVal != 0)
*destVal = *srcVal;
continue;
Commit: f09620b42347b1a828250fce20f18fbc58f059d4
https://github.com/scummvm/scummvm/commit/f09620b42347b1a828250fce20f18fbc58f059d4
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-03-05T23:49:12Z
Commit Message:
AGS: Remove workaround in source alpha blnder for fully transparent sprites
We were setting the alpha of 32 bit colors incorrectly, but this
is now fixed. So we no longer need this workaround.
Changed paths:
engines/ags/lib/allegro/surface.h
diff --git a/engines/ags/lib/allegro/surface.h b/engines/ags/lib/allegro/surface.h
index e10ecf8665..57cee82fd4 100644
--- a/engines/ags/lib/allegro/surface.h
+++ b/engines/ags/lib/allegro/surface.h
@@ -217,12 +217,6 @@ private:
inline void blendSourceAlpha(uint8 aSrc, uint8 rSrc, uint8 gSrc, uint8 bSrc, uint8 &aDest, uint8 &rDest, uint8 &gDest, uint8 &bDest, uint32 alpha) const {
// Used after set_alpha_blender
// Uses alpha from source. Result is fully opaque
- // TODO: Understand why the line below is needed. It is not there in the original code.
- // But without it we have some display issue for example with some text at the start
- // of Blackwell Deception. We may incorrectly set the alpha on bitmaps in some cases
- // causing them to be fully transparent when they should not.
- if (aSrc == 0)
- aSrc = 0xff;
rgbBlend(rSrc, gSrc, bSrc, rDest, gDest, bDest, aSrc);
// Original doesn't set alpha (so it is 0), but the function is not meant to be used
// on bitmap with transparency. Should we set alpha to 0xff?
More information about the Scummvm-git-logs
mailing list