summaryrefslogtreecommitdiff
path: root/extmod/modframebuf.c
AgeCommit message (Collapse)Author
2022-12-09extmod/modframebuf: Fix crash in FrameBuffer scrolling beyond extents.TPReal
Fixed the crash occurring when scrolling by at least the size of the framebuffer.
2022-09-19py/obj: Convert make_new into a mp_obj_type_t slot.Jim Mussared
Instead of being an explicit field, it's now a slot like all the other methods. This is a marginal code size improvement because most types have a make_new (100/138 on PYBV11), however it improves consistency in how types are declared, removing the special case for make_new. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19py/obj: Add "full" and "empty" non-variable-length mp_obj_type_t.Jim Mussared
This will always have the maximum/minimum size of a mp_obj_type_t representation and can be used as a member in other structs. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19all: Remove unnecessary locals_dict cast.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19all: Make all mp_obj_type_t defs use MP_DEFINE_CONST_OBJ_TYPE.Jim Mussared
In preparation for upcoming rework of mp_obj_type_t layout. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19all: Simplify buffer protocol to just a "get buffer" callback.Jim Mussared
The buffer protocol type only has a single member, and this existing layout creates problems for the upcoming split/slot-index mp_obj_type_t layout optimisations. If we need to make the buffer protocol more sophisticated in the future either we can rely on the mp_obj_type_t optimisations to just add additional slots to mp_obj_type_t or re-visit the buffer protocol then. This change is a no-op in terms of generated code. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-19extmod/modframebuf: Improve poly-fill boundary pixels.Jim Mussared
Rather than drawing the entire boundary to catch missing pixels, just detect the cases where boundary pixels are skipped during node calculation and pre-emptively draw them then. This adds 72 bytes on PYBV11, but makes filled poly() 20% faster. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-19extmod/modframebuf: Add polygon drawing methods.Mat Booth
Add method for drawing polygons. For non-filled polygons, uses the existing line-drawing code to render arbitrary polygons using the given coords list, at the given x,y position, in the given colour. For filled polygons, arbitrary closed polygons are rendered using a fast point-in-polygon algorithm to determine where the edges of the polygon lie on each pixel row. Tests and documentation updates are also included. Signed-off-by: Mat Booth <mat.booth@gmail.com>
2022-08-19extmod/modframebuf: Add ellipse drawing method.Peter Hinch
2022-08-19extmod/modframebuf: Add fill argument to rect().Jim Mussared
We plan to add `ellipse` and `poly` methods, but rather than having to implement a `fill_xyz` version of each, we can make them take an optional fill argument. This commit add this to `rect` as a starting point. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-19extmod/modframebuf: Optimise argument handling.Jim Mussared
Several methods extract mp_int_t from adjacent arguments. This reduces code size for the repeated calls to mp_obj_get_int. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-06-02all: Remove third argument to MP_REGISTER_MODULE.Damien George
It's no longer needed because this macro is now processed after preprocessing the source code via cpp (in the qstr extraction stage), which means unused MP_REGISTER_MODULE's are filtered out by the preprocessor. Signed-off-by: Damien George <damien@micropython.org>
2022-05-18extmod: Make extmod modules use MP_REGISTER_MODULE.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-05extmod: Move font_petme128_8x8.h from ports/stm32 to extmod.Damien George
And add spaces after commas so it is consistently formatted. Signed-off-by: Damien George <damien@micropython.org>
2022-05-03all: Use mp_obj_malloc everywhere it's applicable.Jim Mussared
This replaces occurences of foo_t *foo = m_new_obj(foo_t); foo->base.type = &foo_type; with foo_t *foo = mp_obj_malloc(foo_t, &foo_type); Excludes any places where base is a sub-field or when new0/memset is used. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-25extmod/modframebuf: Enable blit between different formats via a palette.Peter Hinch
This achieves a substantial performance improvement when rendering glyphs to color displays, the benefit increasing proportional to the number of pixels in the glyph.
2021-01-29extmod/modframebuf: Change int to unsigned int in format methods args.Damien George
These args are already bounds checked and clipped, and using unsigned ints can be more efficient. It also eliminates possible issues and compiler warnings with shifting of signed integers. Signed-off-by: Damien George <damien@micropython.org>
2020-04-05all: Use MP_ERROR_TEXT for all error messages.Jim Mussared
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-21extmod/modframebuf: Allow blit source to be a subclass of FrameBuffer.Jim Mussared
2019-12-12extmod: Add dynamic-runtime guards to btree/framebuf/uheapq/ure/uzlib.Damien George
So they can be built as dynamic native modules, as well as existing static native modules.
2017-12-14extmod/modframebuf: Add 8-bit greyscale format (GS8).Damien George
2017-12-14extmod/modframebuf: Add 2-bit color format (GS2_HMSB).Petr Viktorin
This format is used in 2-color LED matrices and in e-ink displays like SSD1606.
2017-10-04all: Remove inclusion of internal py header files.Damien George
Header files that are considered internal to the py core and should not normally be included directly are: py/nlr.h - internal nlr configuration and declarations py/bc0.h - contains bytecode macro definitions py/runtime0.h - contains basic runtime enums Instead, the top-level header files to include are one of: py/obj.h - includes runtime0.h and defines everything to use the mp_obj_t type py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h, and defines everything to use the general runtime support functions Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-09-06all: Update Makefiles and others to build with new ports/ dir layout.Damien George
Also renames "stmhal" to "stm32" in documentation and everywhere else.
2017-07-31extmod: Use MP_ROM_INT for int values in an mp_rom_map_elem_t.Damien George
2017-07-29extmod/modframebuf: Use correct initialization for .locals_dict.Paul Sokolovsky
2017-07-25extmod/modframebuf: Consistently use "col" as name for colour variables.Damien George
Thanks to @kamikaze, aka Oleg Korsak, for the original idea and patch.
2017-07-25extmod/modframebuf: Fix invalid stride for odd widths in GS4_HMSB fmt.Radomir Dopieralski
Since the stride is specified in pixels, in a 4-bit horizontal format it has to always be even, otherwise the computation is wrong and we can write outside of the buffer sometimes.
2017-06-15all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers.Damien George
2017-06-10extmod/modframebuf: Fix signed/unsigned comparison pendantic warning.Paul Sokolovsky
Happened with 32-bit gcc 4.8.4.
2017-04-04extmod/modframebuf: Make monochrome bitmap formats start with MONO_.Peter Hinch
MONO_xxx is much easier to read if you're not familiar with the code. MVLSB is deprecated but kept for backwards compatibility, for the time being. This patch also updates the associated docs and tests.
2017-03-20extmod/modframebuf: Add support for monochrome horizontal format.Peter Hinch
MHLSB and MHMSB formats are added to the framebuf module, which have 8 adjacent horizontal pixels represented in a single byte.
2017-01-25extmod/modframebuf: Add GS4_HMSB format.Oleg Korsak
2017-01-23extmod/modframebuf: Clip pixels drawn by line method.Damien George
2017-01-08extmod/modframebuf: optimize fill_rect subroutine callOleg Korsak
2016-12-09extmod/modframebuf: Store underlying buffer object to prevent GC free.Damien George
2016-12-08extmod/modframebuf: Make framebuf implement the buffer protocol.Damien George
So that one can easily access the underlying data of the frame buffer, eg to write the data out to a display.
2016-12-05extmod/modframebuf: Add hline, vline, rect and line methods.Damien George
These are basic drawing primitives. They work in a generic way on all framebuf formats by calling the underlying setpixel or fill_rect C-level primitives.
2016-12-01extmod/modframebuf: Optimise fill and fill_rect methods.Damien George
Fill is a very common operation (eg to clear the screen) and it is worth optimising it, by providing a specialised fill_rect function for each framebuffer format. This patch improved the speed of fill by 10 times for a 16-bit display with 160*128 pixels.
2016-12-01extmod/modframebuf: Add back legacy FrameBuffer1 "class".Damien George
For backwards compatibility. It simple creates a frame buffer with the MVLSB format.
2016-12-01extmod/modframebuf: Make FrameBuffer handle 16bit depth.Radomir Dopieralski
Rename FrameBuffer1 into FrameBuffer and make it handle different bit depths via a method table that has getpixel and setpixel. Currently supported formats are MVLSB (monochrome, vertical, LSB) and RGB565. Also add blit() and fill_rect() methods.
2016-09-22all: Remove 'name' member from mp_obj_module_t struct.Damien George
One can instead lookup __name__ in the modules dict to get the value.
2016-09-05extmod/framebuf: Add the xstep!=0 case to scroll() method.Radomir Dopieralski
Adds horizontal scrolling. Right now, I'm just leaving the margins created by the scrolling as they were -- so they will repeat the edge of the framebuf. This is fast, and the user can always fill the margins themselves.
2016-09-04extmod/modframebuf: Include font from stmhal directory explicitly.Damien George
So that users of framebuf don't need to have stmhal directory in their path. (Eventually the font can be moved elsewhere.)
2016-09-02extmod/modframebuf: Fix fill and scroll when height not divisible by 8.Radomir Dopieralski
There was a bug in `framebuf1_fill` function, that makes it leave a few lines unfilled at the bottom if the height is not divisible by 8. A similar bug is fixed in the scroll method.
2016-08-27extmod/modframebuf: Fix pixel accessor to return a 1-bit result.Damien George
2016-04-12extmod: Add initial framebuf module.Damien George