Commit Graph
58 Commits
Author SHA1 Message Date
Thierry Crozat 4b61397acd GRAPHICS: Support bliting CLUT8 Surface in non-CLUT8 ManagedSurface
The inner blitting code already handled that case, but we needed to be able to
pass the Surface palette to that inner code.
2023-04-25 21:44:51 +01:00
Thierry Crozat facb6852b8 GRAPHICS: Fix incorrect assert in ManagedSurface::blitFromInner
When blitting from CLUT8 to another format, we need a palette
for the source surface.
2023-04-25 21:44:51 +01:00
Cameron Cawley ee35a3d268 GRAPHICS: Use standard palettes in ManagedSurface 2023-03-24 21:32:48 +01:00
elasota bf0b23021b GRAPHICS: Fix VS signed/unsigned mismatch warning 2023-03-16 15:08:29 +01:00
Kaloyan Chehlarski 3b27bce87b GRAPHICS: Fix transparency in ManagedSurface::blitFrom()
Added an explicit -1 argument for transColor in a call to transBlitFrom()
inside one of the overloads of blitFrom(). This fixes an issue where
calling blitFrom() with a Rect destination would result in the transparent
color being ignored.
2023-03-01 18:35:58 +02:00
Cameron Cawley 61a55bd415 GRAPHICS: Remove or deprecate RGBA palette functions in ManagedSurface 2023-02-08 00:09:39 +01:00
Cameron Cawley 8f85390b4c GRAPHICS: Add hasPalette and grabPalette to ManagedSurface 2023-02-08 00:09:39 +01:00
Cameron Cawley 72c3be4418 GRAPHICS: Support blitting to and from RGB332 managed surfaces 2023-02-07 23:42:42 +01:00
Greg Kennedy 253a0519a7 GRAPHICS: Enable blitting 24bpp sources in managed_surface.cpp
Function `blitFromInner()` excludes source formats with 3 bytes per pixel.  These are commonly returned from opaque full-color image decoders, like JPEG.  This change enables blitting with these source images.

- Add `== 3` to the list of acceptable source formats
- Add READ_UINT24 handling for 3-byte source formats
- Add READ_UINT24 and RGBA conversion for 3-byte destination when blending (copying non-opaque source to 24bpp surface)
2022-11-13 06:46:35 +02:00
Thierry Crozat d3da8a7367 GRAPHICS: Fix undefined behaviour in ManagedSurface blit on opaque target
The color components computation had intermediate results that could overflow
a signed int. So now the computation is done using unsigned int instead, which
prevents the overflow (since the max intermediate value is 255*255*257*257,
which fits in an unsigned int).

