diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-10-07 02:01:35 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2020-10-26 12:28:48 -0400 |
commit | 3237ae4a4ff9296a377ff9194a11038da161208f (patch) | |
tree | af4338c78467b9b0845d76c39da1fbe10f25e23e /apps/plugins/lib/xlcd_scroll.c | |
parent | 12f3ed1699d6bef25bed90ba95cbcc1a6bb4934a (diff) | |
download | rockbox-3237ae4a4ff9296a377ff9194a11038da161208f.tar.gz rockbox-3237ae4a4ff9296a377ff9194a11038da161208f.zip |
LCD core move buf ptr and address look up function viewport struct
I'm currently running up against the limitations of the lcd_draw functions
I want these functions to be able to be used on any size buffer not
just buffers with a stride matching the underlying device
[DONE] allow the framebuffer to be decoupled from the device framebuffer
[DONE need examples] allow for some simple blit like transformations
[DONE] remove the device framebuffer from the plugin api
[DONE}ditto remote framebuffer
[DONE] remove _viewport_get_framebuffer you can call struct *vp = lcd_set_viewport(NULL) and vp->buffer->fb_ptr
while remote lcds may compile (and work in the sim) its not been tested on targets
[FIXED] backdrops need work to be screen agnostic
[FIXED] screen statusbar is not being combined into the main viewport correctly yet
[FIXED] screen elements are displayed incorrectly after switch to void*
[FIXED] core didn't restore proper viewport on splash etc.
[NEEDS TESTING] remote lcd garbled data
[FIXED] osd lib garbled screen on bmp_part
[FIXED] grey_set_vp needs to return old viewport like lcd_set_viewport
[FIXED] Viewport update now handles viewports with differing buffers/strides by copying to the main buffer
[FIXED] splash on top of WPS leaves old framebuffer data (doesn't redraw)
[UPDATE] refined this a bit more to have clear_viewport set the clean bit and have skin_render do its own screen clear
scrolling viewports no longer trigger wps refresh
also fixed a bug where guisyncyesno was displaying and then disappearing
[ADDED!] New LCD macros that allow you to create properly size frame buffers in you desired size without wasting bytes
(LCD_ and LCD_REMOTE_)
LCD_STRIDE(w, h) same as STRIDE_MAIN
LCD_FBSTRIDE(w, h) returns target specific stride for a buffer W x H
LCD_NBELEMS(w, h) returns the number of fb_data sized elemenst needed for a buffer W x H
LCD_NATIVE_STRIDE(s) conversion between rockbox native vertical and lcd native stride (2bitH)
test_viewports.c has an example of usage
[FIXED!!] 2bit targets don't respect non-native strides
[FIXED] Few define snags
Change-Id: I0d04c3834e464eca84a5a715743a297a0cefd0af
Diffstat (limited to 'apps/plugins/lib/xlcd_scroll.c')
-rw-r--r-- | apps/plugins/lib/xlcd_scroll.c | 107 |
1 files changed, 81 insertions, 26 deletions
diff --git a/apps/plugins/lib/xlcd_scroll.c b/apps/plugins/lib/xlcd_scroll.c index ab9ee1c4cb..89427b6118 100644 --- a/apps/plugins/lib/xlcd_scroll.c +++ b/apps/plugins/lib/xlcd_scroll.c @@ -33,6 +33,11 @@ static const unsigned short patterns[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000}; #if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE void xlcd_scroll_left(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + + int length, oldmode; if ((unsigned)count >= LCD_WIDTH) @@ -43,8 +48,7 @@ void xlcd_scroll_left(int count) length = (LCD_WIDTH-count)*LCD_FBHEIGHT; - rb->memmove(*rb->lcd_framebuffer, *rb->lcd_framebuffer + LCD_HEIGHT*count, - length * sizeof(fb_data)); + rb->memmove(lcd_fb, lcd_fb + LCD_HEIGHT*count, length * sizeof(fb_data)); oldmode = rb->lcd_get_drawmode(); rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); @@ -55,6 +59,11 @@ void xlcd_scroll_left(int count) /* Scroll right */ void xlcd_scroll_right(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + + int length, oldmode; if ((unsigned)count >= LCD_WIDTH) @@ -65,8 +74,8 @@ void xlcd_scroll_right(int count) length = (LCD_WIDTH-count)*LCD_FBHEIGHT; - rb->memmove(*rb->lcd_framebuffer + LCD_HEIGHT*count, - *rb->lcd_framebuffer, length * sizeof(fb_data)); + rb->memmove(lcd_fb + LCD_HEIGHT*count, + lcd_fb, length * sizeof(fb_data)); oldmode = rb->lcd_get_drawmode(); rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); @@ -77,6 +86,11 @@ void xlcd_scroll_right(int count) /* Scroll up */ void xlcd_scroll_up(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + + int width, length, oldmode; fb_data *data; @@ -90,7 +104,7 @@ void xlcd_scroll_up(int count) length = LCD_HEIGHT - count; width = LCD_WIDTH-1; - data = *rb->lcd_framebuffer; + data = lcd_fb; do { rb->memmove(data,data + count,length * sizeof(fb_data)); @@ -106,6 +120,11 @@ void xlcd_scroll_up(int count) /* Scroll down */ void xlcd_scroll_down(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + + int width, length, oldmode; fb_data *data; @@ -119,7 +138,7 @@ void xlcd_scroll_down(int count) length = LCD_HEIGHT - count; width = LCD_WIDTH-1; - data = *rb->lcd_framebuffer; + data = lcd_fb; do { rb->memmove(data + count, data, length * sizeof(fb_data)); @@ -138,6 +157,11 @@ void xlcd_scroll_down(int count) /* Scroll left */ void xlcd_scroll_left(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + + int bitcount=0, oldmode; int blockcount=0, blocklen; @@ -155,7 +179,7 @@ void xlcd_scroll_left(int count) if (blockcount) { - unsigned char *data = *rb->lcd_framebuffer; + unsigned char *data = lcd_fb; unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT; do @@ -168,7 +192,7 @@ void xlcd_scroll_left(int count) if (bitcount) { int bx, y; - unsigned char *addr = *rb->lcd_framebuffer + blocklen; + unsigned char *addr = lcd_fb + blocklen; #if LCD_DEPTH == 2 unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount; #endif @@ -196,6 +220,11 @@ void xlcd_scroll_left(int count) /* Scroll right */ void xlcd_scroll_right(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + + int bitcount=0, oldmode; int blockcount=0, blocklen; @@ -213,7 +242,7 @@ void xlcd_scroll_right(int count) if (blockcount) { - unsigned char *data = *rb->lcd_framebuffer; + unsigned char *data = lcd_fb; unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT; do @@ -226,7 +255,7 @@ void xlcd_scroll_right(int count) if (bitcount) { int bx, y; - unsigned char *addr = *rb->lcd_framebuffer + blockcount; + unsigned char *addr = lcd_fb + blockcount; #if LCD_DEPTH == 2 unsigned fill = 0x55 * (~rb->lcd_get_background() & 3); #endif @@ -256,6 +285,11 @@ void xlcd_scroll_right(int count) /* Scroll left */ void xlcd_scroll_left(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + + fb_data *data, *data_end; int length, oldmode; @@ -265,7 +299,7 @@ void xlcd_scroll_left(int count) return; } - data = *rb->lcd_framebuffer; + data = lcd_fb; data_end = data + LCD_WIDTH*LCD_FBHEIGHT; length = LCD_WIDTH - count; @@ -285,6 +319,11 @@ void xlcd_scroll_left(int count) /* Scroll right */ void xlcd_scroll_right(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + + fb_data *data, *data_end; int length, oldmode; @@ -294,7 +333,7 @@ void xlcd_scroll_right(int count) return; } - data = *rb->lcd_framebuffer; + data = lcd_fb; data_end = data + LCD_WIDTH*LCD_FBHEIGHT; length = LCD_WIDTH - count; @@ -318,6 +357,10 @@ void xlcd_scroll_right(int count) /* Scroll up */ void xlcd_scroll_up(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + int length, oldmode; if ((unsigned)count >= LCD_HEIGHT) @@ -328,8 +371,8 @@ void xlcd_scroll_up(int count) length = LCD_HEIGHT - count; - rb->memmove(*rb->lcd_framebuffer, - *rb->lcd_framebuffer + count * LCD_FBWIDTH, + rb->memmove(lcd_fb, + lcd_fb + count * LCD_FBWIDTH, length * LCD_FBWIDTH * sizeof(fb_data)); oldmode = rb->lcd_get_drawmode(); @@ -341,6 +384,10 @@ void xlcd_scroll_up(int count) /* Scroll down */ void xlcd_scroll_down(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + int length, oldmode; if ((unsigned)count >= LCD_HEIGHT) @@ -351,8 +398,8 @@ void xlcd_scroll_down(int count) length = LCD_HEIGHT - count; - rb->memmove(*rb->lcd_framebuffer + count * LCD_FBWIDTH, - *rb->lcd_framebuffer, + rb->memmove(lcd_fb + count * LCD_FBWIDTH, + lcd_fb, length * LCD_FBWIDTH * sizeof(fb_data)); oldmode = rb->lcd_get_drawmode(); @@ -367,6 +414,10 @@ void xlcd_scroll_down(int count) /* Scroll up */ void xlcd_scroll_up(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + int bitcount=0, oldmode; int blockcount=0, blocklen; @@ -388,8 +439,8 @@ void xlcd_scroll_up(int count) if (blockcount) { - rb->memmove(*rb->lcd_framebuffer, - *rb->lcd_framebuffer + blockcount * LCD_FBWIDTH, + rb->memmove(lcd_fb, + lcd_fb + blockcount * LCD_FBWIDTH, blocklen * LCD_FBWIDTH * sizeof(fb_data)); } if (bitcount) @@ -424,7 +475,7 @@ void xlcd_scroll_up(int count) : /* inputs */ [wide]"r"(LCD_FBWIDTH), [rows]"r"(blocklen), - [addr]"a"(*rb->lcd_framebuffer + blocklen * LCD_FBWIDTH), + [addr]"a"(lcd_fb + blocklen * LCD_FBWIDTH), [cnt] "d"(bitcount), [bkg] "d"(0x55 * (~rb->lcd_get_background() & 3)) : /* clobbers */ @@ -432,7 +483,7 @@ void xlcd_scroll_up(int count) ); #else /* C version */ int x, by; - unsigned char *addr = *rb->lcd_framebuffer + blocklen * LCD_FBWIDTH; + unsigned char *addr = lcd_fb + blocklen * LCD_FBWIDTH; #if LCD_DEPTH == 2 unsigned fill = 0x55 * (~rb->lcd_get_background() & 3); #else @@ -457,7 +508,7 @@ void xlcd_scroll_up(int count) #if LCD_DEPTH == 2 int x, by; - fb_data *addr = *rb->lcd_framebuffer + blocklen * LCD_FBWIDTH; + fb_data *addr = lcd_fb + blocklen * LCD_FBWIDTH; unsigned fill, mask; fill = patterns[rb->lcd_get_background() & 3] << 8; @@ -491,6 +542,10 @@ void xlcd_scroll_up(int count) /* Scroll up */ void xlcd_scroll_down(int count) { + /*size_t dst_stride;*/ + /*struct viewport *vp_main = NULL;*/ + fb_data *lcd_fb = get_framebuffer(NULL, NULL); + int bitcount=0, oldmode; int blockcount=0, blocklen; @@ -512,8 +567,8 @@ void xlcd_scroll_down(int count) if (blockcount) { - rb->memmove(*rb->lcd_framebuffer + blockcount * LCD_FBWIDTH, - *rb->lcd_framebuffer, + rb->memmove(lcd_fb + blockcount * LCD_FBWIDTH, + lcd_fb, blocklen * LCD_FBWIDTH * sizeof(fb_data)); } if (bitcount) @@ -548,7 +603,7 @@ void xlcd_scroll_down(int count) : /* inputs */ [wide]"r"(LCD_WIDTH), [rows]"r"(blocklen), - [addr]"a"(*rb->lcd_framebuffer + blockcount * LCD_FBWIDTH), + [addr]"a"(lcd_fb + blockcount * LCD_FBWIDTH), [cnt] "d"(bitcount), [bkg] "d"((0x55 * (~rb->lcd_get_background() & 3)) << bitcount) : /* clobbers */ @@ -556,7 +611,7 @@ void xlcd_scroll_down(int count) ); #else /* C version */ int x, by; - unsigned char *addr = *rb->lcd_framebuffer + blockcount * LCD_FBWIDTH; + unsigned char *addr = lcd_fb + blockcount * LCD_FBWIDTH; #if LCD_DEPTH == 2 unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount; #else @@ -581,7 +636,7 @@ void xlcd_scroll_down(int count) #if LCD_DEPTH == 2 int x, by; - fb_data *addr = *rb->lcd_framebuffer + blockcount * LCD_FBWIDTH; + fb_data *addr = lcd_fb + blockcount * LCD_FBWIDTH; unsigned fill, mask; fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount); |