gosu 1.3.0 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependencies/SDL/include/SDL.h +108 -14
- data/dependencies/SDL/include/SDL_assert.h +81 -50
- data/dependencies/SDL/include/SDL_atomic.h +135 -35
- data/dependencies/SDL/include/SDL_audio.h +960 -355
- data/dependencies/SDL/include/SDL_bits.h +11 -6
- data/dependencies/SDL/include/SDL_blendmode.h +91 -14
- data/dependencies/SDL/include/SDL_clipboard.h +30 -7
- data/dependencies/SDL/include/SDL_config.h +277 -27
- data/dependencies/SDL/include/SDL_config_android.h +13 -38
- data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
- data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
- data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
- data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
- data/dependencies/SDL/include/SDL_config_psp.h +16 -37
- data/dependencies/SDL/include/SDL_config_windows.h +28 -91
- data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
- data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
- data/dependencies/SDL/include/SDL_copying.h +1 -1
- data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
- data/dependencies/SDL/include/SDL_egl.h +906 -280
- data/dependencies/SDL/include/SDL_endian.h +101 -47
- data/dependencies/SDL/include/SDL_error.h +70 -19
- data/dependencies/SDL/include/SDL_events.h +387 -79
- data/dependencies/SDL/include/SDL_filesystem.h +73 -64
- data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
- data/dependencies/SDL/include/SDL_gesture.h +36 -6
- data/dependencies/SDL/include/SDL_haptic.h +304 -210
- data/dependencies/SDL/include/SDL_hidapi.h +451 -0
- data/dependencies/SDL/include/SDL_hints.h +1286 -897
- data/dependencies/SDL/include/SDL_joystick.h +577 -130
- data/dependencies/SDL/include/SDL_keyboard.h +162 -63
- data/dependencies/SDL/include/SDL_keycode.h +7 -5
- data/dependencies/SDL/include/SDL_loadso.h +42 -8
- data/dependencies/SDL/include/SDL_locale.h +34 -32
- data/dependencies/SDL/include/SDL_log.h +212 -19
- data/dependencies/SDL/include/SDL_main.h +72 -17
- data/dependencies/SDL/include/SDL_messagebox.h +70 -23
- data/dependencies/SDL/include/SDL_metal.h +27 -32
- data/dependencies/SDL/include/SDL_misc.h +19 -15
- data/dependencies/SDL/include/SDL_mouse.h +262 -110
- data/dependencies/SDL/include/SDL_mutex.h +286 -66
- data/dependencies/SDL/include/SDL_name.h +1 -1
- data/dependencies/SDL/include/SDL_opengl.h +1 -1
- data/dependencies/SDL/include/SDL_opengles.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2.h +2 -2
- data/dependencies/SDL/include/SDL_pixels.h +199 -34
- data/dependencies/SDL/include/SDL_platform.h +39 -2
- data/dependencies/SDL/include/SDL_power.h +23 -10
- data/dependencies/SDL/include/SDL_quit.h +1 -1
- data/dependencies/SDL/include/SDL_rect.h +78 -28
- data/dependencies/SDL/include/SDL_render.h +1204 -472
- data/dependencies/SDL/include/SDL_revision.h +2 -2
- data/dependencies/SDL/include/SDL_rwops.h +605 -33
- data/dependencies/SDL/include/SDL_scancode.h +1 -1
- data/dependencies/SDL/include/SDL_sensor.h +76 -42
- data/dependencies/SDL/include/SDL_shape.h +38 -27
- data/dependencies/SDL/include/SDL_stdinc.h +96 -24
- data/dependencies/SDL/include/SDL_surface.h +571 -139
- data/dependencies/SDL/include/SDL_system.h +339 -101
- data/dependencies/SDL/include/SDL_syswm.h +50 -20
- data/dependencies/SDL/include/SDL_test.h +1 -1
- data/dependencies/SDL/include/SDL_test_assert.h +2 -2
- data/dependencies/SDL/include/SDL_test_common.h +23 -6
- data/dependencies/SDL/include/SDL_test_compare.h +1 -1
- data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
- data/dependencies/SDL/include/SDL_test_font.h +3 -3
- data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
- data/dependencies/SDL/include/SDL_test_harness.h +6 -6
- data/dependencies/SDL/include/SDL_test_images.h +1 -1
- data/dependencies/SDL/include/SDL_test_log.h +1 -1
- data/dependencies/SDL/include/SDL_test_md5.h +1 -1
- data/dependencies/SDL/include/SDL_test_memory.h +1 -1
- data/dependencies/SDL/include/SDL_test_random.h +2 -2
- data/dependencies/SDL/include/SDL_thread.h +226 -128
- data/dependencies/SDL/include/SDL_timer.h +129 -22
- data/dependencies/SDL/include/SDL_touch.h +48 -8
- data/dependencies/SDL/include/SDL_types.h +1 -1
- data/dependencies/SDL/include/SDL_version.h +72 -46
- data/dependencies/SDL/include/SDL_video.h +1266 -460
- data/dependencies/SDL/include/SDL_vulkan.h +100 -161
- data/dependencies/SDL/include/begin_code.h +22 -1
- data/dependencies/SDL/include/close_code.h +1 -1
- data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
- data/dependencies/SDL_sound/SDL_sound.c +104 -70
- data/dependencies/SDL_sound/SDL_sound.h +6 -6
- data/dependencies/SDL_sound/SDL_sound_aiff.c +32 -32
- data/dependencies/SDL_sound/SDL_sound_au.c +14 -14
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +6 -7
- data/dependencies/SDL_sound/SDL_sound_flac.c +28 -30
- data/dependencies/SDL_sound/SDL_sound_internal.h +21 -14
- data/dependencies/SDL_sound/SDL_sound_modplug.c +26 -28
- data/dependencies/SDL_sound/SDL_sound_mp3.c +20 -36
- data/dependencies/SDL_sound/SDL_sound_raw.c +15 -16
- data/dependencies/SDL_sound/SDL_sound_shn.c +11 -10
- data/dependencies/SDL_sound/SDL_sound_voc.c +20 -18
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +11 -9
- data/dependencies/SDL_sound/SDL_sound_wav.c +49 -43
- data/dependencies/SDL_sound/dr_flac.h +10925 -4466
- data/dependencies/SDL_sound/dr_mp3.h +2802 -844
- data/dependencies/SDL_sound/libmodplug/fastmix.c +63 -64
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
- data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
- data/dependencies/SDL_sound/libmodplug/load_amf.c +12 -7
- data/dependencies/SDL_sound/libmodplug/load_ams.c +103 -44
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
- data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
- data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +61 -61
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +94 -58
- data/dependencies/SDL_sound/libmodplug/load_med.c +20 -11
- data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +50 -19
- data/dependencies/SDL_sound/libmodplug/load_okt.c +59 -28
- data/dependencies/SDL_sound/libmodplug/load_psm.c +104 -79
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
- data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
- data/dependencies/SDL_sound/libmodplug/load_ult.c +4 -3
- data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
- data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
- data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
- data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +32 -19
- data/dependencies/SDL_sound/libmodplug/sndfile.c +76 -160
- data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
- data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
- data/dependencies/SDL_sound/stb_vorbis.h +504 -329
- data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
- data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
- data/dependencies/mojoAL/mojoal.c +4848 -0
- data/dependencies/stb/stb_image.h +208 -73
- data/dependencies/stb/stb_image_write.h +57 -23
- data/dependencies/stb/stb_truetype.h +345 -279
- data/dependencies/utf8proc/utf8proc.c +37 -18
- data/dependencies/utf8proc/utf8proc.h +17 -5
- data/dependencies/utf8proc/utf8proc_data.h +12012 -10089
- data/ext/gosu/extconf.rb +29 -30
- data/include/Gosu/Audio.hpp +70 -85
- data/include/Gosu/Buttons.hpp +103 -103
- data/include/Gosu/Color.hpp +19 -11
- data/include/Gosu/Directories.hpp +31 -24
- data/include/Gosu/Font.hpp +42 -44
- data/include/Gosu/Gosu.hpp +5 -8
- data/include/Gosu/Graphics.hpp +58 -71
- data/include/Gosu/GraphicsBase.hpp +26 -33
- data/include/Gosu/IO.hpp +0 -3
- data/include/Gosu/Image.hpp +56 -62
- data/include/Gosu/ImageData.hpp +23 -27
- data/include/Gosu/Inspection.hpp +1 -4
- data/include/Gosu/Math.hpp +0 -3
- data/include/Gosu/TextInput.hpp +34 -40
- data/include/Gosu/Timing.hpp +2 -8
- data/include/Gosu/Version.hpp +2 -2
- data/include/Gosu/Window.hpp +71 -70
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/compat.rb +24 -37
- data/lib/gosu.rb +2 -2
- data/lib64/SDL2.dll +0 -0
- data/src/Audio.cpp +88 -86
- data/src/AudioFile.hpp +6 -6
- data/src/AudioFileAudioToolbox.cpp +1 -1
- data/src/AudioFileSDLSound.cpp +1 -1
- data/src/AudioImpl.cpp +0 -7
- data/src/AudioImpl.hpp +6 -8
- data/src/BitmapIO.cpp +23 -22
- data/src/BlockAllocator.cpp +2 -1
- data/src/Channel.cpp +22 -20
- data/src/Color.cpp +12 -9
- data/src/DirectoriesApple.cpp +25 -24
- data/src/DirectoriesUnix.cpp +14 -12
- data/src/DirectoriesWin.cpp +26 -30
- data/src/EmptyImageData.hpp +15 -17
- data/src/FileUnix.cpp +1 -1
- data/src/FileWin.cpp +1 -1
- data/src/Font.cpp +59 -54
- data/src/Graphics.cpp +135 -143
- data/src/Image.cpp +41 -47
- data/src/Input.cpp +1 -1
- data/src/InputUIKit.cpp +1 -1
- data/src/LargeImageData.cpp +108 -101
- data/src/LargeImageData.hpp +17 -15
- data/src/Log.hpp +6 -6
- data/src/Macro.cpp +35 -37
- data/src/Macro.hpp +11 -11
- data/src/Math.cpp +8 -1
- data/src/Resolution.cpp +12 -7
- data/src/RubyGosu.cxx +11 -39
- data/src/TexChunk.cpp +50 -41
- data/src/TexChunk.hpp +22 -22
- data/src/Text.cpp +37 -37
- data/src/TextBuilder.cpp +60 -57
- data/src/TextBuilder.hpp +20 -20
- data/src/TextInput.cpp +127 -135
- data/src/TimingApple.cpp +1 -7
- data/src/TimingUnix.cpp +0 -6
- data/src/TimingWin.cpp +0 -6
- data/src/TrueTypeFont.cpp +107 -107
- data/src/TrueTypeFont.hpp +39 -38
- data/src/TrueTypeFontApple.cpp +19 -22
- data/src/TrueTypeFontUnix.cpp +21 -26
- data/src/TrueTypeFontWin.cpp +30 -30
- data/src/Window.cpp +97 -87
- data/src/WindowUIKit.cpp +46 -49
- metadata +7 -17
- data/dependencies/SDL/include/SDL_config_os2.h +0 -188
- data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
- data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
- data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
- data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
- data/dependencies/al_soft/AL/alext.h +0 -585
- data/dependencies/al_soft/AL/efx-creative.h +0 -3
- data/dependencies/al_soft/AL/efx-presets.h +0 -402
- data/dependencies/al_soft/AL/efx.h +0 -762
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/lib/OpenAL32.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
/* stb_image_write - v1.
|
1
|
+
/* stb_image_write - v1.16 - public domain - http://nothings.org/stb
|
2
2
|
writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015
|
3
3
|
no warranty implied; use at your own risk
|
4
4
|
|
@@ -140,6 +140,7 @@ CREDITS:
|
|
140
140
|
Ivan Tikhonov
|
141
141
|
github:ignotion
|
142
142
|
Adam Schackart
|
143
|
+
Andrew Kensler
|
143
144
|
|
144
145
|
LICENSE
|
145
146
|
|
@@ -166,9 +167,9 @@ LICENSE
|
|
166
167
|
#endif
|
167
168
|
|
168
169
|
#ifndef STB_IMAGE_WRITE_STATIC // C++ forbids static forward declarations
|
169
|
-
|
170
|
-
|
171
|
-
|
170
|
+
STBIWDEF int stbi_write_tga_with_rle;
|
171
|
+
STBIWDEF int stbi_write_png_compression_level;
|
172
|
+
STBIWDEF int stbi_write_force_png_filter;
|
172
173
|
#endif
|
173
174
|
|
174
175
|
#ifndef STBI_WRITE_NO_STDIO
|
@@ -178,7 +179,7 @@ STBIWDEF int stbi_write_tga(char const *filename, int w, int h, int comp, const
|
|
178
179
|
STBIWDEF int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data);
|
179
180
|
STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality);
|
180
181
|
|
181
|
-
#ifdef
|
182
|
+
#ifdef STBIW_WINDOWS_UTF8
|
182
183
|
STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input);
|
183
184
|
#endif
|
184
185
|
#endif
|
@@ -285,7 +286,7 @@ static void stbi__stdio_write(void *context, void *data, int size)
|
|
285
286
|
fwrite(data,1,size,(FILE*) context);
|
286
287
|
}
|
287
288
|
|
288
|
-
#if defined(
|
289
|
+
#if defined(_WIN32) && defined(STBIW_WINDOWS_UTF8)
|
289
290
|
#ifdef __cplusplus
|
290
291
|
#define STBIW_EXTERN extern "C"
|
291
292
|
#else
|
@@ -296,25 +297,25 @@ STBIW_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned in
|
|
296
297
|
|
297
298
|
STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input)
|
298
299
|
{
|
299
|
-
|
300
|
+
return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL);
|
300
301
|
}
|
301
302
|
#endif
|
302
303
|
|
303
304
|
static FILE *stbiw__fopen(char const *filename, char const *mode)
|
304
305
|
{
|
305
306
|
FILE *f;
|
306
|
-
#if defined(
|
307
|
+
#if defined(_WIN32) && defined(STBIW_WINDOWS_UTF8)
|
307
308
|
wchar_t wMode[64];
|
308
309
|
wchar_t wFilename[1024];
|
309
|
-
|
310
|
+
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)/sizeof(*wFilename)))
|
310
311
|
return 0;
|
311
312
|
|
312
|
-
|
313
|
+
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)/sizeof(*wMode)))
|
313
314
|
return 0;
|
314
315
|
|
315
|
-
#if _MSC_VER >= 1400
|
316
|
-
|
317
|
-
|
316
|
+
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
317
|
+
if (0 != _wfopen_s(&f, wFilename, wMode))
|
318
|
+
f = 0;
|
318
319
|
#else
|
319
320
|
f = _wfopen(wFilename, wMode);
|
320
321
|
#endif
|
@@ -397,7 +398,7 @@ static void stbiw__putc(stbi__write_context *s, unsigned char c)
|
|
397
398
|
|
398
399
|
static void stbiw__write1(stbi__write_context *s, unsigned char a)
|
399
400
|
{
|
400
|
-
if (s->buf_used + 1 > sizeof(s->buffer))
|
401
|
+
if ((size_t)s->buf_used + 1 > sizeof(s->buffer))
|
401
402
|
stbiw__write_flush(s);
|
402
403
|
s->buffer[s->buf_used++] = a;
|
403
404
|
}
|
@@ -405,7 +406,7 @@ static void stbiw__write1(stbi__write_context *s, unsigned char a)
|
|
405
406
|
static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c)
|
406
407
|
{
|
407
408
|
int n;
|
408
|
-
if (s->buf_used + 3 > sizeof(s->buffer))
|
409
|
+
if ((size_t)s->buf_used + 3 > sizeof(s->buffer))
|
409
410
|
stbiw__write_flush(s);
|
410
411
|
n = s->buf_used;
|
411
412
|
s->buf_used = n+3;
|
@@ -490,11 +491,22 @@ static int stbiw__outfile(stbi__write_context *s, int rgb_dir, int vdir, int x,
|
|
490
491
|
|
491
492
|
static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, const void *data)
|
492
493
|
{
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
494
|
+
if (comp != 4) {
|
495
|
+
// write RGB bitmap
|
496
|
+
int pad = (-x*3) & 3;
|
497
|
+
return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *) data,0,pad,
|
498
|
+
"11 4 22 4" "4 44 22 444444",
|
499
|
+
'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header
|
500
|
+
40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header
|
501
|
+
} else {
|
502
|
+
// RGBA bitmaps need a v4 header
|
503
|
+
// use BI_BITFIELDS mode with 32bpp and alpha mask
|
504
|
+
// (straight BI_RGB with alpha mask doesn't work in most readers)
|
505
|
+
return stbiw__outfile(s,-1,-1,x,y,comp,1,(void *)data,1,0,
|
506
|
+
"11 4 22 4" "4 44 22 444444 4444 4 444 444 444 444",
|
507
|
+
'B', 'M', 14+108+x*y*4, 0, 0, 14+108, // file header
|
508
|
+
108, x,y, 1,32, 3,0,0,0,0,0, 0xff0000,0xff00,0xff,0xff000000u, 0, 0,0,0, 0,0,0, 0,0,0, 0,0,0); // bitmap V4 header
|
509
|
+
}
|
498
510
|
}
|
499
511
|
|
500
512
|
STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
|
@@ -622,6 +634,8 @@ STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const
|
|
622
634
|
|
623
635
|
#define stbiw__max(a, b) ((a) > (b) ? (a) : (b))
|
624
636
|
|
637
|
+
#ifndef STBI_WRITE_NO_STDIO
|
638
|
+
|
625
639
|
static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear)
|
626
640
|
{
|
627
641
|
int exponent;
|
@@ -756,7 +770,7 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f
|
|
756
770
|
char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n";
|
757
771
|
s->func(s->context, header, sizeof(header)-1);
|
758
772
|
|
759
|
-
#ifdef
|
773
|
+
#ifdef __STDC_LIB_EXT1__
|
760
774
|
len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
761
775
|
#else
|
762
776
|
len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
@@ -777,7 +791,6 @@ STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x,
|
|
777
791
|
return stbi_write_hdr_core(&s, x, y, comp, (float *) data);
|
778
792
|
}
|
779
793
|
|
780
|
-
#ifndef STBI_WRITE_NO_STDIO
|
781
794
|
STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data)
|
782
795
|
{
|
783
796
|
stbi__write_context s = { 0 };
|
@@ -968,6 +981,23 @@ STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, i
|
|
968
981
|
(void) stbiw__sbfree(hash_table[i]);
|
969
982
|
STBIW_FREE(hash_table);
|
970
983
|
|
984
|
+
// store uncompressed instead if compression was worse
|
985
|
+
if (stbiw__sbn(out) > data_len + 2 + ((data_len+32766)/32767)*5) {
|
986
|
+
stbiw__sbn(out) = 2; // truncate to DEFLATE 32K window and FLEVEL = 1
|
987
|
+
for (j = 0; j < data_len;) {
|
988
|
+
int blocklen = data_len - j;
|
989
|
+
if (blocklen > 32767) blocklen = 32767;
|
990
|
+
stbiw__sbpush(out, data_len - j == blocklen); // BFINAL = ?, BTYPE = 0 -- no compression
|
991
|
+
stbiw__sbpush(out, STBIW_UCHAR(blocklen)); // LEN
|
992
|
+
stbiw__sbpush(out, STBIW_UCHAR(blocklen >> 8));
|
993
|
+
stbiw__sbpush(out, STBIW_UCHAR(~blocklen)); // NLEN
|
994
|
+
stbiw__sbpush(out, STBIW_UCHAR(~blocklen >> 8));
|
995
|
+
memcpy(out+stbiw__sbn(out), data+j, blocklen);
|
996
|
+
stbiw__sbn(out) += blocklen;
|
997
|
+
j += blocklen;
|
998
|
+
}
|
999
|
+
}
|
1000
|
+
|
971
1001
|
{
|
972
1002
|
// compute adler32 on input
|
973
1003
|
unsigned int s1=1, s2=0;
|
@@ -1598,6 +1628,10 @@ STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const
|
|
1598
1628
|
#endif // STB_IMAGE_WRITE_IMPLEMENTATION
|
1599
1629
|
|
1600
1630
|
/* Revision history
|
1631
|
+
1.16 (2021-07-11)
|
1632
|
+
make Deflate code emit uncompressed blocks when it would otherwise expand
|
1633
|
+
support writing BMPs with alpha channel
|
1634
|
+
1.15 (2020-07-13) unknown
|
1601
1635
|
1.14 (2020-02-02) updated JPEG writer to downsample chroma channels
|
1602
1636
|
1.13
|
1603
1637
|
1.12
|
@@ -1635,7 +1669,7 @@ STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const
|
|
1635
1669
|
add HDR output
|
1636
1670
|
fix monochrome BMP
|
1637
1671
|
0.95 (2014-08-17)
|
1638
|
-
|
1672
|
+
add monochrome TGA output
|
1639
1673
|
0.94 (2014-05-31)
|
1640
1674
|
rename private functions to avoid conflicts with stb_image.h
|
1641
1675
|
0.93 (2014-05-27)
|