-
Notifications
You must be signed in to change notification settings - Fork 38
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
Task 16 backend #52
base: devel
Are you sure you want to change the base?
Task 16 backend #52
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.
|
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.
Seems ok overall, just a couple of small things
// | ||
// Created by danie on 2021-11-02. | ||
// |
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.
Missing copyright
String& operator+=(const String& rhs) { | ||
concat(rhs); | ||
return (*this); |
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.
Can't this be templated much like the concat function?
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.
I second that
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.
And why do all these return
statements have their expression parenthesized?
// | ||
// Created by danie on 2021-11-02. | ||
// |
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.
missing copyright
#include <climits> | ||
#include <iostream> | ||
#include <SMCE/BoardView.hpp> | ||
#include "../../include/Ardrivo/FrameBufferAccess.h" |
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.
Shoudn't use relative paths
m_format = format; | ||
break; | ||
default: | ||
return error("Unknown format"); |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint8_t* instead of void*
return true; | ||
} | ||
|
||
bool FramebufferAccess::write(void* buffer) { |
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.
const uint8_t*
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
Obvious copy/paste of the worst code you could find in the whole project. If I was a code duplicate detection tool I'd scream to be heard from the edge of the galaxy
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); |
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.
I second that
String& operator+=(const String& rhs) { | ||
concat(rhs); | ||
return (*this); |
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.
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.