apply r1491 + modification for BIG_ENDIAN to from mapnik2 - closes #444
This commit is contained in:
parent
354bdbd15a
commit
3c655b0a0f
1 changed files with 11 additions and 13 deletions
|
@ -369,13 +369,12 @@ namespace mapnik
|
|||
unsigned g0 = (rgba0 >> 16 ) & 0xff;
|
||||
unsigned b0 = (rgba0 >> 8) & 0xff;
|
||||
|
||||
unsigned a = (a1 * 255 + (255 - a1) * a0 + 127)/255;
|
||||
r0 = uint8_t(((r1 - r0) * a1 + (r0 << 8)) >> 8);
|
||||
g0 = uint8_t(((g1 - g0) * a1 + (g0 << 8)) >> 8);
|
||||
b0 = uint8_t(((b1 - b0) * a1 + (b0 << 8)) >> 8);
|
||||
a0 = uint8_t((a1 + a0) - ((a1 * a0 + 255) >> 8));
|
||||
|
||||
r0 = (r1*a1 + (((255 - a1) * a0 + 127)/255) * r0 + 127)/a;
|
||||
g0 = (g1*a1 + (((255 - a1) * a0 + 127)/255) * g0 + 127)/a;
|
||||
b0 = (b1*a1 + (((255 - a1) * a0 + 127)/255) * b0 + 127)/a;
|
||||
|
||||
row_to[x] = (a)| (b0 << 8) | (g0 << 16) | (r0 << 24) ;
|
||||
row_to[x] = (a0)| (b0 << 8) | (g0 << 16) | (r0 << 24) ;
|
||||
#else
|
||||
unsigned a1 = int( ((rgba1 >> 24) & 0xff) * opacity );
|
||||
if (a1 == 0) continue;
|
||||
|
@ -388,13 +387,12 @@ namespace mapnik
|
|||
unsigned g0 = (rgba0 >> 8 ) & 0xff;
|
||||
unsigned b0 = (rgba0 >> 16) & 0xff;
|
||||
|
||||
unsigned a = (a1 * 255 + (255 - a1) * a0 + 127)/255;
|
||||
|
||||
r0 = (r1*a1 + (((255 - a1) * a0 + 127)/255) * r0 + 127)/a;
|
||||
g0 = (g1*a1 + (((255 - a1) * a0 + 127)/255) * g0 + 127)/a;
|
||||
b0 = (b1*a1 + (((255 - a1) * a0 + 127)/255) * b0 + 127)/a;
|
||||
|
||||
row_to[x] = (a << 24)| (b0 << 16) | (g0 << 8) | (r0) ;
|
||||
r0 = uint8_t(((r1 - r0) * a1 + (r0 << 8)) >> 8);
|
||||
g0 = uint8_t(((g1 - g0) * a1 + (g0 << 8)) >> 8);
|
||||
b0 = uint8_t(((b1 - b0) * a1 + (b0 << 8)) >> 8);
|
||||
a0 = uint8_t((a1 + a0) - ((a1 * a0 + 255) >> 8));
|
||||
|
||||
row_to[x] = (a0 << 24)| (b0 << 16) | (g0 << 8) | (r0) ;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue