Re: clip rect

Marc Strämke <[email protected]> 26 Sep 2003 19:02:06 +0200
Newsgroups gmane.comp.embedded.stk.gui.devel
Organization 3dApes
Message-ID <[email protected]>
--=-CYaLmL8HRT0PXx8NlTi0
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: quoted-printable

On Fri, 2003-09-26 at 01:36, Darren V Hart wrote:
> 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.
>=20
> 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.
>=20
> I am currently tracking this down... will try to fix tonight.  My
> current thoughts are these:
>=20
> surface::clip_rect(rectangle) will set the surface clip rect to the
> following rectangle:
>=20
> rectangle(offset()+rect.p1(), rect.p2()+offset())
>=20
> 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.
Actually my intetion was that we translate the clip rect by the offset,
but not at clip_rect SET time, but at usage/drawing time
>=20
> Darrem=20
>=20
>=20
> _______________________________________________
> Libstk mailing list
> [email protected]
> http://www.dvhart.com/cgi-bin/mailman/listinfo/libstk
--=20
Marc Str=E4mke <[email protected]>
3dApes

--=-CYaLmL8HRT0PXx8NlTi0
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iEYEABECAAYFAj90cQ0ACgkQbJphbnNXhAVKCACfbnNY30LojGOMgro/9fR2phH8
gT4An0KLYK0uplkWd/hjmSxxW6ziCzwh
=OPF7
-----END PGP SIGNATURE-----

--=-CYaLmL8HRT0PXx8NlTi0--