Skip to content
Myr

Merge branch 'bmp-assert' of https://github.com/zturtleman/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 6f7420a, e919bcd · Browse files · 1 file+7 added−3 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+7 added−3 removed

  • other:+7 added−3 removed

1 file+7 added−3 removed

modified:stb_image.h+7 added-3 removed
106 unmodified lines
107 Oriol Ferrer Mesia Josh Tobin Matthew Gregan github:phprus108 Julian Raschke Gregory Mullen Baldur Karlsson github:poppolopoppo109 Christian Floisand Kevin Schmidt JR Smith github:darealshinji110 Brad Weinberger Matvey Cherevko Luca Sas github:Michaelangel007111 Blazej Dariusz Roszkowski Alexander Veselov111 Blazej Dariusz Roszkowski Alexander Veselov Zack Middleton112*/113114#ifndef STBI_INCLUDE_STB_IMAGE_H115#define STBI_INCLUDE_STB_IMAGE_H
634 unmodified lines
750751 int read_from_callbacks;752 int buflen;753 stbi_uc buffer_start[128];754 int callback_already_read;755756 stbi_uc *img_buffer, *img_buffer_end;757 stbi_uc *img_buffer_original, *img_buffer_original_end;758} stbi__context;
5 unmodified lines
764static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int len)765{766 s->io.read = NULL;767 s->read_from_callbacks = 0;768 s->callback_already_read = 0;769 s->img_buffer = s->img_buffer_original = (stbi_uc *) buffer;770 s->img_buffer_end = s->img_buffer_original_end = (stbi_uc *) buffer+len;771}772
3 unmodified lines
776 s->io = *c;777 s->io_user_data = user;778 s->buflen = sizeof(s->buffer_start);779 s->read_from_callbacks = 1;780 s->callback_already_read = 0;778 s->img_buffer_original = s->buffer_start;781 s->img_buffer = s->img_buffer_original = s->buffer_start;782 stbi__refill_buffer(s);783 s->img_buffer_original_end = s->img_buffer_end;784}785
715 unmodified lines
15011502static void stbi__refill_buffer(stbi__context *s)1503{1504 int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen);1505 s->callback_already_read += (int) (s->img_buffer - s->img_buffer_original);1506 if (n == 0) {1507 // at end of file, treat same as if from memory, but need to handle case1508 // where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file1509 s->read_from_callbacks = 0;
3817 unmodified lines
5327 if (info.bpp < 16)5328 psize = (info.offset - info.extra_read - info.hsz) >> 2;5329 }5330 if (psize == 0) {5327 STBI_ASSERT(info.offset == (s->img_buffer - s->buffer_start));5331 STBI_ASSERT(info.offset == s->callback_already_read + (int) (s->img_buffer - s->img_buffer_original));5332 }53335334 if (info.bpp == 24 && ma == 0xff000000)5335 s->img_n = 3;
2333 unmodified lines