git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
initial prototype of ruby interface
[swftools.git]
/
lib
/
gfxpoly
/
xrow.c
diff --git
a/lib/gfxpoly/xrow.c
b/lib/gfxpoly/xrow.c
index
123e00c
..
29dad7a
100644
(file)
--- a/
lib/gfxpoly/xrow.c
+++ b/
lib/gfxpoly/xrow.c
@@
-1,3
+1,6
@@
+#include <stdlib.h>
+#include <stdio.h>
+#include <memory.h>
#include "../mem.h"
#include "xrow.h"
#include "../mem.h"
#include "xrow.h"
@@
-11,6
+14,9
@@
xrow_t* xrow_new()
void xrow_add(xrow_t*r, int32_t x)
{
void xrow_add(xrow_t*r, int32_t x)
{
+ if(r->num && r->lastx==x)
+ return;
+ r->lastx = x;
if(r->num >= r->size) {
r->size *= 2;
r->x = rfx_realloc(r->x, sizeof(r->x[0])*r->size);
if(r->num >= r->size) {
r->size *= 2;
r->x = rfx_realloc(r->x, sizeof(r->x[0])*r->size);
@@
-22,7
+28,7
@@
int compare_int32(const void*_i1,const void*_i2)
{
int32_t*i1 = (int32_t*)_i1;
int32_t*i2 = (int32_t*)_i2;
{
int32_t*i1 = (int32_t*)_i1;
int32_t*i2 = (int32_t*)_i2;
- return i1-i2;
+ return *i1-*i2;
}
void xrow_sort(xrow_t*r)
}
void xrow_sort(xrow_t*r)
@@
-46,6
+52,18
@@
void xrow_reset(xrow_t*r)
r->num = 0;
}
r->num = 0;
}
+void xrow_dump(xrow_t*xrow)
+{
+ fprintf(stderr, "x: ");
+ int t;
+ for(t=0;t<xrow->num;t++) {
+ if(t)
+ fprintf(stderr, ", ");
+ fprintf(stderr, "%d", xrow->x[t]);
+ }
+ fprintf(stderr, "\n");
+}
+
void xrow_destroy(xrow_t*r)
{
if(r->x) {
void xrow_destroy(xrow_t*r)
{
if(r->x) {