Hello, This week I plan to start with a clean rewrite of the xrender-pipeline, to factor out the X11 and XRender specific parts from the common code base as far as possible and do things the right way. The current release is just a prototype/hack where I broke the existing source, many things are done in a very ugly or wrong way, and my goal would be to clean this mess up. Because of the limited time frame and my lack of prior experience with Java2D I decided to hack something together instead of flooding the list with my questions and to clean it up later.
I had problems uploading my code to the repository, as well as to the java.net project I created for this purpose (yes, I guess both times my fault ;) ), so for now I uploaded it to an http-server: http://palme.agosys.com/clemens/xrender-hack-0.0.2.tar.gz It would be really helpful if you could grab the code and have a look at it and tell me all the "don'ts" and how I could solve this or that better. I also attached a list of questions, if you know maybe one or another anwer, please let me know the answer :) Thank you in advance, lg Clemens 1.) I've created a seperate struct to hold the per-surface xrender data structures, similar to ShmPixmapData. I initialize it in JX11SD_InitWindow for windows, because initSurface where I do the xrender-initialization for pixmaps is not called for windows. Is there a better place to do it for windows, maybe unified for both windows and pixmaps? 2.) For now I also leak xrender-resources, because Java_sun_java2d_x11_X11SurfaceData_initOps is also called at window-resize. Whaht should I do about this? Should I store xrender-related data in the peers, like its done with the window-handle? 3.) I am currently using lock/unlock/getrasinfo for MaskFill, is it worth to write seperate upload-routines because of the overhead those functions have (JNI calls, Locking, Xsync, ...)? 4.) In X11SD_InitWindow I've currently RGB24 hardcoded, but I guess this assumption will be wrong once translucent windows are supported by Java. How can I get the surfacetype of a window? 5.) Currently I set the color by passing SunGraphics2D.pixel down to the native library, which premultiplies it. I guess this „hardcoded" way of doing things is not really good. Is the right way to install an appropriate ColorModel? For premultiplied surfaces I need to specify a ColorSpace, which one is the right for me? 6.) Is there a way to get force a BufferedImage to be cached? For now texturepaints only work when the image has been drawn already, otherwise its not cached any my pipeline can't handle this case. 7.) In X11PMBlitLoops/X11PMTransformedBlit/Transform I simply use the inverted transformation on the source. However this means my drawing area is from 0,0 ->bounds.x/bounds.y. If I don't do it this way, e.g. the rotation point is moved. Is there a way to translate the inverted transform, so that I don't need to composite from 0,0? 8.) I am a bit puzzeled with the problem described at: http://thread.gmane.org/gmane.comp.freedesktop.xorg/30450/focus=30476 Is this a bug, or an unwelcome feature? Any ideas how I can work arround it? I already do clipping the shape-outline however due to rounding errors I either cut something away or get a black thin line. 9.) When scaling images e.g. only on the x-axis, the result is also blurred and smeared over the y-axis. http://article.gmane.org/gmane.comp.freedesktop.xorg/30507 (One of the screenshots is the wrong one, simply have a look for the other images in the album of the right image) Any ideas where this could come from, or how I could avoid it? Setting RepeatPad helps a bit (at least Nimbus looks right), but seems to fall back to software. 10.) Just from a quick look at http://linuxhippy.blogspot.com/2008/07/nimbus_20.html, any ideas what could cause this artifact? It quite struggles me for some time ;)
