[PULL] Surface transformations v1

Pekka Paalanen ppaalanen at gmail.com
Fri Jan 27 07:07:16 PST 2012


Hi Kristian, and everyone,

this is the bulk of the surface transformations work. For
non-transformed surfaces, it should not regress. A quick Valgrind run
showed no new issues.

Surfaces can now have any number of arbitrary projective-linear (4x4
matrix) transformations. The transformations are used in drawing the
surface and relaying input event coordinates. Damage and repaint
regions are taken care of as well. For now, this is intended to be used
for 2D-to-2D transformations only.

This series also includes X/MIT-like licenced code for inverting a 4x4
matrix by LU-decomposition. I could not find one in the web, so I
implemented it from a book (*not* Numerical Recipes in C or C++, since
they impose licence issues). The reference is in the source. Anyone
working on their hobby graphics engine might be interested ;-)
For testing the matrix inversion alone, there is a standalone unit test
application.

To stress test the surface transformations, Weston now has a debug
feature: if you press Super+Alt and left-drag a surface with a mouse,
it rotates. This is just a debug feature, and has some rough edges.

For testing input coordinate transformations, there is a new demo
application called clickdot. It simply shows a cross where you clicked,
and it should match the mouse cursor hotspot.

The major contribution of this series is cleaning up the coordinate
systems and making coordinate transformations explicit.

Things known broken:

- Transforming surfaces with opaque regions usually results in some
  misrendering. In practice this concerns rotated RGB surfaces (as
  opposed to RGBA).

- move and resize orientation for rotated surfaces is wrong

- related surfaces, e.g. menus, are not transformed

- cursors are not transformed

I intend to continue fixing the remaining issues, at least opaques and
move & resize.

If someone wonders, why on Earth am I doing this, there are two major
reasons:

 * we need this to have zoom effect and fullscreen scaling to work
   simultaneously in a uniform way

 * it's bling, like wscreensaver ;-)


The following changes since commit 804e05185b65b3ccff59586be916c8ff6acf3b4f:

  cairo-util: Don't anger png.h by including setjmp.h (2012-01-26 11:36:17 -0500)

are available in the git repository at:
  git://git.collabora.co.uk/git/user/pq/wayland-demos.git transform-v1

Pekka Paalanen (30):
      compositor: implement a stack of surface transformations
      util: document matrices
      compositor: move matrix code to separate files
      compositor: drop inverse matrix from weston_transform
      compositor: implement inverse matrix transformation
      tests: add matrix-test
      update git ignores
      compositor: simplify the matrix inversion API
      clickdot: a copy of resizor
      clickdot: implement the purpose
      compositor: apply full transformation to input coordinates
      shell: add key binding for rotating a surface
      compositor: handle non-invertible surface transformations
      compositor: restructure weston_surface::transform
      compositor: rewrite draw and input coordinate transformations
      compositor: remove unused *_uniform members
      compositor: disable attrib arrays after use
      compositor: honour repaint regions with transformed surfaces
      compositor: make position a surface transformation
      compositor: move weston_surface::x,y into geometry
      compositor-drm: do not scan out transformed surfaces
      compositor: fix zoom origin
      compositor: add weston_surface bounding box
      compositor: move weston_surface::width,height into geometry
      compositor: weston_surface_draw() to use bounding box
      compositor: weston_output_set_cursor() to use bounding box
      compositor: weston_surface_assign_output() to use bounding box
      compositor: use bounding box for damage regions
      compositor: make overlap computation use the boundingbox
      Collabora copyright updates

 Makefile.am          |    2 +-
 clients/.gitignore   |    6 +-
 clients/Makefile.am  |    4 +
 clients/clickdot.c   |  181 +++++++++++++++++++++
 configure.ac         |    6 +-
 src/.gitignore       |    2 +-
 src/Makefile.am      |    2 +
 src/compositor-drm.c |   25 ++--
 src/compositor.c     |  409 +++++++++++++++++++++++++++++++++---------------
 src/compositor.h     |   66 ++++++---
 src/matrix.c         |  250 +++++++++++++++++++++++++++++
 src/matrix.h         |   64 ++++++++
 src/shell.c          |  240 +++++++++++++++++++++++------
 src/tablet-shell.c   |   23 ++-
 src/util.c           |   85 ++---------
 tests/.gitignore     |    2 +
 tests/Makefile.am    |   15 ++
 tests/matrix-test.c  |  422 ++++++++++++++++++++++++++++++++++++++++++++++++++
 18 files changed, 1511 insertions(+), 293 deletions(-)
 create mode 100644 clients/clickdot.c
 create mode 100644 src/matrix.c
 create mode 100644 src/matrix.h
 create mode 100644 tests/.gitignore
 create mode 100644 tests/Makefile.am
 create mode 100644 tests/matrix-test.c


Thanks,
pq


More information about the wayland-devel mailing list