summaryrefslogtreecommitdiff
path: root/i965_drv_video/i965_render.c
diff options
context:
space:
mode:
authorZou Nan hai <nanhai.zou@intel.com>2009-08-07 10:42:13 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2009-08-07 10:43:36 +0800
commit3b220c845a4e0158d1d80f596e33fdc1af4f5766 (patch)
treefd6f0a7a2d6b657d74591ba0e6e5c10aeedaee69 /i965_drv_video/i965_render.c
parent2f21a30e2734ce0209b394c764fbd2f9d4b76130 (diff)
downloadlibva-3b220c845a4e0158d1d80f596e33fdc1af4f5766.tar.gz
i965_drv_video: fix rendering issue
Diffstat (limited to 'i965_drv_video/i965_render.c')
-rw-r--r--i965_drv_video/i965_render.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/i965_drv_video/i965_render.c b/i965_drv_video/i965_render.c
index 7e3f07c..f87218b 100644
--- a/i965_drv_video/i965_render.c
+++ b/i965_drv_video/i965_render.c
@@ -860,7 +860,8 @@ i965_render_upload_vertex(VADriverContextP ctx,
struct intel_region *dest_region = render_state->draw_region;
struct object_surface *obj_surface;
float *vb;
- float src_scale_x, src_scale_y;
+
+ float u1, v1, u2, v2;
int i, width, height;
int box_x1 = dest_region->x + destx;
int box_y1 = dest_region->y + desty;
@@ -872,26 +873,28 @@ i965_render_upload_vertex(VADriverContextP ctx,
width = obj_surface->width;
height = obj_surface->height;
- src_scale_x = ((float)srcw / width) / (float)destw;
- src_scale_y = ((float)srch / height) / (float)desth;
+ u1 = (float)srcx / width;
+ v1 = (float)srcy / height;
+ u2 = (float)(srcx + srcw) / width;
+ v2 = (float)(srcy + srch) / height;
dri_bo_map(render_state->vb.vertex_buffer, 1);
assert(render_state->vb.vertex_buffer->virtual);
vb = render_state->vb.vertex_buffer->virtual;
i = 0;
- vb[i++] = (destx + destw) * src_scale_x;
- vb[i++] = (desty + desth) * src_scale_y;
+ vb[i++] = u2;
+ vb[i++] = v2;
vb[i++] = (float)box_x2;
vb[i++] = (float)box_y2;
- vb[i++] = destx * src_scale_x;
- vb[i++] = (desty + desth) * src_scale_y;
+ vb[i++] = u1;
+ vb[i++] = v2;
vb[i++] = (float)box_x1;
vb[i++] = (float)box_y2;
- vb[i++] = destx * src_scale_x;
- vb[i++] = desty * src_scale_y;
+ vb[i++] = u1;
+ vb[i++] = v1;
vb[i++] = (float)box_x1;
vb[i++] = (float)box_y1;