[gsoc] webdraw - rio works

From: David Hoskin <root@davidrhoskin.com>
To: plan9-gsoc@googlegroups.com
Date: Fri, 13 Jun 2014 00:59:43 -0700
Subject: [gsoc] webdraw - rio works

Hi everyone,

A false assumption about how <canvas> graphics contexts are shared led
me to set up mutually exclusive clipping regions on screens with
multiple windows, preventing anything from being drawn.  Now that I am
confident in my drawmasked clipping code, I was able to remove this
fail-safe clipping entirely, and rio started displaying windows!

My initial implementation of windows used the Refnone refresh
discipline, with each window drawing directly to a rect in the
containing screen's canvas.  This made windows hard to move, and caused
problems with drawing to overlapping windows.

I changed all windows to use Refbackup and gave them all their own
backing image, and then used a simple painter's algorithm to redraw
the screen completely on each flush request.  This produced a correct
result, but was unbelievably slow and crashed my browser within
seconds.

For now, I'm using CSS to position each window's backing canvas
directly over the screen.  This works for the common case, but fails if
screens other than the root window are used, and does not allow
the data to be read to use the screen as the src image for some other
drawing operation.

Next up is to implement a lighter-weight drawing function that doesn't
need to create a full-blown intermediate <canvas>.  A simple drawY()
working directly on the pixel data should be trivial, since I don't
have to worry about multiple channel formats.  With an efficient
drawing method, I will be able to implement proper memlayer clipping.

A screenshot of rio is here:
http://davidrhoskin.com/gsoc/2014/img/rio-basic.png
Unfortunately, there's a bit of a bug: graphical clients grab the whole screen!

-- David