Commit Graph

7 Commits

Author SHA1 Message Date
0x0203 4de6d284a3 - Determine pixel layout at runtime instead of relying on compile-time flags
- Fix some potential null dereference bugs
2019-06-06 14:54:30 -04:00
0x0203 1dfe4ebc19 Implement software rendering of RECT_MUTI_COLOR for x11_rawfb 2019-06-06 12:58:03 -04:00
0x0203 6d24023d98 - Implement text foreground color
- Be consistent about reading and writing pixel values to avoid casting/offset madness
- clean up function names for clarity/consistency
- Fix fence post errors preventing get/set pixels from operating on first row/column
- Enforce mutual exclusivity for pixel layout macros
2019-06-06 12:42:32 -04:00
0x0203 b9f9d0a176 Allow proper drawing to last column of screen. 2019-05-31 19:31:54 -04:00
Patrick Rudolph 66946dc3cf nuklear_rawfb: Use pitch in offset calculation
Use the framebuffer pitch to calculate the correct offset.
Fixes garbled rendering on framebuffer that have
pitch != x_resolution * bpp / 8.

The demo application is unaffected as the pitch always aligns with
the x resolution of the window.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
2018-02-04 17:08:17 +01:00
vurtun e5850a01b9 Fixed style issues in software renderer 2017-10-07 14:30:22 +02:00
Patrick Rudolph 2eb72b26e4 Add software rasterizer library and demo.
The software rasterizer is to be used with raw framebuffer
devices, where no GPU or X11 is available.
The demo emulates a raw framebuffer on X11 using XShmImage / XImage.

Features implemented:
* Drawing primitives
* Drawing polygons (using Darel Rex Finley algorithm)
* Drawing arcs and circles (using Bresenham's elipses algorithm)
* Drawing images using nearest filtering
* Bounds check on every operation
* Fastpath for lines
* Font rendering using nearest filtering
* Window resize
* Thread safe implementation by using a context
* Fixed lower and upper scissors on fast-path
* Adapted coding style to nuklear's style
* Implemented text scissors

Color formats:
Define one of them at compile time.
* RAWFB_RGBX_8888 (32bpp)
* RAWFB_XRGB_8888 (32bpp)

Tested:
The library has been tested on Lenovo Thinkpad T500 and is able to render
more than 30fps on a single core with no further optimizations and VSNYC enabled.

TODO:
* Improve font rendering by using filters.
* Account font foreground color.

Usage:
The raw framebuffer library needs a "texture" that holds the prerendered
font data. The texture is used at runtime to blit the letters onto screen.
You have to provide the framebuffer address, dimension and pitch.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
2017-10-07 12:08:24 +02:00