hwc: Fix scaling issue in copybit.

We should do scaling only in required dimension(s)
(width and/or height).

Change-Id: Iaf6e9ae09351dadb91f60f02730338fb01545a73
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 38c0810..41c7f62 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 The Android Open Source Project
- * Copyright (C) 2012-2014, The Linux Foundation. All rights reserved.
+ * Copyright (C) 2012-2015, The Linux Foundation. All rights reserved.
  *
  * Not a Contribution.
  *
@@ -926,16 +926,18 @@
        int tmp_w =  src_crop_width;
        int tmp_h =  src_crop_height;
 
-       if (dsdx > copybitsMaxScale || dtdy > copybitsMaxScale ){
+       if (dsdx > copybitsMaxScale)
          tmp_w = (int)((float)src_crop_width*copybitsMaxScale);
+       if (dtdy > copybitsMaxScale)
          tmp_h = (int)((float)src_crop_height*copybitsMaxScale);
-       }else if (dsdx < 1/copybitsMinScale ||dtdy < 1/copybitsMinScale ){
-         // ceil the tmp_w and tmp_h value to maintain proper ratio
-         // b/w src and dst (should not cross the desired scale limit
-         // due to float -> int )
+       // ceil the tmp_w and tmp_h value to maintain proper ratio
+       // b/w src and dst (should not cross the desired scale limit
+       // due to float -> int )
+       if (dsdx < 1/copybitsMinScale)
          tmp_w = (int)ceil((float)src_crop_width/copybitsMinScale);
+       if (dtdy < 1/copybitsMinScale)
          tmp_h = (int)ceil((float)src_crop_height/copybitsMinScale);
-       }
+
        ALOGD("%s:%d::tmp_w = %d,tmp_h = %d",__FUNCTION__,__LINE__,tmp_w,tmp_h);
 
        int usage = GRALLOC_USAGE_PRIVATE_IOMMU_HEAP;