-
Notifications
You must be signed in to change notification settings - Fork 15
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
Support path function to fulfill TinyVG rendering #74
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -670,7 +670,7 @@ void twin_clear_file(twin_file_t *file); | |
*/ | ||
|
||
#define twin_fixed_mul(a, b) ((twin_fixed_t) (((int64_t) (a) * (b)) >> 16)) | ||
#define twin_fixed_div(a, b) ((twin_fixed_t) ((((int64_t) (a)) << 16) / b)) | ||
#define twin_fixed_div(a, b) ((twin_fixed_t) ((((int64_t) (a)) << 16) / (b))) | ||
|
||
twin_fixed_t twin_fixed_sqrt(twin_fixed_t a); | ||
|
||
|
@@ -800,6 +800,7 @@ void twin_path_ellipse(twin_path_t *path, | |
twin_fixed_t y, | ||
twin_fixed_t x_radius, | ||
twin_fixed_t y_radius); | ||
|
||
void twin_path_arc(twin_path_t *path, | ||
twin_fixed_t x, | ||
twin_fixed_t y, | ||
|
@@ -808,6 +809,26 @@ void twin_path_arc(twin_path_t *path, | |
twin_angle_t start, | ||
twin_angle_t extent); | ||
|
||
void twin_path_arc_ellipse(twin_path_t *path, | ||
bool large_arc, | ||
bool sweep, | ||
twin_fixed_t radius_x, | ||
twin_fixed_t radius_y, | ||
twin_fixed_t cur_x, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use twin_point_t cur_point; Replace twin_fixed_t cur_x;
twin_fixed_t cur_y; The advantage of doing this is that it directly separates the function of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I have also considered replacing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK I got it, close this review, please. |
||
twin_fixed_t cur_y, | ||
twin_fixed_t target_x, | ||
twin_fixed_t target_y, | ||
twin_angle_t rotation); | ||
|
||
void twin_path_arc_circle(twin_path_t *path, | ||
bool large_arc, | ||
bool sweep, | ||
twin_fixed_t radius, | ||
twin_fixed_t cur_x, | ||
twin_fixed_t cur_y, | ||
twin_fixed_t target_x, | ||
twin_fixed_t target_y); | ||
|
||
void twin_path_rectangle(twin_path_t *path, | ||
twin_fixed_t x, | ||
twin_fixed_t y, | ||
|
@@ -1061,6 +1082,12 @@ void twin_path_curve(twin_path_t *path, | |
twin_fixed_t x3, | ||
twin_fixed_t y3); | ||
|
||
void twin_path_quadratic_curve(twin_path_t *path, | ||
twin_fixed_t x1, | ||
twin_fixed_t y1, | ||
twin_fixed_t x2, | ||
twin_fixed_t y2); | ||
|
||
/* | ||
* timeout.c | ||
*/ | ||
|
@@ -1098,6 +1125,10 @@ twin_fixed_t twin_tan(twin_angle_t a); | |
|
||
void twin_sincos(twin_angle_t a, twin_fixed_t *sin, twin_fixed_t *cos); | ||
|
||
twin_angle_t twin_atan2(twin_fixed_t y, twin_fixed_t x); | ||
|
||
twin_angle_t twin_acos(twin_fixed_t x); | ||
|
||
/* | ||
* widget.c | ||
*/ | ||
|
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 you generalize the handling for n_points = 3 and 4? That is, share code by avoiding duplication.