[webkit-qt] GraphicsContext and Canvas
Ariya Hidayat
ariya.hidayat at gmail.com
Wed Feb 3 22:43:04 PST 2010
Hello good people,
Currently Canvas is not performing very well, see
https://bugs.webkit.org/show_bug.cgi?id=32530 for the details of one
of the problems. I have a patch for that (attached in the bug, please
review!) by introducing BufferedImage, but that is just a stop-gap
measure. This is because ImageBuffer still gets created and destroyed
for every single frame, which causes us to recreate the pixmap for the
canvas all the time.
My proposal would be as follows. We change Graphics Context so that it
has an internal buffer (of ImageBuffer instance). For a graphics
context that operates on a canvas, we just use its ImageBuffer for the
painting, with some reference counting so everytime we clear the
(Buffered)Image instance we don't need to throw the pixmap again and
again.
Bonus: we can get rid of our ImageBufferData.
Also, this opens further optimization for pixel manipulation (which I
have planned to do since ages, but then I am a lazy guy :). Currently
getting or setting a pixel from our canvas converts the pixmap to an
image and later back again to the pixmap (expensive on non-raster
graphics systems). If we can keep both the pixmap and image ourselves,
we might do some heuristic caching and optimization. For example,
usually pixel manipulations are not interleaved with vector/path
fill/stroke etc. This allows us to keep either the pixmap format or
the image format as long as we need it and avoid constant conversion
between them.
I'l try to give it a shot in the next few weeks. Ideas and feedbacks
are warmly welcomed.
Thank you!
Regards,
--
Ariya Hidayat
http://www.linkedin.com/in/ariyahidayat
More information about the webkit-qt
mailing list