mirror of
https://github.com/love2d/love.git
synced 2026-08-19 12:14:20 +02:00
Fixed Image:setMipmapFilter keeping bad state around if it errors.
This commit is contained in:
@@ -256,6 +256,7 @@ void Image::checkMipmapsCreated()
|
|||||||
|
|
||||||
void Image::setFilter(const Texture::Filter &f)
|
void Image::setFilter(const Texture::Filter &f)
|
||||||
{
|
{
|
||||||
|
const Filter oldfilter = filter;
|
||||||
filter = f;
|
filter = f;
|
||||||
|
|
||||||
// We don't want filtering or (attempted) mipmaps on the default texture.
|
// We don't want filtering or (attempted) mipmaps on the default texture.
|
||||||
@@ -267,7 +268,18 @@ void Image::setFilter(const Texture::Filter &f)
|
|||||||
|
|
||||||
bind();
|
bind();
|
||||||
gl.setTextureFilter(filter);
|
gl.setTextureFilter(filter);
|
||||||
checkMipmapsCreated();
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
checkMipmapsCreated();
|
||||||
|
}
|
||||||
|
catch (love::Exception &)
|
||||||
|
{
|
||||||
|
// Don't keep the new mipmap filter if we can't create mipmaps.
|
||||||
|
filter = oldfilter;
|
||||||
|
gl.setTextureFilter(filter);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::setWrap(const Texture::Wrap &w)
|
void Image::setWrap(const Texture::Wrap &w)
|
||||||
|
|||||||
Reference in New Issue
Block a user