namespace
{
- const int viewerCanvasWidth = 656;
- const int videoWidth = 118;
- const int videoHeight = 144;
- const int videoCanvasHeightPortrait = videoWidth * 2; // QCIF width(176) size * 2
- const int videoCanvasHeightLandscape = videoHeight * 2; // QCIF height(144) size * 2
+ const int viewerMaxWidth = 656; // Max width size according to UI
+ const int viewerMaxHeight = 369; // Max height size according to UI
- // TODO: This func. port from old message application, check it.
void getResizedSize(int contentW, int contentH, int &w, int &h)
{
- int canvasWidth = viewerCanvasWidth;
- int canvasHeight = (contentW > contentH) ? videoCanvasHeightLandscape : videoCanvasHeightPortrait;
+ bool isLandscape = contentW > contentH;
- // Check image size
- if(contentW > canvasWidth)
+ if(isLandscape)
{
- w = canvasWidth;
- h = contentH * canvasWidth / contentW;
-
- if (h > canvasHeight)
+ w = viewerMaxWidth;
+ h = viewerMaxWidth * contentH / contentW;
+ if(h > viewerMaxHeight)
{
- w = contentW * canvasHeight / contentH;
- h = canvasHeight;
+ w = viewerMaxHeight * contentW / contentH;
+ h = viewerMaxHeight;
}
}
- else if(contentH > canvasHeight)
+ else
{
- w = contentW * canvasHeight / contentH;
- h = canvasHeight;
-
- if (w > canvasWidth)
+ w = viewerMaxHeight * contentH / contentW;
+ h = viewerMaxHeight;
+ if(w > viewerMaxWidth)
{
- w = canvasWidth;
- h = contentH * canvasWidth / contentW;
+ w = viewerMaxWidth;
+ h = viewerMaxWidth * contentW / contentH;
}
}
- else if(contentW <= canvasWidth && contentH <= canvasHeight)
- {
- w = contentW * canvasHeight / contentH;
- h = canvasHeight;
- }
-
- // Uncomment if needed:
- #if 0
- // Make size as even number becasue of hardware limitation
- if(w % 2)
- w = w - 1;
-
- if (h % 2)
- h = h - 1;
-
- // Make size as multiples of 16 because of hardware limitation, C110
- int remained = 0;
- if((remained = w % 16))
- w = w - remained;
-
- if((remained = h % 16))
- h = h - remained;
- #endif
}
}