prevent loading of textures which do not exist

main
Brett 2024-07-30 21:29:45 -04:00
parent ff2c8e3be8
commit c01cb757a1
19 changed files with 85 additions and 79 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.25)
set(BLT_GRAPHICS_VERSION 0.13.28)
set(BLT_GRAPHICS_VERSION 0.13.29)
set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})

@ -1 +1 @@
Subproject commit 5ab01e43dfc2956f220e5f5fb663c00078928f17
Subproject commit f99e6b3db98a693ce57edca281134560efdce1a3

View File

@ -2041,11 +2041,11 @@
2022-12-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[psaux] Delay the upem validity assertion.
Fixes #1194.
* src/psaux/psft.c (cf2_getUnitsPerEm): Remove the upem assert.
[psaux] Delay the upem validity assertion.
Fixes #1194.
* src/psaux/psft.c (cf2_getUnitsPerEm): Remove the upem assert.
(cf2_checkTransform): Assert the upem validity after checking the scale.
2022-12-14 David Vanderson <david.vanderson@gmail.com>
@ -2422,10 +2422,10 @@
2022-10-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Avoid `FT_Set_Charmap`.
Set charmap aggressively without all validations of `FT_Set_Charmap`
because we take it from the available array and only temporarily.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Avoid `FT_Set_Charmap`.
Set charmap aggressively without all validations of `FT_Set_Charmap`
because we take it from the available array and only temporarily.
Even CMap Format 14 will gracefully return 0.
2022-10-03 Alexei Podtelezhnikov <apodtele@gmail.com>
@ -2509,13 +2509,13 @@
2022-09-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Discard and recreate bitmaps for copying and converting.
Reusing target bitmaps for copying and converting is permitted. It is,
however, pointless to preserve their content before overwriting. Free-
malloc might be faster than realloc.
* src/base/ftbitmap.c (FT_Bitmap_Copy, FT_Bitmap_Convert): Free
[base] Discard and recreate bitmaps for copying and converting.
Reusing target bitmaps for copying and converting is permitted. It is,
however, pointless to preserve their content before overwriting. Free-
malloc might be faster than realloc.
* src/base/ftbitmap.c (FT_Bitmap_Copy, FT_Bitmap_Convert): Free
an old buffer and create a new one.
2022-09-16 Dominik Röttsches <drott@chromium.org>
@ -2709,7 +2709,7 @@
* src/autofit/afhints.h (AF_AxisHintsRec): Use unsigned types.
* src/autofit/afhints.c (af_axis_hints_new_{segment,edge},
* src/autofit/afhints.c (af_axis_hints_new_{segment,edge_t},
af_glyph_hints_get_num_segments, af_glyph_hints_get_segment_offset):
Updated accordingly.
* src/autofit/aflatin.c (af_cjk_hints_compute_edges): Ditto.
@ -3112,8 +3112,8 @@
2022-06-16 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype/GX] Clean up advance adjustment (Brrr).
[truetype/GX] Clean up advance adjustment (Brrr).
* src/truetype/ttgload.c (load_truetype_glyph): Remove remaining code.
2022-06-16 Ben Wagner <bungeman@chromium.org>
@ -3846,22 +3846,22 @@
2022-02-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Clear reused mask.
In PS hinter, memory allocations persist until the module is done.
Therefore, we have to clear reused masks.
[pshinter] Clear reused mask.
In PS hinter, memory allocations persist until the module is done.
Therefore, we have to clear reused masks.
* src/pshinter/pshrec.c (ps_mask_table_alloc): Clear reused mask.
2022-02-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Use unsigned indices.
This reduces casting and eliminates some checks.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_table_merge,
ps_dimension_add_t1stem, ps_hints_t1stem3): Updated.
(ps_dimension_add_counter): Updated, unnecessary checks removed.
[pshinter] Use unsigned indices.
This reduces casting and eliminates some checks.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_table_merge,
ps_dimension_add_t1stem, ps_hints_t1stem3): Updated.
(ps_dimension_add_counter): Updated, unnecessary checks removed.
2022-02-08 Alexei Podtelezhnikov <apodtele@gmail.com>
@ -3878,12 +3878,12 @@
2022-02-08 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Revise the hint table handling.
* src/pshinter/pshrec.c (ps_hint_table_ensure): Remove redundant size
check; avoid array zeroing because it is fully initialized when used.
(ps_hint_table_alloc): Fix off-by-one comparison and remove another
zeroing of the array elements.
[pshinter] Revise the hint table handling.
* src/pshinter/pshrec.c (ps_hint_table_ensure): Remove redundant size
check; avoid array zeroing because it is fully initialized when used.
(ps_hint_table_alloc): Fix off-by-one comparison and remove another
zeroing of the array elements.
2022-02-06 Werner Lemberg <wl@gnu.org>
@ -3933,10 +3933,10 @@
2022-01-31 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Partially revert 9870b6c07e2c.
Fix crashes reported by Werner.
[cache] Partially revert 9870b6c07e2c.
Fix crashes reported by Werner.
* src/cache/ftcmru.c (FTC_MruList_New): Use `FT_ALLOC` again.
2022-01-31 Werner Lemberg <wl@gnu.org>
@ -4251,9 +4251,9 @@
2022-01-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Avoid unnecessary zeroing.
* src/pshinter/pshalgo.c (psh_hint_table_init,psh_glyph_init,
[pshinter] Avoid unnecessary zeroing.
* src/pshinter/pshalgo.c (psh_hint_table_init,psh_glyph_init,
psh_glyph_interpolate_normal_points): Use FT_QNEW_ARRAY.
2022-01-20 Alexei Podtelezhnikov <apodtele@gmail.com>

View File

@ -8179,7 +8179,7 @@ test -z "$GREP" && GREP=grep
_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
_LT_DECL([], [EGREP], [1], [An ERE matcher])
_LT_DECL([], [FGREP], [1], [A literal string matcher])
dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
dnl Non-bleeding-edge_t autoconf doesn't subst GREP, so do it here too
AC_SUBST([GREP])
])

