Commit Graph

186 Commits

Author SHA1 Message Date
William Wilgus 3d9d2de34d Revert "lcd framebuffer - Bugfix #2 ensure proper alignment"
This reverts commit 3a5c5edbf6.

Reason for revert:pulling in system.h breaks SDL

:(

Change-Id: Ied5e08de4770aa0da87c14b304480448db349423
2021-03-25 06:34:58 +00:00
William Wilgus 3a5c5edbf6 lcd framebuffer - Bugfix #2 ensure proper alignment
-- apparenty 0x4 aligned doesn't work properly

requires 0x8 alignment at least for the h10 20gb
but enabled for all processors that define MEM_ALIGN_ATTR

Change-Id: I11edaab183b91a6d158f1f439f173b9b699dc914
2021-03-25 00:32:26 -04:00
William Wilgus 60f642ba4f lcd_framebuffer bugfixes, sanity checks
several issues I saw that could pontentially cause problems
scroll engine doesn't take text height into account when checking bounds

NBELEMS was one whole row too large hopefully I got them right this time

Change-Id: If303da8320429c3964fc675351cb088d46303745
2020-10-31 01:11:30 -04:00
William Wilgus 40e98a2e49 Whitespace cleanup on fb_viewport Rewrite
Change-Id: I24aac41c8abecf7b78a44d7f59e842b791be4563
2020-10-26 12:38:22 -04:00
William Wilgus 3237ae4a4f 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
2020-10-26 12:28:48 -04:00
Moshe Piekarski 12f3ed1699 make the plugin API frambuffer agnostic
Change-Id: I5abdc231093054c517ff53b9a456997e440e3f6e
2020-10-26 12:28:48 -04:00
Solomon Peachy 658026e626 [4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.
Note:  I left behind lcd_bitmap in features.txt, because removing it
would require considerable work in the manual and the translations.

Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
2020-07-24 21:20:13 +00:00
Solomon Peachy 0c4f89370d [2/4] get rid of HAVE_LCD_CHARCELLS
HAVE_LCD_BITMAP is now redundant.

lcd_bitmap is always-on in features.txt so manual and lang strings
don't have to change

Change-Id: I08eeb20de48099ffc2dc23782711af368c2ec794
2020-07-24 21:20:13 +00:00
Marcin Bukat f2075a5709 Add XRGB8888 native format
This got lost somehow during Agptek port merge

Change-Id: Ie84463ba523d2307466b49354867117e7393a440
2018-06-12 13:25:12 +02:00
Thomas Martitz a1842c04f9 lcd-24bit: Introduce a 24-bit mid-level LCD driver
With LCD driver all calculation will be performed on RGB888 and the hardware/OS
can display from our 24bit framebuffer.

It is not yet as performance optimized as the existing drivers but should be
good enough.The vast number of small changes is due to the fact that
fb_data can be a struct type now, while most of the code expected a scalar type.

lcd-as-memframe ASM code does not work with 24bit currently so the with 24bit
it enforces the generic C code.

All plugins are ported over. Except for rockpaint. It uses so much memory that
it wouldnt fit into the 512k plugin buffer anymore (patches welcome).

Change-Id: Ibb1964545028ce0d8ff9833ccc3ab66be3ee0754
2014-06-21 00:15:53 +02:00
Thomas Martitz 05a67d021c Touchscreen: Show a line separator in lists.
This patch adds a configurable line separator between list items, very
similar to lists in Android. Additionally, below the list item there is a
thicker line. It can be disabled in the settings. Its color can
be configured as well.

Remote and monochrome displays are explicitly unsupported. If there is desire
this can be changed but it doesn't seem useful to me.

Change-Id: I005313b0d8f5ecd15864bf20e66ea4e3390d8b7d
2014-03-03 15:14:16 +01:00
Thomas Martitz 62524237f0 Implement lcd_get_dpi() for all bitmap targets.
DPI values are autogenerated from the resolution and collected display size
values. These values are inserted as comments as well.

Change-Id: Id03aedf9af18348f773dfce002805e480f6751e8
2014-03-03 15:14:15 +01:00
Thomas Martitz 488a1b983e put_line/scrolling: Make the scroll engine inform custom scrollers about start/stop of scrolling.
With the new lcd_putsxy_scroll_func() code can register custom scroll functions
(put_line() makes use of that). In order for the custom scroller to be able
to properly manage its userdata pointer (set via struct scrollinfo::userdata)
the scroll engine must inform the scroller about start and stop of scrolling.

To inform about start the lcd_scroll_* functions now return true when
the line will scroll. To inform about stop the scroll engine calls into the
scroller one last time, with the text set to NULL.

put_line() can use this to release the userdata registered per scrolling line
so that it can be recycled.

This fixes that some scrolling lines became glitchy after some time because
the userdata was recycled too early.

Change-Id: Iff0a6ce2a4f9ae2bada1b8e62f4f5950224942a9
2014-01-12 01:34:06 +01:00
Thomas Martitz 81be2016bb Fix Player red and icons on mono displays.
Change-Id: Ib8adcb4c70f2dd3ddd25da8f0606f48926dfd89e
2014-01-07 23:39:37 +01:00
Thomas Martitz d146970ca1 lcd/grey: Enable viewport fg_pattern and bg_pattern for all bitmap targets.
Greylib performed a horrible hack and stored fg and bg patterns in other
struct viewport fields. One of them was just removed. So instead of
this hack simply enable the *_pattern fields for mono targets as well,
so that greylib can use them normally.

Change-Id: Ib0842ebcc97f5bf9d9382b4471903afa2f96f39f
2014-01-07 22:14:41 +01:00
Thomas Martitz e1c7b3b8f7 lcd-16bit: Remove {lss,lse,lst}_pattern fields from struct viewport.
These where used for line styling during scrolling, which is now done in apps/,
The  viewport struct doesn't need to record these anymore.

Change-Id: I810d9dcb2644b00a798c6e75acab69c74a78e77f
2014-01-07 14:13:48 +01:00
Thomas Martitz 36e469db8b lcd-common: Remove direct style (line decorations) from lcd-puts* functions.
This logic is moved into apps (put_line()) which can better handle line
decorations with respect to scrolling, mulitline and other complications.

Firmware doesn't need this. The remaining drawing function know only one style,
that is foreground on background/backdrop (changing drawmode is still supported).

Change-Id: I707060edc388a7d723a7d09b0cf5cbda6ec56708
2014-01-07 14:13:48 +01:00
Thomas Martitz 4978094480 lcd-common: Remove support for custom line heights from viewport.
Since scrolling is now pixel-based this is not necessary anymore. custom line
height is handled by put_line() but can also possible to implement with
lcd_puts_scroll_func().

Change-Id: Iee9b12bf99afac93d95d2a1a6f5d5b4db237b21c
2014-01-07 14:13:48 +01:00
Thomas Martitz 9a4686b563 lcd-common/scroll_engine: Remove unused functions lcd_puts_style_xyoffset() and lcd_puts_scroll_style_xyoffset().
With this functions removed there is no exported function in firmware left
that draws line decorations. Also no function supports specifying an y-offset
anymore (was used for pixel accurate positioning of otherwise strictly line-based
API calls).

Both should be handled in apps/ now.

Change-Id: Iba4b28ccc6e686c7db63e34b51ad4badae983fce
2014-01-07 14:13:48 +01:00
Thomas Martitz 775ebe4ff6 lcd-common/scroll_engine: Remove unused functions lcd_puts_scroll_style().
Change-Id: Ia4f943b3738ab6e66b0e3f1507c629b36d7eba94
2014-01-07 14:13:48 +01:00
Thomas Martitz 7cd07290e6 lcd-common: Remove unused function lcd_puts_style_offset().
Change-Id: I24da23d132f933fe647416dc58e8f50879715423
2014-01-07 14:13:48 +01:00
Thomas Martitz 1e324aac36 lcd-common: Remove unused function lcd_puts_style().
Change-Id: Id2c64c116f79b8e61a7af49b9072b3e884ffb455
2014-01-07 14:13:48 +01:00
Thomas Martitz 8f64625888 lcd-common: Remove unused function lcd_puts_offset().
Change-Id: I39749bf3db915e5a8ddb6e6f25eb201ea0aaf981
2014-01-07 14:13:48 +01:00
Thomas Martitz a422604435 lcd-common/scroll_engine: Remove unused functions lcd_puts_scroll_offset() and lcd_puts_scroll_style_offset().
Change-Id: Ia84ae88020d06a1cb634942ab5e635fd5d10ac66
2014-01-07 14:13:48 +01:00
Thomas Martitz 77836e5736 lcd-16bit: Introduce lcd_gradient_fillrect_part().
It is similar to lcd_gradient_fillrect(), except that it only draws a part
of the complete gradient. This can be used to draw only the bottom half
of a full gradient.

Change-Id: Ib47cc5237f6966e35ba07988bddbb00fd97adf96
2014-01-07 11:36:00 +01:00
Thomas Martitz 6630958533 lcd-common/scroll_engine: Introduce lcd_putsxy_scroll_func().
This function supports installing a custom scroll callback. This will be
called when the scrollengine redraws the line. It allows to draw extended
styles (or anything your can possible imagine) along with the text.

It is also strictly pixel-based, the first pixel-based function that supports
scrolling.

Change-Id: I57f81ac7b3d08b877aea4cb8afa882f175ebcdfc
2014-01-07 11:36:00 +01:00
Thomas Martitz a17a7038c2 lcd: Fix certain drawmode combinations.
Some seldomly used drawmode combinations did not work in conjunction with
alpha bitmaps and backdrops. Now all should work (see comment added) by using
more bits.

Change-Id: I2bc96ecf471fa8c1a608a321a235b9c8527b3dc5
2014-01-05 19:35:23 +01:00
Thomas Martitz c72b454286 Fix reds. Also apply the new scrolling to lcd charcell (this even uncovered an
error).

Change-Id: I29243bb36b6cec1471bd6c0afc64e00547a68c50
2013-12-15 00:38:48 +01:00
Thomas Martitz 26801b3bd8 scroll_engine: Add STYLE_NONE to allow for drawing lines without styling.
This allows to draw lines without destroying styles that were drawn manually
(e.g. from apps/) beforehand.

Change-Id: I0de290c9343061efb115e1b76da5b76395c2b2af
2013-12-14 23:11:31 +01:00
Thomas Martitz 1c5d0b41ee scroll_engine: Rename scroll_stop* functions to be more consistent with the lcd api.
Change-Id: I8ada10b96bfb628cca0331689e8b936ae47c7e1c
2013-12-14 23:11:30 +01:00
Thomas Martitz 1430b07894 bitmap drawing: Use extra bit in mask to avoid nested if() in switch-cases.
Speeds up alpha bitmap drawing by up to 10%. mono bitmap drawing is also a tiny bit faster.

Change-Id: I5a9379740c1a0091de9c621aabbe57d767ce2905
2013-02-12 10:34:48 +01:00
Jonathan Gordon 685cf59008 9 segment bitmap drawing:
Use %x9(id) to draw an image in the whole current viewport using the
9 segment drawer (which draws the corners as normal and *tiles*
the middle segments to the needed width/height).

Future work is to make it scale instead of tile

Change-Id: Ic3ed1cad93f96091694801eb442e0da5a2401203
2012-12-09 17:11:19 +11:00
Jonathan Gordon 8efb8f97c4 lcd drivers: split lcd_gradient_rect so it is actually useful
lcd_gradient_rect() was only usable to draw list lines, so split
it up and make a generic gradient draw function available to apps/

Change-Id: I665911a90fef239b5e06592ea2763cbeeb74c83f
2012-03-01 00:10:17 +11:00
Jonathan Gordon 2c71aa9feb lcd/skin_engine: Add the ability to draw onto the backdrop layer
The framebuffer the lcd driver uses can now be changed on the fly
which means that regular lcd_* drawing functions can draw onto the
"backdrop" buffer. The skin engine can use this to create layered
effects.

Add the tag %VB to a viewport to draw that viewport onto the
backdrop layer. If you want to draw an image onto the backdrop
framebuffer use %x(backdrop filename) instead of %X() inside
a viewport with %VB.

Change-Id: I741498e2af6d4f2d78932cabe8942317893e7cfc
2012-02-28 23:03:04 +11:00
Jonathan Gordon b37e6bc8c1 lcd drivers: Convert lcd_[remote_]framebuffer to a pointer
Change all lcd drivers to using a pointer to the static framebuffer
instead of directly accessing the static array. This will let us
later do fun things like dynamic framebuffer sizes (RaaA) or
ability to use different buffers for different layers (dynamic
skin backdrops!)

Change-Id: I0a4d58a9d7b55e6c932131b929e5d4c9f9414b06
2012-02-28 11:44:59 +11:00
Michael Sevakis 8f92ab02e1 Oops. Left some bits I didn't want to keep.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31336 a1c6a512-1295-4272-9138-f99709370657
2011-12-16 23:46:12 +00:00
Michael Sevakis 95e6043d5e Convert remaining memframe LCDs that can be convert to common code.
Massage the way it interfaces a bit to make things more flexible.
The chroma_buf scheme on Sansa Connect and Creative ZVx calling the
lcd_write_yuv420_lines implementation in lcd-as-memframe.S with five params
with a chroma buffer that the function can't use wouldn't work anyway so just
have them use the stock implementation (really, how was that working?).


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31335 a1c6a512-1295-4272-9138-f99709370657
2011-12-16 23:40:39 +00:00
Jonathan Gordon b3caa01062 Fix FS#12237 (caused by r30302) where centered skin text isnt eqactly centered
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31246 a1c6a512-1295-4272-9138-f99709370657
2011-12-14 09:48:52 +00:00
Thomas Martitz 1280f322ec Fix build errors and warnings in the lcd drivers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30940 a1c6a512-1295-4272-9138-f99709370657
2011-11-08 22:04:43 +00:00
Thomas Martitz f443e7bbf7 Support for transparency in 32bit bitmaps on color targets.
This uses the alpha blending capabilities introduced with anti-aliased fonts
to draw bitmaps with transparency information. The bmp loader is extended to read
this information (pass FORMAT_TRANSPARENT in format). The alpha information will
be used when drawing the bitmap.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30937 a1c6a512-1295-4272-9138-f99709370657
2011-11-08 21:36:49 +00:00
Thomas Martitz 13209604c1 Add new lcd_bmp and lcd_bmp_part APIs.
This new APIs wrap around lcd_[mono|transparent]_bitmap/_part calls and
handle all kinds bitmaps. The intended use is to draw bitmaps that
come from read_bmp_fd/_file.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30936 a1c6a512-1295-4272-9138-f99709370657
2011-11-08 21:34:46 +00:00
Thomas Martitz 93c6c79e8d Better fix for FS#12337. Use 0 to make the line height calculated from the font height, as before r30773.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30850 a1c6a512-1295-4272-9138-f99709370657
2011-10-29 15:16:02 +00:00
Thomas Martitz a13e9644b5 - Fix some reds by implementing lcd_get_dpi().
- Use the list item centering capabilities in the plugin lib
- Bump plugin ABI for the changed viewport struct (sort the API too).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30775 a1c6a512-1295-4272-9138-f99709370657
2011-10-17 18:28:35 +00:00
Thomas Martitz 3b12634e6b Commit FS#12321 - Touchscreen: List line padding, to more easily select lines
This adds line padding to lists on touchscreens,
in order to make lists reasonably useful without huge fonts.

It's configurable:
* Automatic (default, line height calculated using a lcd dpi aware function)
* Off (status quo, line height = font height)
* X pixels (from 2 to 50 in even steps)

The automatic setting should/aims to Just Work Out Of The Box on all targets

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30773 a1c6a512-1295-4272-9138-f99709370657
2011-10-17 17:38:10 +00:00
Thomas Martitz 33af0dec28 Touchscreen: Improved scroll threshold
Remove the hardcoded (and way too small) scroll threshold (the distance moved in pixels before we think the users wants to scroll) and replace it with something based on the actual DPI of the screen.
On Android we call the API for that, on other touchscreens we reimplemented Android's formula (as of 2.2) and calculate it.

Flyspray: 11727

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28548 a1c6a512-1295-4272-9138-f99709370657
2010-11-10 15:25:15 +00:00
Thomas Martitz 3022a60cc2 Rename {draw,fill}_viewport once more (to draw_border_viewport and fill_viewport) and remove the viewport parameter as suggested by Dave Chapman.
The parameter wasn't used yet and it's not clear whether it should be a absolute or relative viewport.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28242 a1c6a512-1295-4272-9138-f99709370657
2010-10-11 01:19:55 +00:00
Thomas Martitz 5462ef728f Add _rect to {draw,fill}_viewport as suggested by Jonathan Gordon to reduce the chance to confuse it with update_viewport().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28240 a1c6a512-1295-4272-9138-f99709370657
2010-10-10 23:35:03 +00:00
Thomas Martitz 8a0152bd4a Two new lcd/multi screen api convinience functions: draw_viewport(), fill_viewport().
They work as the drawrect/fillrect pendants but work on a viewport basis; pass NULL to draw the current viewport (the one set with set_viewport()).
In conjunction with action_get_touchscreen_press_in_vp() it should be less of a pain to draw buttons and get presses on them.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28239 a1c6a512-1295-4272-9138-f99709370657
2010-10-10 23:15:05 +00:00
Thomas Martitz d9d0b4dd20 Pixel-accurate (vertical) list scrolling for touchscreen targets.
Looks much smoother now as you don't scroll by whole lines anymore.
Add some functions lcd driver to enable the line based scrolling engine to draw the lines with a pixel-based y-offset.
This should also allow for a sensible kinetic scrolling mechanism (still a todo).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28214 a1c6a512-1295-4272-9138-f99709370657
2010-10-06 12:46:42 +00:00
Rafaël Carré 0f063b7d72 Implement lcd(_remote)_putsxyf() and export to plugins
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27921 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 21:46:18 +00:00