forked from nothings/stb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stb_image regression test for attempted PoC in nothings#1454 (com…
- Loading branch information
1 parent
5addd83
commit 2b7b082
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* https://github.com/nothings/stb/pull/1454#issuecomment-2581308033 */ | ||
|
||
#include "../../stb_image.h" | ||
|
||
#include <stdlib.h> | ||
|
||
int test_1454_gif() | ||
{ | ||
const stbi_uc data[] = { 'G', 'I', 'F', '8', '9', 'a', // Magic number | ||
1, 0, 1, 0, // Width and height | ||
0, 0, 0}; // flags, bgindex, ratio | ||
int size = (int)sizeof(data); | ||
|
||
int *delays = NULL; | ||
int x, y, z, comp; | ||
stbi_uc* image = stbi_load_gif_from_memory( | ||
(const stbi_uc*)data, size, | ||
&delays, | ||
&x, &y, &z, | ||
&comp, 3); | ||
|
||
if (image) | ||
{ | ||
stbi_image_free(image); | ||
} | ||
|
||
if (delays) | ||
{ | ||
stbi_image_free(delays); | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "1454_gif.h" | ||
|
||
#define STB_IMAGE_IMPLEMENTATION | ||
#include "../../stb_image.h" | ||
|
||
int main() { | ||
test_1454_gif(); | ||
} |