Commit Graph

247 Commits

Author SHA1 Message Date
Peter Nelson a28ab8cac2
Codechange: Replace C-style casts to size_t with static_cast. (#12455)
* Codechange: Replace C-style casts to size_t with static_cast.

This touches only simple value-type casts.

* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX

Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +01:00
Peter Nelson 6bc4a62c27 Codechange: Pass std::string_view from blitters instead of char *. 2024-04-10 22:02:04 +01:00
Peter Nelson 8e881471c1 Codechange: Pass replacement blitter name as string_view instead char *. 2024-04-05 23:23:33 +01:00
Peter Nelson 7572cfd103 Codechange: Redefine ZOOM_LVL so that ZOOM_LVL_NORMAL is 1x zoom.
This matches expectations of what normal zoom means.
2024-04-04 22:27:03 +01:00
Peter Nelson 3c94e81665 Codechange: Use ZOOM_LVL_MIN to refer to first zoom level.
Many uses of ZOOM_LVL_NORMAL actually just want the first zoom level slot, so use ZOOM_LVL_MIN to make this clearer.
2024-04-04 22:27:03 +01:00
frosch a886bd9666
Fix #12319, 3a676a5: Some SSE blitters were broken due to ODR violations (#12322) 2024-03-16 23:42:38 +00:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Patric Stout bb49112784 Codechange: switch our codebase to C++20 2024-01-17 00:25:08 +01:00
Loïc Guilloux 93ba6d6776
Fix: compilation without precompiled headers (#11770) 2024-01-14 13:27:03 +01:00
Rubidium 3a676a5af0 Codechange: replace static inline with static for non-class functions 2024-01-06 13:37:33 +01:00
Peter Nelson a2a7ecf88e
Fix 9ce1626b: Some blitters have `bp->remap` aliased to `remap` for performance. (#11626)
While this probably doesn't make a huge difference for the custom transparent remap code path, the alias is there so use it.
2023-12-25 20:59:37 +00:00
Peter Nelson 9ce1626bb4 Change: Support custom transparency remaps with 32bpp blitters.
This closes a 15 year old TODO...
2023-12-25 11:22:52 +00:00
Peter Nelson b85ecf9ac2
Codechange: Replace pointer to Sprite array with reference to SpriteCollection. (#11580)
Add `SpriteLoader::SpriteCollection` type which is an array of `SpriteLoad::Sprite`.

This removes the ambiguity of what `SpriteLoader::Sprite *` is pointing to,
and cleans up mismatches using both dereference -> and array access [] for the
same object.
2023-12-20 20:38:21 +00:00
rubidium42 cb8612ba79 Remove: ZOOM_LVL_COUNT
This is the only enumeration with a COUNT and END. The logic of the COUNT
implied that BEGIN could be non-zero, but all but two uses of zoom level
assume that BEGIN is zero, making the separate count only confusing.
2023-11-29 21:12:28 -04:00
Michael Lutz 071fdab236 Codechange: Replicate cursor screen backup to chat message display, removing explicit memory management.
Incidentally, this makes Blitter::GetBytesPerPixel unneeed.
2023-11-04 16:08:34 +01:00
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 2023-10-20 23:05:43 +02:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Rubidium 07860e67e2 Codechange: use fmt::format_to to format the help message 2023-05-20 16:50:03 +02:00
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 2023-05-17 10:14:41 +01:00
Patric Stout 199e41c762
Codechange: use default dtor instead of empty (#10826) 2023-05-14 23:31:03 +02:00
Peter Nelson e6740046ee Codechange: Use range-for iteration. 2023-05-11 07:58:55 +01:00
Rubidium 12085d088c Cleanup: remove obsolete string_compare_type 2023-05-09 23:14:48 +02:00
Rubidium 86786a7af6 Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp 2023-04-29 10:25:25 +02:00
PeterN e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. (#10663)
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
Tyler Trahan a18182e24b
Revert 92c7551: Line drawing algorithm fix broke other cases (#10497)
This reverts commit 92c755161d.
2023-02-26 19:23:31 +00:00
Nik Nyby 92c755161d
Fix #10222: Adjust line drawing algorithm (#10491) 2023-02-20 16:18:25 -05:00
Rubidium 71b46db8d0 Cleanup: remove commented out code 2023-01-26 23:47:55 +01:00
Rubidium f7af9a299a Codechange: prevent suspicious pointer scaling 2023-01-06 19:34:35 +01:00
Patric Stout 1fb101eabb
Codechange: address CodeQL issue "Multiplication result converted to larger type" (#10306)
Most are very unlikely to ever be triggered in our codebase; two
stand out: linkgraph and money cheat. Those, potentially, could
wrap earlier than expected.
2023-01-02 20:30:02 +00:00
PeterN 4031894aef
Cleanup: Remove svn-style `$Id$` comments. (#10122) 2022-11-01 18:24:31 -06:00
Jonathan G Rennison 47456ac672 Change: Reduce number of instructions in AlphaBlendTwoPixels 2022-10-16 18:55:09 +02:00
Jonathan G Rennison f9cdb5b610 Fix: Correctly set alpha of output in AlphaBlendTwoPixels
Match alpha behaviour of ComposeColourRGBA
2022-10-16 18:55:09 +02:00
glx22 da1a0d042e Fix: don't use animated SSE4 Draw() when animation is disabled 2022-10-16 18:55:09 +02:00
glx22 bba6ad1f4e Fix #9935: Use more selectivity when building SSE specific code 2022-08-26 19:36:18 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
Patric Stout bcd7a7aafe
Codechange: rename _SQ64 into POINTER_IS_64BIT (#9313) 2021-05-30 10:40:03 +02:00
rubidium42 b791ffc6de Fix: do not hide parameter by local variable with the same name 2021-05-27 18:30:56 +02:00
rubidium42 44ca7d9377 Change: Use gender-neutral pronouns 2021-05-15 10:16:48 +02:00
rubidium42 ddaedaf32a Fix: empty undocumented branches 2021-05-15 10:16:10 +02:00
Charles Pigott 591ea9862d
Codechange: Suppress warnings when asserts are disabled (#8916) 2021-04-01 10:03:12 +02:00
Michael Lutz ae1f7bd695
Fix 937d60f2: Broken company colours for 40bpp-blitter. (#8821) 2021-03-08 15:43:08 +01:00
Michael Lutz 937d60f239
Fix #8774: Black screenshots when using 40bpp-blitter. (#8791)
This affected all screenshot types that render to an off-screen
buffer and don't copy the actual screen contents.
2021-03-02 20:55:39 +01:00
Michael Lutz ef4cec9382 Fix #8750: [OpenGL] Line drawing did not set proper RGB/mask colours. 2021-02-27 13:09:38 +01:00
Michael Lutz 94d8acb7d0 Add: A 32 bpp blitter that uses the animation buffer from the video backend to speed up palette animation. 2021-02-22 22:16:07 +01:00
Michael Lutz 200be7d20c Add: [OpenGL] Support for a separate animation buffer that stores the palette values of the screen in addition to the colour buffer. 2021-02-22 22:16:07 +01:00
Michael Lutz 01ef44fa4f Codechange: Allow blitter factories to decide at runtime if the blitter is usable. 2021-02-22 22:16:07 +01:00
Michael Lutz d4dbb3f46e Fix: Don't trash video buffer alpha in SSE3/4 blitters. 2021-02-22 22:16:07 +01:00
Michael Lutz 02e8741457 Codechange: Allow for using a sprite encoder that is not the currently active blitter when loading a sprite. 2021-02-22 22:16:07 +01:00