Kp
5eaa53d220
Fix SDL-only build
2021-11-01 03:37:20 +00:00
Kp
961aae074a
Remove unused ogl_ubitmapm_cs argument scale
...
Every caller passes `F1_0`. Remove the argument, and propagate its
results through the function.
2021-11-01 03:37:18 +00:00
Kp
855697bf5d
Make font scaling constructors explicit
2021-09-19 10:53:48 +00:00
Kp
3c37552e5b
Use enum class bm_mode for grs_bitmap::type
2021-09-12 16:20:52 +00:00
Kp
21241471c6
Return string width/height from gr_get_string_size
...
Use structured bindings to capture the values on return, so that they
can be declared as `const` if they are immutable after initial
computation.
2021-09-12 16:20:52 +00:00
Kp
0750046bc1
Move retrieval of font average width out of gr_get_string_size
...
Most callers do not need it, and it is only vaguely related to the
purpose of measuring a particular string. For those callers that need
it, lift it out.
2021-09-12 16:20:52 +00:00
Kp
6a1f5937a2
Change ogl_font_choose_size to return width/height
2021-09-04 12:17:14 +00:00
Kp
4c681c40fd
Factor out the slider font smoothing hack
...
Move the test from the innermost loop to one layer farther out, since it
was conditional on two specific passes of the innermost loop.
2021-09-04 12:17:14 +00:00
Kp
6172b69329
Convert more font.cpp sites to use xrange
2021-09-04 12:17:14 +00:00
Kp
fb3c2a4808
Narrow grs_canvas fg/bg color fields
2021-09-04 12:17:14 +00:00
Kp
35c7684200
Cache text color change control code
...
This generates the same code in an optimized build, but makes the intent
clearer.
2021-09-04 12:17:14 +00:00
Kp
172c183d83
Reduce scope of font rendering variables
2021-08-26 03:13:45 +00:00
Kp
517919a473
Remove unused return value of gr_internal_color_string, ogl_internal_string
2021-08-26 03:13:45 +00:00
Kp
1c13d3c8d3
Improve error reporting for PHYSFSX_openReadBuffered
...
Return the PHYSFS error code on failure, so that callers can report why
the open failed.
2021-07-25 23:00:56 +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
Dmitry Grigoryev
fbd05a1592
optimize include files (include what you use)
2021-02-06 21:38:50 +01:00
Kp
aaf4629c05
Fix potential canvas.cv_font / cv_font inconsistency in gr_ustring
...
A prior conversion changed the actual rendering to use the argument
cv_font, but still picked which render function to use based on the
flags for the active font. Switch to use only the supplied font.
2020-12-27 22:03:09 +00:00
Kp
c1d6150015
Pass grs_font& to gr_set_curfont
2020-12-27 22:03:09 +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
80f8bbabd1
Add constexpr
to compile-time switches in font templates
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
316a4740a6
Move words_bigendian into if constexpr
...
`words_bigendian` is `constexpr`, so move the tests on it behind `if
constexpr` to encourage the compiler to prune unreachable paths.
2020-07-05 23:34:33 +00:00
Kp
7a790f6068
Inline gr_set_fontcolor
...
It is a trivial function.
2020-07-05 23:34:32 +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
d197ba42c3
Fix mouse-selection in listboxes
...
Commit d355ef4030
removed a seemingly unnecessary modification of the
global variable grd_curcanv->cv_font, after eliminating all local reads
of it. However, a non-local read, buried in listbox_mouse, depended on
grd_curcanv->cv_font being set to a MEDIUM font. After that commit,
grd_curcanv->cv_font retained its prior value, which is not a MEDIUM
font. This caused listbox_mouse to compute an incorrect height of the
lines in the listbox, which manifested as the game choosing the wrong
line when the mouse is clicked in the listbox.
Fix the problem by explicitly using MEDIUM3_FONT, since that was
usually the value left in grd_curcanv->cv_font prior to that commit. In
some cases, a different MEDIUM font would be left there, but all the
MEDIUM fonts have the same height, so they are interchangeable for this
purpose.
Reported-by: Q3BFG10K <https://github.com/dxx-rebirth/dxx-rebirth/issues/498 >
Fixes: d355ef4030
("Pass font to various drawing functions")
2020-04-04 19:30:23 +00:00
Kp
9bed4f6d78
Fix bogus borders due to fill_n length/value transposition
...
Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/415 >
Fixes: 7bcbaae230
("Tighten protection against grs_bitmap bm_data confusion")
2019-03-29 02:34:53 +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
60a99f1ea2
Allow longer mission titles in New Game dialog
2018-06-27 03:34:34 +00:00
Kp
d5bfeb0813
Fix OS X build break
...
Github user bdamm (Rebirth forum user dammfine) reports[1][2][3] a build
failure on OS X, likely caused by clang failing to implement forwarding
constructors fully. The Rebirth fallback to variadic constructor
forwarding is imperfect, and in this case caused a failure. Add an
explicit conversion to disambiguate the ternary expression's type.
[1]: Rebirth forum report: https://forum.dxx-rebirth.com/showthread.php?tid=1055
[2]: Github commit comment: ccc2a288f1
?diff=unified#commitcomment-29322121
[3]: Github issue: https://github.com/dxx-rebirth/dxx-rebirth/issues/391
Reported-by: bdamm <https://github.com/dxx-rebirth/dxx-rebirth/issues/391 >
Fixes: ccc2a288f1
("Simplify HUD_SCALE_X_AR, HUD_SCALE_Y_AR")
2018-06-12 02:53:06 +00:00
Kp
f51b7b6b20
Enforce separation of font X/Y scaling
2018-06-08 04:04:05 +00:00
Kp
08446f0ab6
Pass font to gr_string,gr_printf
2018-05-19 23:21:42 +00:00
Kp
a19d4157e2
Prevent reloading cv_font in font.cpp internal functions
...
Callers usually have cv_font already loaded, so pass it down instead of
reloading from memory.
2018-05-19 23:21:42 +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
88832e3679
Use constexpr integral_constant for various magic numbers
2017-10-14 17:10:30 +00:00
Kp
719de35484
Pass grs_bitmap to gr_pixel
2017-03-11 19:56:23 +00:00
Kp
5541e764cd
Use cached canvas in font.cpp
2017-03-11 19:56:23 +00:00
Kp
c725a6cb88
Pass canvas to gr_init_font
2017-03-11 19:56:22 +00:00
Kp
b390ce2da0
Use cached canvas in gr_string
2017-02-11 21:42:46 +00:00
Kp
05905ced06
Pass font to gr_get_string_wrap
2017-02-11 21:42:44 +00:00
Kp
46be18e7f9
Pass canvas to get_centered_x
2017-02-11 21:42:44 +00:00
Kp
6f81d13c41
Pass canvas to gr_set_curfont
2017-02-11 21:42:38 +00:00
Kp
ae33aaafc1
Pass canvas to gr_set_fontcolor
2017-02-11 21:42:32 +00:00
Kp
764d20d4e1
Make grs_bitmap::bm_flags private
2017-01-15 00:03:13 +00:00
Kp
5da784dbed
Pass canvas to gr_{,u}string
2017-01-08 22:32:00 +00:00
Kp
1ef6b9d5bc
Pass font to gr_get_string_size
2017-01-08 22:31:59 +00:00