diff options
| author | Matheus Catarino França <matheus-catarino@hotmail.com> | 2024-02-01 09:51:31 -0300 |
|---|---|---|
| committer | Matheus Catarino França <matheus-catarino@hotmail.com> | 2024-02-01 09:51:31 -0300 |
| commit | 8dc1faa3f003427d91eae0e902c0c3c6e0e5016d (patch) | |
| tree | 53ef078248c8ec8263c0c79a26879f4301ba77a9 /util/sokol_debugtext.h | |
| parent | 15a1a24870e2a2e3c59ee414476c42d770be0baa (diff) | |
check isnan width and height
based on D bindings: https://github.com/kassane/sokol-d/issues/5#issuecomment-1921244802
Diffstat (limited to 'util/sokol_debugtext.h')
| -rw-r--r-- | util/sokol_debugtext.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h index 09da6019..68591591 100644 --- a/util/sokol_debugtext.h +++ b/util/sokol_debugtext.h @@ -3777,6 +3777,8 @@ static sdtx_context_desc_t _sdtx_context_desc_defaults(const sdtx_context_desc_t res.tab_width = _sdtx_def(res.tab_width, _SDTX_DEFAULT_TAB_WIDTH); // keep pixel format attrs are passed as is into pipeline creation SOKOL_ASSERT(res.char_buf_size > 0); + SOKOL_ASSERT(!isnan(res.canvas_width)); + SOKOL_ASSERT(!isnan(res.canvas_height)); SOKOL_ASSERT(res.canvas_width > 0.0f); SOKOL_ASSERT(res.canvas_height > 0.0f); return res; @@ -4336,6 +4338,8 @@ SOKOL_API_IMPL void sdtx_font(int font_index) { SOKOL_API_IMPL void sdtx_canvas(float w, float h) { SOKOL_ASSERT(_SDTX_INIT_COOKIE == _sdtx.init_cookie); + SOKOL_ASSERT(!isnan(w)); + SOKOL_ASSERT(!isnan(h)); SOKOL_ASSERT((w > 0.0f) && (h > 0.0f)); _sdtx_context_t* ctx = _sdtx.cur_ctx; if (ctx) { |