[cairo] request for cairo_win32_surface_get_width/height()
Vladimir Vukicevic
vladimir at pobox.com
Wed Apr 29 10:46:16 PDT 2009
On 4/28/09 11:59 AM, Theo Veenker wrote:
> Vladimir Vukicevic wrote:
>> On 4/28/09 1:08 AM, Theo Veenker wrote:
>>> Hi,
>>>
>>> I like to request cairo_win32_surface_get_width/height() to be added to
>>> the win32 surface support. Cairo_win32_surface_create() uses
>>> GetClipBox()
>>> to determine the size to be used for the surface. But when calling
>>> cairo_win32_surface_create() from a WM_WINDOWPOSCHANGED or WM_SIZE
>>> notification GetClipBox() initially returns a NULLREGION (although the
>>> notification reports the actual window size) and then later it clip
>>> region becomes valid. There is no way of telling which size the actual
>>> surface has once it has been created. I can hack my way around it, but
>>> having these APIs would be nice.
>>
>> You really shouldn't be doing any rendering from WM_WINDOWPOSCHANGED
>> or WM_SIZE..
>
> I don't do any rendering from those. Just recreating the surface. It
> will be drawn on WM_PAINT.
Ah, why not just create the surface in WM_PAINT? (And destroy it when
you finish painting, recreating it for every WM_PAINT) The surface
creation is cheap, and you get to ignore all the resize issues completely.
I can't quite remember why we have set_size/set_drawable in the Xlib
surface, but I suspect it has something to do with it being quite
expensive to call the create methods there because of X round-trips to
obtain some information needed there. That's not the case on most any
other platform.
- Vlad
More information about the cairo
mailing list