summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Theato <[email protected]>2011-01-13 19:17:00 (GMT)
committer Till Theato <[email protected]>2011-01-13 19:30:28 (GMT)
commit17c1ad2062edbda61b093563969756a5ed855704 (patch)
treeae91352aab15b2df1d707cce89c0d4924114d0ab
parent00c18fcbff4d219c060bdafda2b8752baa6d134c (diff)
c0rners: Move map updating from set_param_value to update. It is still only done when necessary however it will be done less times if multiple parameters change per frame (= one update call) since in this case set_param_value is called multiple times.
-rw-r--r--src/filter/c0rners/c0rners.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/filter/c0rners/c0rners.c b/src/filter/c0rners/c0rners.c
index 01a43ce..5ae8db7 100644
--- a/src/filter/c0rners/c0rners.c
+++ b/src/filter/c0rners/c0rners.c
@@ -54,6 +54,7 @@ typedef struct
interpp interp;
float *map;
unsigned char *amap;
+ int mapIsDirty;
} inst;
@@ -749,6 +750,7 @@ f0r_instance_t f0r_construct(unsigned int width, unsigned int height)
in->map=(float*)calloc(1, sizeof(float)*(in->w*in->h*2+2));
in->amap=(unsigned char*)calloc(1, sizeof(char)*(in->w*in->h*2+2));
in->interp=set_intp(*in);
+ in->mapIsDirty = 1;
return (f0r_instance_t)in;
}
@@ -771,8 +773,6 @@ void f0r_set_param_value(f0r_instance_t instance, f0r_param_t parm, int param_in
inst *p;
double tmpf;
int chg;
- tocka2 vog[4];
- int nots[4];
p=(inst*)instance;
@@ -854,16 +854,7 @@ void f0r_set_param_value(f0r_instance_t instance, f0r_param_t parm, int param_in
if (chg!=0)
{
p->interp=set_intp(*p);
- vog[0].x=(p->x1-0.333333)/0.333333*p->w;
- vog[0].y=(p->y1-0.333333)/0.333333*p->h;
- vog[1].x=(p->x2-0.333333)/0.333333*p->w;
- vog[1].y=(p->y2-0.333333)/0.333333*p->h;
- vog[2].x=(p->x3-0.333333)/0.333333*p->w;
- vog[2].y=(p->y3-0.333333)/0.333333*p->h;
- vog[3].x=(p->x4-0.333333)/0.333333*p->w;
- vog[3].y=(p->y4-0.333333)/0.333333*p->h;
- geom4c_b(p->w, p->h, p->w, p->h, vog, p->stretchON, p->stretchx, p->stretchy, p->map, nots);
- make_alphamap(p->amap, vog, p->w, p->h, p->map, p->feath, nots);
+ p->mapIsDirty = 1;
}
}
@@ -942,6 +933,22 @@ void f0r_update(f0r_instance_t instance, double time, const uint32_t* inframe, u
p=(inst*)instance;
+ if (p->mapIsDirty) {
+ tocka2 vog[4];
+ int nots[4];
+ vog[0].x=(p->x1-0.333333)/0.333333*p->w;
+ vog[0].y=(p->y1-0.333333)/0.333333*p->h;
+ vog[1].x=(p->x2-0.333333)/0.333333*p->w;
+ vog[1].y=(p->y2-0.333333)/0.333333*p->h;
+ vog[2].x=(p->x3-0.333333)/0.333333*p->w;
+ vog[2].y=(p->y3-0.333333)/0.333333*p->h;
+ vog[3].x=(p->x4-0.333333)/0.333333*p->w;
+ vog[3].y=(p->y4-0.333333)/0.333333*p->h;
+ geom4c_b(p->w, p->h, p->w, p->h, vog, p->stretchON, p->stretchx, p->stretchy, p->map, nots);
+ make_alphamap(p->amap, vog, p->w, p->h, p->map, p->feath, nots);
+ p->mapIsDirty = 0;
+ }
+
//if (p->transb==0) bkgr=0xFF000000; else bkgr=0;
bkgr=0xFF000000;