Conversation
…e boost issues had been resolved
Codecov Report
@@ Coverage Diff @@
## devel #52 +/- ##
==========================================
- Coverage 64.95% 61.97% -2.99%
==========================================
Files 81 82 +1
Lines 2968 3048 +80
==========================================
- Hits 1928 1889 -39
- Misses 1040 1159 +119
Continue to review full report at Codecov.
|
RuthgerD
left a comment
There was a problem hiding this comment.
Seems ok overall, just a couple of small things
| // | ||
| // Created by danie on 2021-11-02. | ||
| // |
| String& operator+=(const String& rhs) { | ||
| concat(rhs); | ||
| return (*this); |
There was a problem hiding this comment.
Can't this be templated much like the concat function?
There was a problem hiding this comment.
And why do all these return statements have their expression parenthesized?
| // | ||
| // Created by danie on 2021-11-02. | ||
| // |
| #include <climits> | ||
| #include <iostream> | ||
| #include <SMCE/BoardView.hpp> | ||
| #include "../../include/Ardrivo/FrameBufferAccess.h" |
There was a problem hiding this comment.
Shoudn't use relative paths
| m_format = format; | ||
| break; | ||
| default: | ||
| return error("Unknown format"); |
There was a problem hiding this comment.
Maybe be a bit more descriptive so that we know where this comes from
| extern void maybe_init(); | ||
| } // namespace smce | ||
|
|
||
| int FramebufferAccess::begin(std::uint16_t width, std::uint16_t height, SMCE_Pixel_Format format, std::uint8_t fps) { |
There was a problem hiding this comment.
shoudn't this also take they fb key? (even if its just 0 for now)
| m_begun = false; | ||
| } | ||
|
|
||
| bool FramebufferAccess::read(void* buffer) { |
There was a problem hiding this comment.
uint8_t* instead of void*
| return true; | ||
| } | ||
|
|
||
| bool FramebufferAccess::write(void* buffer) { |
| int FramebufferAccess::bitsPerPixel() const { | ||
| if (!m_begun) { | ||
| std::cerr << "FramebufferAccess::bitsPerPixel: device inactive" << std::endl; | ||
| return 0; | ||
| } | ||
| return bits_bytes_pixel_formats[m_format].first; |
There was a problem hiding this comment.
Shoudn't this be something on BoardView::Framebuffer itself? seems awfully useful thing to have and weird for it to be present in Ardrivo only
| enum SMCE_Pixel_Format | ||
| { | ||
| RGB888, // RRRRRRRRGGGGGGGGBBBBBBBB // SMCE extension | ||
| RGB444, // GGGGBBBB----RRRR | ||
| }; | ||
|
|
||
| class SMCE__DLL_RT_API FramebufferAccess { | ||
| private: | ||
| std::size_t m_key = 0; | ||
| SMCE_Pixel_Format m_format = RGB888; | ||
| bool m_begun = false; | ||
|
|
||
| public: | ||
| int begin(std::uint16_t width, std::uint16_t height, SMCE_Pixel_Format format, std::uint8_t fps); | ||
| void end(); | ||
| bool read(void* buffer); | ||
| bool write(void* buffer); | ||
|
|
||
| [[nodiscard]] int width() const; | ||
| [[nodiscard]] int height() const; | ||
| [[nodiscard]] int bitsPerPixel() const; | ||
| [[nodiscard]] int bytesPerPixel() const; | ||
|
|
||
| void horizontalFlip(bool flipped); | ||
| void verticalFlip(bool flipped); | ||
| }; |
There was a problem hiding this comment.
This is a terrible API
I can see that you copied it from the OV767X header, which is also a terrible API which I cannot alter for compatibility with third-party software.
There was a problem hiding this comment.
Keep in mind that this is an internal header, meant for library patches to use. It is NOT for Arduino user code, and thus NEEDS to provide an equivalent of the FrameBuffer interface, not the shitty OV767X one
| String& operator+=(const String& rhs) { | ||
| concat(rhs); | ||
| return (*this); |
| String& operator+=(const String& rhs) { | ||
| concat(rhs); | ||
| return (*this); |
There was a problem hiding this comment.
And why do all these return statements have their expression parenthesized?
4d73b7e to
94f79af
Compare
c30ed30 to
ff1eeee
Compare
36c75b6 to
e3b023f
Compare
83b8248 to
c294c06
Compare
be750e6 to
f7f05f0
Compare
Implementation of Task 16 ArduinoGraphics library support in libSMCE by Group 1 (Daniel and Erik).
Task description: Add to libSMCE the ability to draw on an output screenbuffer, and add to the frontend a display screen component.
Our approach was to create a FrameBufferAccess class to be used in sketches in Arduinoland to access the backend framebuffer.
This branch is currently not working on Windows, as it is branched off from the master branch where the boost libraries seem to fail on Windows. If you want to try out a prototype that works on Windows, try the danielolssonIT:task-16-fix branch.