diff options
author | Filippos Karapetis | 2009-09-04 10:15:12 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-09-04 10:15:12 +0000 |
commit | c3a13a6ae634e4dbca81ab9623414a2bdf82ff26 (patch) | |
tree | ac909d5f63b49f321f2c706d2ca859ed9d84c77b /engines/sci | |
parent | 9381362277c6626f53d6ae8a706d7af76bb930e1 (diff) | |
download | scummvm-rg350-c3a13a6ae634e4dbca81ab9623414a2bdf82ff26.tar.gz scummvm-rg350-c3a13a6ae634e4dbca81ab9623414a2bdf82ff26.tar.bz2 scummvm-rg350-c3a13a6ae634e4dbca81ab9623414a2bdf82ff26.zip |
Removed the "reverse alpha" flag from the graphics driver code. Alpha values are now always 0 for transparent, up to 255 for opaque
svn-id: r43939
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/gfx/gfx_pixmap_scale.cpp | 13 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_resmgr.cpp | 1 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_support.cpp | 43 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_system.h | 6 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_tools.cpp | 2 |
5 files changed, 17 insertions, 48 deletions
diff --git a/engines/sci/gfx/gfx_pixmap_scale.cpp b/engines/sci/gfx/gfx_pixmap_scale.cpp index 392f3bbf6b..865fcf3662 100644 --- a/engines/sci/gfx/gfx_pixmap_scale.cpp +++ b/engines/sci/gfx/gfx_pixmap_scale.cpp @@ -44,8 +44,8 @@ namespace Sci { template<int COPY_BYTES, typename SIZETYPE, int EXTRA_BYTE_OFFSET> void _gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { SIZETYPE result_colors[GFX_PIC_COLORS]; - SIZETYPE alpha_color = 0xffffffff & 0; - SIZETYPE alpha_ormask = 0; + SIZETYPE alpha_color = 0; + SIZETYPE alpha_ormask = 0xffffffff & 0; int xfact = (scale) ? mode->xfact : 1; int yfact = (scale) ? mode->yfact : 1; int widthc, heightc; // Width duplication counter @@ -53,19 +53,14 @@ void _gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale int bytespp = mode->bytespp; int x, y; int i; - byte byte_transparent = (mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA) ? 0 : 255; - byte byte_opaque = (mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA) ? 255 : 0; + byte byte_transparent = 0; + byte byte_opaque = 255; byte *src = pxm->index_data; byte *dest = pxm->data; byte *alpha_dest = pxm->alpha_map; int using_alpha = pxm->color_key != GFX_PIXMAP_COLOR_KEY_NONE; int separate_alpha_map = using_alpha; - if (mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA) { - alpha_ormask = alpha_color; - alpha_color = 0; - } - assert(bytespp == COPY_BYTES); if (separate_alpha_map && !alpha_dest) diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 405b1a7b72..12551fa0f9 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -317,7 +317,6 @@ gfx_mode_t mode_1x1_color_index = { /* Fake 1x1 mode */ /* xfact */ 1, /* yfact */ 1, /* xsize */ 1, /* ysize */ 1, /* bytespp */ 1, - /* flags */ 0, /* palette */ NULL, Graphics::PixelFormat() diff --git a/engines/sci/gfx/gfx_support.cpp b/engines/sci/gfx/gfx_support.cpp index f8776c3257..40da361f91 100644 --- a/engines/sci/gfx/gfx_support.cpp +++ b/engines/sci/gfx/gfx_support.cpp @@ -128,7 +128,7 @@ void gfx_draw_box_pixmap_i(gfx_pixmap_t *pxm, rect_t box, int color) { * BYTESPP: Bytes per pixel * USE_PRIORITY: Whether to care about the priority buffer */ -template <int BYTESPP, bool USE_PRIORITY, bool REVERSE_ALPHA> +template <int BYTESPP, bool USE_PRIORITY> void _gfx_crossblit(byte *dest, byte *src, int bytes_per_dest_line, int bytes_per_src_line, int xl, int yl, byte *alpha, int bytes_per_alpha_line, int bytes_per_alpha_pixel, unsigned int alpha_test_mask, unsigned int alpha_min, @@ -143,7 +143,7 @@ void _gfx_crossblit(byte *dest, byte *src, int bytes_per_dest_line, int bytes_pe int priority_offset = 0; for (x = 0; x < alpha_end; x += bytes_per_alpha_pixel) { - if (((alpha_test_mask & alpha[x]) < alpha_min) ^ REVERSE_ALPHA) { + if (((alpha_test_mask & alpha[x]) < alpha_min) ^ 1) { if (USE_PRIORITY) { if (priority_buffer[priority_offset] <= priority) { @@ -169,33 +169,18 @@ void _gfx_crossblit(byte *dest, byte *src, int bytes_per_dest_line, int bytes_pe } } - static void (*crossblit_fns[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL, - _gfx_crossblit<1, false, false>, - _gfx_crossblit<2, false, false>, - _gfx_crossblit<3, false, false>, - _gfx_crossblit<4, false, false> + _gfx_crossblit<1, false>, + _gfx_crossblit<2, false>, + _gfx_crossblit<3, false>, + _gfx_crossblit<4, false> }; static void (*crossblit_fns_P[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL, - _gfx_crossblit<1, true, false>, - _gfx_crossblit<2, true, false>, - _gfx_crossblit<3, true, false>, - _gfx_crossblit<4, true, false> -}; - -static void (*crossblit_fns_RA[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL, - _gfx_crossblit<1, false, true>, - _gfx_crossblit<2, false, true>, - _gfx_crossblit<3, false, true>, - _gfx_crossblit<4, false, true> -}; - -static void (*crossblit_fns_P_RA[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL, - _gfx_crossblit<1, true, true>, - _gfx_crossblit<2, true, true>, - _gfx_crossblit<3, true, true>, - _gfx_crossblit<4, true, true> + _gfx_crossblit<1, true>, + _gfx_crossblit<2, true>, + _gfx_crossblit<3, true>, + _gfx_crossblit<4, true> }; void _gfx_crossblit_simple(byte *dest, byte *src, int dest_line_width, int src_line_width, int xl, int yl, int bpp) { @@ -223,7 +208,6 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect int xl = pxm->width, yl = pxm->height; int xoffset = (dest_coords.x < 0) ? - dest_coords.x : 0; int yoffset = (dest_coords.y < 0) ? - dest_coords.y : 0; - int revalpha = mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA; if (src_coords.x + src_coords.width > xl) src_coords.width = xl - src_coords.x; @@ -322,8 +306,7 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect else alpha_min = ((alpha_mask >> 8) * gfx_crossblit_alpha_threshold) & alpha_mask; - if (revalpha) - alpha_min = 255 - alpha_min; // Since we use it for the reverse effect + alpha_min = 255 - alpha_min; // Since we use it for the reverse effect if (!alpha_mask) _gfx_crossblit_simple(dest, src, dest_line_width, pxm->width * bpp, xl, yl, bpp); @@ -331,7 +314,7 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect if (priority == GFX_NO_PRIORITY) { if (bpp > 0 && bpp < 5) - ((revalpha) ? crossblit_fns_RA : crossblit_fns)[bpp](dest, src, dest_line_width, pxm->width * bpp, + crossblit_fns[bpp](dest, src, dest_line_width, pxm->width * bpp, xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min, 0, 0, 0, 0); else { @@ -340,7 +323,7 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect } } else { // priority if (bpp > 0 && bpp < 5) - ((revalpha) ? crossblit_fns_P_RA : crossblit_fns_P)[bpp](dest, src, dest_line_width, pxm->width * bpp, + crossblit_fns_P[bpp](dest, src, dest_line_width, pxm->width * bpp, xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min, priority_pos, priority_line_width, priority_skip, priority); else { diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index 7858b860bb..21ce9a8175 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -44,10 +44,6 @@ namespace Sci { #define GFX_MODE_IS_UNSCALED(mode) (((mode)->xfact == 1) && ((mode)->yfact == 1)) -/* Reverse Alpha: Alpha values 0 mean "transparent" if this is -** enabled */ -#define GFX_MODE_FLAG_REVERSE_ALPHA (1<<1) - /** Graphics mode description * * Color masks: @@ -67,8 +63,6 @@ struct gfx_mode_t { int xsize, ysize; /**< Horizontal and vertical size */ int bytespp; /**< Bytes per pixel */ - uint32 flags; /**< GFX_MODE_FLAG_* Flags- see above */ - /** * Palette or NULL to indicate non-palette mode. * Palette mode is only supported for bytespp = 1 diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp index 22181822cc..4beecf38f2 100644 --- a/engines/sci/gfx/gfx_tools.cpp +++ b/engines/sci/gfx/gfx_tools.cpp @@ -50,8 +50,6 @@ gfx_mode_t *gfx_new_mode(int xfact, int yfact, const Graphics::PixelFormat &form mode->yfact = yfact; mode->bytespp = format.bytesPerPixel; mode->format = format; - - mode->flags = flags; mode->palette = palette; return mode; |