From 371c86bf3f4d1708fc40db2aa7fa572eb429d0b4 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 7 Dec 2012 01:50:52 -0500 Subject: Adapt OSD in plugin lib to be greylib compatible. Requires addition of viewports and alternate framebuffers to greylib which are essentially similar to the core implementation except that the framebuffer can be any size and relationship to a viewport. Drawing is always fully clipped to the intersecting area. Adapt oscilloscope.c to the API change. FFT will use the new features (later update). Get rid of silly and wrong lcd_bmp_part use in OSD. Remove it from plugin API (must be made incompatible now). Change-Id: Iafa5e2174148fb8ad11db6b9d4add0dcabc5c563 --- apps/plugins/lib/grey_scroll.c | 50 +++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 20 deletions(-) (limited to 'apps/plugins/lib/grey_scroll.c') diff --git a/apps/plugins/lib/grey_scroll.c b/apps/plugins/lib/grey_scroll.c index 35f73b70c4..78e5725d05 100644 --- a/apps/plugins/lib/grey_scroll.c +++ b/apps/plugins/lib/grey_scroll.c @@ -28,11 +28,14 @@ #include "plugin.h" #include "grey.h" +extern struct viewport _grey_default_vp; + /*** Scrolling ***/ /* Scroll left */ void grey_scroll_left(int count) { + struct viewport *vp = &_grey_default_vp; unsigned char *data, *data_end; int length, blank; @@ -45,8 +48,8 @@ void grey_scroll_left(int count) data = _grey_info.buffer; data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); length = _grey_info.width - count; - blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? - _grey_info.fg_brightness : _grey_info.bg_brightness; + blank = (vp->drawmode & DRMODE_INVERSEVID) ? + _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp); do { @@ -61,6 +64,7 @@ void grey_scroll_left(int count) /* Scroll right */ void grey_scroll_right(int count) { + struct viewport *vp = &_grey_default_vp; unsigned char *data, *data_end; int length, blank; @@ -73,8 +77,8 @@ void grey_scroll_right(int count) data = _grey_info.buffer; data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); length = _grey_info.width - count; - blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? - _grey_info.fg_brightness : _grey_info.bg_brightness; + blank = (vp->drawmode & DRMODE_INVERSEVID) ? + _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp); do { @@ -88,6 +92,7 @@ void grey_scroll_right(int count) /* Scroll up */ void grey_scroll_up(int count) { + struct viewport *vp = &_grey_default_vp; long shift, length; int blank; @@ -99,8 +104,8 @@ void grey_scroll_up(int count) shift = _GREY_MULUQ(_grey_info.width, count); length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count); - blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? - _grey_info.fg_brightness : _grey_info.bg_brightness; + blank = (vp->drawmode & DRMODE_INVERSEVID) ? + _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp); rb->memmove(_grey_info.buffer, _grey_info.buffer + shift, length); @@ -110,6 +115,7 @@ void grey_scroll_up(int count) /* Scroll down */ void grey_scroll_down(int count) { + struct viewport *vp = &_grey_default_vp; long shift, length; int blank; @@ -121,8 +127,8 @@ void grey_scroll_down(int count) shift = _GREY_MULUQ(_grey_info.width, count); length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count); - blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ? - _grey_info.fg_brightness : _grey_info.bg_brightness; + blank = (vp->drawmode & DRMODE_INVERSEVID) ? + _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp); rb->memmove(_grey_info.buffer + shift, _grey_info.buffer, length); @@ -134,6 +140,7 @@ void grey_scroll_down(int count) /* Scroll left */ void grey_ub_scroll_left(int count) { + struct viewport *vp = &_grey_default_vp; unsigned char *data, *data_end; int blank, length; @@ -147,9 +154,9 @@ void grey_ub_scroll_left(int count) data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); length = (_grey_info.width - count) << _GREY_BSHIFT; count <<= _GREY_BSHIFT; - blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ? - _grey_info.fg_brightness : - _grey_info.bg_brightness]; + blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? + _GREY_FG_BRIGHTNESS(vp) : + _GREY_BG_BRIGHTNESS(vp)]; do { rb->memmove(data, data + count, length); @@ -167,6 +174,7 @@ void grey_ub_scroll_left(int count) /* Scroll right */ void grey_ub_scroll_right(int count) { + struct viewport *vp = &_grey_default_vp; unsigned char *data, *data_end; int blank, length; @@ -180,9 +188,9 @@ void grey_ub_scroll_right(int count) data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height); length = (_grey_info.width - count) << _GREY_BSHIFT; count <<= _GREY_BSHIFT; - blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ? - _grey_info.fg_brightness : - _grey_info.bg_brightness]; + blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? + _GREY_FG_BRIGHTNESS(vp) : + _GREY_BG_BRIGHTNESS(vp)]; do { rb->memmove(data + count, data, length); @@ -199,6 +207,7 @@ void grey_ub_scroll_right(int count) /* Scroll up */ void grey_ub_scroll_up(int count) { + struct viewport *vp = &_grey_default_vp; unsigned char *dst, *end, *src; int blank; @@ -210,9 +219,9 @@ void grey_ub_scroll_up(int count) dst = _grey_info.values; end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width); - blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ? - _grey_info.fg_brightness : - _grey_info.bg_brightness]; + blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? + _GREY_FG_BRIGHTNESS(vp) : + _GREY_BG_BRIGHTNESS(vp)]; #if (LCD_PIXELFORMAT == VERTICAL_PACKING) \ || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) @@ -274,6 +283,7 @@ void grey_ub_scroll_up(int count) /* Scroll down */ void grey_ub_scroll_down(int count) { + struct viewport *vp = &_grey_default_vp; unsigned char *start, *dst; int blank; @@ -285,9 +295,9 @@ void grey_ub_scroll_down(int count) start = _grey_info.values; dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width); - blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ? - _grey_info.fg_brightness : - _grey_info.bg_brightness]; + blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ? + _GREY_FG_BRIGHTNESS(vp) : + _GREY_BG_BRIGHTNESS(vp)]; #if (LCD_PIXELFORMAT == VERTICAL_PACKING) \ || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) -- cgit v1.2.3