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

refactor: Screen API #51

Merged
merged 12 commits into from
May 4, 2024
Merged

refactor: Screen API #51

merged 12 commits into from
May 4, 2024

Conversation

Tropix126
Copy link
Member

Describe the changes this PR makes. Why should it be merged?

  • Changes text drawing to no longer support the line positioning mode, since that has some inconsistent behavior.
  • Removed direct usage of mint::Point2, instead adding our own Point2 struct with an actually practical implementation.
  • Re-exports some mint types used by devices through the geometry module.
  • draw pixel is now dead. Instead we blanket-impl Fill for all types that can be converted into a Point2.
  • Fixes various issues caused by not taking the program header into account while drawing.

Additional Context

Closes #44. Needs hardware testing.

Copy link
Member

@Gavin-Niederman Gavin-Niederman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than a few things.

Comment on lines +176 to +183
pub fn from_dimensions(origin: impl Into<Point2<i16>>, width: u16, height: u16) -> Self {
let origin = origin.into();
Self {
x0: start_x,
y0: start_y + 0x20,
x1: end_x,
y1: end_y + 0x20,
start: origin,
end: Point2 {
x: origin.x + (width as i16),
y: origin.y + (height as i16),
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be convenient to provide an API for creating a rectangle centered at a point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that these changes may be an accident.

Copy link
Member

@Gavin-Niederman Gavin-Niederman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Gavin-Niederman Gavin-Niederman merged commit e234638 into main May 4, 2024
8 checks passed
@Gavin-Niederman Gavin-Niederman deleted the refactor/screen-drawing branch May 4, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Screen API is in need of a refactor.
2 participants