Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
Modify Radial to be reducible to an Arc
Browse files Browse the repository at this point in the history
  • Loading branch information
Meiguro committed Feb 28, 2016
1 parent 0da98c1 commit 4db6cd0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 10 additions & 9 deletions src/simply/simply_stage.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,19 @@ static void radial_element_draw(GContext *ctx, SimplyStage *self, SimplyElementR
const GOvalScaleMode scale_mode = GOvalScaleModeFitCircle;
const int32_t angle_start = DEG_TO_TRIGANGLE(element->angle_start);
const int32_t angle_end = DEG_TO_TRIGANGLE(element->angle_end);
const GRect *frame = &element->rect.common.frame;
if (element->rect.common.background_color.a) {
graphics_fill_radial(ctx, element->rect.common.frame, scale_mode, element->rect.radius,
angle_start, angle_end);
graphics_fill_radial(ctx, *frame, scale_mode, element->rect.radius, angle_start, angle_end);
}
if (element->rect.common.border_color.a && element->rect.common.border_width) {
graphics_draw_arc(ctx, element->rect.common.frame, scale_mode, angle_start, angle_end);
GRect inner_frame = grect_inset(element->rect.common.frame, GEdgeInsets(element->rect.radius));
prv_draw_line_polar(ctx, &element->rect.common.frame, &inner_frame, scale_mode, angle_start);
prv_draw_line_polar(ctx, &element->rect.common.frame, &inner_frame, scale_mode, angle_end);
if (inner_frame.size.w) {
graphics_draw_arc(ctx, inner_frame, GOvalScaleModeFitCircle,
angle_start, angle_end);
graphics_draw_arc(ctx, *frame, scale_mode, angle_start, angle_end);
if (element->rect.radius) {
GRect inner_frame = grect_inset(*frame, GEdgeInsets(element->rect.radius));
if (inner_frame.size.w) {
prv_draw_line_polar(ctx, frame, &inner_frame, scale_mode, angle_start);
prv_draw_line_polar(ctx, frame, &inner_frame, scale_mode, angle_end);
graphics_draw_arc(ctx, inner_frame, GOvalScaleModeFitCircle, angle_start, angle_end);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/simply/simply_stage.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ struct SimplyElementRect {
uint16_t radius;
};

typedef struct SimplyElementRect SimplyElementCircle;

typedef struct SimplyElementRadial SimplyElementRadial;

struct SimplyElementRadial {
Expand All @@ -73,8 +75,6 @@ struct SimplyElementRadial {
uint16_t angle_end;
};

typedef struct SimplyElementRect SimplyElementCircle;

typedef struct SimplyElementText SimplyElementText;

struct SimplyElementText {
Expand Down

0 comments on commit 4db6cd0

Please sign in to comment.