Skip to content

Commit a5f4ec6

Browse files
vkedwardliflyinghead
authored andcommitted
rend: use thread-local flip state
1 parent bd0bf5e commit a5f4ec6

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

core/rend/CustomTexture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ u8* CustomTextureSource::loadCustomTexture(u32 hash, int& width, int& height)
126126
if (file == nullptr)
127127
return nullptr;
128128
int n;
129-
stbi_set_flip_vertically_on_load(1);
129+
stbi_set_flip_vertically_on_load_thread(1);
130130
u8 *imgData = stbi_load_from_file(file, &width, &height, &n, STBI_rgb_alpha);
131131
std::fclose(file);
132132
return imgData;

core/ui/gui_util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ static u8 *loadImage(const std::string& path, int& width, int& height)
788788
return nullptr;
789789

790790
int channels;
791-
stbi_set_flip_vertically_on_load(0);
791+
stbi_set_flip_vertically_on_load_thread(0);
792792
u8 *imgData = stbi_load_from_file(file, &width, &height, &channels, STBI_rgb_alpha);
793793
std::fclose(file);
794794
return imgData;
@@ -858,7 +858,7 @@ ImTextureID ImguiStateTexture::getId()
858858
return loadedPic;
859859

860860
int channels;
861-
stbi_set_flip_vertically_on_load(0);
861+
stbi_set_flip_vertically_on_load_thread(0);
862862
loadedPic.data = stbi_load_from_memory(&pngData[0], pngData.size(), &loadedPic.width, &loadedPic.height, &channels, STBI_rgb_alpha);
863863

864864
return loadedPic;

core/ui/vgamepad.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static bool loadOSDButtons(const std::string& path)
108108
if (file == nullptr)
109109
return false;
110110

111-
stbi_set_flip_vertically_on_load(1);
111+
stbi_set_flip_vertically_on_load_thread(1);
112112
int width, height, n;
113113
u8 *image_data = stbi_load_from_file(file, &width, &height, &n, STBI_rgb_alpha);
114114
std::fclose(file);
@@ -143,7 +143,7 @@ static ImTextureID loadOSDButtons()
143143
// default in resource
144144
size_t size;
145145
std::unique_ptr<u8[]> data = resource::load(getButtonsResPath(), size);
146-
stbi_set_flip_vertically_on_load(1);
146+
stbi_set_flip_vertically_on_load_thread(1);
147147
int width, height, n;
148148
u8 *image_data = stbi_load_from_memory(data.get(), (int)size, &width, &height, &n, STBI_rgb_alpha);
149149
if (image_data != nullptr)

0 commit comments

Comments
 (0)