summaryrefslogtreecommitdiff
path: root/apps/plugins/clock/clock_draw_analog.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/clock/clock_draw_analog.c')
-rw-r--r--apps/plugins/clock/clock_draw_analog.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/apps/plugins/clock/clock_draw_analog.c b/apps/plugins/clock/clock_draw_analog.c
index dbed316322..391bd73519 100644
--- a/apps/plugins/clock/clock_draw_analog.c
+++ b/apps/plugins/clock/clock_draw_analog.c
@@ -28,7 +28,7 @@
28#define ANALOG_SECOND_RADIUS(screen, round) \ 28#define ANALOG_SECOND_RADIUS(screen, round) \
29 ANALOG_MINUTE_RADIUS(screen, round) 29 ANALOG_MINUTE_RADIUS(screen, round)
30#define ANALOG_MINUTE_RADIUS(screen, round) \ 30#define ANALOG_MINUTE_RADIUS(screen, round) \
31 (round?MIN(screen->height/2 -10, screen->width/2 -10):screen->height/2) 31 (round?MIN(screen->getheight()/2 -10, screen->getwidth()/2 -10):screen->getheight()/2)
32#define ANALOG_HOUR_RADIUS(screen, round) \ 32#define ANALOG_HOUR_RADIUS(screen, round) \
33 (2*ANALOG_MINUTE_RADIUS(screen, round)/3) 33 (2*ANALOG_MINUTE_RADIUS(screen, round)/3)
34 34
@@ -52,8 +52,8 @@ void polar_to_cartesian_screen_centered(struct screen * display,
52 int a, int r, int* x, int* y) 52 int a, int r, int* x, int* y)
53{ 53{
54 polar_to_cartesian(a, r, x, y); 54 polar_to_cartesian(a, r, x, y);
55 *x+=display->width/2; 55 *x+=display->getwidth()/2;
56 *y+=display->height/2; 56 *y+=display->getheight()/2;
57} 57}
58 58
59void angle_to_square(int square_width, int square_height, 59void angle_to_square(int square_width, int square_height,
@@ -87,8 +87,8 @@ void angle_to_square_screen_centered(struct screen * display,
87 int a, int* x, int* y) 87 int a, int* x, int* y)
88{ 88{
89 angle_to_square(square_width, square_height, a, x, y); 89 angle_to_square(square_width, square_height, a, x, y);
90 *x+=display->width/2; 90 *x+=display->getwidth()/2;
91 *y+=display->height/2; 91 *y+=display->getheight()/2;
92} 92}
93 93
94void draw_hand(struct screen* display, int angle, 94void draw_hand(struct screen* display, int angle,
@@ -100,9 +100,9 @@ void draw_hand(struct screen* display, int angle,
100 polar_to_cartesian_screen_centered(display, angle, radius, &x1, &y1); 100 polar_to_cartesian_screen_centered(display, angle, radius, &x1, &y1);
101 }else{/* fullscreen clock, hands describes square motions */ 101 }else{/* fullscreen clock, hands describes square motions */
102 int square_width, square_height; 102 int square_width, square_height;
103 /* radius is defined smallest between width and height */ 103 /* radius is defined smallest between getwidth() and getheight() */
104 square_height=radius; 104 square_height=radius;
105 square_width=(radius*display->width)/display->height; 105 square_width=(radius*display->getwidth())/display->getheight();
106 angle_to_square_screen_centered( 106 angle_to_square_screen_centered(
107 display, square_width, square_height, angle, &x1, &y1); 107 display, square_width, square_height, angle, &x1, &y1);
108 } 108 }
@@ -140,14 +140,14 @@ void draw_counter(struct screen* display, struct counter* counter)
140 counter_time.hour, counter_time.minute); 140 counter_time.hour, counter_time.minute);
141 getstringsize(smalldigits_bitmaps, buffer, &hour_str_w, &str_h); 141 getstringsize(smalldigits_bitmaps, buffer, &hour_str_w, &str_h);
142 draw_string(display, smalldigits_bitmaps, buffer, 142 draw_string(display, smalldigits_bitmaps, buffer,
143 display->width-hour_str_w, 143 display->getwidth()-hour_str_w,
144 display->height-2*str_h); 144 display->getheight()-2*str_h);
145 145
146 rb->snprintf(buffer, 10, "%02d", counter_time.second); 146 rb->snprintf(buffer, 10, "%02d", counter_time.second);
147 getstringsize(smalldigits_bitmaps, buffer, &second_str_w, &str_h); 147 getstringsize(smalldigits_bitmaps, buffer, &second_str_w, &str_h);
148 draw_string(display, smalldigits_bitmaps, buffer, 148 draw_string(display, smalldigits_bitmaps, buffer,
149 display->width-(hour_str_w+second_str_w)/2, 149 display->getwidth()-(hour_str_w+second_str_w)/2,
150 display->height-str_h); 150 display->getheight()-str_h);
151} 151}
152 152
153void draw_date(struct screen* display, struct time* time, int date_format) 153void draw_date(struct screen* display, struct time* time, int date_format)
@@ -166,14 +166,14 @@ void draw_date(struct screen* display, struct time* time, int date_format)
166 /* draws month and day */ 166 /* draws month and day */
167 getstringsize(smalldigits_bitmaps, buffer, &monthday_str_w, &str_h); 167 getstringsize(smalldigits_bitmaps, buffer, &monthday_str_w, &str_h);
168 draw_string(display, smalldigits_bitmaps, buffer, 168 draw_string(display, smalldigits_bitmaps, buffer,
169 0, display->height-year_line*str_h); 169 0, display->getheight()-year_line*str_h);
170 rb->snprintf(buffer, 10, "%04d", time->year); 170 rb->snprintf(buffer, 10, "%04d", time->year);
171 171
172 /* draws year */ 172 /* draws year */
173 getstringsize(smalldigits_bitmaps, buffer, &year_str_w, &str_h); 173 getstringsize(smalldigits_bitmaps, buffer, &year_str_w, &str_h);
174 draw_string(display, smalldigits_bitmaps, buffer, 174 draw_string(display, smalldigits_bitmaps, buffer,
175 (monthday_str_w-year_str_w)/2, 175 (monthday_str_w-year_str_w)/2,
176 display->height-monthday_line*str_h); 176 display->getheight()-monthday_line*str_h);
177} 177}
178 178
179void draw_border(struct screen* display, int skin) 179void draw_border(struct screen* display, int skin)
@@ -181,7 +181,7 @@ void draw_border(struct screen* display, int skin)
181 /* Draws square dots every 5 minutes */ 181 /* Draws square dots every 5 minutes */
182 int i; 182 int i;
183 int x, y; 183 int x, y;
184 int size=display->height/50;/* size of the square dots */ 184 int size=display->getheight()/50;/* size of the square dots */
185 if(size%2)/* a pair number */ 185 if(size%2)/* a pair number */
186 size++; 186 size++;
187 for(i=0; i < 60; i+=5){ 187 for(i=0; i < 60; i+=5){
@@ -190,7 +190,7 @@ void draw_border(struct screen* display, int skin)
190 ANALOG_MINUTE_RADIUS(display, skin), &x, &y); 190 ANALOG_MINUTE_RADIUS(display, skin), &x, &y);
191 }else{ 191 }else{
192 angle_to_square_screen_centered( 192 angle_to_square_screen_centered(
193 display, display->width/2-size/2, display->height/2-size/2, 193 display, display->getwidth()/2-size/2, display->getheight()/2-size/2,
194 MINUTE_ANGLE(i, 0), &x, &y); 194 MINUTE_ANGLE(i, 0), &x, &y);
195 } 195 }
196 display->fillrect(x-size/2, y-size/2, size, size); 196 display->fillrect(x-size/2, y-size/2, size, size);
@@ -222,15 +222,15 @@ void draw_hour(struct screen* display, struct time* time,
222 222
223void draw_center_cover(struct screen* display) 223void draw_center_cover(struct screen* display)
224{ 224{
225 display->hline((display->width/2)-1, 225 display->hline((display->getwidth()/2)-1,
226 (display->width/2)+1, (display->height/2)+3); 226 (display->getwidth()/2)+1, (display->getheight()/2)+3);
227 display->hline((display->width/2)-3, 227 display->hline((display->getwidth()/2)-3,
228 (display->width/2)+3, (display->height/2)+2); 228 (display->getwidth()/2)+3, (display->getheight()/2)+2);
229 display->fillrect((display->width/2)-4, (display->height/2)-1, 9, 3); 229 display->fillrect((display->getwidth()/2)-4, (display->getheight()/2)-1, 9, 3);
230 display->hline((display->width/2)-3, 230 display->hline((display->getwidth()/2)-3,
231 (display->width/2)+3, (display->height/2)-2); 231 (display->getwidth()/2)+3, (display->getheight()/2)-2);
232 display->hline((display->width/2)-1, 232 display->hline((display->getwidth()/2)-1,
233 (display->width/2)+1, (display->height/2)-3); 233 (display->getwidth()/2)+1, (display->getheight()/2)-3);
234} 234}
235 235
236void analog_clock_draw(struct screen* display, struct time* time, 236void analog_clock_draw(struct screen* display, struct time* time,