forked from len0rd/rockbox
Remove a viewport ambiguity by changing the screens width/heigth members into lcdwidth/lcdheight. Normal usercode should always use getwidth()/getheigth() as that returns the viewport width/height. Fixes issues that would have appeared in many places when introducing viewports with sizes != lcd sizes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17857 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
3d240f1e2a
commit
205f3df781
26 changed files with 165 additions and 149 deletions
|
@ -35,7 +35,7 @@ void black_background(struct screen* display){
|
|||
#endif
|
||||
{
|
||||
display->clear_display();
|
||||
display->fillrect(0,0,display->width,display->height);
|
||||
display->fillrect(0,0,display->getwidth(),display->getheight());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define ANALOG_SECOND_RADIUS(screen, round) \
|
||||
ANALOG_MINUTE_RADIUS(screen, round)
|
||||
#define ANALOG_MINUTE_RADIUS(screen, round) \
|
||||
(round?MIN(screen->height/2 -10, screen->width/2 -10):screen->height/2)
|
||||
(round?MIN(screen->getheight()/2 -10, screen->getwidth()/2 -10):screen->getheight()/2)
|
||||
#define ANALOG_HOUR_RADIUS(screen, round) \
|
||||
(2*ANALOG_MINUTE_RADIUS(screen, round)/3)
|
||||
|
||||
|
@ -52,8 +52,8 @@ void polar_to_cartesian_screen_centered(struct screen * display,
|
|||
int a, int r, int* x, int* y)
|
||||
{
|
||||
polar_to_cartesian(a, r, x, y);
|
||||
*x+=display->width/2;
|
||||
*y+=display->height/2;
|
||||
*x+=display->getwidth()/2;
|
||||
*y+=display->getheight()/2;
|
||||
}
|
||||
|
||||
void angle_to_square(int square_width, int square_height,
|
||||
|
@ -87,8 +87,8 @@ void angle_to_square_screen_centered(struct screen * display,
|
|||
int a, int* x, int* y)
|
||||
{
|
||||
angle_to_square(square_width, square_height, a, x, y);
|
||||
*x+=display->width/2;
|
||||
*y+=display->height/2;
|
||||
*x+=display->getwidth()/2;
|
||||
*y+=display->getheight()/2;
|
||||
}
|
||||
|
||||
void draw_hand(struct screen* display, int angle,
|
||||
|
@ -100,9 +100,9 @@ void draw_hand(struct screen* display, int angle,
|
|||
polar_to_cartesian_screen_centered(display, angle, radius, &x1, &y1);
|
||||
}else{/* fullscreen clock, hands describes square motions */
|
||||
int square_width, square_height;
|
||||
/* radius is defined smallest between width and height */
|
||||
/* radius is defined smallest between getwidth() and getheight() */
|
||||
square_height=radius;
|
||||
square_width=(radius*display->width)/display->height;
|
||||
square_width=(radius*display->getwidth())/display->getheight();
|
||||
angle_to_square_screen_centered(
|
||||
display, square_width, square_height, angle, &x1, &y1);
|
||||
}
|
||||
|
@ -140,14 +140,14 @@ void draw_counter(struct screen* display, struct counter* counter)
|
|||
counter_time.hour, counter_time.minute);
|
||||
getstringsize(smalldigits_bitmaps, buffer, &hour_str_w, &str_h);
|
||||
draw_string(display, smalldigits_bitmaps, buffer,
|
||||
display->width-hour_str_w,
|
||||
display->height-2*str_h);
|
||||
display->getwidth()-hour_str_w,
|
||||
display->getheight()-2*str_h);
|
||||
|
||||
rb->snprintf(buffer, 10, "%02d", counter_time.second);
|
||||
getstringsize(smalldigits_bitmaps, buffer, &second_str_w, &str_h);
|
||||
draw_string(display, smalldigits_bitmaps, buffer,
|
||||
display->width-(hour_str_w+second_str_w)/2,
|
||||
display->height-str_h);
|
||||
display->getwidth()-(hour_str_w+second_str_w)/2,
|
||||
display->getheight()-str_h);
|
||||
}
|
||||
|
||||
void 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)
|
|||
/* draws month and day */
|
||||
getstringsize(smalldigits_bitmaps, buffer, &monthday_str_w, &str_h);
|
||||
draw_string(display, smalldigits_bitmaps, buffer,
|
||||
0, display->height-year_line*str_h);
|
||||
0, display->getheight()-year_line*str_h);
|
||||
rb->snprintf(buffer, 10, "%04d", time->year);
|
||||
|
||||
/* draws year */
|
||||
getstringsize(smalldigits_bitmaps, buffer, &year_str_w, &str_h);
|
||||
draw_string(display, smalldigits_bitmaps, buffer,
|
||||
(monthday_str_w-year_str_w)/2,
|
||||
display->height-monthday_line*str_h);
|
||||
display->getheight()-monthday_line*str_h);
|
||||
}
|
||||
|
||||
void draw_border(struct screen* display, int skin)
|
||||
|
@ -181,7 +181,7 @@ void draw_border(struct screen* display, int skin)
|
|||
/* Draws square dots every 5 minutes */
|
||||
int i;
|
||||
int x, y;
|
||||
int size=display->height/50;/* size of the square dots */
|
||||
int size=display->getheight()/50;/* size of the square dots */
|
||||
if(size%2)/* a pair number */
|
||||
size++;
|
||||
for(i=0; i < 60; i+=5){
|
||||
|
@ -190,7 +190,7 @@ void draw_border(struct screen* display, int skin)
|
|||
ANALOG_MINUTE_RADIUS(display, skin), &x, &y);
|
||||
}else{
|
||||
angle_to_square_screen_centered(
|
||||
display, display->width/2-size/2, display->height/2-size/2,
|
||||
display, display->getwidth()/2-size/2, display->getheight()/2-size/2,
|
||||
MINUTE_ANGLE(i, 0), &x, &y);
|
||||
}
|
||||
display->fillrect(x-size/2, y-size/2, size, size);
|
||||
|
@ -222,15 +222,15 @@ void draw_hour(struct screen* display, struct time* time,
|
|||
|
||||
void draw_center_cover(struct screen* display)
|
||||
{
|
||||
display->hline((display->width/2)-1,
|
||||
(display->width/2)+1, (display->height/2)+3);
|
||||
display->hline((display->width/2)-3,
|
||||
(display->width/2)+3, (display->height/2)+2);
|
||||
display->fillrect((display->width/2)-4, (display->height/2)-1, 9, 3);
|
||||
display->hline((display->width/2)-3,
|
||||
(display->width/2)+3, (display->height/2)-2);
|
||||
display->hline((display->width/2)-1,
|
||||
(display->width/2)+1, (display->height/2)-3);
|
||||
display->hline((display->getwidth()/2)-1,
|
||||
(display->getwidth()/2)+1, (display->getheight()/2)+3);
|
||||
display->hline((display->getwidth()/2)-3,
|
||||
(display->getwidth()/2)+3, (display->getheight()/2)+2);
|
||||
display->fillrect((display->getwidth()/2)-4, (display->getheight()/2)-1, 9, 3);
|
||||
display->hline((display->getwidth()/2)-3,
|
||||
(display->getwidth()/2)+3, (display->getheight()/2)-2);
|
||||
display->hline((display->getwidth()/2)-1,
|
||||
(display->getwidth()/2)+1, (display->getheight()/2)-3);
|
||||
}
|
||||
|
||||
void analog_clock_draw(struct screen* display, struct time* time,
|
||||
|
|
|
@ -45,8 +45,8 @@ void binary_clock_draw(struct screen* display, struct time* time, int skin){
|
|||
char buffer[9];
|
||||
int i;
|
||||
const struct picture* binary_bitmaps = &(binary_skin[skin][display->screen_type]);
|
||||
int y_offset=(display->height-(binary_bitmaps->height*3))/2;
|
||||
int x_offset=(display->width-(binary_bitmaps->width*6))/2;
|
||||
int y_offset=(display->getheight()-(binary_bitmaps->height*3))/2;
|
||||
int x_offset=(display->getwidth()-(binary_bitmaps->width*6))/2;
|
||||
for(i=0;i<3;i++){
|
||||
print_binary(buffer, lines_values[i], 6);
|
||||
draw_string(display, binary_bitmaps, buffer, x_offset,
|
||||
|
|
|
@ -64,19 +64,22 @@ void digital_clock_draw(struct screen* display,
|
|||
}
|
||||
}
|
||||
getstringsize(digits_bitmaps, buffer, &str_w, &str_h);
|
||||
draw_string(display, digits_bitmaps, buffer, (display->width-str_w)/2, 0);
|
||||
draw_string(display, digits_bitmaps, buffer,
|
||||
(display->getwidth()-str_w)/2, 0);
|
||||
if(settings->digital.show_seconds){
|
||||
buffer_pos=0;
|
||||
buffer_printf(buffer, buffer_pos, "%02d", time->second);
|
||||
getstringsize(digits_bitmaps, buffer, &str_w, &str_h);
|
||||
draw_string(display, digits_bitmaps, buffer, (display->width-str_w)/2,
|
||||
draw_string(display, digits_bitmaps, buffer,
|
||||
(display->getwidth()-str_w)/2,
|
||||
digits_bitmaps->height);
|
||||
}
|
||||
if(settings->general.date_format!=NONE){
|
||||
format_date(buffer, time, settings->general.date_format);
|
||||
getstringsize(smalldigits_bitmaps, buffer, &str_w, &str_h);
|
||||
draw_string(display, smalldigits_bitmaps, buffer, (display->width-str_w)/2,
|
||||
display->height-smalldigits_bitmaps->height*2);
|
||||
draw_string(display, smalldigits_bitmaps, buffer,
|
||||
(display->getwidth()-str_w)/2,
|
||||
display->getheight()-smalldigits_bitmaps->height*2);
|
||||
}
|
||||
if(counter){
|
||||
struct time counter_time;
|
||||
|
@ -84,7 +87,7 @@ void digital_clock_draw(struct screen* display,
|
|||
rb->snprintf(buffer, 20, "%02d:%02d:%02d",
|
||||
counter_time.hour, counter_time.minute, counter_time.second);
|
||||
getstringsize(smalldigits_bitmaps, buffer, &str_w, &str_h);
|
||||
draw_string(display, smalldigits_bitmaps, buffer, (display->width-str_w)/2,
|
||||
display->height-str_h);
|
||||
draw_string(display, smalldigits_bitmaps, buffer,
|
||||
(display->getwidth()-str_w)/2, display->getheight()-str_h);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,11 +144,11 @@ void draw_logo(struct screen* display){
|
|||
void draw_message(struct screen* display, int msg, int y){
|
||||
const struct picture* message = &(messages[display->screen_type]);
|
||||
display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
||||
display->fillrect(0, display->height-message->height,
|
||||
display->width, message->height);
|
||||
display->fillrect(0, display->getheight()-message->height,
|
||||
display->getwidth(), message->height);
|
||||
display->set_drawmode(DRMODE_SOLID);
|
||||
vertical_picture_draw_sprite(display, message, msg,
|
||||
0, display->height-(message->height*y));
|
||||
0, display->getheight()-(message->height*y));
|
||||
}
|
||||
|
||||
void load_settings(void){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue