96 Commits

Author SHA1 Message Date
Cameron Cawley 779980fd76 GRAPHICS: Check the return value when clipping in ManagedSurface functions 2026-04-08 16:58:20 +01:00
Cameron Cawley 18e4df9a8f GRAPHICS: Ensure that ManagedSurface transparent colours are converted 2025-11-17 14:42:55 +02:00
Cameron Cawley 1c25b17517 GRAPHICS: Add generic alpha blitting routines 2025-11-17 14:42:55 +02:00
Malhar f4772f01bd GRAPHICS: Fix Deprecation Warning in ManagedSurface copy constructor
Instead of using the deprecated `operator=` method, use `copyFrom()`
2025-08-12 10:49:48 +03:00
Malhar ac6ed58737 GRAPHICS: MACGUI: Define custom copy constructor for MacWindow
To avoid using the deprecated copy constructor for `ManagedSurface`
MacWindow has a member `_borderSurface` of type ManagedSurface
2025-08-12 10:49:48 +03:00
Cameron Cawley b423a34522 GRAPHICS: Copy miscellaneous properties when scaling ManagedSurfaces 2025-07-06 12:01:08 +03:00
Cameron Cawley aebd8c7346 GRAPHICS: Add a ManagedSurface function for filling surfaces with blending 2025-06-22 14:09:44 +03:00
Cameron Cawley e5037fd5b6 GRAPHICS: Add ManagedSurface::blendBlitFrom to match other functions 2025-06-19 20:16:30 +02:00
Cameron Cawley 9d871d2ff6 GRAPHICS: Removed deprecated ManagedSurface constructors 2025-03-03 18:13:02 +02:00
Cameron Cawley e03b609cdc GRAPHICS: Remove masks from ManagedSurface::transBlitFrom 2025-01-08 19:29:46 +02:00
Cameron Cawley 05104adbf3 GRAPHICS: Add simplified mask blitting routines to ManagedSurface 2025-01-05 16:38:34 +02:00
Cameron Cawley 645f5d2e36 GRAPHICS: Remove overrideColor from ManagedSurface::transBlitFrom 2024-12-30 10:59:16 +02:00
Paul Gilbert f422bf985c GRAPHICS: Fix copying ManagedSurface to copy transparency info 2024-12-16 01:46:12 -08:00
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