TizenRefApp-7103 getResizedSize() was checked and fixed 94/88094/5
authorOleksander Kostenko <o.kostenko@samsung.com>
Tue, 13 Sep 2016 08:58:59 +0000 (11:58 +0300)
committerAndrey Klimenko <and.klimenko@samsung.com>
Tue, 13 Sep 2016 13:42:20 +0000 (06:42 -0700)
Change-Id: Ie98110aa7397fa889fb1e9e7e4d9b7bdb29d813b
Signed-off-by: Oleksander Kostenko <o.kostenko@samsung.com>
src/Viewer/View/src/SmilVideoItemView.cpp

index e3db136..f638ea1 100644 (file)
@@ -22,64 +22,33 @@ using namespace Msg;
 
 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
     }
 }