mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 20:15:32 +00:00
FullscreenUI: Skip SVG prefix if image is not a SVG
This commit is contained in:
parent
c34dda39b7
commit
227c249d7f
@ -374,6 +374,10 @@ GPUTexture* ImGuiFullscreen::GetCachedTexture(std::string_view name)
|
|||||||
|
|
||||||
GPUTexture* ImGuiFullscreen::GetCachedTexture(std::string_view name, u32 svg_width, u32 svg_height)
|
GPUTexture* ImGuiFullscreen::GetCachedTexture(std::string_view name, u32 svg_width, u32 svg_height)
|
||||||
{
|
{
|
||||||
|
// ignore size hints if it's not needed, don't duplicate
|
||||||
|
if (!TextureNeedsSVGDimensions(name))
|
||||||
|
return GetCachedTexture(name);
|
||||||
|
|
||||||
svg_width = static_cast<u32>(std::ceil(LayoutScale(static_cast<float>(svg_width))));
|
svg_width = static_cast<u32>(std::ceil(LayoutScale(static_cast<float>(svg_width))));
|
||||||
svg_height = static_cast<u32>(std::ceil(LayoutScale(static_cast<float>(svg_height))));
|
svg_height = static_cast<u32>(std::ceil(LayoutScale(static_cast<float>(svg_height))));
|
||||||
|
|
||||||
@ -420,6 +424,11 @@ bool ImGuiFullscreen::InvalidateCachedTexture(std::string_view path)
|
|||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ImGuiFullscreen::TextureNeedsSVGDimensions(std::string_view path)
|
||||||
|
{
|
||||||
|
return StringUtil::EndsWithNoCase(Path::GetExtension(path), "svg");
|
||||||
|
}
|
||||||
|
|
||||||
void ImGuiFullscreen::UploadAsyncTextures()
|
void ImGuiFullscreen::UploadAsyncTextures()
|
||||||
{
|
{
|
||||||
std::unique_lock lock(s_state.shared_state_mutex);
|
std::unique_lock lock(s_state.shared_state_mutex);
|
||||||
|
@ -142,6 +142,7 @@ GPUTexture* GetCachedTexture(std::string_view name);
|
|||||||
GPUTexture* GetCachedTexture(std::string_view name, u32 svg_width, u32 svg_height);
|
GPUTexture* GetCachedTexture(std::string_view name, u32 svg_width, u32 svg_height);
|
||||||
GPUTexture* GetCachedTextureAsync(std::string_view name);
|
GPUTexture* GetCachedTextureAsync(std::string_view name);
|
||||||
bool InvalidateCachedTexture(std::string_view path);
|
bool InvalidateCachedTexture(std::string_view path);
|
||||||
|
bool TextureNeedsSVGDimensions(std::string_view path);
|
||||||
void UploadAsyncTextures();
|
void UploadAsyncTextures();
|
||||||
|
|
||||||
void BeginLayout();
|
void BeginLayout();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user