r100/r200: fix Y coord flipping in accelerated blits
authorAlex Deucher <alexdeucher@gmail.com>
Wed, 20 Jan 2010 00:13:26 +0000 (19:13 -0500)
committerAlex Deucher <alexdeucher@gmail.com>
Wed, 20 Jan 2010 00:13:26 +0000 (19:13 -0500)
src/mesa/drivers/dri/r200/r200_blit.c
src/mesa/drivers/dri/radeon/radeon_blit.c

index 8d9c976916866f3e6a1ac48cb7bf893e793b4035..f899f7efdcead9c29584c83e044cdc1644942bf5 100644 (file)
@@ -241,9 +241,8 @@ static inline void calc_tex_coords(float img_width, float img_height,
     buf[3] = buf[2] + reg_height / img_height;
     if (flip_y)
     {
-        float tmp = buf[2];
-        buf[2] = 1.0 - buf[3];
-        buf[3] = 1.0 - tmp;
+        buf[2] = 1.0 - buf[1];
+        buf[3] = 1.0 - buf[3];
     }
 }
 
@@ -266,17 +265,17 @@ static inline void emit_draw_packet(struct r200_context *r200,
     verts[0] = dst_x_offset;
     verts[1] = dst_y_offset + reg_height;
     verts[2] = texcoords[0];
-    verts[3] = texcoords[2];
+    verts[3] = texcoords[3];
 
     verts[4] = dst_x_offset + reg_width;
     verts[5] = dst_y_offset + reg_height;
     verts[6] = texcoords[1];
-    verts[7] = texcoords[2];
+    verts[7] = texcoords[3];
 
     verts[8] = dst_x_offset + reg_width;
     verts[9] = dst_y_offset;
     verts[10] = texcoords[1];
-    verts[11] = texcoords[3];
+    verts[11] = texcoords[2];
 
     BEGIN_BATCH(14);
     OUT_BATCH(R200_CP_CMD_3D_DRAW_IMMD_2 | (12 << 16));
index c40f21c7744164990dc3fc45f8019db4bd6afa64..0df4fbb33c530c7d9e3d81b569b4ad5323727a3d 100644 (file)
@@ -234,9 +234,8 @@ static inline void calc_tex_coords(float img_width, float img_height,
     buf[3] = buf[2] + reg_height / img_height;
     if (flip_y)
     {
-        float tmp = buf[2];
-        buf[2] = 1.0 - buf[3];
-        buf[3] = 1.0 - tmp;
+        buf[2] = 1.0 - buf[2];
+        buf[3] = 1.0 - buf[3];
     }
 }
 
@@ -259,17 +258,17 @@ static inline void emit_draw_packet(struct r100_context *r100,
     verts[0] = dst_x_offset;
     verts[1] = dst_y_offset + reg_height;
     verts[2] = texcoords[0];
-    verts[3] = texcoords[2];
+    verts[3] = texcoords[3];
 
     verts[4] = dst_x_offset + reg_width;
     verts[5] = dst_y_offset + reg_height;
     verts[6] = texcoords[1];
-    verts[7] = texcoords[2];
+    verts[7] = texcoords[3];
 
     verts[8] = dst_x_offset + reg_width;
     verts[9] = dst_y_offset;
     verts[10] = texcoords[1];
-    verts[11] = texcoords[3];
+    verts[11] = texcoords[2];
 
     BEGIN_BATCH(15);
     OUT_BATCH(RADEON_CP_PACKET3_3D_DRAW_IMMD | (13 << 16));