Fix wrong access and simplify
authorSylvain Becker <sylvain.becker@gmail.com>
Fri, 08 Feb 2019 17:15:30 +0100
changeset 126074fb583571d7c
parent 12606 dfda346c1a7d
child 12608 b3a02787a4dd
Fix wrong access and simplify
src/video/SDL_blit_N.c
     1.1 --- a/src/video/SDL_blit_N.c	Thu Feb 07 22:45:50 2019 +0100
     1.2 +++ b/src/video/SDL_blit_N.c	Fri Feb 08 17:15:30 2019 +0100
     1.3 @@ -2178,27 +2178,17 @@
     1.4      b = (Pixel >> 16) & 0xFF;
     1.5      a = (Pixel >> 24) & 0xFF;
     1.6  
     1.7 -    {
     1.8 -        int val;
     1.9 -        for (val = 0; val <= 3; val++) {
    1.10 -            if (r != val && g != val && b != val && a != val) {
    1.11 -                missing = val;
    1.12 -                break;
    1.13 -            }
    1.14 -        }
    1.15 -    }
    1.16 -
    1.17      if (r == 0) {
    1.18 -        r = missing;
    1.19 +        r = 1;
    1.20          missing = 0;
    1.21      } else if (g == 0) {
    1.22 -        g = missing;
    1.23 +        g = 1;
    1.24          missing = 1;
    1.25      } else if (b == 0) {
    1.26 -        b = missing;
    1.27 +        b = 1;
    1.28          missing = 2;
    1.29      } else if (a == 0) {
    1.30 -        a = missing;
    1.31 +        a = 1;
    1.32          missing = 3;
    1.33      }
    1.34  
    1.35 @@ -2207,7 +2197,7 @@
    1.36      *_b = b - 1;
    1.37      *_a = a - 1;
    1.38  
    1.39 -    if (missing) {
    1.40 +    if (_missing) {
    1.41          *_missing = missing;
    1.42      }
    1.43      return;