Commit graph

83 commits

Author SHA1 Message Date
Cameron Cawley
a8221621e6 GRAPHICS: Explicitly handle matching formats in ManagedSurface::simpleBlitFrom 2024-07-05 08:38:08 +03:00
Cameron Cawley
3676b39194 GRAPHICS: Deprecate the ManagedSurface copy constructor
Also reverted the changes from commit 81f566a.
2024-07-04 22:54:21 +03:00
Cameron Cawley
4bbcf77f70 GRAPHICS: Add move constructors to ManagedSurface 2024-07-04 22:54:21 +03:00
Misty De Meo
81f566a71b GRAPHICS: replace deprecated operator 2024-07-03 09:27:11 +03:00
Cameron Cawley
224f5bb9d3 GRAPHICS: Add scaling and conversion wrappers to ManagedSurface 2024-07-02 13:31:18 +01:00
Cameron Cawley
86f9731bae GRAPHICS: Only invalidate the updated area of the screen in ManagedSurface::blitFrom 2024-06-30 16:35:41 +03:00
Cameron Cawley
49ca5c3a0e GRAPHICS: Add simplified blitting routines to ManagedSurface 2024-06-19 02:36:17 +02:00
Paul Gilbert
7559ecdf84 GRAPHICS: Copy fields, not surface itself, in ManagedSurface constructor 2024-06-06 20:31:03 -07:00
Paul Gilbert
6136c20a35 GRAPHICS: Fix setting _disposeAfterUse in ManagedSurface constructor
The copyFrom method called in the constructor always sets
_disposeAfterUse to true, so in the case we call the constructor
with DisposeAfterUse::NO, we need to set the field value after
the call to prevent it being overwritten.

I'm also not entirely happy that the DisposeAfterUse::YES case
automatically deletes the passed surface immediately, it seems
like it'll be prone to nasty side effects. But I'm leaving as is,
because I'm not sure which code, if any, currently relies on it
to prevent a memory leak.
2024-06-05 21:54:05 -07:00
D G Turner
0d68f7d39a GRAPHICS: Fix Signed vs. Unsigned Comparison GCC Warnings 2024-03-20 22:16:45 +00:00
Matthew Jimenez
771dc751db GRAPHICS: Switch ManagedSurface to use Palette class 2024-03-18 21:06:04 +02:00
Kaloyan Chehlarski
be67cf827b GRAPHICS: Prevent segfault in ManagedSurface
The create() overload of ManagedSurface that creates a
new, owned surface, previously assumed that the
_innerSurface was owned before the call was made. Thus,
when switching between sub-surface and owning surface
modes, a segfault would occur when attempting to free
the pixel data of the inner surface, which is not actually
owned by the ManagedSurface. This commit makes sure
that when free() is called, the inner surface no longer
has an active pointer to its old pixel data.
2024-01-28 02:06:05 +01:00
Wyatt Radkiewicz
5112d79690 GRAPHICS: Fixed ManagedSurface bug 2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
4fbde03866 ALL: blendBlitFrom exaclty matched TS::blit 2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
0961399727 ALL: blendBlitFrom prototype now matches TS::blit 2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
e374c4d9cf GRAPHICS: Fixed ManagedSurface::blendBlitFrom 2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
a64c7ea3b7 GRAPHICS: New blendBlitFrom overload 2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
41a942c5ce ALL: Renamed TS_ARGB to MS_ARGB 2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
df2367c3c9 GRAPHICS: Change blendBlitFrom's format function 2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
ad0c823f2f GRAPHICS: TransparentSurface scales in place
TransparentSurface now scales in place instead of making a copy. This
is much faster than before.
Also BlendBlit::blit now takes a scale offset parameter to help with
vary large images being cropped, otherwise people can leave it to 0.
2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
c2c7ca0275 GRAPHICS: BlendBlit NEON blending modes coded 2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
e7cd583e9f GRAPHICS: Refactor blendBlitUnfiltered
ALL: Fixed last commit not compiling :(

GRAPHICS: Refactoring BlendBlit for SIMD
2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
d36e603864 GRAPHICS: ManagedSurface::blendBlitFrom started on 2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
f15462079d GRAPHICS: ManagedSurface::blendBlitFrom fix 2023-08-13 00:22:10 +02:00
Wyatt Radkiewicz
d03727885a GRAPHICS: Created blendBlitFrom in ManagedSurface 2023-08-13 00:22:10 +02:00
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