2013/9/13 Martin Owens <doctormo@...400...>:
https://bugs.launchpad.net/inkscape/+bug/871563/comments/12
Hey KK,
Your message above in that bug report is a little cryptic because the current code and the patches previous suggested use pixbufs, while you talk about cairo surfaces.
Are you saying that the pixbuf code should be removed and replaced with dealing directly in cairo surfaces?
It's not necessary. The pixbuf can be modified in place to conform to the Cairo pixel format. After that, a Cairo image surface can be created that shares the pixbuf's underlying data. This technique is used in the interactive renderer (src/display) and could also be used in the PDF renderer (src/extension/internal/cairo-*)
I'm a little confused because the bug is about pasting objects, and I can only assume that we get a pointer to a block of data when someone pastes things in and we stuff that into an image object of some kind.
Could you explain what you mean?
The compressed image data should be passed all the way down to the renderer, which should call cairo_set_mime_data() before using the surface that represents the image. In case of embedded images, this is the base64-decoded value of the data href. For linked images, it's the contents of the file.
The relevant function to change is CairoRenderContext::renderImage() in src/extension/internal/cairo-render-context.cpp. The best way to pass the compressed image data around would be to store it directly on the pixbuf, using g_object_set_data_full() in sp_image_update() in sp-image.cpp. The same technique could be used to store the Cairo surface which is currently created per-pixbuf.
Regards, Krzysztof