summaryrefslogtreecommitdiff
path: root/hwc
diff options
context:
space:
mode:
authorLajos Molnar <molnar@ti.com>2011-09-29 15:43:59 -0500
committerErik Gilling <konkers@android.com>2011-10-11 17:52:36 -0700
commitd4599029522592f46eccf9d57add7ebd7d23fdd1 (patch)
treefb7afd41d639c9fa123eebb79a916f8f575a8b95 /hwc
parentf4524c063d4cc4afeb19b08966f51b42257d3acd (diff)
downloadomap4-aah-d4599029522592f46eccf9d57add7ebd7d23fdd1.tar.gz
hwc: simplify: use swap() macro
Change-Id: I3c4a83a64bee10d8810fd292bb53dfff7be8d664 Signed-off-by: Lajos Molnar <molnar@ti.com>
Diffstat (limited to 'hwc')
-rw-r--r--hwc/hwc.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/hwc/hwc.c b/hwc/hwc.c
index 16e6f59..8bd0f96 100644
--- a/hwc/hwc.c
+++ b/hwc/hwc.c
@@ -39,6 +39,7 @@
#define min(a, b) ( { typeof(a) __a = (a), __b = (b); __a < __b ? __a : __b; } )
#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)
#include <video/dsscomp.h>
@@ -187,11 +188,8 @@ static int scaled(hwc_layer_t *layer)
int w = layer->sourceCrop.right - layer->sourceCrop.left;
int h = layer->sourceCrop.bottom - layer->sourceCrop.top;
- if (layer->transform & HWC_TRANSFORM_ROT_90) {
- int t = w;
- w = h;
- h = t;
- }
+ 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);
@@ -425,12 +423,8 @@ static void set_ext_matrix(omap4_hwc_device_t *hwc_dev, int orig_w, int orig_h)
m_scale(hwc_dev->m, 1, -1, 1, 1);
if (hwc_dev->ext & EXT_ROTATION & 1) {
- int q = orig_w;
- orig_w = orig_h;
- orig_h = q;
- q = source_x;
- source_x = source_y;
- source_y = q;
+ swap(orig_w, orig_h);
+ swap(source_x, source_y);
}
/* get target size */
@@ -546,11 +540,8 @@ static int omap4_hwc_can_scale_layer(omap4_hwc_device_t *hwc_dev, hwc_layer_t *l
int dst_h = layer->displayFrame.bottom - layer->displayFrame.top;
/* account for 90-degree rotation */
- if (layer->transform & HWC_TRANSFORM_ROT_90) {
- int tmp = src_w;
- src_w = src_h;
- src_h = tmp;
- }
+ if (layer->transform & HWC_TRANSFORM_ROT_90)
+ swap(src_w, src_h);
/* NOTE: layers should be able to be scaled externally since
framebuffer is able to be scaled on selected external resolution */
@@ -990,11 +981,8 @@ static int omap4_hwc_prepare(struct hwc_composer_device *dev, hwc_layer_list_t*
/* full screen video */
o->cfg.win.x = 0;
o->cfg.win.y = 0;
- if (o->cfg.rotation & 1) {
- __u16 t = o->cfg.win.w;
- o->cfg.win.w = o->cfg.win.h;
- o->cfg.win.h = t;
- }
+ if (o->cfg.rotation & 1)
+ swap(o->cfg.win.w, o->cfg.win.h);
o->cfg.rotation = 0;
o->cfg.mirror = 0;