diff options
author | Damien George <damien@micropython.org> | 2025-05-26 00:17:56 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-06-04 02:40:45 +1000 |
commit | b15348415e9d5ad2a978ca38a8da356faee88e91 (patch) | |
tree | 0ee8d030b11964f8218a46c60addf91024da144e /examples/natmod/framebuf/framebuf.c | |
parent | d5f2fc239af2d69407170fa290ba6752c8f1790c (diff) |
extmod/modframebuf: Add support for blit'ing read-only data.
Currently the `FrameBuffer.blit(buf, x, y)` method requires the `buf`
argument to be another `FrameBuffer`, which is quite restrictive because it
doesn't allow blit'ing read-only memory/data.
This commit extends `blit()` to allow the `buf` argument to be a tuple or
list of the form:
(buffer, width, height, format[, stride])
where `buffer` can be anything with the buffer protocol and may be
read-only, eg `bytes`.
Also, the palette argument to `blit()` may be of the same form.
The form of this tuple/list was chosen to be the same as the signature of
the `FrameBuffer` constructor (that saves quite a bit of code size doing it
that way).
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'examples/natmod/framebuf/framebuf.c')
-rw-r--r-- | examples/natmod/framebuf/framebuf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/natmod/framebuf/framebuf.c b/examples/natmod/framebuf/framebuf.c index 1ba702e33..5fd7c6be3 100644 --- a/examples/natmod/framebuf/framebuf.c +++ b/examples/natmod/framebuf/framebuf.c @@ -4,6 +4,9 @@ #include "py/dynruntime.h" #if !defined(__linux__) +void *memcpy(void *dst, const void *src, size_t n) { + return mp_fun_table.memmove_(dst, src, n); +} void *memset(void *s, int c, size_t n) { return mp_fun_table.memset_(s, c, n); } |