clip rect
Darren V Hart <[email protected]> Thu, 25 Sep 2003 17:36:44 -0600
| Newsgroups | gmane.comp.embedded.stk.gui.devel |
|---|---|
| Message-ID | <1064533003.30104.23.camel@brain> |
since *cough* Marc *cough* took it upon himself to change the symantics of clip_rect to use local coords instead of global coords we have a problem on our hands. The current draw mechanism starts with state and passes a clip_rect down to each child's draw routine, they set the clip rect to that unless its empty, in which case they set it to their rect(). This doesn't work once the clip_rect was changed to local coordinates. Now the surface::clip_rect() routine adds the offset to clip_rect, which is breaking (effectively adding the offset twice to the clip_rect, see ./test_app sdl). image_panel inside a viewport for example, the viewport sets the clip_rect to 10,10, then image_panel sets it to 20,20 (inadvertantly) and the image gets drawn at 20,20 instead of 10,10. I am currently tracking this down... will try to fix tonight. My current thoughts are these: surface::clip_rect(rectangle) will set the surface clip rect to the following rectangle: rectangle(offset()+rect.p1(), rect.p2()+offset()) This means the user (and drawing) will need to set the offset before setting the clip_rect, or they will not get what they expect. the clip_rect should be set using local corrdinates as it will be translated by the surface itself. I think this is what Marc intended. Darrem