Kp
2c2ef3fa33
Factor out common logic in rle conditionals
2021-09-04 12:17:14 +00:00
Kp
3697aabcdd
RLE processing: use varying pointer types instead of multiplication
2021-09-04 12:17:14 +00:00
Kp
5bd093b3cb
Rework gr_rle_getsize
...
- Add a limiter to let it return early when the result is predictable.
The first caller checks only whether the returned value is above a
threshold. Once the value goes above that threshold, its precise
value will not matter, so stop counting and return early.
- Add comments explaining some of the logic.
2021-09-04 12:17:14 +00:00
Kp
15f944b0b6
Skip trying to rle compress a paged-out bitmap
...
This would crash if it ever happened, so skip such bitmaps.
2021-09-04 12:17:14 +00:00
Kp
99e14b4100
Factor out common paths in gr_rle_encode
2021-09-04 12:17:14 +00:00
Kp
21f736ec37
Require grs_subcanvas for gr_init_sub_canvas
...
Prevent passing a canvas that is not specifically typed as a
grs_subcanvas.
2021-09-04 12:17:14 +00:00
Kp
3b5134896f
Remove unused return value of gr_bitmap_rle_compress
2021-08-26 03:13:45 +00:00
Kp
ec4d75d44e
Switch decode_row from xrange to span to better express its operation
2021-06-28 03:37:51 +00:00
Kp
73c3474f8e
Reduce uses of RAIIdmem for local variables
2021-06-28 03:37:49 +00:00
Kp
ee07a45712
Simplify MALLOC invocations
...
Remove overload for C array decay, and fix up the call sites that
required it.
2021-06-28 03:37:48 +00:00
Kp
32b7899059
Remove const
qualifier from gr_init_bitmap
...
gr_init_bitmap can be passed a pointer to uninitialized memory, and
will save that pointer into the bitmap for the underlying memory to be
initialized later. In gcc-11, this triggers a warning because the
`const` qualifier leads gcc to expect that the memory will only be read
(while uninitialized) and not written.
Reported-by: TheDemonicSurfer <https://github.com/dxx-rebirth/dxx-rebirth/issues/593 >
2021-06-12 21:07:32 +00:00
Kp
537e9fef37
Throw if a bitmap starts outside its parents boundaries
...
Such bitmaps will, at best, fail to render due to clipping. These
should never happen, so report it with an exception if it does.
2021-02-25 03:53:49 +00:00
Dmitry Grigoryev
fbd05a1592
optimize include files (include what you use)
2021-02-06 21:38:50 +01:00
Kp
775d039083
Expand gcc memcpy workaround to gcc-10
...
The upstream bug is still not fixed.
2021-01-17 22:23:23 +00:00
Kp
fc63029833
Move more symbols into namespaces
2020-12-26 21:17:29 +00:00
Kp
6285878c4c
Add color_palette_index type alias, to note palette-related uint8_t
2020-07-16 02:31:04 +00:00
Kp
8cc7be4986
Use std::bitset to track used colors
...
This reduces memory usage over using std::array<bool> for the same
number of bits.
2020-07-16 02:31:04 +00:00
Kp
db7b4b3f88
Refer to <memory> directly, not through "compiler-make_unique.h"
2020-05-02 21:18:43 +00:00
Kp
cc38cdf4b8
Qualify uses of std::make_unique
2020-05-02 21:18:42 +00:00
Kp
8839f538e0
Refer to <array> directly, not through "compiler-array.h"
2020-05-02 21:18:42 +00:00
Kp
53761500f1
Qualify uses of std::array
2020-05-02 21:18:42 +00:00
Kp
9cee93abb1
Require support for C++14 std::exchange
2020-05-02 21:18:42 +00:00
Kp
334da8e8e6
Move some SDL-only symbols into !DXX_USE_OGL
2019-08-06 02:59:41 +00:00
Kp
dd8cfa763f
Expand gcc memcpy workaround
...
Add link to upstream bug report.
2019-07-22 00:51:01 +00:00
Kp
e2692d26ab
Clear grs_main_bitmap before initializing
...
No code path has been observed causing a leak by reinitializing without
resetting, but add an explicit reset to prevent future mistakes.
2019-07-07 22:00:02 +00:00
Kp
a52d8106ce
Use xrange for loops with simple identifier start and simple identifier end
...
s/for\s*(\s*\(\w\+\)\s\+\(\w\+\)\s*=\s*\([A-Za-z_0-9]\+\)\s*;\s*\2\s*!=\s*\([A-Za-z_0-9]\+\)u\?\s*;\s*\(++\s*\2\|\2\s*++\s*\))/range_for (const \1 \2, xrange(\3, \4))/
2019-05-04 18:27:37 +00:00
Kp
3bd10610fc
Use xrange for loops with zero start and simple identifier end
...
s/for\s*(\s*\(\w\+\)\s\+\(\w\+\)\s*=\s*0\+u\?\s*;\s*\2\s*!=\s*\([A-Za-z_0-9]\+\)u\?\s*;\s*\(++\s*\2\|\2\s*++\s*\))/range_for (const \1 \2, xrange(\3))/
2019-05-04 18:27:37 +00:00
Kp
15ac8a5ac6
Add utility xrange for range-based loops with precomputed bounds
...
Utility xrange, inspired by the Python2 feature of the same name,
provides an object that returns successive values from [start, end). It
is useful when the end index is known in advance, and is particularly
helpful when that index is expensive to recompute.
2019-05-04 18:27:36 +00:00
Kp
7bcbaae230
Tighten protection against grs_bitmap bm_data confusion
...
Bitmaps based on grs_main_bitmap own their data. Bitmaps based on
grs_bitmap do not. Adjust prototypes to prevent initializing a
grs_main_bitmap with data it will not own.
2019-02-02 18:36:39 +00:00
Kp
12b57e84e6
Switch most in-tree http:// links to https://
...
For each link given as http://, verify that the site is accessible over
https:// and, if so, switch to it. These domains were converted:
* llvm.org
* clang.llvm.org
* en.cppreference.com
* www.dxx-rebirth.com
* www.libsdl.org
* www.scons.org
2018-09-02 00:57:29 +00:00
Kp
b53be4943c
Update memcpy blacklist
2018-08-20 00:34:16 +00:00
Kp
f33877d379
Make grs_main_bitmap::grs_main_bitmap() clear the whole structure
2018-07-14 17:23:15 +00:00
Kp
ca2b1e0cf0
Remove build_colormap_good parameter used
...
`build_colormap_good` only took `used` to clear it. Only one caller
needed it cleared. Move the clear into that caller. Remove the
parameter from all calls.
2018-03-08 04:21:18 +00:00
Kp
b6e2205b9f
Simplify palette color tracking
...
Callers only care whether a color is used, not how often it is used.
2018-03-08 04:21:18 +00:00
Kp
ff49e949d4
Fix savegame thumbnail previews
...
Transposed arguments to fill_n caused rls_stretch_scanline to write
garbage to the preview buffer.
Reported-by: Havner <https://github.com/dxx-rebirth/dxx-rebirth/issues/354 >
Fixes: 8aadb4be5b
("Use fill_n instead of inline loop to write scanline")
2017-11-06 04:24:16 +00:00
Kp
7eadc218a6
Add debugging code to trace global canvas updates
2017-11-05 20:49:09 +00:00
Kp
8684cf5571
Remove unused gr_bitblt_dest_step_shift
...
It is always 0, and has been since it was imported in D2X.
2017-11-01 02:01:20 +00:00
Kp
0909b126ac
Simplify gr_rle_expand_scanline_generic
...
Both the `if` and `else` paths had the same loop and post-loop
processing. The `if` path was a strict subset of the `else` path. The
`else` path had one setup statement, and was otherwise equal to the `if`
path. Move the shared statements outside the guarded path.
2017-10-06 01:59:09 +00:00
Kp
8aadb4be5b
Use fill_n instead of inline loop to write scanline
2017-10-06 01:59:09 +00:00
Kp
49cc3aa324
Work around i686-w64-mingw32-g++ compiler crash
2017-04-22 21:23:55 +00:00
Kp
8184a4609b
Simplify gr_rle_decode
2017-04-08 16:48:17 +00:00
Kp
2e1e1b1185
Fix pointer/array::iterator mismatch in scalec.cpp
2017-04-08 16:48:17 +00:00
Kp
297746024b
Use enum for GR blending mode
2017-03-18 18:07:36 +00:00
Kp
719de35484
Pass grs_bitmap to gr_pixel
2017-03-11 19:56:23 +00:00
Kp
9dbec8433d
Pass grs_bitmap to gr_upixel
2017-03-11 19:56:23 +00:00
Kp
9311548eba
Pass grs_bitmap to ogl_upixelc
2017-03-11 19:56:23 +00:00
Kp
beaa49a7ba
Pass destination bitmap to scale_bitmap
2017-02-11 21:42:34 +00:00
Kp
d779a26307
Pass canvas to gr_bm_ubitblt0x_rle
2017-02-11 21:42:33 +00:00
Kp
f8b057d43d
Pass canvas to gr_bm_ubitbltm
2017-02-11 21:42:32 +00:00
Kp
9cc5d6f439
Pass canvas to gr_bm_ubitblt
2017-02-11 21:42:32 +00:00