diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2010-01-20 17:18:28 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2010-01-20 17:18:28 +0000 |
commit | 131b6c4a00575c9e996a9ae60c90a9647fb5ef75 (patch) | |
tree | dba439673b801a22a833270dbd615628bf0614e4 /src/frontend_linux.c | |
parent | a3097232844a20ea918d63722dbe6a7c71493bab (diff) | |
download | libnsfb-131b6c4a00575c9e996a9ae60c90a9647fb5ef75.tar.gz libnsfb-131b6c4a00575c9e996a9ae60c90a9647fb5ef75.tar.bz2 |
move plot functions to their own sub directory
fix 8 and 16bpp plotters when used with cursor
svn path=/trunk/libnsfb/; revision=9850
Diffstat (limited to 'src/frontend_linux.c')
-rw-r--r-- | src/frontend_linux.c | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/src/frontend_linux.c b/src/frontend_linux.c index e65c888..e6e7601 100644 --- a/src/frontend_linux.c +++ b/src/frontend_linux.c @@ -37,7 +37,14 @@ static int linux_set_geometry(nsfb_t *nsfb, int width, int height, int bpp) static int linux_initialise(nsfb_t *nsfb) { - UNUSED(nsfb); + if (nsfb->frontend_priv != NULL) + return -1; + + /* sanity checked depth. */ + if ((nsfb->bpp != 32) && (nsfb->bpp != 16) && (nsfb->bpp != 8)) + return -1; + + return 0; } @@ -55,10 +62,69 @@ static bool linux_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout) return false; } +static int linux_claim(nsfb_t *nsfb, nsfb_bbox_t *box) +{ + struct nsfb_cursor_s *cursor = nsfb->cursor; + + if ((cursor != NULL) && + (cursor->plotted == true) && + (nsfb_plot_bbox_intersect(box, &cursor->loc))) { + + nsfb->plotter_fns->bitmap(nsfb, + &cursor->savloc, + cursor->sav, + cursor->sav_width, + cursor->sav_height, + cursor->sav_width, + false); + cursor->plotted = false; + } + return 0; +} + +static int linux_cursor(nsfb_t *nsfb, struct nsfb_cursor_s *cursor) +{ + nsfb_bbox_t sclip; + + if ((cursor != NULL) && (cursor->plotted == true)) { + sclip = nsfb->clip; + + nsfb->plotter_fns->set_clip(nsfb, NULL); + + nsfb->plotter_fns->bitmap(nsfb, + &cursor->savloc, + cursor->sav, + cursor->sav_width, + cursor->sav_height, + cursor->sav_width, + false); + + nsfb_cursor_plot(nsfb, cursor); + + nsfb->clip = sclip; + } + return true; +} + + +static int linux_release(nsfb_t *nsfb, nsfb_bbox_t *box) +{ + struct nsfb_cursor_s *cursor = nsfb->cursor; + + if ((cursor != NULL) && (cursor->plotted == false)) { + nsfb_cursor_plot(nsfb, cursor); + } + + return 0; +} + const nsfb_frontend_rtns_t linux_rtns = { .initialise = linux_initialise, .finalise = linux_finalise, .input = linux_input, + .claim = linux_claim, + .release = linux_release, + .cursor = linux_cursor, .geometry = linux_set_geometry, }; |