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

Add ellipse routines. Fix #146 #365

Closed
wants to merge 10 commits into from
Closed

Add ellipse routines. Fix #146 #365

wants to merge 10 commits into from

Conversation

PeterTillema
Copy link
Contributor

@PeterTillema PeterTillema commented Mar 8, 2022

No description provided.

Copy link
Member

@adriweb adriweb left a comment

Choose a reason for hiding this comment

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

nice

src/graphx/graphx.h Outdated Show resolved Hide resolved
@runer112 runer112 self-requested a review March 8, 2022 12:14
@runer112 runer112 marked this pull request as draft March 8, 2022 12:15
@mateoconlechuga
Copy link
Member

For integer overflows, just say in the documentation what the maximum radius can be.

@PeterTillema PeterTillema changed the title WIP: Add ellipse routines Add ellipse routines Mar 14, 2022
* Draws an unclipped ellipse.
*
* This is measured from the top left origin of the screen.
* Performs faster than using gfx_FillEllipse, but can cause corruption if used outside the bounds of the screen.
Copy link
Member

Choose a reason for hiding this comment

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

gfx_FillEllipse -> gfx_Ellipse

* @param a The horizontal radius of the ellipse.
* @param b The vertical radius of the ellipse.
*/
void gfx_FillEllipse_NoClip(int x, int y, int a, int b);
Copy link
Member

@runer112 runer112 Mar 14, 2022

Choose a reason for hiding this comment

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

Please use the following types: uint24_t x, uint24_t y, uint8_t a, uint8_t b.

Also applies to gfx_Ellipse_NoClip.

Copy link
Member

Choose a reason for hiding this comment

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

Please use the following types: uint24_t x, uint24_t y, uint8_t a, uint8_t b.

Also applies to gfx_Ellipse_NoClip.

Pretty sure the radii should be uint24_t?

Copy link
Member

Choose a reason for hiding this comment

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

I checked the implementation beforehand. It only reads the radii as one byte values.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see a reason why the functions can't just use uint24_t and functionality can be added later. Restricting it now in the prototype doesn't seem like a good idea.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm... I guess that's true. It's probably a bit better that the radii be uint24_t then.

* @param a The horizontal radius of the ellipse.
* @param b The vertical radius of the ellipse.
*/
void gfx_FillEllipse(int x, int y, int a, int b);
Copy link
Member

@runer112 runer112 Mar 14, 2022

Choose a reason for hiding this comment

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

Please use the following types: int24_t x, int24_t y, uint8_t a, uint8_t b.

Also applies to gfx_Ellipse.

Copy link
Member

@mateoconlechuga mateoconlechuga Mar 14, 2022

Choose a reason for hiding this comment

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

Please use the following types: int24_t x, int24_t y, uint8_t a, uint8_t b.

Also applies to gfx_Ellipse.

Pretty sure the radii should be uint24_t?

@adriweb adriweb changed the title Add ellipse routines Add ellipse routines. Fix #146 Mar 14, 2022
@adriweb adriweb linked an issue Mar 14, 2022 that may be closed by this pull request
@mateoconlechuga
Copy link
Member

Note for PT_: When I say that the fact that only radii of less than 128 is trash, it is just that - I am not referencing your code, I truly appreciate the pull request and think it is well done, and I am only saying that the minor issue that it doesn't support large radii is just a defect that will have to be resolved at one point because users will want it in the future. I'm not being personal about it, and I regret pointing it out, I should have handled that better. Anyway, the rest of it looks good so it can be merged and functionality added later if no one else minds.

@mateoconlechuga
Copy link
Member

I have merged this PR in manually - I left the radii as uint8_t because it can be changed in the future as needed. Thanks for the PR, sorry I made such a mess of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Graphics function for drawing arcs
5 participants