Fixing #935: Secure function against random data return.
This commit is contained in:
parent
df8260a1c4
commit
c55b8c17e1
@ -32,9 +32,9 @@
|
|||||||
#include <SFML/Graphics/VertexArray.hpp>
|
#include <SFML/Graphics/VertexArray.hpp>
|
||||||
#include <SFML/Graphics/GLCheck.hpp>
|
#include <SFML/Graphics/GLCheck.hpp>
|
||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
|
#include <cassert>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// Convert an sf::BlendMode::Factor constant to the corresponding OpenGL constant.
|
// Convert an sf::BlendMode::Factor constant to the corresponding OpenGL constant.
|
||||||
@ -53,6 +53,10 @@ namespace
|
|||||||
case sf::BlendMode::DstAlpha: return GL_DST_ALPHA;
|
case sf::BlendMode::DstAlpha: return GL_DST_ALPHA;
|
||||||
case sf::BlendMode::OneMinusDstAlpha: return GL_ONE_MINUS_DST_ALPHA;
|
case sf::BlendMode::OneMinusDstAlpha: return GL_ONE_MINUS_DST_ALPHA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sf::err() << "Invalid value for sf::BlendMode::Factor! Fallback to sf::BlendMode::Zero." << std::endl;
|
||||||
|
assert(false);
|
||||||
|
return GL_ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,6 +68,10 @@ namespace
|
|||||||
case sf::BlendMode::Add: return GLEXT_GL_FUNC_ADD;
|
case sf::BlendMode::Add: return GLEXT_GL_FUNC_ADD;
|
||||||
case sf::BlendMode::Subtract: return GLEXT_GL_FUNC_SUBTRACT;
|
case sf::BlendMode::Subtract: return GLEXT_GL_FUNC_SUBTRACT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sf::err() << "Invalid value for sf::BlendMode::Equation! Fallback to sf::BlendMode::Add." << std::endl;
|
||||||
|
assert(false);
|
||||||
|
return GLEXT_GL_FUNC_ADD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user