Thanks Roman and Tom, > - Try to limit the number of buffers needed and cache them.
This certainly sounds like a good idea; one question though: how can the buffer be reset between operations? I've tried using clearRect(), fill(), even setSample() and setPixel(), and can't get it to work. Either the old contents remain in the buffer (thus they get composited twice, and are too dark), or the buffer background is no longer transparent and the background itself gets composited on the screen. It definitely should be possible, maybe I'm missing something... > + if (comp == null || comp instanceof AlphaComposite) > + super.draw(s); > + > + // Custom composite > + else > > Would it be cleaner to create a CustomVolatileImageGraphics that extends > VolatileImageGraphics? I'm not sure - the composite is set after the VolatileImageGraphics is created, so we don't know at creation-time whether to return the custom subclass... > + pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, TRUE, 8, width, height ); > + gdk_pixbuf_get_from_drawable( pixbuf, pixmap, NULL, 0, 0, 0, 0, width, > height ); > + pixels = gdk_pixbuf_get_pixels(pixbuf); > > Is pixmap guaranteed to be entirely on-screen for this call? If not, some of > the resultant pixbuf will be black or undefined. Good point, I don't think we can make that guarantee. I'm not overly familiar with GDK (that little block of code took quite a bit of digging through APIs)... Or, as we were saying on Friday... undefined portions of the pixbuf for offscreen areas are fine, since those portions won't be displayed anyways. It would be a nice performance boost if we could detect that, however, and avoid compositing offscreen areas. Thanks, Francis
