Skip to content

Commit

Permalink
font: fix scaling for video modes with non square pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
Tupakaveli committed Dec 2, 2019
1 parent a6249cc commit 376edf0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/renderman.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ struct rm_mode
static struct rm_mode rm_mode_table[NUM_RM_VMODES] = {
// 24 bit color mode with black borders
{-1, 16, 640, -1, 1, 4, GS_INTERLACED, GS_FIELD, RM_ARATIO_4_3, 1, 1}, // AUTO
{GS_MODE_PAL, 16, 640, 512, 1, 4, GS_INTERLACED, GS_FIELD, RM_ARATIO_4_3, 11, 10}, // PAL@50Hz
{GS_MODE_NTSC, 16, 640, 448, 1, 4, GS_INTERLACED, GS_FIELD, RM_ARATIO_4_3, 54, 59}, // NTSC@60Hz
{GS_MODE_DTV_480P, 31, 640, 448, 1, 2, GS_NONINTERLACED, GS_FRAME, RM_ARATIO_4_3, 1, 1}, // DTV480P@60Hz
{GS_MODE_DTV_576P, 31, 640, 512, 1, 2, GS_NONINTERLACED, GS_FRAME, RM_ARATIO_4_3, 1, 1}, // DTV576P@50Hz
{GS_MODE_PAL, 16, 640, 512, 1, 4, GS_INTERLACED, GS_FIELD, RM_ARATIO_4_3, 16, 15}, // PAL@50Hz
{GS_MODE_NTSC, 16, 640, 448, 1, 4, GS_INTERLACED, GS_FIELD, RM_ARATIO_4_3, 14, 15}, // NTSC@60Hz
{GS_MODE_DTV_480P, 31, 640, 448, 1, 2, GS_NONINTERLACED, GS_FRAME, RM_ARATIO_4_3, 14, 15}, // DTV480P@60Hz
{GS_MODE_DTV_576P, 31, 640, 512, 1, 2, GS_NONINTERLACED, GS_FRAME, RM_ARATIO_4_3, 16, 15}, // DTV576P@50Hz
{GS_MODE_VGA_640_60, 31, 640, 480, 1, 2, GS_NONINTERLACED, GS_FRAME, RM_ARATIO_4_3, 1, 1}, // VGA640x480@60Hz
// 24 bit color mode full screen, multi-pass (2 passes, HIRES)
{GS_MODE_PAL, 16, 704, 576, 2, 4, GS_INTERLACED, GS_FIELD, RM_ARATIO_4_3, 11, 10}, // PAL@50Hz
{GS_MODE_NTSC, 16, 704, 480, 2, 4, GS_INTERLACED, GS_FIELD, RM_ARATIO_4_3, 54, 59}, // NTSC@60Hz
{GS_MODE_DTV_480P, 31, 704, 480, 2, 2, GS_NONINTERLACED, GS_FRAME, RM_ARATIO_4_3, 1, 1}, // DTV480P@60Hz
{GS_MODE_DTV_576P, 31, 704, 576, 2, 2, GS_NONINTERLACED, GS_FRAME, RM_ARATIO_4_3, 1, 1}, // DTV576P@50Hz
{GS_MODE_PAL, 16, 704, 576, 2, 4, GS_INTERLACED, GS_FIELD, RM_ARATIO_4_3, 12, 11}, // PAL@50Hz
{GS_MODE_NTSC, 16, 704, 480, 2, 4, GS_INTERLACED, GS_FIELD, RM_ARATIO_4_3, 10, 11}, // NTSC@60Hz
{GS_MODE_DTV_480P, 31, 704, 480, 2, 2, GS_NONINTERLACED, GS_FRAME, RM_ARATIO_4_3, 10, 11}, // DTV480P@60Hz
{GS_MODE_DTV_576P, 31, 704, 576, 2, 2, GS_NONINTERLACED, GS_FRAME, RM_ARATIO_4_3, 12, 11}, // DTV576P@50Hz
// 16 bit color mode full screen, multi-pass (3 passes, HIRES)
{GS_MODE_DTV_720P, 31, 1280, 720, 3, 1, GS_NONINTERLACED, GS_FRAME, RM_ARATIO_16_9, 1, 1}, // HDTV720P@60Hz
{GS_MODE_DTV_1080I, 31, 1920, 1080, 3, 1, GS_INTERLACED, GS_FRAME, RM_ARATIO_16_9, 1, 1}, // HDTV1080I@60Hz
Expand Down Expand Up @@ -432,7 +432,7 @@ int rmWideScale(int x)
// Get the pixel aspect ratio (how wide or narrow are the pixels?)
float rmGetPAR()
{
float fPAR = (float)rm_mode_table[vmode].PAR1 / (float)rm_mode_table[vmode].PAR2;
float fPAR = (float)rm_mode_table[vmode].PAR2 / (float)rm_mode_table[vmode].PAR1;

// In anamorphic mode the pixels are stretched to 16:9
if ((DAR == RM_ARATIO_16_9) && (rm_mode_table[vmode].aratio == RM_ARATIO_4_3))
Expand Down
4 changes: 2 additions & 2 deletions src/themes.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static void drawAttributeText(struct menu_list *menu, struct submenu_list *item,
if (mutableText->currentValue) {
char result[300];
if (mutableText->displayMode == DISPLAY_NEVER) {
if (!strcmp(mutableText->alias, "Size: ")) {
if (!strcmp(mutableText->alias, "Size: ")) {
snprintf(result, sizeof(result), "%s MiB", mutableText->currentValue);
if (mutableText->sizingMode == SIZING_NONE)
fntRenderString(elem->font, elem->posX, elem->posY, elem->aligned, 0, 0, result, elem->color);
Expand All @@ -207,7 +207,7 @@ static void drawAttributeText(struct menu_list *menu, struct submenu_list *item,
fntRenderString(elem->font, elem->posX, elem->posY, elem->aligned, elem->width, elem->height, mutableText->currentValue, elem->color);
}
} else {
if (!strcmp(mutableText->alias, "Size: "))
if (!strcmp(mutableText->alias, "Size: "))
snprintf(result, sizeof(result), "%s%s MiB", mutableText->alias, mutableText->currentValue);
else
snprintf(result, sizeof(result), "%s%s", mutableText->alias, mutableText->currentValue);
Expand Down

0 comments on commit 376edf0

Please sign in to comment.