compositor: q&d solution for surface drift
When a transformed (rotated) surface is continuously resized from its
top-left corner, its location will drift. This is due to accumulating
rounding errors in transforming an offset from surface-local to global
coordinates in surface_attach().
Diminish the drift down to unobservable level by changing the
weston_surface global position from integer to float.
The offset transformation is now done without rounding. To preserve the
precision, wl_shell::configure() interface must use floats, and so does
weston_surface_configure(), too.
The con of this patch is that it adds inconsistency to the surface
position coordinates: sometimes they are floats, sometimes integers.
diff --git a/src/compositor.h b/src/compositor.h
index 5d12d43..4495412 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -128,7 +128,7 @@
int32_t width, int32_t height);
void (*configure)(struct weston_shell *shell,
struct weston_surface *surface,
- int32_t x, int32_t y, int32_t width, int32_t height);
+ GLfloat x, GLfloat y, int32_t width, int32_t height);
void (*destroy)(struct weston_shell *shell);
};
@@ -228,7 +228,7 @@
* That includes the transformations referenced from the list.
*/
struct {
- int32_t x, y; /* surface translation on display */
+ GLfloat x, y; /* surface translation on display */
int32_t width, height;
/* struct weston_transform */
@@ -372,7 +372,7 @@
void
weston_surface_configure(struct weston_surface *surface,
- int x, int y, int width, int height);
+ GLfloat x, GLfloat y, int width, int height);
void
weston_surface_assign_output(struct weston_surface *surface);