Note: I also considered adding an explicit cast to do the uint8 * uint8
operations using uint32, but decided not to as it is not required (there is no
overflow due to integer promotion) and makes the code more difficult to read.
2022-10-31 21:46:22 +00:00
Pragyansh Chaturvedi e439beece7 GRAPHICS: Bump color parameter to uint32 type for functions using it 2022-09-09 02:21:47 +02:00
elasota 95fd7dcffc GRAPHICS: Fix alpha blend on 16-bit targets treating the destination pixel as black 2022-06-13 20:14:36 +03:00
elasota 8c560fe94f GRAPHICS: Fix redundant color loads 2022-06-13 15:09:08 +02:00
elasota 709175d835 GRAPHICS: Optimized managed surface blit in transparent/opaque pixel case 2022-06-13 15:09:08 +02:00
Cameron Cawley 085130c6da GRAPHICS: Move ManagedSurface::clip() to the Surface class 2022-06-03 16:00:46 +01:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Paul Gilbert baccbedf50 GRAPHICS: Changed surface classes sizes from uint16 to int16 2021-07-04 18:24:27 -07:00
Mathias Parnaudeau deefffd983 GRAPHICS: Fix leak in managed surface
In the case of the ManagedSurface constructor from a Surface object,
_disposeAfterUse is not initialized. But more, copyFrom() sets
_disposeAfterUse to YES after allocation of buffer. And then,
after the call to copyFrom, _disposeAfterUse was set to NO, what
made the pixels buffer not freed.
2021-05-12 14:10:26 +03:00
Eugene Sandulenko 364407a5c6 GRAPHICS: Properly initialize ManagedSurface copy constructor 2021-05-01 01:49:48 +02:00
Eugene Sandulenko 6217cf8a37 GRAPHICS: Added ManagedSurface constructor from Surface 2021-04-11 21:21:44 +02:00
Eugene Sandulenko 9894efd574 GRAPHICS: Added copyFrom(Surface) to ManagerSurface 2021-04-11 21:21:44 +02:00
Thierry Crozat 7ec6215547 GRAPHICS: Fix possible out of bound write for 1bpp blit in ManagedSurface 2021-03-16 23:46:50 +00:00
Thierry Crozat 4945526219 GRAPHICS: Fix 24bpp pixel formats handling in ManageSurface blitting
The code was only working for one specific case of 24bpp
pixel formats, and it is now generic. This fixes wrong
colors in the AGS savegame screenshots.
2021-03-13 03:28:22 +00:00
Vladimir Menshakov 91cbd8fc53 GRAPHICS: Fix crash in blitFromInner if destRect is empty 2021-03-06 20:57:27 +00:00
Thierry Crozat f12813c630 GRAPHICS: Support having transparent ManagedSurface 2021-02-22 22:59:07 +00:00
Paul Gilbert c53fb72922 GRAPHICS: Better 32-bit surface handling in ManagedSurface
Fixes several issues dealing with 32-bit surfaces, such as
- transBlitFrom between 32-bit surfaces
- 32-bit surfaces where the alpha channel is explicitly turned off
- Alpha blending when dest pixels are the transparent color
- Specifying colors to fill, line routines without alpha
2021-02-20 14:37:29 -08:00
Matthew Jimenez c9696cb36c GRAPHICS: Fix blending with default transColor on 32-bpp surfaces 2021-02-06 20:56:38 -06:00
Paul Gilbert 0589f9a817 GRAPHICS: Support 24-bit surfaces as dest for blitFrom 2021-02-06 16:37:31 -08:00
Paul Gilbert 81d891ebb0 GRAPHICS: ManagedSurface transBlitFrom ignore alpha matching transColor 2021-02-06 16:37:31 -08:00
Martin Gerhardy b02ae40c9c GRAPHICS: allow scaling for opaque surfaces 2021-01-17 21:54:11 +01:00
Eugene Sandulenko b91cd981ef GRPAHICS: Match new[] with proper delete[] 2020-07-27 12:15:11 +02:00
Cameron Cawley 80430b4756 GRAPHICS: Ensure that creating a ManagedSurface from another preserves the palette 2020-07-25 13:29:09 +02:00
Cameron Cawley 731596b5f7 GRAPHICS: Support converting between different palettes using ManagedSurface 2020-07-25 13:29:09 +02:00
Cameron Cawley 44e948a283 GRAPHICS: Support full alpha when blitting using masks in ManagedSurface 2020-07-25 13:29:09 +02:00
Paul Gilbert bb405565b7 GRAPHICS: Fix memory overrun blitting from paletted surfaces 2020-05-08 18:45:34 -07:00
Eugene Sandulenko 81c443c973 GRAPHICS: Add sanity check 2020-04-27 13:57:35 +02:00
Eugene Sandulenko 915d4615ba GRAPHICS: Added mask-driven transparency blitting to ManagedSurface 2020-04-24 00:51:24 +02:00
Paul Gilbert 4f1521f542 GRAPHICS: Fix setting ManagedSurface palette 2020-03-22 20:29:37 -07:00
Paul Gilbert 3a0c62e1e4 GRAPHICS: Make copying sources as const 2020-02-01 13:13:51 -08:00
Paul Gilbert 46e49e3ed3 GRAPHICS: Add transparent color field and palette to ManagedSurface 2020-02-01 13:13:51 -08:00
Eugene Sandulenko 3851c2d9a6 GRAPHICS: Added source transparency parameter to ManagedSurface::transBlit 2019-09-03 17:17:14 +02:00
Eugene Sandulenko 14f8e0574f GRAPHICS: Fix Managed Surface alpha blending 2019-09-03 17:17:14 +02:00
SupSuper 1669ef6244 GRAPHICS: Fix ManagedSurface transBlitFrom ignoring flipped parameter 2019-07-14 00:46:30 +02:00
SupSuper 176109da59 GRAPHICS: Fix wrong rect size when blitting subsurface to ManagedSurface
We want the srcRect size and not the original surface size
2019-07-14 00:46:30 +02:00
Le Philousophe ed34a41810 GRAPHICS: Fix rects handling in ManagedSurface::copyFrom
Like in create(), when using copyFrom the whole surface gets new data
and is now completely dirty so let's use markAllDirty.
2019-06-09 14:38:31 -07:00
Le Philousophe 1297ae2b76 GRAPHICS: Fix ManagedSurface::copyFrom memory handling
When calling ManagedSurface::copyFrom, _disposeAfterUse should be set to
YES because inner surface frees up old pixels array and creates a new one.
2019-06-09 14:38:31 -07:00
Paul Gilbert 4fbf11db90 GRAPHICS: Fix ManagedSurface clear calls when no surface is set 2017-12-03 13:10:41 -05:00
Paul Gilbert 1a25abbd73 GRAPHICS: Apply eriktorbjorn's fix for non-origin transBlitFrom calls 2017-02-21 20:41:35 -05:00
Paul Gilbert a17109887c GRAPHICS: Further fix compiler warnings for byte casts 2017-01-15 10:06:00 -05:00
Paul Gilbert 553f1c2ef4 GRAPHICS: Fix compiler warnings of double to byte casts 2017-01-15 09:32:55 -05:00