Skip to content

Commit

Permalink
OMXImage: Avoid clamping resolution of photos to display size
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Apr 3, 2020
1 parent 2be649f commit 1d81463
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions xbmc/cores/omxplayer/OMXImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,10 @@ bool COMXImage::DecodeJpeg(const std::string& srcFile, const XFILE::auto_buffer

bool COMXImage::ClampLimits(unsigned int &width, unsigned int &height, unsigned int m_width, unsigned int m_height, bool transposed)
{
RESOLUTION_INFO& res_info = CDisplaySettings::GetInstance().GetResolutionInfo(CServiceBroker::GetWinSystem()->GetGfxContext().GetVideoResolution());
unsigned int owidth = width;
unsigned int oheight = height;
unsigned int max_width = width;
unsigned int max_height = height;
const unsigned int gui_width = transposed ? res_info.iHeight:res_info.iWidth;
const unsigned int gui_height = transposed ? res_info.iWidth:res_info.iHeight;
const float aspect = (float)m_width / m_height;
bool clamped = false;

Expand All @@ -154,13 +153,15 @@ bool COMXImage::ClampLimits(unsigned int &width, unsigned int &height, unsigned
}
}
max_width = max_height * 16/9;
}

if (gui_width)
max_width = std::min(max_width, gui_width);
if (gui_height)
max_height = std::min(max_height, gui_height);

RESOLUTION_INFO& res_info = CDisplaySettings::GetInstance().GetResolutionInfo(CServiceBroker::GetWinSystem()->GetGfxContext().GetVideoResolution());
const unsigned int gui_width = transposed ? res_info.iHeight:res_info.iWidth;
const unsigned int gui_height = transposed ? res_info.iWidth:res_info.iHeight;
if (gui_width)
max_width = std::min(max_width, gui_width);
if (gui_height)
max_height = std::min(max_height, gui_height);
}
max_width = std::min(max_width, 2048U);
max_height = std::min(max_height, 2048U);

Expand All @@ -177,6 +178,7 @@ bool COMXImage::ClampLimits(unsigned int &width, unsigned int &height, unsigned
clamped = true;
}

CLog::Log(LOGDEBUG, "%s: %dx%d %dx%d -> %dx%d clamped=%d", __func__, owidth, oheight, m_width, m_height, width, height, clamped);
return clamped;
}

Expand Down

0 comments on commit 1d81463

Please sign in to comment.