Skip to content

Commit

Permalink
Rename texture table to texture source
Browse files Browse the repository at this point in the history
  • Loading branch information
mikke89 committed Sep 7, 2023
1 parent 7839515 commit bd25b7a
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 34 deletions.
18 changes: 9 additions & 9 deletions Include/RmlUi/Core/CallbackTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Texture;
Callback function for generating textures on demand.
/// @param[in] texture_interface The interface used to specify the texture.
/// @return True on success.
*/
*/
using CallbackTextureFunction = Function<bool(const CallbackTextureInterface& texture_interface)>;

/**
Expand Down Expand Up @@ -86,17 +86,17 @@ class RMLUICORE_API CallbackTextureInterface {
Vector2i& dimensions;
};

class RMLUICORE_API CallbackTextureTable {
class RMLUICORE_API CallbackTextureSource {
public:
CallbackTextureTable() = default;
CallbackTextureTable(CallbackTextureFunction&& callback);
~CallbackTextureTable() = default;
CallbackTextureSource() = default;
CallbackTextureSource(CallbackTextureFunction&& callback);
~CallbackTextureSource() = default;

CallbackTextureTable(const CallbackTextureTable&) = delete;
CallbackTextureTable& operator=(const CallbackTextureTable&) = delete;
CallbackTextureSource(const CallbackTextureSource&) = delete;
CallbackTextureSource& operator=(const CallbackTextureSource&) = delete;

CallbackTextureTable(CallbackTextureTable&& other) noexcept;
CallbackTextureTable& operator=(CallbackTextureTable&& other) noexcept;
CallbackTextureSource(CallbackTextureSource&& other) noexcept;
CallbackTextureSource& operator=(CallbackTextureSource&& other) noexcept;

Texture GetTexture(RenderManager& render_manager) const;

Expand Down
2 changes: 1 addition & 1 deletion Include/RmlUi/Core/Spritesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct Spritesheet {
String name;
int definition_line_number;
float display_scale; // The inverse of the 'resolution' spritesheet property.
TextureTable texture_table;
TextureSource texture_source;

Spritesheet(const String& name, const String& source, const String& document_path, int definition_line_number, float display_scale);
};
Expand Down
8 changes: 4 additions & 4 deletions Include/RmlUi/Core/Texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class RenderManager;
It is constructed through the render manager. It can be freely copied, and does not own or release the underlying
resource. The user is responsible for ensuring that the lifetime of the texture is valid.
*/
*/
class RMLUICORE_API Texture final {
public:
Texture() = default;
Expand All @@ -61,10 +61,10 @@ class RMLUICORE_API Texture final {
friend class RenderManager;
};

class RMLUICORE_API TextureTable : NonCopyMoveable {
class RMLUICORE_API TextureSource : NonCopyMoveable {
public:
TextureTable() = default;
TextureTable(String source, String document_path);
TextureSource() = default;
TextureSource(String source, String document_path);

Texture GetTexture(RenderManager& render_manager) const;

Expand Down
4 changes: 2 additions & 2 deletions Samples/basic/bitmapfont/src/FontEngineBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ FontFaceBitmap* GetFontFaceHandle(const String& family, FontStyle style, FontWei
FontFaceBitmap::FontFaceBitmap(String family, FontStyle style, FontWeight weight, FontMetrics metrics, String texture_name, String texture_path,
Vector2f texture_dimensions, FontGlyphs&& glyphs, FontKerning&& kerning) :
family(family),
style(style), weight(weight), metrics(metrics), texture_table(texture_name, texture_path), texture_dimensions(texture_dimensions),
style(style), weight(weight), metrics(metrics), texture_source(texture_name, texture_path), texture_dimensions(texture_dimensions),
glyphs(std::move(glyphs)), kerning(std::move(kerning))
{}

Expand Down Expand Up @@ -159,7 +159,7 @@ int FontFaceBitmap::GenerateString(RenderManager& render_manager, const String&

mesh_list.resize(1);

mesh_list[0].texture = texture_table.GetTexture(render_manager);
mesh_list[0].texture = texture_source.GetTexture(render_manager);

Rml::Mesh& mesh = mesh_list[0].mesh;
auto& vertices = mesh.vertices;
Expand Down
4 changes: 2 additions & 2 deletions Samples/basic/bitmapfont/src/FontEngineBitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <RmlUi/Core/Types.h>

class FontFaceBitmap;
using Rml::TextureTable;
using Rml::TextureSource;

namespace FontProviderBitmap {
void Initialise();
Expand Down Expand Up @@ -83,7 +83,7 @@ class FontFaceBitmap {

FontMetrics metrics;

TextureTable texture_table;
TextureSource texture_source;
Vector2f texture_dimensions;

FontGlyphs glyphs;
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/CallbackTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,20 @@ RenderManager& CallbackTextureInterface::GetRenderManager() const
return render_manager;
}

CallbackTextureTable::CallbackTextureTable(CallbackTextureFunction&& callback) : callback(std::move(callback)) {}
CallbackTextureSource::CallbackTextureSource(CallbackTextureFunction&& callback) : callback(std::move(callback)) {}

CallbackTextureTable::CallbackTextureTable(CallbackTextureTable&& other) noexcept :
CallbackTextureSource::CallbackTextureSource(CallbackTextureSource&& other) noexcept :
callback(std::move(other.callback)), textures(std::move(other.textures))
{}

CallbackTextureTable& CallbackTextureTable::operator=(CallbackTextureTable&& other) noexcept
CallbackTextureSource& CallbackTextureSource::operator=(CallbackTextureSource&& other) noexcept
{
callback = std::move(other.callback);
textures = std::move(other.textures);
return *this;
}

Texture CallbackTextureTable::GetTexture(RenderManager& render_manager) const
Texture CallbackTextureSource::GetTexture(RenderManager& render_manager) const
{
CallbackTexture& texture = textures[&render_manager];
if (!texture)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DecoratorNinePatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ SharedPtr<Decorator> DecoratorNinePatchInstancer::InstanceDecorator(const String
auto decorator = MakeShared<DecoratorNinePatch>();

if (!decorator->Initialise(sprite_outer->rectangle, sprite_inner->rectangle, (edges_set ? &edges : nullptr),
sprite_outer->sprite_sheet->texture_table.GetTexture(instancer_interface.GetRenderManager()), sprite_outer->sprite_sheet->display_scale))
sprite_outer->sprite_sheet->texture_source.GetTexture(instancer_interface.GetRenderManager()), sprite_outer->sprite_sheet->display_scale))
{
return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DecoratorTiled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ bool DecoratorTiledInstancer::GetTileProperties(DecoratorTiled::Tile* tiles, Tex
tile.size = sprite->rectangle.Size();
tile.display_scale = sprite->sprite_sheet->display_scale;

texture = sprite->sprite_sheet->texture_table.GetTexture(instancer_interface.GetRenderManager());
texture = sprite->sprite_sheet->texture_source.GetTexture(instancer_interface.GetRenderManager());
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Elements/ElementImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ bool ElementImage::LoadTexture()
{
rect = sprite->rectangle;
rect_source = RectSource::Sprite;
texture = sprite->sprite_sheet->texture_table.GetTexture(*render_manager);
texture = sprite->sprite_sheet->texture_source.GetTexture(*render_manager);
dimensions_scale = sprite->sprite_sheet->display_scale * dp_ratio;
valid_sprite = true;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Elements/ElementProgress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ bool ElementProgress::LoadTexture()
{
rect = sprite->rectangle;
rect_set = true;
texture = sprite->sprite_sheet->texture_table.GetTexture(*render_manager);
texture = sprite->sprite_sheet->texture_source.GetTexture(*render_manager);
texture_set = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/FontEngineDefault/FontFaceLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ bool FontFaceLayer::Generate(const FontFaceHandleDefault* handle, const FontFace
return true;
};

static_assert(std::is_nothrow_move_constructible<CallbackTextureTable>::value,
"CallbackTextureTable must be nothrow move constructible so that it can be placed in the vector below.");
static_assert(std::is_nothrow_move_constructible<CallbackTextureSource>::value,
"CallbackTextureSource must be nothrow move constructible so that it can be placed in the vector below.");

textures_owned.emplace_back(std::move(texture_callback));
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/FontEngineDefault/FontFaceLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class FontFaceLayer {
};

using CharacterMap = UnorderedMap<Character, TextureBox>;
using TextureList = Vector<CallbackTextureTable>;
using TextureList = Vector<CallbackTextureSource>;

SharedPtr<const FontEffect> effect;

Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Spritesheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
namespace Rml {

Spritesheet::Spritesheet(const String& name, const String& source, const String& document_path, int definition_line_number, float display_scale) :
name(name), definition_line_number(definition_line_number), display_scale(display_scale), texture_table(source, document_path)
name(name), definition_line_number(definition_line_number), display_scale(display_scale), texture_source(source, document_path)
{}

bool SpritesheetList::AddSpriteSheet(const String& name, const String& image_source, const String& definition_source, int definition_line_number,
Expand All @@ -57,7 +57,7 @@ bool SpritesheetList::AddSpriteSheet(const String& name, const String& image_sou
if (new_sprite.sprite_sheet)
{
Log::Message(Log::LT_WARNING, "Sprite '%s' was overwritten due to duplicate names at the same block scope. Declared at %s:%d and %s:%d",
sprite_name.c_str(), new_sprite.sprite_sheet->texture_table.GetDefinitionSource().c_str(),
sprite_name.c_str(), new_sprite.sprite_sheet->texture_source.GetDefinitionSource().c_str(),
new_sprite.sprite_sheet->definition_line_number, definition_source.c_str(), definition_line_number);
}

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ bool Texture::operator==(const Texture& other) const
return render_manager == other.render_manager && file_index == other.file_index && callback_handle == other.callback_handle;
}

TextureTable::TextureTable(String source, String document_path) : source(std::move(source)), document_path(std::move(document_path)) {}
TextureSource::TextureSource(String source, String document_path) : source(std::move(source)), document_path(std::move(document_path)) {}

Texture TextureTable::GetTexture(RenderManager& render_manager) const
Texture TextureSource::GetTexture(RenderManager& render_manager) const
{
Texture& texture = textures[&render_manager];
if (!texture)
texture = render_manager.LoadTexture(source, document_path);
return texture;
}

const String& TextureTable::GetDefinitionSource() const
const String& TextureSource::GetDefinitionSource() const
{
return document_path;
}
Expand Down

0 comments on commit bd25b7a

Please sign in to comment.