git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added basic support for split up background bitmaps
[swftools.git]
/
lib
/
jpeg.c
diff --git
a/lib/jpeg.c
b/lib/jpeg.c
index
dee4dfa
..
71483f6
100644
(file)
--- a/
lib/jpeg.c
+++ b/
lib/jpeg.c
@@
-227,7
+227,7
@@
boolean mem_fill_input_buffer (j_decompress_ptr cinfo)
void mem_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
{
struct jpeg_source_mgr* mgr = cinfo->src;
void mem_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
{
struct jpeg_source_mgr* mgr = cinfo->src;
- printf("skip %d +%d\n", size - mgr->bytes_in_buffer, num_bytes);
+ printf("skip %d +%ld\n", size - mgr->bytes_in_buffer, num_bytes);
if(num_bytes<=0)
return;
mgr->next_input_byte += num_bytes;
if(num_bytes<=0)
return;
mgr->next_input_byte += num_bytes;
@@
-313,13
+313,13
@@
int jpeg_load(const char*filename, unsigned char**dest, int*_width, int*_height)
int width = *_width = cinfo.output_width;
int height = *_height = cinfo.output_height;
int width = *_width = cinfo.output_width;
int height = *_height = cinfo.output_height;
- *dest = malloc(width*height*4);
+ *dest = (unsigned char*)malloc(width*height*4);
int y;
for (y=0;y<height;y++) {
int x;
U8 *js = scanline;
int y;
for (y=0;y<height;y++) {
int x;
U8 *js = scanline;
- RGBA*line = (RGBA*)&(*dest)[y*width];
+ RGBA*line = &((RGBA*)(*dest))[y*width];
jpeg_read_scanlines(&cinfo, &js, 1);
if (cinfo.out_color_space == JCS_GRAYSCALE) {
jpeg_read_scanlines(&cinfo, &js, 1);
if (cinfo.out_color_space == JCS_GRAYSCALE) {
@@
-362,6
+362,7
@@
int jpeg_load(const char*filename, unsigned char**dest, int*_width, int*_height)
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
+ fclose(fi);
return 1;
}
return 1;
}