deweese 02/03/04 03:34:58 Modified: sources/org/apache/batik/ext/awt/image GraphicsUtil.java Log: Final tweaks for Mac OS X. Revision Changes Path 1.26 +26 -8 xml-batik/sources/org/apache/batik/ext/awt/image/GraphicsUtil.java Index: GraphicsUtil.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/GraphicsUtil.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- GraphicsUtil.java 3 Mar 2002 01:59:11 -0000 1.25 +++ GraphicsUtil.java 4 Mar 2002 11:34:58 -0000 1.26 @@ -66,7 +66,7 @@ * implementations. * * @author <a href="mailto:[EMAIL PROTECTED]">Thomas DeWeese</a> - * @version $Id: GraphicsUtil.java,v 1.25 2002/03/03 01:59:11 deweese Exp $ + * @version $Id: GraphicsUtil.java,v 1.26 2002/03/04 11:34:58 deweese Exp $ */ public class GraphicsUtil { @@ -285,22 +285,40 @@ boolean useDrawRenderedImage = false; - SampleModel srcSM = cr.getSampleModel(); - if ((srcSM.getWidth()*srcSM.getHeight()) > + SampleModel srcSM; + srcCM = cr.getColorModel(); + srcSM = cr.getSampleModel(); + if ((srcSM.getWidth()*srcSM.getHeight()) >= (clipR.width*clipR.height)) // if srcSM tiles are larger than the clip size // then just draw the renderedImage useDrawRenderedImage = true; + WritableRaster wr; if (useDrawRenderedImage) { - // org.ImageDisplay.showImage("foo: ", cr); // This can be significantly faster but can also - // require much more memory. - g2d.drawRenderedImage(cr, IDENTITY); + // require much more memory, so we only use it when + // the clip size is smaller than the tile size. + wr = srcCM.createCompatibleWritableRaster + (clipR.width, clipR.height); + + // If we push caching down the tree farther + // Then this code path should probably try to + // align with cr's tile grid to promote tile caching + // (this of course will increase the memory required + // in this path). + cr.copyData(wr.createWritableTranslatedChild + (clipR.x, clipR.y)); + BufferedImage bi = new BufferedImage + (srcCM, wr, srcCM.isAlphaPremultiplied(), null); + + // Any of the drawImage calls that take an + // Affine are prone to the 'CGGStackRestore: gstack + // underflow' bug on Mac OS X. This should work + // around that problem. + g2d.drawImage(bi, clipR.x, clipR.y, null); } else { // Use tiles to draw image... - srcCM = cr.getColorModel(); - WritableRaster wr; wr = Raster.createWritableRaster(srcSM, new Point(0,0)); BufferedImage bi = new BufferedImage (srcCM, wr, srcCM.isAlphaPremultiplied(), null);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]