[PATCH renderproto] Add floating point transforms

Keith Packard keithp at keithp.com
Fri Aug 15 08:55:18 PDT 2014


Fixed point coordinates don't provide reasonable precision for
transformation operations; the resulting transforms are often off by
several pixels.

Allow clients to represent the transformation using either fixed point
or floating point.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 configure.ac    |  2 +-
 render.h        |  5 ++++-
 renderproto.h   | 26 ++++++++++++++++++++++++++
 renderproto.txt | 42 ++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 71 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8154a3a..43d054f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([RenderProto], [0.11.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([RenderProto], [0.12.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 
 # Require xorg-macros: XORG_DEFAULT_OPTIONS
diff --git a/render.h b/render.h
index 7ecde3f..0f04cc6 100644
--- a/render.h
+++ b/render.h
@@ -77,7 +77,10 @@ typedef XID		PictFormat;
 #define X_RenderCreateLinearGradient        34
 #define X_RenderCreateRadialGradient        35
 #define X_RenderCreateConicalGradient       36
-#define RenderNumberRequests		    (X_RenderCreateConicalGradient+1)
+/* 0.12 */
+#define X_RenderSetPictureTransformFloat    37
+
+#define RenderNumberRequests		    (X_RenderSetPictureTransformFloat+1)
 
 #define BadPictFormat			    0
 #define BadPicture			    1
diff --git a/renderproto.h b/renderproto.h
index b7b72c1..4fe8da6 100644
--- a/renderproto.h
+++ b/renderproto.h
@@ -640,6 +640,32 @@ typedef struct {
 
 #define sz_xRenderCreateConicalGradientReq                 24
 
+/* 0.12 and higher */
+
+typedef struct {
+    float	matrix11;
+    float	matrix12;
+    float	matrix13;
+    float	matrix21;
+    float	matrix22;
+    float	matrix23;
+    float	matrix31;
+    float	matrix32;
+    float	matrix33;
+} xRenderTransformFloat;
+
+#define sz_xRenderTransformFloat 36
+
+typedef struct {
+    CARD8		        reqType;
+    CARD8		        renderReqType;
+    CARD16		        length B16;
+    Picture		        picture B32;
+    xRenderTransformFloat	transform;
+} xRenderSetPictureTransformFloatReq;
+
+#define sz_xRenderSetPictureTransformFloatReq	    44
+
 #undef Window
 #undef Drawable
 #undef Font
diff --git a/renderproto.txt b/renderproto.txt
index 9f1f231..fe5a233 100644
--- a/renderproto.txt
+++ b/renderproto.txt
@@ -1,6 +1,6 @@
 			The X Rendering Extension
-			      Version 0.11
-			       2009-07-15
+			      Version 0.12
+			       2014-08-13
 			      Keith Packard
 			    keithp at keithp.com
 
@@ -12,6 +12,10 @@ Rendering geometric figures is accomplished by client-side tessellation into
 either triangles or trapezoids.  Text is drawn by loading glyphs into the
 server and rendering sets of them.
 
+1.1 Version 0.12
+
+Version 0.12 adds 32-bit floating point transforms.
+
 2. Acknowledgments
 
 This extension was the work of many people, in particular:
@@ -252,6 +256,15 @@ ANIMCURSORELT	[
 			cursor:		CURSOR
 			delay:		CARD32
 		]
+6.1 Protocol Types added in Version 0.12
+
+FLOAT		32-bit IEEE 754 single precision float
+TRANSFORMFLOAT	[
+			p11, p12, p13:	FLOAT
+			p21, p22, p23:	FLOAT
+			p31, p32, p33:	FLOAT
+		]
+
 7. Standard PictFormats
 
 The server must support a Direct PictFormat with 8 bits each of red, green,
@@ -1143,6 +1156,29 @@ CreateConicalGradient
 	The colors are non premultiplied.
 
 	
+14.1 Extension requests added in Version 0.12
+
+SetPictureTransformFloat
+
+	picture:	PICTURE
+	transform:	TRANSFORMFLOAT
+
+	Errors:
+		Alloc, Value, Picture
+
+	This request changes the projective transformation used to
+	map coordinates when 'picture' is used as the source or
+	mask in any compositing operation.  The transform
+	maps from destination pixel geometry back to the source pixel
+	geometry.
+
+	Setting a transform via this request replaces any transform
+	set by SetPictureTransform. Similarly, setting a transform via
+	SetPictureTransform replaces any transform set with this
+	request.
+
+	The matrix must be invertable, else a Value error is generated.
+
 15. Extension Versioning
 
 The Render extension was developed in parallel with the implementation to
@@ -1206,3 +1242,5 @@ what each version before 1.0 implemented:
 	0.11:
 		Blend mode operators
 
+	0.12:
+		Floating point transforms
-- 
2.0.1



More information about the xorg-devel mailing list