git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bug in poly2bitmap
[swftools.git]
/
lib
/
gfximage.c
diff --git
a/lib/gfximage.c
b/lib/gfximage.c
index
54adadc
..
3e6cfde
100644
(file)
--- a/
lib/gfximage.c
+++ b/
lib/gfximage.c
@@
-1,3
+1,4
@@
+#include <stdlib.h>
#include <math.h>
#include <memory.h>
#include "jpeg.h"
#include <math.h>
#include <memory.h>
#include "jpeg.h"
@@
-6,7
+7,7
@@
#include "gfximage.h"
#include "types.h"
#include "gfximage.h"
#include "types.h"
-void gfximage_save_jpeg(gfximage_t*img, int quality, const char*filename)
+void gfximage_save_jpeg(gfximage_t*img, const char*filename, int quality)
{
int x,y;
int l = img->width*img->height;
{
int x,y;
int l = img->width*img->height;
@@
-18,6
+19,7
@@
void gfximage_save_jpeg(gfximage_t*img, int quality, const char*filename)
data[s+2] = img->data[t].b;
}
jpeg_save(data, img->width, img->height, quality, filename);
data[s+2] = img->data[t].b;
}
jpeg_save(data, img->width, img->height, quality, filename);
+ free(data);
}
void gfximage_save_png(gfximage_t*image, const char*filename)
}
void gfximage_save_png(gfximage_t*image, const char*filename)
@@
-153,10
+155,10
@@
void blurImage(gfxcolor_t*src, int width, int height, int r)
for(y=0;y<height;y++) {
gfxcolor_t*s = &src[y*width];
gfxcolor_t*d = &tmp[y*width];
for(y=0;y<height;y++) {
gfxcolor_t*s = &src[y*width];
gfxcolor_t*d = &tmp[y*width];
- for(x=0;x<range;x++) {
+ for(x=0;x<range && x<width;x++) {
d[x] = s[x];
}
d[x] = s[x];
}
- for(x=range;x<width-range;x++) {
+ for(;x<width-range;x++) {
int r=0;
int g=0;
int b=0;
int r=0;
int g=0;
int b=0;
@@
-175,7
+177,7
@@
void blurImage(gfxcolor_t*src, int width, int height, int r)
d[x].b = b >> 16;
d[x].a = a >> 16;
}
d[x].b = b >> 16;
d[x].a = a >> 16;
}
- for(x=width-range;x<width;x++) {
+ for(;x<width;x++) {
d[x] = s[x];
}
}
d[x] = s[x];
}
}
@@
-184,11
+186,11
@@
void blurImage(gfxcolor_t*src, int width, int height, int r)
gfxcolor_t*s = &tmp[x];
gfxcolor_t*d = &src[x];
int yy=0;
gfxcolor_t*s = &tmp[x];
gfxcolor_t*d = &src[x];
int yy=0;
- for(y=0;y<range;y++) {
+ for(y=0;y<range&&y<height;y++) {
d[yy] = s[yy];
yy+=width;
}
d[yy] = s[yy];
yy+=width;
}
- for(y=range;y<height-range;y++) {
+ for(;y<height-range;y++) {
int r=0;
int g=0;
int b=0;
int r=0;
int g=0;
int b=0;
@@
-209,7
+211,7
@@
void blurImage(gfxcolor_t*src, int width, int height, int r)
d[yy].a = a >> 16;
yy += width;
}
d[yy].a = a >> 16;
yy += width;
}
- for(y=0;y<range;y++) {
+ for(;y<height;y++) {
d[yy] = s[yy];
yy += width;
}
d[yy] = s[yy];
yy += width;
}
@@
-340,3
+342,11
@@
gfximage_t* gfximage_rescale(gfximage_t*image, int newwidth, int newheight)
image2->height = newheight;
return image2;
}
image2->height = newheight;
return image2;
}
+
+void gfximage_free(gfximage_t*b)
+{
+ free(b->data);
+ b->data = 0;
+ free(b);
+}
+