hwc: Use proper typecasts

- Remove compiler warnings
- Use proper typecasts

Change-Id: I7391f32ae31283239f5cebb93b02f3ce3a5c99f3
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 3a4bada..0d74ab2 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -38,7 +38,7 @@
 
     region_iterator(hwc_region_t region) {
         mRegion = region;
-        r.end = region.numRects;
+        r.end = (int)region.numRects;
         r.current = 0;
         this->next = iterate;
     }
@@ -193,8 +193,8 @@
                          __FUNCTION__, dst_w,src_w,dst_h,src_h);
               return false;
             }
-            dx = (float)dst_w/src_w;
-            dy = (float)dst_h/src_h;
+            dx = (float)dst_w/(float)src_w;
+            dy = (float)dst_h/(float)src_h;
 
             if (dx > MAX_SCALE_FACTOR || dx < MIN_SCALE_FACTOR)
                 return false;
@@ -273,7 +273,7 @@
 
     //render buffer
     if (ctx->mMDP.version == qdutils::MDP_V3_0_4) {
-        last = list->numHwLayers - 1;
+        last = (uint32_t)list->numHwLayers - 1;
         renderBuffer = (private_handle_t *)list->hwLayers[last].handle;
     } else {
         renderBuffer = getCurrentRenderBuffer();
@@ -462,8 +462,8 @@
         return -1;
     }
 
-    float dsdx = (float)screen_w/src_crop_width;
-    float dtdy = (float)screen_h/src_crop_height;
+    float dsdx = (float)screen_w/(float)src_crop_width;
+    float dtdy = (float)screen_h/(float)src_crop_height;
 
     float scaleLimitMax = copybitsMaxScale * copybitsMaxScale;
     float scaleLimitMin = copybitsMinScale * copybitsMinScale;
@@ -494,14 +494,14 @@
        int tmp_h =  src_crop_height;
 
        if (dsdx > copybitsMaxScale || dtdy > copybitsMaxScale ){
-         tmp_w = src_crop_width*copybitsMaxScale;
-         tmp_h = src_crop_height*copybitsMaxScale;
+         tmp_w = (int)((float)src_crop_width*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 )
-         tmp_w = ceil(src_crop_width/copybitsMinScale);
-         tmp_h = ceil(src_crop_height/copybitsMinScale);
+         tmp_w = (int)ceil((float)src_crop_width/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);