Merge branch 'master' of https://github.com/WARP-LAB/stb into working
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sean Barrett · committed by Sean Barrett · parents e5d4d6f, 756166e · Browse files · 1 file·+21 added−21 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+21 added−21 removed
- other:+21 added−21 removed
Provenance
- Commit
ba5fc49- Tree
779d107- Author
Sean Barrett <sean@nothings.org>- Committer
Sean Barrett <sean@nothings.org>- Parent 1
e5d4d6f- Parent 2
756166e
1 file changed+21 added−21 removed
modified:stb_image.h+21 added-21 removed
1585 unmodified lines1586 #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)1587 // convert source image with img_n components to one with req_comp components;1588 // avoid switch per pixel, so use switch per scanline and massive macros1589 switch (STBI__COMBO(img_n, req_comp)) {1590- STBI__CASE(1,2) { dest[0]=src[0], dest[1]=255; } break;1590+ STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=255; } break;1591 STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;1592- STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; } break;1592+ STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=255; } break;1593 STBI__CASE(2,1) { dest[0]=src[0]; } break;1594 STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;1595- STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; } break;1596- STBI__CASE(3,4) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; } break;1595+ STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break;1596+ STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=255; } break;1597 STBI__CASE(3,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break;1598- STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]), dest[1] = 255; } break;1598+ STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = 255; } break;1599 STBI__CASE(4,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break;1600- STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]), dest[1] = src[3]; } break;1601- STBI__CASE(4,3) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; } break;1600+ STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = src[3]; } break;1601+ STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break;1602 default: STBI_ASSERT(0);1603 }1604 #undef STBI__CASE1605 }29 unmodified lines1635 #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)1636 // convert source image with img_n components to one with req_comp components;1637 // avoid switch per pixel, so use switch per scanline and massive macros1638 switch (STBI__COMBO(img_n, req_comp)) {1639- STBI__CASE(1,2) { dest[0]=src[0], dest[1]=0xffff; } break;1639+ STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=0xffff; } break;1640 STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;1641- STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=0xffff; } break;1641+ STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=0xffff; } break;1642 STBI__CASE(2,1) { dest[0]=src[0]; } break;1643 STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break;1644- STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; } break;1645- STBI__CASE(3,4) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=0xffff; } break;1644+ STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break;1645+ STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=0xffff; } break;1646 STBI__CASE(3,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break;1647- STBI__CASE(3,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]), dest[1] = 0xffff; } break;1647+ STBI__CASE(3,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = 0xffff; } break;1648 STBI__CASE(4,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break;1649- STBI__CASE(4,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]), dest[1] = src[3]; } break;1650- STBI__CASE(4,3) { dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; } break;1649+ STBI__CASE(4,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = src[3]; } break;1650+ STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break;1651 default: STBI_ASSERT(0);1652 }1653 #undef STBI__CASE1654 }2109 unmodified lines3764 stbi_uc *y = coutput[0];3765 if (n == 1)3766 for (i=0; i < z->s->img_x; ++i) out[i] = y[i];3767 else3768- for (i=0; i < z->s->img_x; ++i) *out++ = y[i], *out++ = 255;3768+ for (i=0; i < z->s->img_x; ++i) { *out++ = y[i]; *out++ = 255; }3769 }3770 }3771 }3772 stbi__cleanup_jpeg(z);1283 unmodified lines5056 static int stbi__high_bit(unsigned int z)5057 {5058 int n=0;5059 if (z == 0) return -1;5060- if (z >= 0x10000) n += 16, z >>= 16;5061- if (z >= 0x00100) n += 8, z >>= 8;5062- if (z >= 0x00010) n += 4, z >>= 4;5063- if (z >= 0x00004) n += 2, z >>= 2;5064- if (z >= 0x00002) n += 1, z >>= 1;5060+ if (z >= 0x10000) { n += 16; z >>= 16; }5061+ if (z >= 0x00100) { n += 8; z >>= 8; }5062+ if (z >= 0x00010) { n += 4; z >>= 4; }5063+ if (z >= 0x00004) { n += 2; z >>= 2; }5064+ if (z >= 0x00002) { n += 1; z >>= 1; }5065 return n;5066 }5067 5068 static int stbi__bitcount(unsigned int a)277 unmodified lines5346 for (j=0; j < (int) s->img_y>>1; ++j) {5347 stbi_uc *p1 = out + j *s->img_x*target;5348 stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;5349 for (i=0; i < (int) s->img_x*target; ++i) {5350- t = p1[i], p1[i] = p2[i], p2[i] = t;5350+ t = p1[i]; p1[i] = p2[i]; p2[i] = t;5351 }5352 }5353 }5354 2156 unmodified lines