Well, I've spent considerable time trying to get decorations working well.
I've tried two approaches: 1) using window grouping and 2) using specialized
surfaces in the core window object. Approach #1 was fairly easy and very
nice from a performance standpoint. Approach #2 wasn't too difficult either,
but I could not get it to out-perform approach #1. In fact, it was quite a
bit worse (noticable lag when dragging windows). This slow down is due to
changes I had to make in update_region(...). So if someone could come up
with a better algorithm then mine they should be able to improve
performance.

Ok, now for the nitty gritty to approach #2. My implementation was pretty
simple. Each window was given an array of four(one for each side)
CoreWindowDecorations (a struct with a surface,x,y,w,h). I had to modify
several functions, but the only one that impacted performance was
update_region(...). I modified it so that it not only looped through all the
windows looking for intersections, but to loop through all windows and their
decorative surfaces (if any). It then uses the existing algorithm to decide
whether or not regions exist on the left,top,right,or bottom that need to
have update_region called on them.

Originally, update_region had a parameter "start" which told it which window
it should start iterating at. Now, there are two parameters to tell it where
to start. One tells it which window to start with and the other is the side
to start with. A side value of -1 means start with the given main window. If
no intersection is found with the window, then "side" is incremented to "0"
and we start looking for intersections with the sides. Once we run out of
sides, "side" is set back to -1 and window is decremented.

This is a simple change that enabled me to keep most of the other logic the
same for update_region. Unfortunately, it is about 5-10% (based on my CPU
utlization while dragging a window around) slower than just using window
groupings. I also tried all sorts of special cases, but none of them
improved performance much (if at all). For example, I made the assumption
that sides of the same window couldn't overlap, which meant once I found a
side intersection, I could move on to the next window without having to loop
through the other sides (this should be an advantage over window grouping
since it has to loop through all windows).

Anyway, if anyone has any suggestions let me know. If you'd like to see the
update_region that I've been hacking on email me. I apologize if this
doesn't make any sense :)

Stephen



-- 
Info:  To unsubscribe send a mail to [EMAIL PROTECTED] with 
"unsubscribe directfb-dev" as subject.

Reply via email to