Skip to content
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

waveshare2in13v2: Support rotation of image #46

Merged
merged 4 commits into from
Jan 23, 2022
Merged

waveshare2in13v2: Support rotation of image #46

merged 4 commits into from
Jan 23, 2022

Conversation

hansmi
Copy link
Contributor

@hansmi hansmi commented Jan 21, 2022

A new option named Origin controls which of the four corners of the display should be used as the (0,0) position for the image. The included unittests may seem excessive, but they are the result of many off-by-one errors and other mistakes I made while developing this series.

The forthcoming introduction of image orientation will make the
computation slightly more complicated. The bounds are fixed during the
lifetime of a "Dev" instance, so it's better to retain them.
@codecov-commenter
Copy link

codecov-commenter commented Jan 21, 2022

Codecov Report

Merging #46 (2ee68f7) into main (394037d) will increase coverage by 0.4%.
The diff coverage is 96.4%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main     #46     +/-   ##
=======================================
+ Coverage   64.1%   64.4%   +0.4%     
=======================================
  Files         56      56             
  Lines       6740    6821     +81     
=======================================
+ Hits        4317    4393     +76     
- Misses      2279    2284      +5     
  Partials     144     144             
Impacted Files Coverage Δ
waveshare2in13v2/waveshare213v2.go 28.9% <84.6%> (+6.8%) ⬆️
waveshare2in13v2/drawing.go 97.8% <100.0%> (+2.0%) ⬆️
ads1x15/ads1x15.go 82.5% <0.0%> (-0.7%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 394037d...2ee68f7. Read the comment docs.

waveshare2in13v2/drawing.go Outdated Show resolved Hide resolved
waveshare2in13v2/waveshare213v2.go Show resolved Hide resolved
The members of the "drawSpec" structure are only for internal use, so
rename them to start with a lower-case letter.
A new option named "Origin" controls which of the four corners of the
display should be used as the (0,0) position for the image. The
in-memory buffer is kept in logical orientation. The actual rotation
happens only when sending updates.

By aligning the buffer accordingly the code is already prepared for
a more efficient sending of image data for the "TopRight" and
"BottomLeft" origins. See the TODO comment on "drawSpec.BufferDstOffset"
for details.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
@maruel maruel merged commit 0012149 into periph:main Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants