Re: [PATCH] When converting from double to fixed, round carefully.

2008-11-14 Thread Keith Packard
On Fri, 2008-11-14 at 23:31 +0100, Clemens Eisserer wrote:
> Hi,
> 
> > Perhaps we should extend Render to include 64-bit floating point 
> > transforms...
> That would be really great.
> I am doing some tricks with mask-transformations having quite a hard
> time by the fixed-point limitations, especially for large scales (like
> 100x).

A patch would be welcome; the internals are mostly ready now.

-- 
[EMAIL PROTECTED]


signature.asc
Description: This is a digitally signed message part
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Re: [PATCH] When converting from double to fixed, round carefully.

2008-11-14 Thread Clemens Eisserer
Hi,

> Perhaps we should extend Render to include 64-bit floating point transforms...
That would be really great.
I am doing some tricks with mask-transformations having quite a hard
time by the fixed-point limitations, especially for large scales (like
100x).

- Clemens
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


[PATCH] When converting from double to fixed, round carefully.

2008-11-14 Thread Keith Packard
This reduces the matrix representation error after inverting a
transformation matrix (although it doesn't eliminate it entirely).

Perhaps we should extend Render to include 64-bit floating point transforms...
---
 render/matrix.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/render/matrix.c b/render/matrix.c
index 6e50205..0d5d962 100644
--- a/render/matrix.c
+++ b/render/matrix.c
@@ -72,9 +72,9 @@ PictureTransformPoint3d (PictTransformPtr transform,
return FALSE;
result.vector[j] = (xFixed) v;
 }
+*vector = result;
 if (!result.vector[2])
return FALSE;
-*vector = result;
 return TRUE;
 }
 
@@ -286,7 +286,8 @@ from_doubles (PictTransformPtr t, double m[3][3])
double  d = m[j][i];
if (d < -32767.0 || d > 32767.0)
return FALSE;
-   t->matrix[j][i] = pixman_double_to_fixed (d);
+   d = d * 65536.0 + 0.5;
+   t->matrix[j][i] = (xFixed) floor (d);
}
 return TRUE;
 }
@@ -294,7 +295,7 @@ from_doubles (PictTransformPtr t, double m[3][3])
 static Bool
 invert (double r[3][3], double m[3][3])
 {
-double  det, norm;
+double  det;
 inti, j;
 static int a[3] = { 2, 2, 1 };
 static int b[3] = { 1, 0, 0 };
-- 
1.5.6.5

___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg