[Xr] Can the xrs argument be removed?
Bill Spitzak
spitzak at d2.com
Thu May 22 18:17:25 PDT 2003
On Thursday 22 May 2003 02:54 pm, Keith Packard wrote:
> 1)
> XrState *s = XrCreate ();
>
> XrSetThreadState (s);
>
> ...
>
> XrMoveTo (NULL, 10, 10);
> XrLineTo (NULL, 20, 20);
>
> XrStroke (NULL);
>
> XrDestroy (NULL);
>
> question -- what happens to the previous thread state?
I thought about this some, and I figured XrDestroy() would set the state back
to whatever it is when Xr starts up initially. If you really want to remember
the previous state you have to do XrGetThreadState first and remember it.
Perhaps XrSetThreadState() should set a pointer in the new XrState to the
previous XrState, and XrDestroy restores this previous state. Loops have to
be prevented somehow, perhaps setting the state moves it to the top of the
stack. This would be convienent if a "null" state is not wanted, so that the
Xr calls all work even if XrSetThreadState has not been called yet. Then this
"bottom" state could point at itself and refuse to be destroyed.
> 2)
> XrNewState ();
>
> XrMoveTo (10, 10);
> XrLineTo (20, 20);
>
> XrStroke ();
>
> XrDisposeState ();
>
>
> question -- how to manage multiple states?
I don't think this is wanted, as you already have XrSave/Restore which would
do everything this can do, right? If in fact this is the best way to
implement XrSave/Restore then they can be written to do this internally.
--
,~,~,~,~ ~ ~ ~ ~
/\_ _|_========___ Bill Spitzak
~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com
More information about the cairo
mailing list