View File

@ -763,7 +763,7 @@
Improve segment allocation.
(af_latin_hints_compute_edges): Change return type to FT_Error.
Update all callers.
Improve edge allocation and link handling.
Improve edge_t allocation and link handling.
(af_latin_hints_detect_features): Change return type to FT_Error.
Update all callers.
@ -7329,7 +7329,7 @@
src/autohint/ahmodule.c [DEBUG_HINTER]: Removing compiler warnings
(only used in development builds anyway).
Improve support of local extrema and stem edge points.
Improve support of local extrema and stem edge_t points.
* src/pshinter/pshalgo3.h (PSH3_Hint_TableRec): Use PSH3_ZoneRec
for `zones'.

View File

@ -1130,7 +1130,7 @@
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sdf/ftsdf.c (sdf_{edge,contour,shape}_new): Use FT_QALLOC.
* src/sdf/ftsdf.c (sdf_{edge_t,contour,shape}_new): Use FT_QALLOC.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
@ -2136,14 +2136,14 @@
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add functions to compute pixel edge distances.
[sdf] Add functions to compute pixel edge_t distances.
* src/sdf/ftbsdf.c (compute_edge_distance, bsdf_approximate_edge):
New functions.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add function to find edge pixels in a grid of alpha values.
[sdf] Add function to find edge_t pixels in a grid of alpha values.
* src/sdf/ftbsdf.c (bsdf_is_edge): New function.
@ -2215,7 +2215,7 @@
2020-08-19 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add functions to get shortest distance from any edge/contour.
[sdf] Add functions to get shortest distance from any edge_t/contour.
* src/sdf/ftsdf.c (sdf_edge_get_min_distance): New function.
(sdf_contour_get_min_distance): New function, currently disabled.
@ -4770,7 +4770,7 @@
The buffer size FT_MAX_GRAY_SPANS is set to 10 spans, which should be
enough to cover the entire scanline for simple glyphs in most cases:
each slightly slanted edge needs up to two spans, plus a filling span
each slightly slanted edge_t needs up to two spans, plus a filling span
in-between. This is not new, we used to do it before cb4388783cecc.
* src/smooth/ftgrays.c (gray_TWorker): Add `spans' and `num_spans'.
@ -5029,7 +5029,7 @@
Reported by Sender Ghost <lightside@gmx.com>.
* src/autofit/afcjk.c (af_cjk_hints_compute_edges): Catch a corner
case where `edge->first' could be NULL.
case where `edge_t->first' could be NULL.
* src/pfr/pfrobjs.c (pfr_slot_load): Remove unnecessary test of
`size'.

View File

@ -366,7 +366,7 @@
* src/autofit/afloader.c (af_loader_load_g): Compute lsb_delta and
rsb_delta correctly in edge cases.
rsb_delta correctly in edge_t cases.
2006-03-22 Werner Lemberg <wl@gnu.org>

View File

@ -5706,7 +5706,7 @@
(af_direction_compute): Fine tuning.
(af_glyph_hints_align_edge_points): Fix logic.
(af_glyph_hints_align_strong_points): Do linear search for small
edge counts.
edge_t counts.
(af_glyph_hints_align_weak_points): Skip any touched neighbors.
(af_iup_shift): Handle zero `delta'.
@ -5724,7 +5724,7 @@
(af_latin_hints_compute_segments) [AF_HINT_METRICS]: Remove dead code.
(af_latin_hints_compute_edges) [AF_HINT_METRICS]: Remove dead code.
Don't set `edge->dir'
Don't set `edge_t->dir'
(af_latin_hint_edges): Add more logging.
* src/autofit/afloader.c: Updated.

