Repository navigation
Accept struct color types in setBaseColor() and setTextColor() - #358
Merged
Merged
Conversation
With a palette, these functions stored the given value as is, which needed an implicit conversion to uint32_t. The struct color types (rgb565_t, rgb888_t, ...) only convert explicitly, so passing one failed to compile even when drawing to a display without a palette. The value is now cast explicitly: with a palette it is used as the palette index, as setColor() already does; without one it is converted to RGB888 as before.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Accept struct color types in
setBaseColor()andsetTextColor()setBaseColor(),setTextColor()(one and two arguments) and the functions that callsetBaseColor()(clear(),clearDisplay(),setScrollRect()with a color) failed to compile when given a struct color type such aslgfx::rgb565_torlgfx::rgb888_t(cannot convert 'lgfx::v1::rgb565_t' to 'uint32_t'). This happened for every target, not only sprites with a palette, because the palette branch is compiled in any case.setColor(). Without a palette, it is converted to RGB888 as before. Numeric color types behave as before.Testing
rgb332_t,rgb565_t,rgb888_t,argb8888_t,bgr888_t,bgr666_tandswap565_t(plusuint16_t/uint32_t) builds on ESP-IDF 5.1 to 6.1 and Arduino 2.x / 3.x (the versions in this repository's CI, all chips) and the native (SDL) build. It failed to compile before this change. CI on the fork: passed.