diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2009-04-08 21:39:21 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2009-04-08 21:39:21 +0000 |
commit | 762784c01baec27dffcf1437b2427a45d82a59de (patch) | |
tree | bc3231dbb7166448d16785c6d543808d8f4ee8a8 /test/plottest.c | |
parent | 08bf9ed1ac868954feefdc812204fd6a4d4767e7 (diff) | |
download | libnsfb-762784c01baec27dffcf1437b2427a45d82a59de.tar.gz libnsfb-762784c01baec27dffcf1437b2427a45d82a59de.tar.bz2 |
add font glyph plotting support
svn path=/trunk/libnsfb/; revision=7068
Diffstat (limited to 'test/plottest.c')
-rw-r--r-- | test/plottest.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/test/plottest.c b/test/plottest.c index 992fdd9..f2008fa 100644 --- a/test/plottest.c +++ b/test/plottest.c @@ -14,6 +14,56 @@ extern const struct { unsigned char pixel_data[132 * 135 * 4 + 1]; } nsglobe; +const struct { + unsigned int w; + unsigned int h; + 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 */ + } +}; + +const struct { + unsigned int w; + unsigned int h; + 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 */ + } +}; + int main(int argc, char **argv) { nsfb_t *nsfb; @@ -147,6 +197,26 @@ int main(int argc, char **argv) nsfb_plot_bitmap(nsfb, &box3, (nsfb_colour_t *)nsglobe.pixel_data, nsglobe.width, nsglobe.height, nsglobe.width, true); + /* test glyph plotting */ + for (loop = 100; loop < 200; loop+= Mglyph1.w) { + box3.x0 = loop; + box3.y0 = 20; + box3.x1 = box3.x0 + Mglyph8.w; + box3.y1 = box3.y0 + Mglyph8.h; + + nsfb_plot_glyph1(nsfb, &box3, Mglyph1.data, Mglyph1.w, 0xff000000); + } + + /* test glyph plotting */ + for (loop = 100; loop < 200; loop+= Mglyph8.w) { + box3.x0 = loop; + box3.y0 = 50; + box3.x1 = box3.x0 + Mglyph8.w; + box3.y1 = box3.y0 + Mglyph8.h; + + nsfb_plot_glyph8(nsfb, &box3, Mglyph8.data, Mglyph8.w, 0xff000000); + } + nsfb_release(nsfb, &box); /* random rectangles in clipped area*/ |