mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Fixing #935: Secure function against random data return.
This commit is contained in:
parent
506ec95fde
commit
0f1dc5a754
@ -32,9 +32,9 @@
|
||||
#include <SFML/Graphics/VertexArray.hpp>
|
||||
#include <SFML/Graphics/GLCheck.hpp>
|
||||
#include <SFML/System/Err.hpp>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
// 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::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::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