Correct calculation of the size of logo in list header.

- Function for calculating from infoviewer.cpp to pictureviewer.cpp moved
- Correct calculation in channellist.cpp, epgview.cpp and moviebrowser.cpp


git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1869 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Commit: 4f4f46a912
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2011-11-22 (Tue, 22 Nov 2011)
This commit is contained in:
Michael Liebmann
2011-11-21 23:11:52 +00:00
parent 250ebc278c
commit 971c3d4fb3
6 changed files with 44 additions and 57 deletions

View File

@@ -510,6 +510,23 @@ bool CPictureViewer::DisplayLogo (uint64_t channel_id, int posx, int posy, int w
return ret;
}
void CPictureViewer::rescaleImageDimensions(int *width, int *height, const int max_width, const int max_height, bool upscale)
{
float aspect;
if ((!upscale) && (*width <= max_width) && (*height <= max_height))
return;
aspect = (float)(*width) / (float)(*height);
if (((float)(*width) / (float)max_width) > ((float)(*height) / (float)max_height)) {
*width = max_width;
*height = (int)(max_width / aspect);
}else{
*height = max_height;
*width = (int)(max_height * aspect);
}
}
bool CPictureViewer::DisplayImage (const std::string & name, int posx, int posy, int width, int height)
{
/* TODO: cache or check for same */