blob: d8d32cf81a738b41117add1cd21902a069c12b05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
Right now every toplevel (direct descendent of a root window) window is
given an associated "view". The view is responsible for translating the
various offscreen window events to some on screen representation. In
it's current form that means just showing the window exactly as it was
before, verbatim. Eventually it will also mean doing translucency and
animations.
One interesting property of the views is that they track window
"damage". That means that they know when parts of their windows get
drawn off screen. The views should take advantage of this to only
update the on screen area that corresponds to the offscreen area that
got redrawn (the damaged areas).
Also, in order to facilitate a reasonable amount of large-sized windows,
we need to make sure that views that are completely occluded are
properly culled and not drawn. Figuring out the proper culling logic is
a bit tricky, because only the view knows its geometry at any given
instant, and each view doesn't know the geometry or relative stacking
order and opacity of its siblings.
One possible way to solve the problem is to institute a sort comparison
function that returns the difference of two views. This function would
return an area that encompasses the part of the first view that doesn't
overlap with the second view. In addition, the area would need to
account for (I mean, include) overlapping areas where the second view isn't
fully opaque. To figure out which part of a given view needs to be
redrawn, the application would call the comparison function for that
view against all of the views that are higher in the stack than it. The
view's initial bounding area would be intersected with each run of the
comparison function, and the remaining area is the area that isn't
occluded. This area should get passed to the view when requesting it
render itself. It would then only redraw damaged areas within the
passed in area.
It's important that the application keep a list of views with windows
that have been recently damaged and only do the comparison on those views
and on views that been recently exposed because of a higher stacked view
moving.
Also, the final rendered output of any given run should be
cached and redrawn initially next time around.
|