From 0f3db39f79300a8354812050cf15e3e060e71442 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 4 Dec 2009 11:12:07 +0000 Subject: Improve cursor handling Improve screen copy handling and API svn path=/trunk/libnsfb/; revision=9714 --- include/cursor.h | 5 ++++- include/frontend.h | 6 +++--- include/libnsfb.h | 18 ++++++++++++------ include/libnsfb_plot.h | 2 +- include/nsfb_plot.h | 2 +- 5 files changed, 21 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/cursor.h b/include/cursor.h index d22d5e6..e3a8a04 100644 --- a/include/cursor.h +++ b/include/cursor.h @@ -30,7 +30,10 @@ struct nsfb_cursor_s { }; -/** plot the cursor saving the image underneath. */ +/** Plot the cursor saving the image underneath. */ bool nsfb_cursor_plot(nsfb_t *nsfb, struct nsfb_cursor_s *cursor); +/** Clear the cursor restoring the image underneath */ +bool nsfb_cursor_clear(nsfb_t *nsfb, struct nsfb_cursor_s *cursor); + #endif /* CURSOR_H */ diff --git a/include/frontend.h b/include/frontend.h index bf6fee6..f477996 100644 --- a/include/frontend.h +++ b/include/frontend.h @@ -15,8 +15,8 @@ typedef int (nsfb_fendfn_geometry_t)(nsfb_t *nsfb, int width, int height, int bp typedef bool (nsfb_fendfn_input_t)(nsfb_t *nsfb, nsfb_event_t *event, int timeout); /* frontend area claim */ typedef int (nsfb_fendfn_claim_t)(nsfb_t *nsfb, nsfb_bbox_t *box); -/* frontend area release */ -typedef int (nsfb_fendfn_release_t)(nsfb_t *nsfb, nsfb_bbox_t *box); +/* frontend area update */ +typedef int (nsfb_fendfn_update_t)(nsfb_t *nsfb, nsfb_bbox_t *box); /* frontend cursor display */ typedef int (nsfb_fendfn_cursor_t)(nsfb_t *nsfb, struct nsfb_cursor_s *cursor); @@ -27,7 +27,7 @@ typedef struct nsfb_frontend_rtns_s { nsfb_fendfn_geometry_t *geometry; nsfb_fendfn_input_t *input; nsfb_fendfn_claim_t *claim; - nsfb_fendfn_release_t *release; + nsfb_fendfn_update_t *update; nsfb_fendfn_cursor_t *cursor; } nsfb_frontend_rtns_t; diff --git a/include/libnsfb.h b/include/libnsfb.h index d828fca..5975768 100644 --- a/include/libnsfb.h +++ b/include/libnsfb.h @@ -68,21 +68,27 @@ enum nsfb_frontend_e nsfb_frontend_from_name(const char *name); /** Claim an area of screen to be redrawn. * - * Informs the nsfb library that an area of screen will be updated by the user - * program, used for soft cursor plotting. + * Informs the nsfb library that an area of screen will be directly + * updated by the user program. This is neccisarry so the library can + * ensure the soft cursor plotting is correctly handled. After the + * update has been perfomed ::nsfb_update should be called. * * @param box The bounding box of the area which might be altered. */ int nsfb_claim(nsfb_t *nsfb, nsfb_bbox_t *box); -/** Release an area of screen which has been redrawn. +/** Update an area of screen which has been redrawn. * - * Informs the nsfb library that an area of screen has been updated by the user - * program. Some frontends only update on area release. + * Informs the nsfb library that an area of screen has been directly + * updated by the user program. Some frontends only show the update on + * notification. The area updated does not neccisarrily have to + * corelate with a previous ::nsfb_claim bounding box, however if the + * redrawn area is larger than the claimed area pointer plotting + * artifacts may occour. * * @param box The bounding box of the area which has been altered. */ -int nsfb_release(nsfb_t *nsfb, nsfb_bbox_t *box); +int nsfb_update(nsfb_t *nsfb, nsfb_bbox_t *box); /** Obtain the geometry of a nsfb context. * diff --git a/include/libnsfb_plot.h b/include/libnsfb_plot.h index 4bb40fa..45aad28 100644 --- a/include/libnsfb_plot.h +++ b/include/libnsfb_plot.h @@ -82,7 +82,7 @@ bool nsfb_plot_point(nsfb_t *nsfb, int x, int y, nsfb_colour_t c); * * Copy an area of the display. */ -bool nsfb_plot_copy(nsfb_t *nsfb, int srcx, int srcy, int width, int height, int dstx, int dsty); +bool nsfb_plot_copy(nsfb_t *nsfb, nsfb_bbox_t *srcbox, nsfb_bbox_t *dstbox); /** Plot bitmap. */ diff --git a/include/nsfb_plot.h b/include/nsfb_plot.h index 6574fad..790a923 100644 --- a/include/nsfb_plot.h +++ b/include/nsfb_plot.h @@ -67,7 +67,7 @@ typedef bool (nsfb_plotfn_bitmap_t)(nsfb_t *nsfb, const nsfb_bbox_t *loc, const * * Copy an area of the display. */ -typedef bool (nsfb_plotfn_copy_t)(nsfb_t *nsfb, int srcx, int srcy, int width, int height, int dstx, int dsty); +typedef bool (nsfb_plotfn_copy_t)(nsfb_t *nsfb, nsfb_bbox_t *srcbox, nsfb_bbox_t *dstbox); /** Plot an 8 bit per pixel glyph. -- cgit v1.2.3