summaryrefslogtreecommitdiff
path: root/apps/plugins/xworld
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2020-10-07 02:01:35 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2020-10-26 12:28:48 -0400
commit3237ae4a4ff9296a377ff9194a11038da161208f (patch)
treeaf4338c78467b9b0845d76c39da1fbe10f25e23e /apps/plugins/xworld
parent12f3ed1699d6bef25bed90ba95cbcc1a6bb4934a (diff)
downloadrockbox-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/xworld')
-rw-r--r--apps/plugins/xworld/sys.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c
index 0bd1e0dc08..c57da9456b 100644
--- a/apps/plugins/xworld/sys.c
+++ b/apps/plugins/xworld/sys.c
@@ -40,6 +40,7 @@
40#include "engine.h" 40#include "engine.h"
41 41
42static struct System* save_sys; 42static struct System* save_sys;
43static fb_data *lcd_fb = NULL;
43 44
44static bool sys_save_settings(struct System* sys) 45static bool sys_save_settings(struct System* sys)
45{ 46{
@@ -438,6 +439,8 @@ void sys_init(struct System* sys, const char* title)
438 { 439 {
439 sys_reset_settings(sys); 440 sys_reset_settings(sys);
440 } 441 }
442 struct viewport *vp_main = rb->lcd_set_viewport(NULL);
443 lcd_fb = vp_main->buffer->fb_ptr;
441} 444}
442 445
443void sys_destroy(struct System* sys) 446void sys_destroy(struct System* sys)
@@ -584,7 +587,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
584 struct bitmap out_bmp; 587 struct bitmap out_bmp;
585 out_bmp.width = LCD_WIDTH; 588 out_bmp.width = LCD_WIDTH;
586 out_bmp.height = LCD_HEIGHT; 589 out_bmp.height = LCD_HEIGHT;
587 out_bmp.data = (unsigned char*) *rb->lcd_framebuffer; 590 out_bmp.data = (unsigned char*) lcd_fb;
588 591
589#ifdef HAVE_LCD_COLOR 592#ifdef HAVE_LCD_COLOR
590 if(sys->settings.scaling_quality == 1) 593 if(sys->settings.scaling_quality == 1)
@@ -631,25 +634,25 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
631 { 634 {
632#ifdef HAVE_LCD_COLOR 635#ifdef HAVE_LCD_COLOR
633 int r, g, b; 636 int r, g, b;
634 fb_data pix = *rb->lcd_framebuffer[y * LCD_WIDTH + x]; 637 fb_data pix = lcd_fb[y * LCD_WIDTH + x];
635#if (LCD_DEPTH > 24) 638#if (LCD_DEPTH > 24)
636 r = 0xff - pix.r; 639 r = 0xff - pix.r;
637 g = 0xff - pix.g; 640 g = 0xff - pix.g;
638 b = 0xff - pix.b; 641 b = 0xff - pix.b;
639 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = (fb_data) { b, g, r, 255 }; 642 lcd_fb[y * LCD_WIDTH + x] = (fb_data) { b, g, r, 255 };
640#elif (LCD_DEPTH == 24) 643#elif (LCD_DEPTH == 24)
641 r = 0xff - pix.r; 644 r = 0xff - pix.r;
642 g = 0xff - pix.g; 645 g = 0xff - pix.g;
643 b = 0xff - pix.b; 646 b = 0xff - pix.b;
644 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = (fb_data) { b, g, r }; 647 lcd_fb[y * LCD_WIDTH + x] = (fb_data) { b, g, r };
645#else 648#else
646 r = RGB_UNPACK_RED (pix); 649 r = RGB_UNPACK_RED (pix);
647 g = RGB_UNPACK_GREEN(pix); 650 g = RGB_UNPACK_GREEN(pix);
648 b = RGB_UNPACK_BLUE (pix); 651 b = RGB_UNPACK_BLUE (pix);
649 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_RGBPACK(0xff - r, 0xff - g, 0xff - b); 652 lcd_fb[y * LCD_WIDTH + x] = LCD_RGBPACK(0xff - r, 0xff - g, 0xff - b);
650#endif 653#endif
651#else 654#else
652 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_BRIGHTNESS(0xff - *rb->lcd_framebuffer[y * LCD_WIDTH + x]); 655 lcd_fb[y * LCD_WIDTH + x] = LCD_BRIGHTNESS(0xff - lcd_fb[y * LCD_WIDTH + x]);
653#endif 656#endif
654 } 657 }
655 } 658 }
@@ -671,14 +674,14 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
671 if(prev_frames && orig_fb) 674 if(prev_frames && orig_fb)
672 { 675 {
673 676
674 rb->memcpy(orig_fb, *rb->lcd_framebuffer, sizeof(fb_data) * LCD_WIDTH * LCD_HEIGHT); 677 rb->memcpy(orig_fb, lcd_fb, sizeof(fb_data) * LCD_WIDTH * LCD_HEIGHT);
675 /* fancy useless slow motion blur */ 678 /* fancy useless slow motion blur */
676 for(int y = 0; y < LCD_HEIGHT; ++y) 679 for(int y = 0; y < LCD_HEIGHT; ++y)
677 { 680 {
678 for(int x = 0; x < LCD_WIDTH; ++x) 681 for(int x = 0; x < LCD_WIDTH; ++x)
679 { 682 {
680 int r, g, b; 683 int r, g, b;
681 fb_data pix = *rb->lcd_framebuffer[y * LCD_WIDTH + x]; 684 fb_data pix = lcd_fb[y * LCD_WIDTH + x];
682 r = RGB_UNPACK_RED (pix); 685 r = RGB_UNPACK_RED (pix);
683 g = RGB_UNPACK_GREEN(pix); 686 g = RGB_UNPACK_GREEN(pix);
684 b = RGB_UNPACK_BLUE (pix); 687 b = RGB_UNPACK_BLUE (pix);
@@ -695,7 +698,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16
695 r /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1); 698 r /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1);
696 g /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1); 699 g /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1);
697 b /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1); 700 b /= (BLUR_FRAMES + 1) / 2 * (1 + BLUR_FRAMES + 1);
698 *rb->lcd_framebuffer[y * LCD_WIDTH + x] = LCD_RGBPACK(r, g, b); 701 lcd_fb[y * LCD_WIDTH + x] = LCD_RGBPACK(r, g, b);
699 } 702 }
700 } 703 }
701 prev_baseidx -= LCD_WIDTH * LCD_HEIGHT; 704 prev_baseidx -= LCD_WIDTH * LCD_HEIGHT;