MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / stbi__de_iphone

Function stbi__de_iphone

Source/Utils/stb_image.h:5032–5073  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5030#endif // STBI_THREAD_LOCAL
5031
5032static void stbi__de_iphone(stbi__png *z)
5033{
5034 stbi__context *s = z->s;
5035 stbi__uint32 i, pixel_count = s->img_x * s->img_y;
5036 stbi_uc *p = z->out;
5037
5038 if (s->img_out_n == 3) { // convert bgr to rgb
5039 for (i=0; i < pixel_count; ++i) {
5040 stbi_uc t = p[0];
5041 p[0] = p[2];
5042 p[2] = t;
5043 p += 3;
5044 }
5045 } else {
5046 STBI_ASSERT(s->img_out_n == 4);
5047 if (stbi__unpremultiply_on_load) {
5048 // convert bgr to rgb and unpremultiply
5049 for (i=0; i < pixel_count; ++i) {
5050 stbi_uc a = p[3];
5051 stbi_uc t = p[0];
5052 if (a) {
5053 stbi_uc half = a / 2;
5054 p[0] = (p[2] * 255 + half) / a;
5055 p[1] = (p[1] * 255 + half) / a;
5056 p[2] = ( t * 255 + half) / a;
5057 } else {
5058 p[0] = p[2];
5059 p[2] = t;
5060 }
5061 p += 4;
5062 }
5063 } else {
5064 // convert bgr to rgb
5065 for (i=0; i < pixel_count; ++i) {
5066 stbi_uc t = p[0];
5067 p[0] = p[2];
5068 p[2] = t;
5069 p += 4;
5070 }
5071 }
5072 }
5073}
5074
5075#define STBI__PNG_TYPE(a,b,c,d) (((unsigned) (a) << 24) + ((unsigned) (b) << 16) + ((unsigned) (c) << 8) + (unsigned) (d))
5076

Callers 1

stbi__parse_png_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected