MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / stbi__getn

Function stbi__getn

lite/example/cpp_example/mge/cv/stb_image.h:1704–1725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1702// nothing
1703#else
1704static int stbi__getn(stbi__context* s, stbi_uc* buffer, int n) {
1705 if (s->io.read) {
1706 int blen = (int)(s->img_buffer_end - s->img_buffer);
1707 if (blen < n) {
1708 int res, count;
1709
1710 memcpy(buffer, s->img_buffer, blen);
1711
1712 count = (s->io.read)(s->io_user_data, (char*)buffer + blen, n - blen);
1713 res = (count == (n - blen));
1714 s->img_buffer = s->img_buffer_end;
1715 return res;
1716 }
1717 }
1718
1719 if (s->img_buffer + n <= s->img_buffer_end) {
1720 memcpy(buffer, s->img_buffer, n);
1721 s->img_buffer += n;
1722 return 1;
1723 } else
1724 return 0;
1725}
1726#endif
1727
1728#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && \

Callers 4

stbi__parse_png_fileFunction · 0.85
stbi__tga_loadFunction · 0.85
stbi__hdr_loadFunction · 0.85
stbi__pnm_loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected