Skip to content

Commit b356518

Browse files
committed
Split texture's resize function into sRGB and non-sRGB
1 parent 08b22ee commit b356518

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

include/CSFML/Graphics/Texture.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,24 @@ CSFML_GRAPHICS_API void sfTexture_destroy(const sfTexture* texture);
185185
///
186186
/// \param texture Texture to resize
187187
/// \param size Width and height of the texture
188-
/// \param sRgb `true` to enable sRGB conversion, `false` to disable it
189188
///
190189
/// \return `true` if resizing was successful, `false` if it failed
191190
///
192191
////////////////////////////////////////////////////////////
193-
CSFML_GRAPHICS_API bool sfTexture_resize(sfTexture* texture, sfVector2u size, bool sRgb);
192+
CSFML_GRAPHICS_API bool sfTexture_resize(sfTexture* texture, sfVector2u size);
193+
194+
////////////////////////////////////////////////////////////
195+
/// \brief Resize the texture with sRGB-enabled
196+
///
197+
/// If this function fails, the texture is left unchanged.
198+
///
199+
/// \param texture Texture to resize
200+
/// \param size Width and height of the texture
201+
///
202+
/// \return `true` if resizing was successful, `false` if it failed
203+
///
204+
////////////////////////////////////////////////////////////
205+
CSFML_GRAPHICS_API bool sfTexture_resizeSrgb(sfTexture* texture, sfVector2u size);
194206

195207
////////////////////////////////////////////////////////////
196208
/// \brief Return the size of the texture

src/CSFML/Graphics/Texture.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,20 @@ void sfTexture_destroy(const sfTexture* texture)
171171

172172

173173
////////////////////////////////////////////////////////////
174-
bool sfTexture_resize(sfTexture* texture, sfVector2u size, bool sRgb)
174+
bool sfTexture_resize(sfTexture* texture, sfVector2u size)
175175
{
176176
assert(texture);
177177
assert(texture->This);
178-
return texture->This->resize(convertVector2(size), sRgb);
178+
return texture->This->resize(convertVector2(size), false);
179+
}
180+
181+
182+
////////////////////////////////////////////////////////////
183+
bool sfTexture_resizeSrgb(sfTexture* texture, sfVector2u size)
184+
{
185+
assert(texture);
186+
assert(texture->This);
187+
return texture->This->resize(convertVector2(size), true);
179188
}
180189

181190

0 commit comments

Comments
 (0)