[Scummvm-git-logs] scummvm master -> d8b46ff8c3b79dca908ea7c71898984f65ad92d4
criezy
criezy at scummvm.org
Mon Jun 14 19:28:17 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0cf45fbc39 AGS: Fix some regressions with blender modes
d8b46ff8c3 AGS: Remove incorrect TODO
Commit: 0cf45fbc39467a7dc424424dc6d139e4188e9245
https://github.com/scummvm/scummvm/commit/0cf45fbc39467a7dc424424dc6d139e4188e9245
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-06-14T20:21:10+01:00
Commit Message:
AGS: Fix some regressions with blender modes
Changed paths:
R engines/ags/lib/allegro/col_blend.cpp
R engines/ags/lib/allegro/col_blend.h
engines/ags/engine/ac/draw.cpp
engines/ags/engine/gfx/ali_3d_scummvm.cpp
engines/ags/engine/gfx/blender.cpp
engines/ags/engine/gfx/blender.h
engines/ags/engine/gfx/gfx_util.cpp
engines/ags/lib/allegro/gfx.cpp
engines/ags/lib/allegro/gfx.h
engines/ags/module.mk
diff --git a/engines/ags/engine/ac/draw.cpp b/engines/ags/engine/ac/draw.cpp
index 144ef3b091..bc76a9e642 100644
--- a/engines/ags/engine/ac/draw.cpp
+++ b/engines/ags/engine/ac/draw.cpp
@@ -1468,9 +1468,9 @@ void tint_image(Bitmap *ds, Bitmap *srcimg, int red, int grn, int blu, int light
// when light is being adjusted and when it is not.
// If luminance >= 250, then normal brightness, otherwise darken
if (luminance >= 250)
- set_blender_mode(_myblender_color15, _myblender_color16, _myblender_color32, red, grn, blu, 0);
+ set_blender_mode(kTintBlenderMode, red, grn, blu, 0);
else
- set_blender_mode(_myblender_color15_light, _myblender_color16_light, _myblender_color32_light, red, grn, blu, 0);
+ set_blender_mode(kTintLightBlenderMode, red, grn, blu, 0);
if (light_level >= 100) {
// fully colourised
diff --git a/engines/ags/engine/gfx/ali_3d_scummvm.cpp b/engines/ags/engine/gfx/ali_3d_scummvm.cpp
index a1680bb17d..baa4cd31ce 100644
--- a/engines/ags/engine/gfx/ali_3d_scummvm.cpp
+++ b/engines/ags/engine/gfx/ali_3d_scummvm.cpp
@@ -39,7 +39,6 @@ namespace ALSW {
using namespace Shared;
-static unsigned long _trans_alpha_blender32(unsigned long x, unsigned long y, unsigned long n);
static RGB faded_out_palette[256];
@@ -398,7 +397,7 @@ void ScummVMRendererGraphicsDriver::RenderSpriteBatch(const ALSpriteBatch &batch
set_alpha_blender();
else
// here _transparency is used as alpha (between 1 and 254)
- set_blender_mode(nullptr, nullptr, _trans_alpha_blender32, 0, 0, 0, bitmap->_transparency);
+ set_blender_mode(kArgbToRgbBlender, 0, 0, 0, bitmap->_transparency);
surface->TransBlendBlt(bitmap->_bmp, drawAtX, drawAtY);
} else {
@@ -683,27 +682,6 @@ void ScummVMRendererGraphicsDriver::BoxOutEffect(bool blackingOut, int speed, in
}
// end fading routines
-// add the alpha values together, used for compositing alpha images
-// TODO: why is this here, move to gfx/blender? check if there's already similar function there
-static unsigned long _trans_alpha_blender32(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long res, g;
-
- n = (n * geta32(x)) / 256;
-
- if (n)
- n++;
-
- res = ((x & 0xFF00FF) - (y & 0xFF00FF)) * n / 256 + y;
- y &= 0xFF00;
- x &= 0xFF00;
- g = (x - y) * n / 256 + y;
-
- res &= 0xFF00FF;
- g &= 0xFF00;
-
- return res | g;
-}
-
ScummVMRendererGraphicsFactory *ScummVMRendererGraphicsFactory::_factory = nullptr;
diff --git a/engines/ags/engine/gfx/blender.cpp b/engines/ags/engine/gfx/blender.cpp
index c9c08e3bcc..96942f804f 100644
--- a/engines/ags/engine/gfx/blender.cpp
+++ b/engines/ags/engine/gfx/blender.cpp
@@ -20,225 +20,18 @@
*
*/
-#include "ags/lib/allegro/col_blend.h"
#include "ags/engine/gfx/blender.h"
#include "ags/lib/allegro.h"
#include "ags/shared/core/types.h"
namespace AGS3 {
-// Take hue and saturation of blend colour, luminance of image
-unsigned long _myblender_color15_light(unsigned long x, unsigned long y, unsigned long n) {
- float xh, xs, xv;
- float yh, ys, yv;
- int r, g, b;
-
- rgb_to_hsv(getr15(x), getg15(x), getb15(x), &xh, &xs, &xv);
- rgb_to_hsv(getr15(y), getg15(y), getb15(y), &yh, &ys, &yv);
-
- // adjust luminance
- yv -= (1.0 - ((float)n / 250.0));
- if (yv < 0.0) yv = 0.0;
-
- hsv_to_rgb(xh, xs, yv, &r, &g, &b);
-
- return makecol15(r, g, b);
-}
-
-// Take hue and saturation of blend colour, luminance of image
-// n is the last parameter passed to draw_lit_sprite
-unsigned long _myblender_color16_light(unsigned long x, unsigned long y, unsigned long n) {
- float xh, xs, xv;
- float yh, ys, yv;
- int r, g, b;
-
- rgb_to_hsv(getr16(x), getg16(x), getb16(x), &xh, &xs, &xv);
- rgb_to_hsv(getr16(y), getg16(y), getb16(y), &yh, &ys, &yv);
-
- // adjust luminance
- yv -= (1.0 - ((float)n / 250.0));
- if (yv < 0.0) yv = 0.0;
-
- hsv_to_rgb(xh, xs, yv, &r, &g, &b);
-
- return makecol16(r, g, b);
-}
-
-// Take hue and saturation of blend colour, luminance of image
-unsigned long _myblender_color32_light(unsigned long x, unsigned long y, unsigned long n) {
- float xh, xs, xv;
- float yh, ys, yv;
- int r, g, b;
-
- rgb_to_hsv(getr32(x), getg32(x), getb32(x), &xh, &xs, &xv);
- rgb_to_hsv(getr32(y), getg32(y), getb32(y), &yh, &ys, &yv);
-
- // adjust luminance
- yv -= (1.0 - ((float)n / 250.0));
- if (yv < 0.0) yv = 0.0;
-
- hsv_to_rgb(xh, xs, yv, &r, &g, &b);
-
- return makeacol32(r, g, b, geta32(y));
-}
-
-// Take hue and saturation of blend colour, luminance of image
-unsigned long _myblender_color15(unsigned long x, unsigned long y, unsigned long n) {
- float xh, xs, xv;
- float yh, ys, yv;
- int r, g, b;
-
- rgb_to_hsv(getr15(x), getg15(x), getb15(x), &xh, &xs, &xv);
- rgb_to_hsv(getr15(y), getg15(y), getb15(y), &yh, &ys, &yv);
-
- hsv_to_rgb(xh, xs, yv, &r, &g, &b);
-
- return makecol15(r, g, b);
-}
-
-// Take hue and saturation of blend colour, luminance of image
-unsigned long _myblender_color16(unsigned long x, unsigned long y, unsigned long n) {
- float xh, xs, xv;
- float yh, ys, yv;
- int r, g, b;
-
- rgb_to_hsv(getr16(x), getg16(x), getb16(x), &xh, &xs, &xv);
- rgb_to_hsv(getr16(y), getg16(y), getb16(y), &yh, &ys, &yv);
-
- hsv_to_rgb(xh, xs, yv, &r, &g, &b);
-
- return makecol16(r, g, b);
-}
-
-// Take hue and saturation of blend colour, luminance of image
-unsigned long _myblender_color32(unsigned long x, unsigned long y, unsigned long n) {
- float xh, xs, xv;
- float yh, ys, yv;
- int r, g, b;
-
- rgb_to_hsv(getr32(x), getg32(x), getb32(x), &xh, &xs, &xv);
- rgb_to_hsv(getr32(y), getg32(y), getb32(y), &yh, &ys, &yv);
-
- hsv_to_rgb(xh, xs, yv, &r, &g, &b);
-
- return makeacol32(r, g, b, geta32(y));
-}
-
-// trans24 blender, but preserve alpha channel from image
-unsigned long _myblender_alpha_trans24(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long res, g, alph;
-
- if (n)
- n++;
-
- alph = y & 0xff000000;
- y &= 0x00ffffff;
-
- res = ((x & 0xFF00FF) - (y & 0xFF00FF)) * n / 256 + y;
- y &= 0xFF00;
- x &= 0xFF00;
- g = (x - y) * n / 256 + y;
-
- res &= 0xFF00FF;
- g &= 0xFF00;
-
- return res | g | alph;
-}
-
void set_my_trans_blender(int r, int g, int b, int a) {
// use standard allegro 15 and 16 bit blenders, but customize
// the 32-bit one to preserve the alpha channel
- set_blender_mode(_blender_trans15, _blender_trans16, _myblender_alpha_trans24, r, g, b, a);
+ set_blender_mode(kAlphaPreservedBlenderMode, r, g, b, a);
}
-// plain copy source to destination
-// assign new alpha value as a summ of alphas.
-unsigned long _additive_alpha_copysrc_blender(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long newAlpha = ((x & 0xff000000) >> 24) + ((y & 0xff000000) >> 24);
-
- if (newAlpha > 0xff) newAlpha = 0xff;
-
- return (newAlpha << 24) | (x & 0x00ffffff);
-}
-
-FORCEINLINE unsigned long argb2argb_blend_core(unsigned long src_col, unsigned long dst_col, unsigned long src_alpha) {
- unsigned long dst_g, dst_alpha;
- src_alpha++;
- dst_alpha = geta32(dst_col);
- if (dst_alpha)
- dst_alpha++;
-
- // dst_g now contains the green hue from destination color
- dst_g = (dst_col & 0x00FF00) * dst_alpha / 256;
- // dst_col now contains the red & blue hues from destination color
- dst_col = (dst_col & 0xFF00FF) * dst_alpha / 256;
-
- // res_g now contains the green hue of the pre-final color
- dst_g = (((src_col & 0x00FF00) - (dst_g & 0x00FF00)) * src_alpha / 256 + dst_g) & 0x00FF00;
- // res_rb now contains the red & blue hues of the pre-final color
- dst_col = (((src_col & 0xFF00FF) - (dst_col & 0xFF00FF)) * src_alpha / 256 + dst_col) & 0xFF00FF;
-
- // dst_alpha now contains the final alpha
- // we assume that final alpha will never be zero
- dst_alpha = 256 - (256 - src_alpha) * (256 - dst_alpha) / 256;
- // src_alpha is now the final alpha factor made for being multiplied by,
- // instead of divided by: this makes it possible to use it in faster
- // calculation below
- src_alpha = /* 256 * 256 == */ 0x10000 / dst_alpha;
-
- // setting up final color hues
- dst_g = (dst_g * src_alpha / 256) & 0x00FF00;
- dst_col = (dst_col * src_alpha / 256) & 0xFF00FF;
- return dst_col | dst_g | (--dst_alpha << 24);
-}
-
-// blend source to destination with respect to source and destination alphas;
-// assign new alpha value as a multiplication of translucenses.
-// combined_alpha = front.alpha + back.alpha * (1 - front.alpha);
-// combined_rgb = (front.rgb * front.alpha + back.rgb * (1 - front.alpha) * back.alpha) / combined_alpha;
-unsigned long _argb2argb_blender(unsigned long src_col, unsigned long dst_col, unsigned long src_alpha) {
- if (src_alpha > 0)
- src_alpha = geta32(src_col) * ((src_alpha & 0xFF) + 1) / 256;
- else
- src_alpha = geta32(src_col);
- if (src_alpha == 0)
- return dst_col;
- return argb2argb_blend_core(src_col, dst_col, src_alpha);
-}
-
-unsigned long _rgb2argb_blender(unsigned long src_col, unsigned long dst_col, unsigned long src_alpha) {
- if (src_alpha == 0 || src_alpha == 0xFF)
- return src_col | 0xFF000000;
- return argb2argb_blend_core(src_col | 0xFF000000, dst_col, src_alpha);
-}
-
-unsigned long _argb2rgb_blender(unsigned long src_col, unsigned long dst_col, unsigned long src_alpha) {
- unsigned long res, g;
-
- if (src_alpha > 0)
- src_alpha = geta32(src_col) * ((src_alpha & 0xFF) + 1) / 256;
- else
- src_alpha = geta32(src_col);
- if (src_alpha)
- src_alpha++;
-
- res = ((src_col & 0xFF00FF) - (dst_col & 0xFF00FF)) * src_alpha / 256 + dst_col;
- dst_col &= 0xFF00;
- src_col &= 0xFF00;
- g = (src_col - dst_col) * src_alpha / 256 + dst_col;
-
- res &= 0xFF00FF;
- g &= 0xFF00;
-
- return res | g;
-}
-
-// sets the alpha channel to opaque. used when drawing a non-alpha sprite onto an alpha-sprite
-unsigned long _opaque_alpha_blender(unsigned long x, unsigned long y, unsigned long n) {
- return x | 0xff000000;
-}
-
-
void set_additive_alpha_blender() {
set_blender_mode(kAdditiveBlenderMode, 0, 0, 0, 0);
}
diff --git a/engines/ags/engine/gfx/blender.h b/engines/ags/engine/gfx/blender.h
index 63d94f6148..39551d9f50 100644
--- a/engines/ags/engine/gfx/blender.h
+++ b/engines/ags/engine/gfx/blender.h
@@ -43,29 +43,9 @@ namespace AGS3 {
void set_alpha_blender();
*/
-unsigned long _myblender_color15(unsigned long x, unsigned long y, unsigned long n);
-unsigned long _myblender_color16(unsigned long x, unsigned long y, unsigned long n);
-unsigned long _myblender_color32(unsigned long x, unsigned long y, unsigned long n);
-unsigned long _myblender_color15_light(unsigned long x, unsigned long y, unsigned long n);
-unsigned long _myblender_color16_light(unsigned long x, unsigned long y, unsigned long n);
-unsigned long _myblender_color32_light(unsigned long x, unsigned long y, unsigned long n);
// Customizable alpha blender that uses the supplied alpha value as src alpha,
// and preserves destination's alpha channel (if there was one);
void set_my_trans_blender(int r, int g, int b, int a);
-// Argb2argb alpha blender combines RGBs proportionally to src alpha, but also
-// applies dst alpha factor to the dst RGB used in the merge;
-// The final alpha is calculated by multiplying two translucences (1 - .alpha).
-// Custom alpha parameter, when not zero, is treated as fraction of source
-// alpha that has to be used in color blending.
-unsigned long _argb2argb_blender(unsigned long src_col, unsigned long dst_col, unsigned long src_alpha);
-// Argb2rgb blender combines RGBs proportionally to src alpha, but discards alpha in the end.
-// It is almost a clone of Allegro's _blender_alpha32, except it also applies optional overall alpha.
-unsigned long _argb2rgb_blender(unsigned long src_col, unsigned long dst_col, unsigned long src_alpha);
-// Rgb2argb blender treats all src pixels as if having opaque alpha.
-unsigned long _rgb2argb_blender(unsigned long src_col, unsigned long dst_col, unsigned long src_alpha);
-// Sets the alpha channel to opaque. Used when drawing a non-alpha sprite onto an alpha-sprite.
-unsigned long _opaque_alpha_blender(unsigned long src_col, unsigned long dst_col, unsigned long src_alpha);
-
// Additive alpha blender plain copies src over, applying a summ of src and
// dst alpha values.
void set_additive_alpha_blender();
diff --git a/engines/ags/engine/gfx/gfx_util.cpp b/engines/ags/engine/gfx/gfx_util.cpp
index c4d9db080c..db847be076 100644
--- a/engines/ags/engine/gfx/gfx_util.cpp
+++ b/engines/ags/engine/gfx/gfx_util.cpp
@@ -52,23 +52,21 @@ Bitmap *ConvertBitmap(Bitmap *src, int dst_color_depth) {
}
-typedef BLENDER_FUNC PfnBlenderCb;
-
struct BlendModeSetter {
// Blender setter for destination with and without alpha channel;
- // assign null pointer if not supported
- PfnBlenderCb AllAlpha; // src w alpha -> dst w alpha
- PfnBlenderCb AlphaToOpaque; // src w alpha -> dst w/o alpha
- PfnBlenderCb OpaqueToAlpha; // src w/o alpha -> dst w alpha
- PfnBlenderCb OpaqueToAlphaNoTrans; // src w/o alpha -> dst w alpha (opt-ed for no transparency)
- PfnBlenderCb AllOpaque; // src w/o alpha -> dst w/o alpha
+ // assign kRgbToRgbBlender if not supported
+ BlenderMode AllAlpha; // src w alpha -> dst w alpha
+ BlenderMode AlphaToOpaque; // src w alpha -> dst w/o alpha
+ BlenderMode OpaqueToAlpha; // src w/o alpha -> dst w alpha
+ BlenderMode OpaqueToAlphaNoTrans; // src w/o alpha -> dst w alpha (opt-ed for no transparency)
+ BlenderMode AllOpaque; // src w/o alpha -> dst w/o alpha
};
// Array of blender descriptions
-// NOTE: set NULL function pointer to fallback to common image blitting
+// NOTE: set kRgbToRgbBlender to fallback to common image blitting
static const BlendModeSetter BlendModeSets[kNumBlendModes] = {
- { nullptr, nullptr, nullptr, nullptr, nullptr }, // kBlendMode_NoAlpha
- { _argb2argb_blender, _argb2rgb_blender, _rgb2argb_blender, _opaque_alpha_blender, nullptr }, // kBlendMode_Alpha
+ { kRgbToRgbBlender, kRgbToRgbBlender, kRgbToRgbBlender, kRgbToRgbBlender, kRgbToRgbBlender }, // kBlendMode_NoAlpha
+ { kArgbToArgbBlender, kArgbToRgbBlender, kRgbToArgbBlender, kOpaqueBlenderMode, kRgbToRgbBlender }, // kBlendMode_Alpha
// NOTE: add new modes here
};
@@ -76,18 +74,15 @@ bool SetBlender(BlendMode blend_mode, bool dst_has_alpha, bool src_has_alpha, in
if (blend_mode < 0 || blend_mode > kNumBlendModes)
return false;
const BlendModeSetter &set = BlendModeSets[blend_mode];
- PfnBlenderCb blender;
+ BlenderMode blender;
if (dst_has_alpha)
blender = src_has_alpha ? set.AllAlpha :
(blend_alpha == 0xFF ? set.OpaqueToAlphaNoTrans : set.OpaqueToAlpha);
else
blender = src_has_alpha ? set.AlphaToOpaque : set.AllOpaque;
- if (blender) {
- set_blender_mode(nullptr, nullptr, blender, 0, 0, 0, blend_alpha);
- return true;
- }
- return false;
+ set_blender_mode(blender, 0, 0, 0, blend_alpha);
+ return true;
}
void DrawSpriteBlend(Bitmap *ds, const Point &ds_at, Bitmap *sprite,
diff --git a/engines/ags/lib/allegro/col_blend.cpp b/engines/ags/lib/allegro/col_blend.cpp
deleted file mode 100644
index 22377dc636..0000000000
--- a/engines/ags/lib/allegro/col_blend.cpp
+++ /dev/null
@@ -1,368 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "common/textconsole.h"
-#include "ags/lib/allegro.h"
-#include "ags/globals.h"
-//#include "allegro/internal/aintern.h"
-
-namespace AGS3 {
-
-#define BLEND(bpp, r, g, b) _blender_trans##bpp(makecol##bpp(r, g, b), y, n)
-
-#define T(x, y, n) (((y) - (x)) * (n) / 255 + (x))
-
-
-
-/* _blender_black:
- * Fallback routine for when we don't have anything better to do.
- */
-unsigned long _blender_black(unsigned long x, unsigned long y, unsigned long n) {
- return 0;
-}
-
-
-
-#if (defined ALLEGRO_COLOR24) || (defined ALLEGRO_COLOR32)
-
-
-
-#if (defined ALLEGRO_NO_ASM) || (!defined ALLEGRO_I386)
-/* i386 asm version is in imisc.s */
-
-
-/* _blender_trans24:
- * 24 bit trans blender function.
- */
-unsigned long _blender_trans24(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long res, g;
-
- if (n)
- n++;
-
- res = ((x & 0xFF00FF) - (y & 0xFF00FF)) * n / 256 + y;
- y &= 0xFF00;
- x &= 0xFF00;
- g = (x - y) * n / 256 + y;
-
- res &= 0xFF00FF;
- g &= 0xFF00;
-
- return res | g;
-}
-
-
-#endif /* C version */
-
-
-
-/* _blender_alpha24:
- * Combines a 32 bit RGBA sprite with a 24 bit RGB destination.
- */
-unsigned long _blender_alpha24(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long xx = makecol24(getr32(x), getg32(x), getb32(x));
- unsigned long res, g;
-
- n = geta32(x);
-
- if (n)
- n++;
-
- res = ((xx & 0xFF00FF) - (y & 0xFF00FF)) * n / 256 + y;
- y &= 0xFF00;
- xx &= 0xFF00;
- g = (xx - y) * n / 256 + y;
-
- res &= 0xFF00FF;
- g &= 0xFF00;
-
- return res | g;
-}
-
-
-
-/* _blender_alpha32:
- * Combines a 32 bit RGBA sprite with a 32 bit RGB destination.
- */
-unsigned long _blender_alpha32(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long res, g;
-
- n = geta32(x);
-
- if (n)
- n++;
-
- res = ((x & 0xFF00FF) - (y & 0xFF00FF)) * n / 256 + y;
- y &= 0xFF00;
- x &= 0xFF00;
- g = (x - y) * n / 256 + y;
-
- res &= 0xFF00FF;
- g &= 0xFF00;
-
- return res | g;
-}
-
-
-
-/* _blender_alpha24_bgr:
- * Combines a 32 bit RGBA sprite with a 24 bit RGB destination, optimised
- * for when one is in a BGR format and the other is RGB.
- */
-unsigned long _blender_alpha24_bgr(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long res, g;
-
- n = x >> 24;
-
- if (n)
- n++;
-
- x = ((x >> 16) & 0xFF) | (x & 0xFF00) | ((x << 16) & 0xFF0000);
-
- res = ((x & 0xFF00FF) - (y & 0xFF00FF)) * n / 256 + y;
- y &= 0xFF00;
- x &= 0xFF00;
- g = (x - y) * n / 256 + y;
-
- res &= 0xFF00FF;
- g &= 0xFF00;
-
- return res | g;
-}
-
-#endif /* end of 24/32 bit routines */
-
-
-#if (defined ALLEGRO_COLOR15) || (defined ALLEGRO_COLOR16)
-
-
-
-/* _blender_trans16:
- * 16 bit trans blender function.
- */
-unsigned long _blender_trans16(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long result;
-
- if (n)
- n = (n + 1) / 8;
-
- x = ((x & 0xFFFF) | (x << 16)) & 0x7E0F81F;
- y = ((y & 0xFFFF) | (y << 16)) & 0x7E0F81F;
-
- result = ((x - y) * n / 32 + y) & 0x7E0F81F;
-
- return ((result & 0xFFFF) | (result >> 16));
-}
-
-
-
-/* _blender_alpha16:
- * Combines a 32 bit RGBA sprite with a 16 bit RGB destination.
- */
-unsigned long _blender_alpha16(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long result;
-
- n = geta32(x);
-
- if (n)
- n = (n + 1) / 8;
-
- x = makecol16(getr32(x), getg32(x), getb32(x));
-
- x = (x | (x << 16)) & 0x7E0F81F;
- y = ((y & 0xFFFF) | (y << 16)) & 0x7E0F81F;
-
- result = ((x - y) * n / 32 + y) & 0x7E0F81F;
-
- return ((result & 0xFFFF) | (result >> 16));
-}
-
-
-
-/* _blender_alpha16_rgb
- * Combines a 32 bit RGBA sprite with a 16 bit RGB destination, optimised
- * for when both pixels are in an RGB layout.
- */
-unsigned long _blender_alpha16_rgb(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long result;
-
- n = x >> 24;
-
- if (n)
- n = (n + 1) / 8;
-
- x = ((x >> 3) & 0x001F) | ((x >> 5) & 0x07E0) | ((x >> 8) & 0xF800);
-
- x = (x | (x << 16)) & 0x7E0F81F;
- y = ((y & 0xFFFF) | (y << 16)) & 0x7E0F81F;
-
- result = ((x - y) * n / 32 + y) & 0x7E0F81F;
-
- return ((result & 0xFFFF) | (result >> 16));
-}
-
-
-
-/* _blender_alpha16_bgr
- * Combines a 32 bit RGBA sprite with a 16 bit RGB destination, optimised
- * for when one pixel is in an RGB layout and the other is BGR.
- */
-unsigned long _blender_alpha16_bgr(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long result;
-
- n = x >> 24;
-
- if (n)
- n = (n + 1) / 8;
-
- x = ((x >> 19) & 0x001F) | ((x >> 5) & 0x07E0) | ((x << 8) & 0xF800);
-
- x = (x | (x << 16)) & 0x7E0F81F;
- y = ((y & 0xFFFF) | (y << 16)) & 0x7E0F81F;
-
- result = ((x - y) * n / 32 + y) & 0x7E0F81F;
-
- return ((result & 0xFFFF) | (result >> 16));
-}
-
-
-/* _blender_trans15:
- * 15 bit trans blender function.
- */
-unsigned long _blender_trans15(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long result;
-
- if (n)
- n = (n + 1) / 8;
-
- x = ((x & 0xFFFF) | (x << 16)) & 0x3E07C1F;
- y = ((y & 0xFFFF) | (y << 16)) & 0x3E07C1F;
-
- result = ((x - y) * n / 32 + y) & 0x3E07C1F;
-
- return ((result & 0xFFFF) | (result >> 16));
-}
-
-
-
-/* _blender_alpha15:
- * Combines a 32 bit RGBA sprite with a 15 bit RGB destination.
- */
-unsigned long _blender_alpha15(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long result;
-
- n = geta32(x);
-
- if (n)
- n = (n + 1) / 8;
-
- x = makecol15(getr32(x), getg32(x), getb32(x));
-
- x = (x | (x << 16)) & 0x3E07C1F;
- y = ((y & 0xFFFF) | (y << 16)) & 0x3E07C1F;
-
- result = ((x - y) * n / 32 + y) & 0x3E07C1F;
-
- return ((result & 0xFFFF) | (result >> 16));
-}
-
-
-
-/* _blender_alpha15_rgb
- * Combines a 32 bit RGBA sprite with a 15 bit RGB destination, optimised
- * for when both pixels are in an RGB layout.
- */
-unsigned long _blender_alpha15_rgb(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long result;
-
- n = x >> 24;
-
- if (n)
- n = (n + 1) / 8;
-
- x = ((x >> 3) & 0x001F) | ((x >> 6) & 0x03E0) | ((x >> 9) & 0xEC00);
-
- x = (x | (x << 16)) & 0x3E07C1F;
- y = ((y & 0xFFFF) | (y << 16)) & 0x3E07C1F;
-
- result = ((x - y) * n / 32 + y) & 0x3E07C1F;
-
- return ((result & 0xFFFF) | (result >> 16));
-}
-
-
-
-/* _blender_alpha15_bgr
- * Combines a 32 bit RGBA sprite with a 15 bit RGB destination, optimised
- * for when one pixel is in an RGB layout and the other is BGR.
- */
-unsigned long _blender_alpha15_bgr(unsigned long x, unsigned long y, unsigned long n) {
- unsigned long result;
-
- n = x >> 24;
-
- if (n)
- n = (n + 1) / 8;
-
- x = ((x >> 19) & 0x001F) | ((x >> 6) & 0x03E0) | ((x << 7) & 0xEC00);
-
- x = (x | (x << 16)) & 0x3E07C1F;
- y = ((y & 0xFFFF) | (y << 16)) & 0x3E07C1F;
-
- result = ((x - y) * n / 32 + y) & 0x3E07C1F;
-
- return ((result & 0xFFFF) | (result >> 16));
-}
-
-#endif /* end of 15/16 bit routines */
-
-
-
-#ifdef ALLEGRO_COLOR16
-#define BF16(name) name
-#else
-#define BF16(name) _blender_black
-#endif
-
-
-#if (defined ALLEGRO_COLOR24) || (defined ALLEGRO_COLOR32)
-#define BF24(name) name
-#else
-#define BF24(name) _blender_black
-#endif
-
-
-
-/* these functions are all the same, so we can generate them with a macro */
-#define SET_BLENDER_FUNC(name) \
- void set_##name##_blender(int r, int g, int b, int a) \
- { \
- set_blender_mode(BF16(_blender_##name##15), \
- BF16(_blender_##name##16), \
- BF24(_blender_##name##24), \
- r, g, b, a); \
- }
-
-
-//SET_BLENDER_FUNC(trans)
-
-} // namespace AGS3
diff --git a/engines/ags/lib/allegro/col_blend.h b/engines/ags/lib/allegro/col_blend.h
deleted file mode 100644
index e468011298..0000000000
--- a/engines/ags/lib/allegro/col_blend.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef AGS_LIB_ALLEGRO_COL_BLEND_H
-#define AGS_LIB_ALLEGRO_COL_BLEND_H
-
-namespace AGS3 {
-
-unsigned long _blender_trans16(unsigned long x, unsigned long y, unsigned long n);
-unsigned long _blender_trans15(unsigned long x, unsigned long y, unsigned long n);
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/lib/allegro/gfx.cpp b/engines/ags/lib/allegro/gfx.cpp
index c0ae9d1149..9534c81673 100644
--- a/engines/ags/lib/allegro/gfx.cpp
+++ b/engines/ags/lib/allegro/gfx.cpp
@@ -371,8 +371,4 @@ void clear_bitmap(BITMAP *bmp) {
bmp->clear();
}
-void set_blender_mode(BLENDER_FUNC b15, BLENDER_FUNC b16, BLENDER_FUNC b24, int r, int g, int b, int a) {
- // TODO
-}
-
} // namespace AGS3
diff --git a/engines/ags/lib/allegro/gfx.h b/engines/ags/lib/allegro/gfx.h
index 18de3f3458..b42b8e4ff3 100644
--- a/engines/ags/lib/allegro/gfx.h
+++ b/engines/ags/lib/allegro/gfx.h
@@ -236,9 +236,6 @@ extern void rectfill(BITMAP *bmp, int x1, int y_1, int x2, int y2, int color);
extern void triangle(BITMAP *bmp, int x1, int y_1, int x2, int y2, int x3, int y3, int color);
extern void circlefill(BITMAP *bmp, int x, int y, int radius, int color);
-typedef unsigned long(*BLENDER_FUNC)(unsigned long x, unsigned long y, unsigned long n);
-extern void set_blender_mode(BLENDER_FUNC b15, BLENDER_FUNC b16, BLENDER_FUNC b24, int r, int g, int b, int a);
-
} // namespace AGS3
#endif
diff --git a/engines/ags/module.mk b/engines/ags/module.mk
index 67b39f584d..821aaffd36 100644
--- a/engines/ags/module.mk
+++ b/engines/ags/module.mk
@@ -12,7 +12,6 @@ MODULE_OBJS = \
lib/aastr-0.1.1/aastr.o \
lib/aastr-0.1.1/aautil.o \
lib/alfont/alfont.o \
- lib/allegro/col_blend.o \
lib/allegro/color.o \
lib/allegro/config.o \
lib/allegro/draw.o \
Commit: d8b46ff8c3b79dca908ea7c71898984f65ad92d4
https://github.com/scummvm/scummvm/commit/d8b46ff8c3b79dca908ea7c71898984f65ad92d4
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-06-14T20:21:10+01:00
Commit Message:
AGS: Remove incorrect TODO
The ShouldAntiAliasText check is now done in ALFONT_FONT::getFont()
so we do not need a separate alfont_textout_aa function.
Changed paths:
engines/ags/lib/alfont/alfont.cpp
engines/ags/lib/alfont/alfont.h
engines/ags/shared/font/ttf_font_renderer.cpp
diff --git a/engines/ags/lib/alfont/alfont.cpp b/engines/ags/lib/alfont/alfont.cpp
index 2d5326167f..1cc6b47fde 100644
--- a/engines/ags/lib/alfont/alfont.cpp
+++ b/engines/ags/lib/alfont/alfont.cpp
@@ -74,11 +74,6 @@ void alfont_textout(BITMAP *bmp, ALFONT_FONT *font, const char *text, int x, int
font->getFont()->drawString(&surf, text, x, y, bmp->w - x, color);
}
-void alfont_textout_aa(BITMAP *bmp, ALFONT_FONT *font, const char *text, int x, int y, uint32 color) {
- warning("TODO: alfont_textout_aa");
- return alfont_textout(bmp, font, text, x, y, color);
-}
-
void alfont_set_font_size(ALFONT_FONT *font, int size) {
font->_size = size;
}
diff --git a/engines/ags/lib/alfont/alfont.h b/engines/ags/lib/alfont/alfont.h
index 671c400afd..852e52bd31 100644
--- a/engines/ags/lib/alfont/alfont.h
+++ b/engines/ags/lib/alfont/alfont.h
@@ -56,7 +56,6 @@ extern void alfont_destroy_font(ALFONT_FONT *font);
extern size_t alfont_text_length(ALFONT_FONT *font, const char *text);
extern size_t alfont_text_height(ALFONT_FONT *font);
extern void alfont_textout(BITMAP *bmp, ALFONT_FONT *font, const char *text, int x, int y, uint32 color);
-extern void alfont_textout_aa(BITMAP *bmp, ALFONT_FONT *font, const char *text, int x, int y, uint32 color);
extern const char *alfont_get_name(ALFONT_FONT *font);
extern void alfont_set_font_size(ALFONT_FONT *font, int size);
diff --git a/engines/ags/shared/font/ttf_font_renderer.cpp b/engines/ags/shared/font/ttf_font_renderer.cpp
index ea68d98979..052576273d 100644
--- a/engines/ags/shared/font/ttf_font_renderer.cpp
+++ b/engines/ags/shared/font/ttf_font_renderer.cpp
@@ -69,10 +69,7 @@ void TTFFontRenderer::RenderText(const char *text, int fontNumber, BITMAP *desti
return;
// Y - 1 because it seems to get drawn down a bit
- if ((ShouldAntiAliasText()) && (bitmap_color_depth(destination) > 8))
- alfont_textout_aa(destination, _fontData[fontNumber].AlFont, text, x, y - 1, colour);
- else
- alfont_textout(destination, _fontData[fontNumber].AlFont, text, x, y - 1, colour);
+ alfont_textout(destination, _fontData[fontNumber].AlFont, text, x, y - 1, colour);
}
bool TTFFontRenderer::LoadFromDisk(int fontNumber, int fontSize) {
More information about the Scummvm-git-logs
mailing list