Skip to content

Commit

Permalink
Added private utility function to map a float display aspect, to the …
Browse files Browse the repository at this point in the history
…respective SDTV_ASPECT_* enum value.
  • Loading branch information
macrule authored and popcornmix committed Jul 3, 2015
1 parent 1d95389 commit 18ca889
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp
Expand Up @@ -60,7 +60,10 @@
# define DLOG(fmt, args...)
#endif

#if defined(TARGET_RASPBERRY_PI)
static void SetResolutionString(RESOLUTION_INFO &res);
static SDTV_ASPECT_T get_sdtv_aspect_from_display_aspect(float display_aspect);
#endif

CEGLNativeTypeRaspberryPI::CEGLNativeTypeRaspberryPI()
{
Expand Down Expand Up @@ -470,6 +473,25 @@ static void SetResolutionString(RESOLUTION_INFO &res)
res.dwFlags & D3DPRESENTFLAG_MODE3DTB ? " 3DTB" : "",
res.dwFlags & D3DPRESENTFLAG_MODE3DSBS ? " 3DSBS" : "");
}

static SDTV_ASPECT_T get_sdtv_aspect_from_display_aspect(float display_aspect)
{
SDTV_ASPECT_T aspect;
const float delta = 1e-3;
if(fabs(get_display_aspect_ratio(SDTV_ASPECT_16_9) - display_aspect) < delta)
{
aspect = SDTV_ASPECT_16_9;
}
else if(fabs(get_display_aspect_ratio(SDTV_ASPECT_14_9) - display_aspect) < delta)
{
aspect = SDTV_ASPECT_14_9;
}
else
{
aspect = SDTV_ASPECT_4_3;
}
return aspect;
}
#endif

bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions)
Expand Down

0 comments on commit 18ca889

Please sign in to comment.