On 04.07.2011 23:07, Eric Wasylishen wrote:
I think that we should start a discussion about this whole drawing code.
Hopefully we end up with a deeper understanding of what should happen here and
will then be able to package it up with a nice and clean call to the backend
and three or four (almost?) correct implementations for this in GSContext,
GSStreamContext and GSCairoContext. But then I may be completely wrong here, as
I really don't understand much of this new code.
What I would like to do is:
- get rid of -guiDrawInRect entirely.
- reinstate caching since currently there is no caching whatsoever.
- possibly switch to the new
drawInRect:fromRect:operation:fraction:respectFlipped:hints: method
Our goal should be for the following cairo calls to be used when drawing an
uncached image:
cairo_surface_t *src = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, [rep
pixelsWide], [rep pixelsHigh]);
// copy the ARGB data in NSBitmapImageRep to the src image surface in BGRA
format
cairo_t *cr = cairo_create(dest);
// set the transformation matrix and clipping rect on cr to refect the source
rect and dest rect
cairo_set_source_surface(cr, src, 0, 0);
cairo_paint(cr);
cairo_destroy(cr);
cairo_surface_destroy(src);
That's it, I think. To do caching, the code is the same except the 'src'
surface is created as an xlib surface so it's stored on the X server, and the
surface is kept around and reused, so the copying from NSBitmapImageRep to
cairo only happens once as long as the cached surface is kept alive.
What you are talking about is to combine the current code in CairoGState
-DPSimage:... and drawGState:... into one method. Or rather to split up
the code differently, having one method that creates an image surface
and different ways to draw that. This sounds sensible to me, we just
need to be aware that sometimes we are already dealing with cached
images that that we need a code path for that as well.
_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev