-
-
Notifications
You must be signed in to change notification settings - Fork 187
All graphics methods now use 32-bit ARGB or RGB565 format instead of BGR #2811
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
All graphics methods now use 32-bit ARGB or RGB565 format instead of BGR #2811
Conversation
Automated fixes for code style.
…b7c-2ccc-474b-820f-1b8c2e03cdd7 Code style fixes for nanoframework/nf-interpreter PR#2811
// Disable the MPU | ||
// --------------- | ||
|
||
__DMB(); // Make sure outstanding transfers are done |
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.
Per project code style: please move comment to line above, not inlined.
MPU->CTRL = 0; // Disable the MPU and clear the control register | ||
|
||
// --------------- | ||
// Configure the region |
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.
OK to use just a single comment line. No need for the "boxed" version 😉
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.
@TerryFogg thank you for taking care of this!
Can you please extract the memory access fix to a separate PR?
We want PRs to be atomic and this one is about RGB fixes, memory access is unrelated.
Plus having it separated, make is clear about the issue & fix and its easily discoverable in the code history in case it's needed in the future.
@TerryFogg I've fixed the code formatting of targets/ChibiOS/ST_STM32F769I_DISCOVERY/target_external_memory.c so that the PR with the required changes are clear and not masked by the code style changes. |
I have submitted a separate PR #2820 for the STM32F769 series chip unaligned memory problem. |
Description
The code has been modified to only use ARGB or RGR565 format.
Code was also modified to the RotateImage to properly rotate images with a transparent background.
This was not in place, although it was already in place for stretch image.
Fixed a bug.
In testing on the STM32F769I_Discovery I ran into an exception.
Native code working on an ESP32WroverKitV4.1 would create an exception in the Bitmap_Decoder.cpp.
I eventually tracked this down to a
ARM: STM32F7: hard fault caused by unaligned Memory Access
Included in this code is the fix for this problem as recommended by keil.
Motivation and Context
Problems with colours. This eliminates some confusion with the formats in memory.
How Has This Been Tested?
The modifed code was tested on
All three tests showed the same resulting colours.
See the following testing notes below
Testing notes
A selection of 9 ARGB colours was selected to test operation
16-bit RGB565 values expected to be in the native bitmap for presentation to the display controller to properly send to the display device. Examination of the memory buffer of the Bitmap showed that it was correctly in the RGB565 format stored as little endian.
RGB565 format is commonly called "native" format in the C++/C code
JPEG test was created using Paint.net to set the 9 pixels to the ARGB colours then saved to disk and re-read. The values re-read from the disk are "compressed" so are slightly different. The expected values were found using the eye-dropper tool of paint.net to get the hex colour values.
Bitmaps saved in the resource file are all converted to RGB565 format before being embedded into the assembly and deployed to flash. ( This is by design)
The graphics code supports reading in bitmaps of 32-bit, 24-bit and 8-bit indexed, usually from file. For this test the bitmaps are setup as a C# byte array to eliminate the need to have a file system.
Restoring RGB565 to ARGB
Restored results are inexact values due to the loss of 3 bits red, 2 bits green and 3 bits blue. The restoration code uses an algorithm originally from .netMF to approximate the original ARGB colour.
Gif values should be the same as SetPixel, GetPixel, unlike jpeg GIF uses lossless compression.
Screenshots
Types of changes
Checklist