View File

@ -4029,7 +4029,7 @@
af_latin_hints_compute_blue_edges.
(af_cjk_metrics_init_blues): New function, CJK version of
af_latin_metrics_init_blues.
(af_cjk_hint_edges): Add code to align the edge stems to blue zones.
(af_cjk_hint_edges): Add code to align the edge_t stems to blue zones.
* src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric
instead of AF_LatinMetric, and initialize as af_cjk_metrics_init.

View File

@ -2516,7 +2516,7 @@
af_get_edge_index): New functions.
(af_glyph_hints_dump_points): Remove unnecessary `|', `[', and `]'.
Add segment and edge index for each point.
Add segment and edge_t index for each point.
Slightly change printing order of some elements.
Don't print `-1' but `--' for missing elements.

View File

@ -2037,7 +2037,7 @@
2016-07-15 Werner Lemberg <wl@gnu.org>
[autofit] Update and improve segment and edge tracing.
[autofit] Update and improve segment and edge_t tracing.
* src/autofit/afhints.c (af_glyph_hints_dump_segments): Trace
`delta' also.

View File

@ -67,7 +67,7 @@ II. Rendering Technology
Note that, for the rasterizer, pixel centers are located at
integer coordinates. The TrueType bytecode interpreter,
however, assumes that the lower left edge of a pixel (which is
however, assumes that the lower left edge_t of a pixel (which is
taken to be a square with a length of 1 unit) has integer
coordinates.

View File

@ -2065,7 +2065,7 @@
<p>The bounding box is specified with the coordinates of the lower left and the upper right corner. In PostScript, those values are often called (llx,lly) and (urx,ury), respectively.</p>
<p>If <code>yMin</code> is negative, this value gives the glyph's descender. Otherwise, the glyph doesn't descend below the baseline. Similarly, if <code>ymax</code> is positive, this value gives the glyph's ascender.</p>
<p><code>xMin</code> gives the horizontal distance from the glyph's origin to the left edge of the glyph's bounding box. If <code>xMin</code> is negative, the glyph extends to the left of the origin.</p>
<p><code>xMin</code> gives the horizontal distance from the glyph's origin to the left edge_t of the glyph's bounding box. If <code>xMin</code> is negative, the glyph extends to the left of the origin.</p>
<hr>
<h2 id="ft_matrix">FT_Matrix<a class="headerlink" href="#ft_matrix" title="Permanent link">&para;</a></h2>

View File

@ -1279,8 +1279,8 @@
<p>1) No hinting in the horizontal direction: Unlike &lsquo;superhinted&rsquo; TrueType, which changes glyph widths to accommodate regular inter-glyph spacing, Adobe's approach is &lsquo;faithful to the design&rsquo; in representing both the glyph width and the inter-glyph spacing designed for the font. This makes the screen display as close as it can be to the result one would get with infinite resolution, while preserving what is considered the key characteristics of each glyph. Note that the distances between unhinted and grid-fitted positions at small sizes are comparable to kerning values and thus would be noticeable (and distracting) while reading if hinting were applied.</p>
<p>One of the reasons to not hint horizontally is anti-aliasing for LCD screens: The pixel geometry of modern displays supplies three vertical subpixels as the eye moves horizontally across each visible pixel. On devices where we can be certain this characteristic is present a rasterizer can take advantage of the subpixels to add increments of weight. In Western writing systems this turns out to be the more critical direction anyway; the weights and spacing of vertical stems (see above) are central to Armenian, Cyrillic, Greek, and Latin type designs. Even when the rasterizer uses greyscale anti-aliasing instead of color (a necessary compromise when one doesn't know the screen characteristics), the unhinted vertical features preserve the design's weight and spacing much better than aliased type would.</p>
<p>2) Alignment in the vertical direction: Weights and spacing along the y&nbsp;axis are less critical; what is much more important is the visual alignment of related features (like cap-height and x-height). The sense of alignment for these is enhanced by the sharpness of grid-fit edges, while the cruder vertical resolution (full pixels instead of &#8531; pixels) is less of a problem.</p>
<p>On the technical side, horizontal alignment zones for ascender, x-height, and other important height values (traditionally called &lsquo;blue zones&rsquo;) as defined in the font are positioned independently, each being rounded to the nearest pixel edge, taking care of overshoot suppression at small sizes, stem darkening, and scaling.</p>
<p>Hstems (that is, hint values defined in the font to help align horizontal features) that fall within a blue zone are said to be &lsquo;captured&rsquo; and are aligned to that zone. Uncaptured stems are moved in one of four ways, top edge up or down, bottom edge up or down. Unless there are conflicting hstems, the smallest movement is taken to minimize distortion.</p>
<p>On the technical side, horizontal alignment zones for ascender, x-height, and other important height values (traditionally called &lsquo;blue zones&rsquo;) as defined in the font are positioned independently, each being rounded to the nearest pixel edge_t, taking care of overshoot suppression at small sizes, stem darkening, and scaling.</p>
<p>Hstems (that is, hint values defined in the font to help align horizontal features) that fall within a blue zone are said to be &lsquo;captured&rsquo; and are aligned to that zone. Uncaptured stems are moved in one of four ways, top edge_t up or down, bottom edge_t up or down. Unless there are conflicting hstems, the smallest movement is taken to minimize distortion.</p>

View File

@ -365,8 +365,8 @@ Functions</h2></td></tr>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">window</td><td>The window that received the event. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">xpos</td><td>The new cursor x-coordinate, relative to the left edge of the content area. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">ypos</td><td>The new cursor y-coordinate, relative to the top edge of the content area.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">xpos</td><td>The new cursor x-coordinate, relative to the left edge_t of the content area. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">ypos</td><td>The new cursor y-coordinate, relative to the top edge_t of the content area.</td></tr>
</table>
</dd>
</dl>
@ -936,8 +936,8 @@ Functions</h2></td></tr>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">window</td><td>The desired window. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">xpos</td><td>Where to store the cursor x-coordinate, relative to the left edge of the content area, or <code>NULL</code>. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">ypos</td><td>Where to store the cursor y-coordinate, relative to the to top edge of the content area, or <code>NULL</code>.</td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">xpos</td><td>Where to store the cursor x-coordinate, relative to the left edge_t of the content area, or <code>NULL</code>. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">ypos</td><td>Where to store the cursor y-coordinate, relative to the to top edge_t of the content area, or <code>NULL</code>.</td></tr>
</table>
</dd>
</dl>
@ -987,8 +987,8 @@ Functions</h2></td></tr>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">window</td><td>The desired window. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">xpos</td><td>The desired x-coordinate, relative to the left edge of the content area. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">ypos</td><td>The desired y-coordinate, relative to the top edge of the content area.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">xpos</td><td>The desired x-coordinate, relative to the left edge_t of the content area. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">ypos</td><td>The desired y-coordinate, relative to the top edge_t of the content area.</td></tr>
</table>
</dd>
</dl>

View File

@ -2178,16 +2178,16 @@ Functions</h2></td></tr>
</tr>
</table>
</div><div class="memdoc">
<p >This function retrieves the size, in screen coordinates, of each edge of the frame of the specified window. This size includes the title bar, if the window has one. The size of the frame may vary depending on the <a class="el" href="window_guide.html#window_hints_wnd">window-related hints</a> used to create it.</p>
<p >Because this function retrieves the size of each window frame edge and not the offset along a particular coordinate axis, the retrieved values will always be zero or positive.</p>
<p >This function retrieves the size, in screen coordinates, of each edge_t of the frame of the specified window. This size includes the title bar, if the window has one. The size of the frame may vary depending on the <a class="el" href="window_guide.html#window_hints_wnd">window-related hints</a> used to create it.</p>
<p >Because this function retrieves the size of each window frame edge_t and not the offset along a particular coordinate axis, the retrieved values will always be zero or positive.</p>
<p >Any or all of the size arguments may be <code>NULL</code>. If an error occurs, all non-<code>NULL</code> size arguments will be set to zero.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">window</td><td>The window whose frame size to query. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">left</td><td>Where to store the size, in screen coordinates, of the left edge of the window frame, or <code>NULL</code>. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">top</td><td>Where to store the size, in screen coordinates, of the top edge of the window frame, or <code>NULL</code>. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">right</td><td>Where to store the size, in screen coordinates, of the right edge of the window frame, or <code>NULL</code>. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">bottom</td><td>Where to store the size, in screen coordinates, of the bottom edge of the window frame, or <code>NULL</code>.</td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">left</td><td>Where to store the size, in screen coordinates, of the left edge_t of the window frame, or <code>NULL</code>. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">top</td><td>Where to store the size, in screen coordinates, of the top edge_t of the window frame, or <code>NULL</code>. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">right</td><td>Where to store the size, in screen coordinates, of the right edge_t of the window frame, or <code>NULL</code>. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">bottom</td><td>Where to store the size, in screen coordinates, of the bottom edge_t of the window frame, or <code>NULL</code>.</td></tr>
</table>
</dd>
</dl>

@ -1 +1 @@
Subproject commit d42fa46dc6b68863046c22467297933dbe39bb55
Subproject commit 231cbee0fc4f59dbe5b8b853a11b08dc84e57c65

@ -1 +1 @@
Subproject commit a3dff1d6c17d4f202f304cd4dd37bc9052709cd1
Subproject commit 111397c71a5f1c2c88e05da9c84edfdba2e472a4

View File

@ -18,6 +18,7 @@
#include <blt/gfx/renderer/resource_manager.h>
#include <blt/std/logging.h>
#include <blt/std/thread.h>
#include <filesystem>
namespace blt::gfx
{
@ -46,6 +47,11 @@ namespace blt::gfx
textures_to_load.pop_back();
}
BLT_DEBUG("Loading texture file %s", texture.path.c_str());
if (!std::filesystem::exists(texture.path))
{
BLT_WARN("Texture '%s' does not exist on disk!", texture.path.c_str());
return;
}
auto* file = new texture_file(texture.path, texture.name);
{
std::scoped_lock lock(save_lock);