-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
extmod/modframebuf Enable blit between different formats. #7666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule axtls
updated
12 files
+4 −21 | axtlswrap/axtlswrap.c | |
+1 −1 | crypto/bigint.c | |
+6 −18 | crypto/crypto_misc.c | |
+1 −1 | crypto/sha1.c | |
+4 −4 | ssl/asn1.c | |
+0 −7 | ssl/os_port.h | |
+1 −0 | ssl/os_port.h | |
+85 −0 | ssl/os_port_micropython.h | |
+9 −8 | ssl/tls1.c | |
+1 −1 | ssl/tls1.h | |
+3 −7 | ssl/tls1_svr.c | |
+63 −123 | ssl/x509.c | |
+1 −1 | www/index.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Test blit between different color spaces | ||
try: | ||
import framebuf, usys | ||
except ImportError: | ||
print("SKIP") | ||
raise SystemExit | ||
|
||
# Monochrome glyph/icon | ||
w = 8 | ||
h = 8 | ||
cbuf = bytearray(w * h // 8) | ||
fbc = framebuf.FrameBuffer(cbuf, w, h, framebuf.MONO_HLSB) | ||
fbc.line(0, 0, 7, 7, 1) | ||
|
||
# RGB565 destination | ||
wd = 16 | ||
hd = 16 | ||
dest = bytearray(wd * hd * 2) | ||
fbd = framebuf.FrameBuffer(dest, wd, hd, framebuf.RGB565) | ||
|
||
wp = 2 | ||
bg = 0x1234 | ||
fg = 0xF800 | ||
pal = bytearray(wp * 2) | ||
palette = framebuf.FrameBuffer(pal, wp, 1, framebuf.RGB565) | ||
palette.pixel(0, 0, bg) | ||
palette.pixel(1, 0, fg) | ||
|
||
fbd.blit(fbc, 0, 0, -1, palette) | ||
|
||
print(fbd.pixel(0, 0) == fg) | ||
print(fbd.pixel(7, 7) == fg) | ||
print(fbd.pixel(8, 8) == 0) # Ouside blit | ||
print(fbd.pixel(0, 1) == bg) | ||
print(fbd.pixel(1, 0) == bg) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
True | ||
True | ||
True | ||
True | ||
True |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mp_obj_cast_to_native_base
can return mp_const_none, but that's not the same as MP_OBJ_NULL.So needs to be
in order to make the code below work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I'm being dumb here but I'm afraid I don't understand this.
This check worked if I didn't pass
palette
or I explicitly passed apalette
valueNone
:Are you saying that I need an additional check after the above, or that the above check should only be on
n_args
and be followed by this subsequent check? I'm not clear about the circumstances in whichpalette_in
ismp_const_none
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The case that this matters for is if
palette
is non-None but isn't derived from FrameBuffer.But I said completely the wrong thing -- mp_obj_cast_to_native_base does actually return MP_OBJ_NULL in this case. Which means the code as you have it is exactly correct. Sorry!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! That's fortuitous as I hadn't considered that case :)