summaryrefslogtreecommitdiff
path: root/src/sna/gen7_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-12-06 16:55:00 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-12-06 16:55:00 +0000
commitd733f7d1f1dc343ac34c4a27ac99d71fc0572bc2 (patch)
tree89650c55e67b2fd19cc4e4425b88a7e4e5e9cb9b /src/sna/gen7_render.c
parent13f47008ec411609968c40b8ec34dd495f14c50b (diff)
sna/gen4+: Add common glyph-to-dst emitters
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen7_render.c')
-rw-r--r--src/sna/gen7_render.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 18c9036f..575d67af 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -1527,6 +1527,45 @@ gen7_emit_composite_primitive_affine_source(struct sna *sna,
}
fastcall static void
+gen7_emit_composite_primitive_identity_mask(struct sna *sna,
+ const struct sna_composite_op *op,
+ const struct sna_composite_rectangles *r)
+{
+ union {
+ struct sna_coordinate p;
+ float f;
+ } dst;
+ float msk_x, msk_y;
+ float w, h;
+ float *v;
+
+ msk_x = r->mask.x + op->mask.offset[0];
+ msk_y = r->mask.y + op->mask.offset[1];
+ w = r->width;
+ h = r->height;
+
+ v = sna->render.vertices + sna->render.vertex_used;
+ sna->render.vertex_used += 15;
+
+ dst.p.x = r->dst.x + r->width;
+ dst.p.y = r->dst.y + r->height;
+ v[0] = dst.f;
+ v[3] = (msk_x + w) * op->mask.scale[0];
+ v[9] = v[4] = (msk_y + h) * op->mask.scale[1];
+
+ dst.p.x = r->dst.x;
+ v[5] = dst.f;
+ v[13] = v[8] = msk_x * op->mask.scale[0];
+
+ dst.p.y = r->dst.y;
+ v[10] = dst.f;
+ v[14] = msk_y * op->mask.scale[1];
+
+ v[7] = v[2] = v[1] = 1;
+ v[12] = v[11] = v[6] = 0;
+}
+
+fastcall static void
gen7_emit_composite_primitive_identity_source_mask(struct sna *sna,
const struct sna_composite_op *op,
const struct sna_composite_rectangles *r)
@@ -2867,8 +2906,12 @@ gen7_render_composite(struct sna *sna,
tmp->is_affine &= tmp->mask.is_affine;
- if (tmp->src.transform == NULL && tmp->mask.transform == NULL)
- tmp->prim_emit = gen7_emit_composite_primitive_identity_source_mask;
+ if (tmp->src.transform == NULL && tmp->mask.transform == NULL) {
+ if (tmp->src.is_solid)
+ tmp->prim_emit = gen7_emit_composite_primitive_identity_mask;
+ else
+ tmp->prim_emit = gen7_emit_composite_primitive_identity_source_mask;
+ }
tmp->floats_per_vertex = 5 + 2 * !tmp->is_affine;
} else {