Re: How to know if a surface is mapped

Uli Schlachter <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Hi,

On 20.03.2013 10:57, Carlos López González wrote:
> 2013/3/20 Uli Schlachter <[email protected]>
[...]
>> On 20.03.2013 08:33, Carlos López González wrote:
>> [...]
>>> The problem comes when the render system needs to map/unmap the Cairo
>>> surface and the widget is requested to be drawn. In that case, according
>>> to
>>> the documentation the surface behavior is unknown and so the render result
>>> is incorrect. But the widget thinks that the update of the drawing area
>>> was
>>> done and it is marked as 'clean' (no refreshed again).
>>>
>>> So the question is: is there any way to know if a surface is currently
>>> mapped?
>>
>> What does "mapped" mean here? How do you map/unmap a cairo surface?
[...]
 > Yes, mapped means that the surface is right after a
 > cairo_surface_map_to_image() call.

So let me see if I understand this correctly?

Thread 1 paints to the surface (and possibly does a map_to_image()). At the same 
time, thread 2 uses the surface as a source for another drawing operation.

How can this work without map_to_image()? The two threads will always race with 
each other. Thread 2 could access the surface between any two drawing operations 
of thread 1 and thus random results result.

You need some synchronisation between the two threads to make sure that the 
widget isn't drawn while the rendering thread paints its surface.


Uli

P.S.: No, there is no way to see if a surface is currently mapped to an image.
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.