summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLajos Molnar <molnar@ti.com>2011-09-29 15:49:54 -0500
committerErik Gilling <konkers@android.com>2011-10-11 17:52:52 -0700
commit2704d381ccfba0fe96e61cd368507506c3adfaca (patch)
tree884036e451cdea93d1e5b2dff73ae81665285e58
parentd4599029522592f46eccf9d57add7ebd7d23fdd1 (diff)
downloadhardware_ti_omap4xxx-2704d381ccfba0fe96e61cd368507506c3adfaca.zip
hardware_ti_omap4xxx-2704d381ccfba0fe96e61cd368507506c3adfaca.tar.gz
hardware_ti_omap4xxx-2704d381ccfba0fe96e61cd368507506c3adfaca.tar.bz2
hwc: simplify: use macros for getting width and height of hwc_rect
Change-Id: I5fbccdb3b9504d1fe3480da59578909e1c233d83 Signed-off-by: Lajos Molnar <molnar@ti.com>
-rw-r--r--hwc/hwc.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/hwc/hwc.c b/hwc/hwc.c
index 8bd0f96..e9f53f3 100644
--- a/hwc/hwc.c
+++ b/hwc/hwc.c
@@ -41,6 +41,9 @@
#define max(a, b) ( { typeof(a) __a = (a), __b = (b); __a > __b ? __a : __b; } )
#define swap(a, b) do { typeof(a) __a = (a); (a) = (b); (b) = __a; } while (0)
+#define WIDTH(rect) ((rect).right - (rect).left)
+#define HEIGHT(rect) ((rect).bottom - (rect).top)
+
#include <video/dsscomp.h>
#include "hal_public.h"
@@ -185,14 +188,13 @@ static int omap4_hwc_is_valid_format(int format)
static int scaled(hwc_layer_t *layer)
{
- int w = layer->sourceCrop.right - layer->sourceCrop.left;
- int h = layer->sourceCrop.bottom - layer->sourceCrop.top;
+ int w = WIDTH(layer->sourceCrop);
+ int h = HEIGHT(layer->sourceCrop);
if (layer->transform & HWC_TRANSFORM_ROT_90)
swap(w, h);
- return (layer->displayFrame.right - layer->displayFrame.left != w ||
- layer->displayFrame.bottom - layer->displayFrame.top != h);
+ return WIDTH(layer->displayFrame) != w || HEIGHT(layer->displayFrame) != h;
}
static int sync_id = 0;
@@ -322,14 +324,14 @@ omap4_hwc_setup_layer(omap4_hwc_device_t *hwc_dev, struct dss2_ovl_info *ovl,
/* display position */
oc->win.x = layer->displayFrame.left;
oc->win.y = layer->displayFrame.top;
- oc->win.w = layer->displayFrame.right - layer->displayFrame.left;
- oc->win.h = layer->displayFrame.bottom - layer->displayFrame.top;
+ oc->win.w = WIDTH(layer->displayFrame);
+ oc->win.h = HEIGHT(layer->displayFrame);
/* crop */
oc->crop.x = layer->sourceCrop.left;
oc->crop.y = layer->sourceCrop.top;
- oc->crop.w = layer->sourceCrop.right - layer->sourceCrop.left;
- oc->crop.h = layer->sourceCrop.bottom - layer->sourceCrop.top;
+ oc->crop.w = WIDTH(layer->sourceCrop);
+ oc->crop.h = HEIGHT(layer->sourceCrop);
}
const float m_unit[2][3] = { { 1., 0., 0. }, { 0., 1., 0. } };
@@ -534,10 +536,10 @@ static int omap4_hwc_can_scale(int src_w, int src_h, int dst_w, int dst_h, int i
static int omap4_hwc_can_scale_layer(omap4_hwc_device_t *hwc_dev, hwc_layer_t *layer, IMG_native_handle_t *handle)
{
- int src_w = layer->sourceCrop.right - layer->sourceCrop.left;
- int src_h = layer->sourceCrop.bottom - layer->sourceCrop.top;
- int dst_w = layer->displayFrame.right - layer->displayFrame.left;
- int dst_h = layer->displayFrame.bottom - layer->displayFrame.top;
+ int src_w = WIDTH(layer->sourceCrop);
+ int src_h = HEIGHT(layer->sourceCrop);
+ int dst_w = WIDTH(layer->displayFrame);
+ int dst_h = HEIGHT(layer->displayFrame);
/* account for 90-degree rotation */
if (layer->transform & HWC_TRANSFORM_ROT_90)