summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2010-04-16 06:23:24 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2010-04-16 06:23:24 -0400
commitadd4d50642138cdb302811a4c93ab5628750cf54 (patch)
tree5e267807d4380e00ee582768a06d277f38f759ef
parentceb929cc66dfc141efdd02b3b095c20582eed7c6 (diff)
Add beginning of interpreterF
-rw-r--r--Makefile2
-rw-r--r--psl.c46
-rw-r--r--psl.h9
3 files changed, 48 insertions, 9 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..053e5a6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,2 @@
+psl: psl.c psl.h
+ gcc -Wall `pkg-config --cflags --libs pixman-1` -lm psl.c \ No newline at end of file
diff --git a/psl.c b/psl.c
index f3f1958..f3eafcb 100644
--- a/psl.c
+++ b/psl.c
@@ -52,7 +52,7 @@ struct instruction_list_t
struct psl_program_t
{
- instruction_list_t *inst;
+ instruction_list_t *instructions;
};
psl_program_t *
@@ -60,7 +60,7 @@ psl_program_create (psl_statement_t *statement)
{
psl_program_t *program = new (psl_program_t);
- program->inst = statement;
+ program->instructions = statement;
return program;
}
@@ -117,14 +117,52 @@ psl_asm (psl_instruction_t *instruction,
return stmt;
}
+static void
+run_box (pixman_box32_t *box,
+ pixman_image_t *destination,
+ instruction_list_t *instructions,
+ pixman_image_t **sources)
+{
+ int width, height;
+
+ height = box->y2 - box->y1;
+ width = box->x2 - box->x1;
+
+ while (height--)
+ {
+ int w = width;
+
+ while (w--)
+ {
+ int i;
+
+ for (i = 0; i < instructions->n_instructions; ++i)
+ {
+ psl_instruction_t *instruction =
+ &(instructions->instructions[i]);
+
+ switch (instruction->type)
+ {
+
+ }
+ }
+ }
+ }
+}
+
void
psl_program_run (psl_program_t *program,
pixman_region32_t *clip,
pixman_image_t *destination,
- pixman_image_t *source1,
- ...)
+ pixman_image_t **sources)
{
+ int n_rects;
+ pixman_box32_t *boxes;
+
+ boxes = pixman_region32_rectangles (clip, &n_rects);
+ while (n_rects--)
+ run_box (boxes++, destination, program->instructions, sources);
}
void
diff --git a/psl.h b/psl.h
index 6e6b865..79e8dc1 100644
--- a/psl.h
+++ b/psl.h
@@ -45,10 +45,9 @@ psl_instruction_t *psl_cmp_lt (psl_var_t *dest,
psl_instruction_t *psl_label (const char *name);
psl_statement_t * psl_asm (psl_instruction_t *instruction,
...);
-void psl_program_run (psl_program_t *program,
- pixman_region32_t *clip,
- pixman_image_t *destination,
- pixman_image_t *source1,
- ...);
+void psl_program_run (psl_program_t *program,
+ pixman_region32_t *clip,
+ pixman_image_t *destination,
+ pixman_image_t **sources);
void psl_program_destroy (psl_program_t *program);