Add input validation to SDL_CalculateGammaRamp; add test coverage to Pixels suite; update test cases in Pixels suite
This commit is contained in:
parent
4f70701db1
commit
4ec8d70ca1
2 changed files with 169 additions and 6 deletions
|
@ -1090,9 +1090,19 @@ void
|
|||
SDL_CalculateGammaRamp(float gamma, Uint16 * ramp)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Input validation */
|
||||
if (gamma < 0.0f ) {
|
||||
SDL_InvalidParamError("gamma");
|
||||
return;
|
||||
}
|
||||
if (ramp == NULL) {
|
||||
SDL_InvalidParamError("ramp");
|
||||
return;
|
||||
}
|
||||
|
||||
/* 0.0 gamma is all black */
|
||||
if (gamma <= 0.0f) {
|
||||
if (gamma == 0.0f) {
|
||||
for (i = 0; i < 256; ++i) {
|
||||
ramp[i] = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue