Skip to content

Commit 99a7a3c

Browse files
committed
Removed unnecessary copy of the texture atlas when uploading.
1 parent fa299f9 commit 99a7a3c

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Source/Core/FontEngineDefault/FontFaceHandleDefault.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ int FontFaceHandleDefault::GenerateLayerConfiguration(const FontEffectList& font
192192
return (int)(layer_configurations.size() - 1);
193193
}
194194

195-
bool FontFaceHandleDefault::GenerateLayerTexture(Vector<byte>& texture_data, Vector2i& texture_dimensions, const FontEffect* font_effect,
195+
bool FontFaceHandleDefault::GenerateLayerTexture(Span<const byte>& texture_data, Vector2i& texture_dimensions, const FontEffect* font_effect,
196196
int texture_id, int handle_version) const
197197
{
198198
if (handle_version != version)

Source/Core/FontEngineDefault/FontFaceHandleDefault.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class FontFaceHandleDefault final : public NonCopyMoveable {
7777
/// @param[in] font_effect The font effect used for the layer.
7878
/// @param[in] texture_id The index of the texture within the layer to generate.
7979
/// @param[in] handle_version The version of the handle data. Function returns false if out of date.
80-
bool GenerateLayerTexture(Vector<byte>& texture_data, Vector2i& texture_dimensions, const FontEffect* font_effect, int texture_id,
80+
bool GenerateLayerTexture(Span<const byte>& texture_data, Vector2i& texture_dimensions, const FontEffect* font_effect, int texture_id,
8181
int handle_version) const;
8282

8383
/// Generates the geometry required to render a single line of text.

Source/Core/FontEngineDefault/FontFaceLayer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ bool FontFaceLayer::Generate(
203203
CallbackTextureFunction texture_callback = [handle, effect_ptr, texture_id, handle_version](
204204
const CallbackTextureInterface& texture_interface) -> bool {
205205
Vector2i dimensions;
206-
Vector<byte> data;
206+
Span<const byte> data;
207207
if (!handle->GenerateLayerTexture(data, dimensions, effect_ptr, texture_id, handle_version) || data.empty())
208208
return false;
209209
if (!texture_interface.GenerateTexture(data, dimensions))
@@ -221,13 +221,13 @@ bool FontFaceLayer::Generate(
221221
return true;
222222
}
223223

224-
bool FontFaceLayer::GenerateTexture(Vector<byte>& texture_data, Vector2i& texture_dimensions, int texture_id, const FontGlyphMap& /*glyphs*/)
224+
bool FontFaceLayer::GenerateTexture(Span<const byte>& texture_data, Vector2i& texture_dimensions, int texture_id, const FontGlyphMap& /*glyphs*/)
225225
{
226226
if (texture_id < 0 || texture_id > static_cast<int>(sprite_set_textures.size()))
227227
return false;
228228

229229
const unsigned char *const source = sprite_set_textures[texture_id];
230-
texture_data.insert(texture_data.end(), source, source + 1024 * 1024 * 4);
230+
texture_data = {source, 1024 * 1024 * 4};
231231
texture_dimensions = {1024, 1024};
232232

233233
/*

Source/Core/FontEngineDefault/FontFaceLayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class FontFaceLayer {
6969
/// @param[out] texture_dimensions The dimensions of the texture.
7070
/// @param[in] texture_id The index of the texture within the layer to generate.
7171
/// @param[in] glyphs The glyphs required by the font face handle.
72-
bool GenerateTexture(Vector<byte>& texture_data, Vector2i& texture_dimensions, int texture_id, const FontGlyphMap& glyphs);
72+
bool GenerateTexture(Span<const byte>& texture_data, Vector2i& texture_dimensions, int texture_id, const FontGlyphMap& glyphs);
7373

7474
/// Generates the geometry required to render a single character.
7575
/// @param[out] mesh_list An array of meshes this layer will write to. It must be at least as big as the number of textures in this layer.

0 commit comments

Comments
 (0)