summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-12-21 14:20:23 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-12-21 14:20:23 +0000
commitbdd0cca4e1192df0038621925c4e6243ba419a81 (patch)
tree3334b7c3f5a13a3b8a2757854cf0fc2ea0acdb00 /src
parent347c5a7b33729f1bedd408d2ef24756d51b66f1d (diff)
sna: Refactor test for a rotation matrix
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/gen4_vertex.c9
-rw-r--r--src/sna/sna.h6
2 files changed, 9 insertions, 6 deletions
diff --git a/src/sna/gen4_vertex.c b/src/sna/gen4_vertex.c
index b3022330..a70c3c81 100644
--- a/src/sna/gen4_vertex.c
+++ b/src/sna/gen4_vertex.c
@@ -691,8 +691,7 @@ void gen4_choose_composite_emitter(struct sna_composite_op *tmp)
DBG(("%s: identity source, identity mask\n", __FUNCTION__));
tmp->prim_emit = emit_primitive_identity_source_mask;
} else if (tmp->src.is_affine) {
- if (tmp->src.transform->matrix[0][1] == 0 &&
- tmp->src.transform->matrix[1][0] == 0) {
+ if (!sna_affine_transform_is_rotation(tmp->src.transform)) {
DBG(("%s: simple src, identity mask\n", __FUNCTION__));
tmp->src.scale[0] /= tmp->src.transform->matrix[2][2];
tmp->src.scale[1] /= tmp->src.transform->matrix[2][2];
@@ -713,8 +712,7 @@ void gen4_choose_composite_emitter(struct sna_composite_op *tmp)
DBG(("%s: identity src, no mask\n", __FUNCTION__));
tmp->prim_emit = emit_primitive_identity_source;
} else if (tmp->src.is_affine) {
- if (tmp->src.transform->matrix[0][1] == 0 &&
- tmp->src.transform->matrix[1][0] == 0) {
+ if (!sna_affine_transform_is_rotation(tmp->src.transform)) {
DBG(("%s: simple src, no mask\n", __FUNCTION__));
tmp->src.scale[0] /= tmp->src.transform->matrix[2][2];
tmp->src.scale[1] /= tmp->src.transform->matrix[2][2];
@@ -883,8 +881,7 @@ void gen4_choose_spans_emitter(struct sna_composite_spans_op *tmp)
} else if (tmp->base.src.transform == NULL) {
tmp->prim_emit = emit_spans_identity;
} else if (tmp->base.is_affine) {
- if (tmp->base.src.transform->matrix[0][1] == 0 &&
- tmp->base.src.transform->matrix[1][0] == 0) {
+ if (!sna_affine_transform_is_rotation(tmp->base.src.transform)) {
tmp->base.src.scale[0] /= tmp->base.src.transform->matrix[2][2];
tmp->base.src.scale[1] /= tmp->base.src.transform->matrix[2][2];
tmp->prim_emit = emit_spans_simple;
diff --git a/src/sna/sna.h b/src/sna/sna.h
index c7ebbd93..3abe36d2 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -619,6 +619,12 @@ bool sna_transform_is_integer_translation(const PictTransform *t,
int16_t *tx, int16_t *ty);
bool sna_transform_is_translation(const PictTransform *t,
pixman_fixed_t *tx, pixman_fixed_t *ty);
+static inline bool
+sna_affine_transform_is_rotation(const PictTransform *t)
+{
+ assert(sna_transform_is_affine(t));
+ return t->matrix[0][1] | t->matrix[1][0];
+}
static inline bool
sna_transform_equal(const PictTransform *a, const PictTransform *b)