diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-12-03 01:16:16 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-12-03 01:16:16 +0000 |
commit | 23437fe6769322d48cc3d264660717475b5d0d74 (patch) | |
tree | cfb0b0cce9c46713a2b788ccd87ea35f271ba850 /src | |
parent | 0bb135c40e5ac1bf7593ec1d68d2815cbf47aa25 (diff) |
i965: Use reciprocal scale factors to avoid the divide per-vertex-element
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/i965_render.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/i965_render.c b/src/i965_render.c index 69e5653b..22e9f8b4 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -1713,8 +1713,8 @@ i965_prepare_composite(int op, PicturePtr source_picture, drm_intel_bo_unreference(composite_op->surface_state_binding_table_bo); composite_op->surface_state_binding_table_bo = surface_state_binding_table_bo; - intel->scale_units[0][0] = source->drawable.width; - intel->scale_units[0][1] = source->drawable.height; + intel->scale_units[0][0] = 1. / source->drawable.width; + intel->scale_units[0][1] = 1. / source->drawable.height; intel->transform[0] = source_picture->transform; composite_op->is_affine = intel_transform_is_affine(intel->transform[0]); @@ -1725,8 +1725,8 @@ i965_prepare_composite(int op, PicturePtr source_picture, intel->scale_units[1][1] = -1; } else { intel->transform[1] = mask_picture->transform; - intel->scale_units[1][0] = mask->drawable.width; - intel->scale_units[1][1] = mask->drawable.height; + intel->scale_units[1][0] = 1. / mask->drawable.width; + intel->scale_units[1][1] = 1. / mask->drawable.height; composite_op->is_affine &= intel_transform_is_affine(intel->transform[1]); } @@ -1897,13 +1897,13 @@ i965_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY, /* rect (x2,y2) */ vb[i++] = (float)(dstX + w); vb[i++] = (float)(dstY + h); - vb[i++] = src_x[2] / intel->scale_units[0][0]; - vb[i++] = src_y[2] / intel->scale_units[0][1]; + vb[i++] = src_x[2] * intel->scale_units[0][0]; + vb[i++] = src_y[2] * intel->scale_units[0][1]; if (!is_affine) vb[i++] = src_w[2]; if (has_mask) { - vb[i++] = mask_x[2] / intel->scale_units[1][0]; - vb[i++] = mask_y[2] / intel->scale_units[1][1]; + vb[i++] = mask_x[2] * intel->scale_units[1][0]; + vb[i++] = mask_y[2] * intel->scale_units[1][1]; if (!is_affine) vb[i++] = mask_w[2]; } @@ -1911,13 +1911,13 @@ i965_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY, /* rect (x1,y2) */ vb[i++] = (float)dstX; vb[i++] = (float)(dstY + h); - vb[i++] = src_x[1] / intel->scale_units[0][0]; - vb[i++] = src_y[1] / intel->scale_units[0][1]; + vb[i++] = src_x[1] * intel->scale_units[0][0]; + vb[i++] = src_y[1] * intel->scale_units[0][1]; if (!is_affine) vb[i++] = src_w[1]; if (has_mask) { - vb[i++] = mask_x[1] / intel->scale_units[1][0]; - vb[i++] = mask_y[1] / intel->scale_units[1][1]; + vb[i++] = mask_x[1] * intel->scale_units[1][0]; + vb[i++] = mask_y[1] * intel->scale_units[1][1]; if (!is_affine) vb[i++] = mask_w[1]; } @@ -1925,13 +1925,13 @@ i965_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY, /* rect (x1,y1) */ vb[i++] = (float)dstX; vb[i++] = (float)dstY; - vb[i++] = src_x[0] / intel->scale_units[0][0]; - vb[i++] = src_y[0] / intel->scale_units[0][1]; + vb[i++] = src_x[0] * intel->scale_units[0][0]; + vb[i++] = src_y[0] * intel->scale_units[0][1]; if (!is_affine) vb[i++] = src_w[0]; if (has_mask) { - vb[i++] = mask_x[0] / intel->scale_units[1][0]; - vb[i++] = mask_y[0] / intel->scale_units[1][1]; + vb[i++] = mask_x[0] * intel->scale_units[1][0]; + vb[i++] = mask_y[0] * intel->scale_units[1][1]; if (!is_affine) vb[i++] = mask_w[0]; } |