summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/plottest.c88
1 files changed, 50 insertions, 38 deletions
diff --git a/test/plottest.c b/test/plottest.c
index 522cf82..3fc4d83 100644
--- a/test/plottest.c
+++ b/test/plottest.c
@@ -1,3 +1,5 @@
+/* libnsfb plotetr test program */
+
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
@@ -21,22 +23,22 @@ const struct {
unsigned char data[16];
} Mglyph1 = {
8, 16, {
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0xc6, /* 11000110 */
- 0xee, /* 11101110 */
- 0xfe, /* 11111110 */
- 0xfe, /* 11111110 */
- 0xd6, /* 11010110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0xc6, /* 11000110 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
- 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0xc6, /* 11000110 */
+ 0xee, /* 11101110 */
+ 0xfe, /* 11111110 */
+ 0xfe, /* 11111110 */
+ 0xd6, /* 11010110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0xc6, /* 11000110 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
+ 0x00, /* 00000000 */
}
};
@@ -46,22 +48,22 @@ const struct {
unsigned char data[16 * 8];
} Mglyph8 = {
8, 16, {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */
- 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, /* 00000000 */
- 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
- 0xaa, 0xff, 0xff, 0x00, 0xff, 0xff, 0xaa, 0x00, /* 11101110 */
- 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaa, 0x00, /* 11111110 */
- 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaa, 0x00, /* 11111110 */
- 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11010110 */
- 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
- 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
- 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
- 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
- 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */
+ 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, /* 00000000 */
+ 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
+ 0xaa, 0xff, 0xff, 0x00, 0xff, 0xff, 0xaa, 0x00, /* 11101110 */
+ 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaa, 0x00, /* 11111110 */
+ 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaa, 0x00, /* 11111110 */
+ 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11010110 */
+ 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
+ 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
+ 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
+ 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
+ 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */
}
};
@@ -100,7 +102,7 @@ int main(int argc, char **argv)
/* claim the whole screen for update */
nsfb_claim(nsfb, &box);
- /* first test, repeatedly clear the graphics area, should result in teh
+ /* first test, repeatedly clear the graphics area, should result in the
* same operation as a single clear to the final colour
*/
for (loop = 0; loop < 256;loop++) {
@@ -190,7 +192,17 @@ int main(int argc, char **argv)
nsfb_plot_ellipse(nsfb, &box3, 0xffff0000);
- nsfb_plot_copy(nsfb,400,400,100,100,600,200);
+ box2.x0 = 400;
+ box2.y0 = 400;
+ box2.x1 = 500;
+ box2.y1 = 500;
+
+ box3.x0 = 600;
+ box3.y0 = 200;
+ box3.x1 = 700;
+ box3.y1 = 300;
+
+ nsfb_plot_copy(nsfb, &box2, &box3);
box3.x0 = 50;
box3.x1 = 200;
@@ -219,7 +231,7 @@ int main(int argc, char **argv)
nsfb_plot_glyph8(nsfb, &box3, Mglyph8.data, Mglyph8.w, 0xff000000);
}
- nsfb_release(nsfb, &box);
+ nsfb_update(nsfb, &box);
/* random rectangles in clipped area*/
box2.x0 = 400;
@@ -232,18 +244,18 @@ int main(int argc, char **argv)
srand(1234);
for (loop=0; loop < 10000; loop++) {
- nsfb_claim(nsfb, &box2);
+ nsfb_claim(nsfb, &box2);
box3.x0 = rand() / (RAND_MAX / box.x1);
box3.y0 = rand() / (RAND_MAX / box.y1);
box3.x1 = rand() / (RAND_MAX / 400);
box3.y1 = rand() / (RAND_MAX / 400);
nsfb_plot_rectangle_fill(nsfb, &box3, 0xff000000 | rand());
- nsfb_release(nsfb, &box2);
+ nsfb_update(nsfb, &box2);
}
while (event.type != NSFB_EVENT_CONTROL)
- nsfb_input(nsfb, &event, -1);
+ nsfb_event(nsfb, &event, -1);
return 0;
}