harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov" <alexei.zakha...@gmail.com>
Subject Re: svn commit: r612466 - in /harmony/enhanced/classlib/trunk: depends/build/ modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/ modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/ modules/awt/src/main/java/unix/org/apache
Date Wed, 16 Jan 2008 17:12:18 GMT
Alexey,

I am unable to build classlib after your commit:

 [hy.javac] Compiling 3863 source files to
/home/ayzakhar/projects/harmony/working_classlib/build/classes
 [hy.javac] ----------
 [hy.javac] 1. ERROR in
/home/ayzakhar/projects/harmony/working_classlib/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XVolatileImage.java
(at line 58)
 [hy.javac]     surface = new PixmapSurface(display, pixmap,
xconf.info.lock(), w, h);
 [hy.javac]                   ^^^^^^^^^^^^^
 [hy.javac] PixmapSurface cannot be resolved to a type
 [hy.javac] ----------
 [hy.javac] 1 problem (1 error)

Looks like you forgot something.

Regards,
Alexei

2008/1/16, apetrenko@apache.org <apetrenko@apache.org>:
> Author: apetrenko
> Date: Wed Jan 16 06:13:14 2008
> New Revision: 612466
>
> URL: http://svn.apache.org/viewvc?rev=612466&view=rev
> Log:
> Patch for HARMONY-5394 "[classlib][awt] XBlitter improvements"
>
> Modified:
>     harmony/enhanced/classlib/trunk/depends/build/defines.mk
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/JavaBlitter.java
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XBlitter.java
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XSurface.java
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XVolatileImage.java
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindowFactory.java
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/XServerConnection.java
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.h
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/blitter.cpp
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/XGraphics2D.cpp
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/exports.txt
>     harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/makefile
>
> Modified: harmony/enhanced/classlib/trunk/depends/build/defines.mk
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/depends/build/defines.mk?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/depends/build/defines.mk (original)
> +++ harmony/enhanced/classlib/trunk/depends/build/defines.mk Wed Jan 16 06:13:14 2008
> @@ -27,7 +27,7 @@
>  CXX_DLL_LD = $(CXX)
>  STDCLIBS = -lstdc++
>  OSLIBS = -lc -lm
> -XLIBS = -L/usr/X11R6/lib -lX11 -lXft
> +XLIBS = -L/usr/X11R6/lib -lX11 -lXft -lXext
>  MDLLIBPREFIX = -Xlinker --start-group
>  MDLLIBSUFFIX = -Xlinker --end-group
>  EXELDFLAGS = $(LDFLAGS)
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/JavaBlitter.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/JavaBlitter.java?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/JavaBlitter.java (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/JavaBlitter.java Wed Jan 16 06:13:14 2008
> @@ -489,9 +489,9 @@
>
>          float[] corners = {
>              x, y,
> -            x + width, y,
> -            x + width, y + height,
> -            x, y + height
> +            x + width + 1, y,
> +            x + width + 1, y + height + 1,
> +            x, y + height + 1
>          };
>
>          at.transform(corners, 0, corners, 0, 4);
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XBlitter.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XBlitter.java?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XBlitter.java (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XBlitter.java Wed Jan 16 06:13:14 2008
> @@ -36,375 +36,188 @@
>  import org.apache.harmony.awt.nativebridge.linux.X11;
>  import org.apache.harmony.awt.nativebridge.linux.X11Defs;
>
> +import org.apache.harmony.awt.internal.nls.Messages;
> +
>  public class XBlitter implements Blitter {
> +
>      static final XBlitter inst = new XBlitter();
>
>      public static XBlitter getInstance(){
>          return inst;
>      }
> +    public void blit(int srcX, int srcY, Surface srcSurf, int dstX, int dstY,
> +            Surface dstSurf, int width, int height, AffineTransform sysxform,
> +            AffineTransform xform, Composite comp, Color bgcolor,
> +            MultiRectArea clip) {
> +
> +        if(xform == null){
> +            blit(srcX, srcY, srcSurf, dstX, dstY, dstSurf, width, height,
> +                    sysxform, comp, bgcolor, clip);
> +        }else{
> +            double scaleX = xform.getScaleX();
> +            double scaleY = xform.getScaleY();
> +            double scaledX = dstX / scaleX;
> +            double scaledY = dstY / scaleY;
> +            AffineTransform at = new AffineTransform();
> +            at.setToTranslation(scaledX, scaledY);
> +            xform.concatenate(at);
> +            sysxform.concatenate(xform);
> +            blit(srcX, srcY, srcSurf, 0, 0, dstSurf, width, height,
> +                    sysxform, comp, bgcolor, clip);
> +        }
> +    }
>
> -    public void blit(
> -            int srcX, int srcY, Surface srcSurf,
> -            int dstX, int dstY, Surface dstSurf,
> -            int width, int height,
> -            AffineTransform sysxform, AffineTransform xform,
> -            Composite comp, Color bgcolor, MultiRectArea clip
> -    ) {
> -        int type = xform.getType();
> -        switch (type) {
> -            case AffineTransform.TYPE_TRANSLATION:
> -                dstX += xform.getTranslateX();
> -                dstY += xform.getTranslateY();
> -            case AffineTransform.TYPE_IDENTITY:
> -                 blit(srcX, srcY, srcSurf, dstX, dstY, dstSurf,
> -                         width, height, sysxform, comp, bgcolor, clip);
> -                break;
> -            default:
> -                XSurface xDstSurf = (XSurface) dstSurf;
> -
> -                BufferedImage compIm;
> -                int w = srcSurf.getWidth();
> -                int h = srcSurf.getHeight();
> -
> -                if (!(srcSurf instanceof ImageSurface)) {
> -                    compIm = xDstSurf.g2d.xConfig.createCompatibleImage(w, h);
> -
> -                    NativeImageBlitter.getInstance().blit(
> -                            srcX, srcY, srcSurf,
> -                            srcX, srcY,
> -                            AwtImageBackdoorAccessor.getInstance().getImageSurface(compIm),
> -                            w, h,
> -                            AlphaComposite.Src, null, null
> -                    );
> -                } else {
> -                    ColorModel cm = srcSurf.getColorModel();
> -                    compIm = new BufferedImage(
> -                            cm,
> -                            srcSurf.getRaster(),
> -                            cm.isAlphaPremultiplied(),
> -                            null
> -                    );
> -                }
> -
> -                WritableRaster compRaster = compIm.getRaster();
> -
> -                AffineTransform at = (AffineTransform) sysxform.clone();
> -                at.concatenate(xform);
> -
> -                // Want to transform without translation to fit into destination image
> -                // Translation will be added then when blitting to final dest surface
> -                dstX += at.getTranslateX();
> -                dstY += at.getTranslateY();
> -                AffineTransform untranslated =
> -                        AffineTransform.getTranslateInstance(
> -                                -at.getTranslateX(),
> -                                -at.getTranslateY()
> -                        );
> -                untranslated.concatenate(at);
> -
> -                AffineTransformOp atop =
> -                        new AffineTransformOp(untranslated, xDstSurf.g2d.getRenderingHints());
> -
> -                Rectangle r = atop.getBounds2D(compRaster).getBounds();
> -                int tWidth = r.width;
> -                int tHeight = r.height;
> -
> -                BufferedImage transformed;
> -                if (compIm.getColorModel().getTransparency() == Transparency.OPAQUE) {
> -                    transformed = xDstSurf.g2d.xConfig.createCompatibleImage(tWidth, tHeight);
> -                } else {
> -                    ColorModel cm = compIm.getColorModel();
> -                    transformed =
> -                            new BufferedImage(
> -                                    cm,
> -                                    compIm.getRaster().createCompatibleWritableRaster(
> -                                            tWidth,
> -                                            tHeight
> -                                    ),
> -                                    cm.isAlphaPremultiplied(),
> -                                    null
> -                            );
> -                }
> -
> -                atop.filter(compIm, transformed);
> -
> -                if (dstX < 0){
> -                    tWidth += dstX;
> -                    dstX = 0;
> -                }
> +    public void blit(int srcX, int srcY, Surface srcSurf, int dstX, int dstY,
> +            Surface dstSurf, int width, int height, AffineTransform sysxform, Composite comp,
> +            Color bgcolor, MultiRectArea clip) {
> +
> +
> +        if(srcSurf.isNativeDrawable()){
> +            double matrix[] = null;
> +            if(sysxform != null){
> +                int type = sysxform.getType();
> +                switch (type) {
> +
> +                    case AffineTransform.TYPE_TRANSLATION:
> +                        dstX += sysxform.getTranslateX();
> +                        dstY += sysxform.getTranslateY();
> +                    case AffineTransform.TYPE_IDENTITY:
> +                        break;
> +
> +                    default:
> +                        matrix = new double[6];
> +                        sysxform.getMatrix(matrix);
> +                        Rectangle transDstBounds = JavaBlitter.getBounds2D(sysxform, new Rectangle(dstX, dstY, width, height)).getBounds();
> +                        dstX = transDstBounds.x;
> +                        dstY = transDstBounds.y;
> +
> +                        Rectangle transSrcBounds = JavaBlitter.getBounds2D(sysxform, new Rectangle(srcX, srcY, width, height)).getBounds();
> +                        srcX = transSrcBounds.x;
> +                        srcY = transSrcBounds.y;
> +                        width = transSrcBounds.width;
> +                        height = transSrcBounds.height;
>
> -                if (dstY < 0){
> -                    tHeight += dstY;
> -                    dstY = 0;
>                  }
>
> -                blit(
> -                        0, 0, AwtImageBackdoorAccessor.getInstance().getImageSurface(transformed),
> -                        dstX, dstY, dstSurf,
> -                        tWidth, tHeight,
> -                        comp, bgcolor, clip
> -                );
> -        }
> -    }
>
> -    public void blit(
> -            int srcX, int srcY, Surface srcSurf,
> -            int dstX, int dstY, Surface dstSurf,
> -            int width, int height,
> -            AffineTransform sysxform,
> -            Composite comp, Color bgcolor, MultiRectArea clip
> -    ) {
> -        int type = sysxform.getType();
> -        switch (type) {
> -            case AffineTransform.TYPE_TRANSLATION:
> -            case AffineTransform.TYPE_IDENTITY:
> -                 blit(
> -                         srcX, srcY, srcSurf,
> -                         dstX + (int) sysxform.getTranslateX(),
> -                         dstY + (int) sysxform.getTranslateY(),
> -                         dstSurf,
> -                         width, height,
> -                         comp, bgcolor, clip
> -                 );
> -                break;
> -            default:
> -                ColorModel cm = srcSurf.getColorModel();
> -                WritableRaster compRaster = srcSurf.getRaster();
> -                BufferedImage compIm = new BufferedImage(
> -                        cm,
> -                        compRaster,
> -                        cm.isAlphaPremultiplied(),
> -                        null
> -                );
> -
> -                Rectangle transDstBounds = JavaBlitter.getBounds2D(sysxform, new Rectangle(dstX, dstY, width, height)).getBounds();
> -                int tWidth = transDstBounds.width;
> -                int tHeight = transDstBounds.height;
> -                int tX = transDstBounds.x;
> -                int tY = transDstBounds.y;
> -
> -                if(tWidth <= 0 || tHeight <= 0) return;
> -                BufferedImage transformed = new BufferedImage(dstSurf.getWidth(), dstSurf.getHeight(), BufferedImage.TYPE_INT_ARGB);
> -
> -                Surface transfSurf = Surface.getImageSurface(transformed);
> -                JavaBlitter.getInstance().blit(srcX, srcY, Surface.getImageSurface(compIm),
> -                        dstX, dstY, transfSurf, width, height, sysxform, AlphaComposite.Src, null, null);
> -                blit(
> -                        tX, tY, transfSurf,
> -                        tX, tY, dstSurf,
> -                        tWidth, tHeight,
> -                        comp, bgcolor, clip
> -                );
> +            }
>
> -        }
> -    }
> +            long dstSurfStruct = dstSurf.getSurfaceDataPtr();
> +            long srcSurfStruct = srcSurf.getSurfaceDataPtr();
> +            int clipRects[] = null;
> +            int numVertex = 0;
> +            if(clip != null){
> +                clipRects = clip.rect;
> +                numVertex = clipRects[0] - 1;
> +            }
>
> -    public void blit(
> -            int srcX, int srcY, Surface srcSurf,
> -            int dstX, int dstY, Surface dstSurf,
> -            int width, int height,
> -            Composite comp, Color bgcolor, MultiRectArea clip
> -    ) {
> -
> -        if (clip == null) {
> -            clip = new MultiRectArea(new Rectangle(dstX, dstY, width, height));
> -        } else {
> -            clip = new MultiRectArea(clip);
> -        }
> -        // XXX - todo - need to do smth with bgcolor
> -        ColorModel srcCM = srcSurf.getColorModel();
> -        XSurface xDstSurf = (XSurface) dstSurf;
> -
> -        if (srcSurf.isNativeDrawable() && srcCM.equals(dstSurf.getColorModel())) {
> -            if (srcSurf instanceof XSurface) { // Blit from native to native
> -                XSurface xSrcSurf = (XSurface) srcSurf;
> -
> -                XGraphics2D g2d = xDstSurf.g2d;
> -
> -                if (comp instanceof AlphaComposite) {
> -                    switch (((AlphaComposite) comp).getRule()) {
> -                        case AlphaComposite.SRC:
> -                        case AlphaComposite.SRC_ATOP:
> -                        case AlphaComposite.SRC_IN:
> -                        case AlphaComposite.SRC_OVER:
> -                            break; // GXCopy - is default
> -                        case AlphaComposite.DST:
> -                        case AlphaComposite.DST_ATOP:
> -                        case AlphaComposite.DST_IN:
> -                        case AlphaComposite.DST_OVER:
> -                            g2d.setImageGCFunction(X11Defs.GXnoop);
> -                            break;
> -                        case AlphaComposite.SRC_OUT: // Clear
> -                        case AlphaComposite.DST_OUT: // Clear
> -                        case AlphaComposite.CLEAR:
> -                        case AlphaComposite.XOR: // Clear
> -                            g2d.setImageGCFunction(X11Defs.GXclear);
> -                            break;
> -                        default: // Do nothing
> +            if(comp instanceof AlphaComposite){
> +                AlphaComposite ac = (AlphaComposite) comp;
> +                int compType = ac.getRule();
> +                float alpha = ac.getAlpha();
> +
> +                if(srcSurf instanceof ImageSurface){
> +                    Object data = srcSurf.getData();
> +
> +                    int dirtyRegions[] = ((ImageSurface) srcSurf).getDirtyRegions();
> +                    int regCount = 0;
> +                    if(dirtyRegions != null) regCount = dirtyRegions[0] - 1;
> +
> +                    boolean hasBackground = false;
> +                    int bgc = 0;
> +
> +                    if(bgcolor != null && srcSurf.getTransparency() != Transparency.OPAQUE){
> +                        hasBackground = true;
> +                        bgc = bgcolor.getRGB();
>                      }
> -                } else {
> -                    imBlit(
> -                            srcX, srcY, srcSurf,
> -                            dstX, dstY, dstSurf,
> -                            width, height,
> -                            comp, bgcolor, clip
> -                    );
> -                    return;
> -                }
> -
> -                // Get translated clip
> -                makeClip(dstX, dstY, width, height, clip);
>
> -                g2d.setXClip(clip, g2d.imageGC);
> -                X11 x11 = X11.getInstance();
> -                x11.XCopyArea(
> -                        g2d.display,
> -                        xSrcSurf.g2d.drawable, g2d.drawable,
> -                        g2d.imageGC,
> -                        srcX, srcY,
> -                        width, height,
> -                        dstX, dstY
> -                );
> -                x11.XFlush(g2d.display);
> -                g2d.resetXClip(g2d.imageGC);
> -
> -                g2d.setImageGCFunction(X11Defs.GXcopy);
> -            } else if (srcSurf.getSurfaceType() == BufferedImage.TYPE_CUSTOM) {
> -                // source is custom image, slow blit
> -                imBlit(
> -                        srcX, srcY, srcSurf,
> -                        dstX, dstY, dstSurf,
> -                        width, height,
> -                        comp, bgcolor, clip
> -                );
> -            } else { // source could be compatible image
> -                int srcTransp = srcCM.getTransparency();
> -                if (srcTransp == Transparency.OPAQUE) {
> -                    if (comp instanceof AlphaComposite) {
> -                        AlphaComposite acomp = (AlphaComposite) comp;
> -                        if (
> -                                acomp.getRule() == AlphaComposite.SRC ||
> -                                (acomp.getAlpha() == 1 &&
> -                                 (acomp.getRule() == AlphaComposite.SRC_OVER ||
> -                                  acomp.getRule() == AlphaComposite.SRC_ATOP ||
> -                                  acomp.getRule() == AlphaComposite.SRC_IN)
> -                                )
> -                        ) {
> -                            // Get translated clip
> -                            makeClip(dstX, dstY, width, height, clip);
> -                            xDstSurf.putImage(
> -                                    clip,
> -                                    srcSurf.getRaster(),
> -                                    dstX, dstY,
> -                                    width, height
> -                            );
> -                        } else {
> -                            imBlit(
> -                                srcX, srcY, srcSurf,
> -                                dstX, dstY, dstSurf,
> -                                width, height,
> -                                comp, bgcolor, clip
> -                            );
> -                        }
> +                    synchronized(data){
> +                        bltImage(srcX, srcY, srcSurfStruct, srcSurf.getData(),
> +                             dstX, dstY, dstSurfStruct, width, height,
> +                             hasBackground, bgc, compType, alpha, matrix,
> +                             clipRects, numVertex, srcSurf.invalidated(),
> +                             dirtyRegions, regCount);
>                      }
> -
> -                } else if (srcTransp == Transparency.BITMASK) {
> -                    // todo - XXX - optimize here - use native clip mask
> -                    imBlit(
> -                        srcX, srcY, srcSurf,
> -                        dstX, dstY, dstSurf,
> -                        width, height,
> -                        comp, bgcolor, clip
> -                    );
> -                } else { // have to compose in java - no native alpha composite
> -                    imBlit(
> -                        srcX, srcY, srcSurf,
> -                        dstX, dstY, dstSurf,
> -                        width, height,
> -                        comp, bgcolor, clip
> -                    );
> -                }
> +                    srcSurf.validate();
> +                }else{
> +                    bltPixmap(srcX, srcY, srcSurfStruct,
> +                            dstX, dstY, dstSurfStruct,
> +                            width, height, compType, alpha, matrix,
> +                            clipRects, numVertex);
> +                }
> +            }else if(comp instanceof XORComposite){
> +                XORComposite xcomp = (XORComposite) comp;
> +                if(srcSurf instanceof ImageSurface){
> +                    Object data = srcSurf.getData();
> +
> +                    int dirtyRegions[] = ((ImageSurface) srcSurf).getDirtyRegions();
> +                    int regCount = 0;
> +                    if(dirtyRegions != null) regCount = dirtyRegions[0] - 1;
> +
> +                    synchronized(data){
> +                        xorImage(srcX, srcY, srcSurfStruct, data,
> +                                dstX, dstY, dstSurfStruct,
> +                                width, height, xcomp.getXORColor().getRGB(), matrix,
> +                                clipRects, numVertex,
> +                                srcSurf.invalidated(), dirtyRegions, regCount);
> +                    }
> +                    srcSurf.validate();
> +                }else{
> +                    xorPixmap(srcX, srcY, srcSurfStruct,
> +                            dstX, dstY, dstSurfStruct,
> +                            width, height, xcomp.getXORColor().getRGB(), matrix,
> +                            clipRects, numVertex);
> +                }
> +            }else{
> +                // awt.17=Unknown Composite type : {0}
> +                throw new IllegalArgumentException(Messages.getString("awt.17",  //$NON-NLS-1$
> +                        comp.getClass()));
>              }
> -        } else {
> -            imBlit(
> -                    srcX, srcY, srcSurf,
> -                    dstX, dstY, dstSurf,
> -                    width, height,
> -                    comp, bgcolor, clip
> -            );
> +        }else{
> +            BufferedImage bi;
> +            if(srcSurf.getTransparency() == Transparency.OPAQUE){
> +                bi = new BufferedImage(srcSurf.getWidth(), srcSurf.getHeight(), BufferedImage.TYPE_INT_RGB);
> +            }else{
> +                bi = new BufferedImage(srcSurf.getWidth(), srcSurf.getHeight(), BufferedImage.TYPE_INT_ARGB);
> +            }
> +            Surface tmpSurf = AwtImageBackdoorAccessor.getInstance().getImageSurface(bi);
> +            JavaBlitter.getInstance().blit(0, 0, srcSurf, 0, 0, tmpSurf,
> +                    srcSurf.getWidth(), srcSurf.getHeight(),
> +                    AlphaComposite.Src, null, null);
> +            blit(srcX, srcY, tmpSurf, dstX, dstY, dstSurf,
> +                    width, height, comp, bgcolor, clip);
>          }
>      }
>
> -    private static void imBlit(
> -            int srcX, int srcY, Surface srcSurf,
> -            int dstX, int dstY, Surface dstSurf,
> -            int width, int height,
> -            Composite comp,
> -            Color bgcolor,
> -            MultiRectArea clip
> -    ) {
> -
> -        if(dstX < 0){
> -            width += dstX;
> -            dstX = 0;
> -        }
> -
> -        if(dstY < 0){
> -            height += dstY;
> -            dstY = 0;
> -        }
> -
> -        if(width <= 0 || height <= 0) return;
> +    // Native methods
>
> -        XSurface xDstSurf = ((XSurface) dstSurf);
> +    public void blit(int srcX, int srcY, Surface srcSurf, int dstX, int dstY,
> +            Surface dstSurf, int width, int height,
> +            Composite comp, Color bgcolor, MultiRectArea clip) {
>
> -        boolean srcNoAlpha =
> -                srcSurf.getColorModel().getTransparency() == Transparency.OPAQUE;
> +        blit(srcX, srcY, srcSurf, dstX, dstY, dstSurf, width, height,
> +                null, comp, bgcolor, clip);
> +    }
>
> -        if (comp instanceof AlphaComposite) {
> -            AlphaComposite acomp = (AlphaComposite) comp;
> -            if (
> -                    acomp.getRule() == AlphaComposite.SRC ||
> -                    (srcNoAlpha && acomp.getAlpha() == 1 &&
> -                     (acomp.getRule() == AlphaComposite.SRC_OVER ||
> -                      acomp.getRule() == AlphaComposite.SRC_ATOP ||
> -                      acomp.getRule() == AlphaComposite.SRC_IN)
> -                    )
> -            ) {
> -                xDstSurf.needServerData = false;
> -            }
> -        }
> +    private native void bltImage(int srcX, int srcY, long srsSurfDataPtr,
> +            Object srcData, int dstX, int dstY, long dstSurfDataPtr,
> +            int width, int height, boolean hasBackground, int bgcolor, int compType,
> +            float alpha, double matrix[], int clip[], int numVertex,
> +            boolean invalidated, int[] dirtyRegions, int regCount);
>
> -        Rectangle2D roi = new Rectangle2D.Float(dstX, dstY, width, height);
> -        xDstSurf.setRoi(roi);
> -        NativeImageBlitter.getInstance().blit(
> -                srcX, srcY, srcSurf,
> -                0, 0, xDstSurf.getImageSurface(),
> -                width, height,
> -                comp, bgcolor, null
> -        );
> -
> -        if (xDstSurf.needServerData) {
> -            xDstSurf.putImage(clip,
> -                    (int) (roi.getX()),
> -                    (int) (roi.getY()),
> -                    (int) roi.getWidth(),
> -                    (int) roi.getHeight()
> -            );
> +    private native void bltPixmap(int srcX, int srcY, long srsSurfDataPtr,
> +            int dstX, int dstY, long dstSurfDataPtr,
> +            int width, int height, int compType,
> +            float alpha, double matrix[], int clip[], int numVertex);
>
> -        } else {
> -            xDstSurf.putImage(clip, dstX, dstY, width, height);
> -        }
> +    private native void xorImage(int srcX, int srcY, long srsSurfDataPtr,
> +            Object srcData, int dstX, int dstY, long dstSurfDataPtr,
> +            int width, int height, int xorcolor, double matrix[], int clip[],
> +            int numVertex, boolean invalidated, int[] dirtyRegions, int regCount);
>
> -        xDstSurf.needServerData = true;
> -    }
> -
> -    private static void makeClip(
> -            int dstX, int dstY,
> -            int width, int height,
> -            MultiRectArea clip
> -    ) {
> -        Rectangle destRect = new Rectangle(dstX, dstY, width, height);
> -        clip.intersect(destRect);
> -    }
> +    private native void xorPixmap(int srcX, int srcY, long srsSurfDataPtr,
> +            int dstX, int dstY, long dstSurfDataPtr,
> +            int width, int height, int xorcolor, double matrix[],
> +            int clip[], int numVertex);
>  }
> +
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java Wed Jan 16 06:13:14 2008
> @@ -66,10 +66,6 @@
>      boolean xor_mode = false;
>
>      boolean indexModel = false;
> -
> -    static{
> -        System.loadLibrary("gl");
> -    }
>
>      public XGraphics2D(long drawable, int tx, int ty, MultiRectArea clip) {
>          super(tx, ty, clip);
> @@ -101,6 +97,41 @@
>          }
>      }
>
> +    public XGraphics2D(XVolatileImage image, int tx, int ty, int width, int height) {
> +        this(image, tx, ty, new MultiRectArea(new Rectangle(width, height)));
> +    }
> +
> +    public XGraphics2D(XVolatileImage image, int tx, int ty, MultiRectArea clip) {
> +        super(tx, ty, clip);
> +        drawable = image.getPixmap();
> +        xConfig = (XGraphicsConfiguration) getDeviceConfiguration();
> +        display = xConfig.dev.display;
> +        gc = createGC(display, drawable);
> +
> +        X11.Visual visual = xConfig.info.get_visual();
> +        xftDraw = createXftDraw(display, drawable, visual.lock());
> +        visual.unlock();
> +
> +        imageGC = createGC(display, drawable);
> +
> +        //xSetForeground(argb); // Set default foregroung to black
> +
> +        blitter = XBlitter.getInstance();
> +        Rectangle bounds = clip.getBounds();
> +        dstSurf = image.getImageSurface();
> +
> +        if (!FontManager.IS_FONTLIB) {
> +            jtr = DrawableTextRenderer.inst;
> +        }
> +
> +        //setTransformedClip(clip);
> +        setClip(clip);
> +
> +        if (xConfig.getColorModel() instanceof IndexColorModel) {
> +            indexModel = true;
> +        }
> +    }
> +
>      public XGraphics2D(long drawable, int tx, int ty, int width, int height) {
>          this(drawable, tx, ty, new MultiRectArea(new Rectangle(width, height)));
>      }
> @@ -214,6 +245,9 @@
>              LinuxNativeFont.freeXftDrawNative(this.xftDraw);
>              xftDraw = 0;
>          }
> +
> +        if(dstSurf instanceof XSurface)
> +            dstSurf.dispose();
>
>          if (gc != 0) {
>              freeGC(display, gc);
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XSurface.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XSurface.java?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XSurface.java (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XSurface.java Wed Jan 16 06:13:14 2008
> @@ -32,255 +32,55 @@
>  import org.apache.harmony.awt.gl.*;
>
>  public class XSurface extends Surface {
> -    private static final X11 x11 = X11.getInstance();
> -
> -    //int width, height; // XXX - todo - use from superclass
> -
> -    XGraphics2D g2d;
> -
> -    private BufferedImage lastSnapshot = null;
> -    boolean needServerData = true;
> -
> -    private Rectangle2D roi; // Rectangle of interest
> -
> -    private ImageSurface imageSurface;
> -
> -    // Cached parameters for XCreateImage
> -    boolean cachedXCIParams = false;
> -    int depthXCI;
> -    int offsetXCI;
> -    int formatXCI;
> -    int bitmapPadXCI;
> -    int bytesPerLineXCI;
> -
>
>      XSurface(XGraphics2D g2d, int width, int height) {
> -        this.g2d = g2d;
> +        surfaceDataPtr = createSurfData(g2d.display, g2d.drawable, g2d.imageGC, g2d.xConfig.info.lock(), width, height);
> +        g2d.xConfig.info.unlock();
>          this.width = width;
>          this.height = height;
> -        roi = new Rectangle2D.Float(0, 0, width, height);
> -    }
> -
> -    void setRoi(Rectangle2D roi) {
> -        this.roi = roi;
> -    }
> -
> -    public ColorModel getColorModel() {
> -        return g2d.xConfig.getColorModel();
>      }
> -
> -    public WritableRaster getRaster() {
> -        if (needServerData) {
> -            long pixmap = x11.XCreatePixmap(
> -                    g2d.display,
> -                    x11.XRootWindow(g2d.display, g2d.xConfig.dev.screen),
> -                    (int) roi.getWidth(), (int) roi.getHeight(),
> -                    g2d.xConfig.info.get_depth()
> -            );
> -
> -            x11.XCopyArea(
> -                    g2d.display,
> -                    g2d.drawable,
> -                    pixmap,
> -                    g2d.imageGC,
> -                    (int) roi.getX(),
> -                    (int) roi.getY(),
> -                    (int) roi.getWidth(), (int) roi.getHeight(),
> -                    0, 0
> -            );
> -
> -            if (!cachedXCIParams) {
> -                long xImagePtr = x11.XGetImage(
> -                        g2d.display,
> -                        pixmap,
> -                        0, 0,
> -                        1, 1,
> -                        ~(0L), // All bits set to 1, should be same as XAllPlanes() result
> -                        X11Defs.ZPixmap
> -                );
> -
> -                if (xImagePtr == 0) // Check obtained XImage pointer
> -                    return null;
> -
> -                X11.XImage xTmpImage = x11.createXImage(xImagePtr);
> -                depthXCI = xTmpImage.get_depth();
> -                formatXCI = xTmpImage.get_format();
> -                offsetXCI = xTmpImage.get_xoffset();
> -                bitmapPadXCI = xTmpImage.get_bitmap_pad();
> -                bytesPerLineXCI = xTmpImage.get_bytes_per_line();
> -                xTmpImage.get_f().destroy_image(xTmpImage);
> -
> -                cachedXCIParams = true;
> -            }
> -
> -            X11.Visual visual = g2d.xConfig.info.get_visual();
> -
> -            long xImagePtr = x11.XCreateImage(
> -                    g2d.display,
> -                    visual.lock(),
> -                    depthXCI,
> -                    formatXCI,
> -                    offsetXCI,
> -                    Utils.memaccess.malloc(height*width*bytesPerLineXCI),
> -                    width, height,
> -                    bitmapPadXCI,
> -                    0
> -            );
> -            visual.unlock();
> -
> -            X11.XImage xImage = x11.createXImage(xImagePtr);
> -            xImage.set_byte_order(X11Defs.LSBFirst);
> -
> -            xImage = x11.XGetSubImage(
> -                    g2d.display,
> -                    pixmap,
> -                    0, 0,
> -                    (int) roi.getWidth(), (int) roi.getHeight(),
> -                    ~(0L), // All bits set to 1, should be same as XAllPlanes() result
> -                    X11Defs.ZPixmap,
> -                    xImage, 0, 0
> -            );
> -            x11.XFreePixmap(g2d.display, pixmap);
> -            lastSnapshot = XVolatileImage.biFromXImage(xImage, g2d.xConfig);
> -
> -            // Cleanup
> -            xImage.get_f().destroy_image(xImage);
> -        } else {
> -            lastSnapshot = g2d.xConfig.createCompatibleImage(width, height);
> -        }
> -
> -        return lastSnapshot.getRaster();
> -    }
> -
> -    void putImage(MultiRectArea clip, int x, int y, int width, int height) {
> -        putImage(
> -                clip,
> -                lastSnapshot.getRaster(),
> -                x, y, width, height
> -        );
> -    }
> -
> -    void putImage(
> -            MultiRectArea clip, Raster r,
> -            int dstX, int dstY,
> -            int dstWidth, int dstHeight
> -    ) {
> -        if (r == null) // Just blit last snapshot
> -            r = lastSnapshot.getRaster();
> -
> -        Object data;
> -        AwtImageBackdoorAccessor dbAccess = AwtImageBackdoorAccessor.getInstance();
> -        data = dbAccess.getData(r.getDataBuffer());
> -        LockedArray lockedData = Utils.arraccess.lockArrayShort(data);
> -
> -        SampleModel sm = r.getSampleModel();
> -        int scanlineStride;
> -        if (sm instanceof ComponentSampleModel) {
> -            scanlineStride = ((ComponentSampleModel) sm).getScanlineStride();
> -        } else if (sm instanceof SinglePixelPackedSampleModel) {
> -            scanlineStride = ((SinglePixelPackedSampleModel) sm).getScanlineStride();
> -        } else if (sm instanceof MultiPixelPackedSampleModel) {
> -            scanlineStride = ((MultiPixelPackedSampleModel) sm).getScanlineStride();
> -        } else {
> -            return;
> -        }
> -
> -        int pad;
> -        if (data instanceof byte[]) {
> -            pad = 8;
> -        } else if (data instanceof short[]) {
> -            pad = 16;
> -            scanlineStride *= 2;
> -        } else if (data instanceof int[]) {
> -            pad = 32;
> -            scanlineStride *= 4;
> -        } else {
> +    @Override
> +    public void dispose() {
> +        if (surfaceDataPtr == 0) {
>              return;
>          }
> -
> -        X11.Visual visual = g2d.xConfig.info.get_visual();
> -
> -        long xImagePtr = x11.XCreateImage(
> -                g2d.display,
> -                visual.lock(),
> -                g2d.xConfig.info.get_depth(),
> -                X11Defs.ZPixmap,
> -                0,
> -                lockedData.getAddress(),
> -                r.getWidth(),
> -                r.getHeight(),
> -                pad,
> -                scanlineStride
> -        );
> -        visual.unlock();
> -
> -        g2d.setXClip(clip, g2d.imageGC);
> -
> -        X11.XImage xImage = x11.createXImage(xImagePtr);
> -        xImage.set_byte_order(X11Defs.LSBFirst); // Set byte order explicitly
> -
> -        x11.XPutImage(
> -                g2d.display,
> -                g2d.drawable,
> -                g2d.imageGC,
> -                xImagePtr,
> -                0, 0,
> -                dstX, dstY,
> -                dstWidth, dstHeight
> -        );
> -
> -        g2d.resetXClip(g2d.imageGC);
> -
> -        lockedData.release();
> -
> -        xImage.set_data(NativeBridge.getInstance().createInt8Pointer(0, true));
> -        xImage.get_f().destroy_image(xImage);
> -    }
> -
> -    public void dispose() {
> -        return;
> -    }
> -
> -    public XGraphics2D getGraphics() {
> -        return g2d;
> -    }
> -
> -    /*
> -    public int getWidth() { // XXX - todo - use from superclass
> -        return this.width;
> -    }
> -
> -    public int getHeight() { // XXX - todo - use from superclass
> -        return this.height;
> +
> +        dispose(surfaceDataPtr);
> +        surfaceDataPtr = 0;
>      }
> -    */
>
> +    @Override
>      public long lock() {
>          return 0;
>      }
>
> +    @Override
>      public void unlock() {
> +
> +    }
> +
> +    @Override
> +    public ColorModel getColorModel() {
> +        return null;
>      }
>
> -    public boolean isNativeDrawable() {
> -        return true;
> +    @Override
> +    public WritableRaster getRaster() {
> +        return null;
>      }
>
> +    @Override
>      public int getSurfaceType() {
> -        return BufferedImage.TYPE_CUSTOM;
> +        return 0;
>      }
>
> +    @Override
>      public Surface getImageSurface() {
> -        if (imageSurface == null) {
> -            imageSurface = new ImageSurface(getColorModel(), getRaster());
> -        } else {
> -            imageSurface.setRaster(getRaster());
> -        }
> -
> -        return imageSurface;
> +        return this;
>      }
>
> -    protected void finalize() throws Throwable {
> -        imageSurface.dispose();
> -    }
> +    private native long createSurfData(long display, long drawable, long gc, long visual_info, int width, int height);
> +
> +    private native void dispose(long structPtr);
> +
>  }
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XVolatileImage.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XVolatileImage.java?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XVolatileImage.java (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XVolatileImage.java Wed Jan 16 06:13:14 2008
> @@ -39,7 +39,7 @@
>
>      private long pixmap;
>      private XGraphicsConfiguration xconf;
> -    private XGraphics2D lastGraphics = null;
> +    Surface surface;
>
>      int width, height;
>
> @@ -54,6 +54,9 @@
>                  w, h,
>                  xconf.info.get_depth()
>          );
> +
> +        surface = new PixmapSurface(display, pixmap, xconf.info.lock(), w, h);
> +        xconf.info.unlock();
>      }
>
>      public long getPixmap() {
> @@ -73,8 +76,7 @@
>      }
>
>      public Graphics2D createGraphics() {
> -        lastGraphics = new XGraphics2D(pixmap, 0, 0, width, height);
> -        return lastGraphics;
> +        return new XGraphics2D(this, 0, 0, width, height);
>      }
>
>      public int validate(GraphicsConfiguration graphicsConfiguration) {
> @@ -278,13 +280,11 @@
>      }
>
>      public void finalize() {
> +        surface.dispose();
>          x11.XFreePixmap(xconf.dev.display, pixmap);
>      }
>
>      public Surface getImageSurface() {
> -        if (lastGraphics == null)
> -            createGraphics();
> -
> -        return lastGraphics.getSurface();
> +        return surface;
>      }
>  }
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindowFactory.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindowFactory.java?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindowFactory.java (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindowFactory.java Wed Jan 16 06:13:14 2008
> @@ -43,7 +43,7 @@
>      private static final X11 x11 = X11.getInstance();
>      private static final NativeBridge bridge = NativeBridge.getInstance();
>
> -    private final XServerConnection xConnection = new XServerConnection(x11);
> +    private final XServerConnection xConnection = XServerConnection.getInstance();
>      private final long display = xConnection.getDisplay();
>      private final int screen = xConnection.getScreen();
>      final WindowManager wm;
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/XServerConnection.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/XServerConnection.java?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/XServerConnection.java (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/XServerConnection.java Wed Jan 16 06:13:14 2008
> @@ -31,8 +31,10 @@
>
>      private final X11 x11;
>
> -    public XServerConnection(X11 x11) {
> -        this.x11 = x11;
> +    private static XServerConnection instance = new XServerConnection();
> +
> +    private XServerConnection() {
> +        this.x11 = X11.getInstance();;
>          display = x11.XOpenDisplay(0); //0 - we use default display only
>          if (display == 0) {
>              String name = System.getProperty("DISPLAY"); //$NON-NLS-1$
> @@ -40,7 +42,15 @@
>              throw new InternalError(Messages.getString("awt.0F", //$NON-NLS-1$
>                      (name != null ? name : ""))); //$NON-NLS-1$
>          }
> +
>          screen = x11.XDefaultScreen(display);
> +
> +        System.loadLibrary("gl");
> +        init(display, screen);
> +    }
> +
> +    public static XServerConnection getInstance(){
> +        return instance;
>      }
>
>      public void close() {
> @@ -54,4 +64,6 @@
>      public int getScreen() {
>          return screen;
>      }
> +
> +    private native void init(long display, int screen);
>  }
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp Wed Jan 16 06:13:14 2008
> @@ -83,6 +83,10 @@
>              {
>                  unsigned int *src, *dst;
>
> +#ifdef unix
> +                unsigned int *s, *d;
> +#endif
> +
>                  src_stride = srcSurf->scanline_stride;
>                  dst_stride = srcSurf->width;
>
> @@ -92,7 +96,16 @@
>                  dst = (unsigned int *)bmpDataPtr + dst_offset;
>
>                  for(int _y = 0; _y < h; _y++, src += src_stride, dst += dst_stride){
> +#ifdef _WIN32
>                      memcpy(dst, src, w * sizeof(int));
> +#endif
> +
> +#ifdef unix
> +                    s = src, d = dst;
> +                    for(int _x = 0; _x < w; _x++, s++, d++){
> +                        *d = 0xff000000 | *s;
> +                    }
> +#endif
>                  }
>              }
>              break;
> @@ -668,10 +681,11 @@
>                      env->ReleasePrimitiveArrayCritical(bandOffsets, p, 0);
>                      break;
>              }
> -            surf->bmp_byte_stride = surf->width << 2;
>              surf->invalidated = true;
> +            surf->bmp_byte_stride = surf->width << 2;
>
>  #ifdef _WIN32
> +
>              surf->bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
>              surf->bmpInfo.bmiHeader.biWidth = surf->width;
>              surf->bmpInfo.bmiHeader.biHeight = -surf->height;
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.h
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.h?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.h (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/SurfaceDataStructure.h Wed Jan 16 06:13:14 2008
> @@ -27,9 +27,11 @@
>  #include <jni.h>
>
>  #ifdef _WIN32
> -
>  #include "gl_GDIPlus.h"
> +#endif
>
> +#ifdef unix
> +#include "XSurfaceInfo.h"
>  #endif
>
>  // Color Space constants
> @@ -146,7 +148,7 @@
>      bool isAlphaPre;
>
>  #ifdef _WIN32
> -    // VolataileImage
> +    // WinVolataileImage
>      GraphicsInfo *gi;
>      GLBITMAPINFO bmpInfo;
>
> @@ -154,6 +156,16 @@
>      HDC srcDC;
>      DWORD rtc;
>      BOOL isTrueColor;
> +#endif
> +
> +#ifdef unix
> +    // XVolatileImage
> +    XImage *ximage;
> +
> +    Display *display;
> +    Drawable drawable;
> +    GC gc;
> +    XVisualInfo *visual_info;
>  #endif
>
>
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/blitter.cpp
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/blitter.cpp?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/blitter.cpp (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/shared/blitter.cpp Wed Jan 16 06:13:14 2008
> @@ -1489,6 +1489,94 @@
>
>  #endif
>
> +#ifdef unix
> +          if(!srcSurf->ximage){
> +              if(XImageByteOrder(srcSurf->display) == LSBFirst){
> +                  srcSurf->ximage = XGetImage(srcSurf->display, srcSurf->drawable, 0, 0,
> +                     srcSurf->width, srcSurf->height, ~(0L), ZPixmap);
> +              }else{
> +                  XImage *tmp = XGetImage(srcSurf->display, srcSurf->drawable, 0, 0,
> +                      1, 1, ~(0L), ZPixmap);
> +
> +                  srcSurf->ximage = XCreateImage(srcSurf->display, srcSurf->visual_info->visual,
> +                      tmp->depth, tmp->format, tmp->xoffset, (char *)malloc(tmp->width * tmp->height * tmp->bytes_per_line),
> +                      srcSurf->width, srcSurf->height, tmp->bitmap_pad, 0);
> +
> +                  XDestroyImage(tmp);
> +
> +                  srcSurf->ximage->byte_order = LSBFirst;
> +
> +                  XGetSubImage(srcSurf->display, srcSurf->drawable, 0, 0,
> +                      srcSurf->width, srcSurf->height, ~(0L), ZPixmap, srcSurf->ximage, 0, 0);
> +              }
> +              srcSurf->scanline_stride_byte = srcSurf->ximage->bytes_per_line;
> +
> +              char *info = (char *)srcSurf->visual_info;
> +              int visual_class = (int)*((int *)(info + sizeof(Visual *) + sizeof(VisualID) + sizeof(int) + sizeof(unsigned int)));
> +              int bpp = srcSurf->ximage->bits_per_pixel;
> +
> +              switch(visual_class){
> +              case TrueColor:
> +              case DirectColor:
> +                  if(bpp == 32){
> +                      srcSurf->scanline_stride = srcSurf->scanline_stride_byte >> 2;
> +                      if(srcSurf->visual_info->red_mask == 0xff0000 && srcSurf->visual_info->green_mask == 0xff00 &&
> +                          srcSurf->visual_info->blue_mask == 0xff){
> +
> +                          srcSurf->ss_type = INT_RGB;
> +                          srcSurf->red_mask = 0xff0000;
> +                          srcSurf->green_mask = 0xff00;
> +                          srcSurf->blue_mask = 0xff;
> +                      } else if (srcSurf->visual_info->red_mask == 0xff && srcSurf->visual_info->green_mask == 0xff00 &&
> +                          srcSurf->visual_info->blue_mask == 0xff0000){
> +
> +                          srcSurf->ss_type = INT_BGR;
> +                          srcSurf->red_mask = 0xff;
> +                          srcSurf->green_mask = 0xff00;
> +                          srcSurf->blue_mask = 0xff0000;
> +                      } else {
> +                          srcSurf->ss_type = -1;
> +                      }
> +                  }else if(bpp == 16){
> +                      srcSurf->scanline_stride = srcSurf->scanline_stride_byte >> 1;
> +                      if(srcSurf->visual_info->red_mask == 0x7c00 && srcSurf->visual_info->green_mask == 0x03e0 &&
> +                          srcSurf->visual_info->blue_mask == 0x1f){
> +
> +                          srcSurf->ss_type = USHORT_555;
> +                          srcSurf->red_mask = 0x7c00;
> +                          srcSurf->green_mask = 0x03e0;
> +                          srcSurf->blue_mask = 0x1f;
> +                      } else if (srcSurf->visual_info->red_mask == 0xf800 && srcSurf->visual_info->green_mask == 0x07e0 &&
> +                          srcSurf->visual_info->blue_mask == 0x1f){
> +
> +                          srcSurf->ss_type = USHORT_565;
> +                          srcSurf->red_mask = 0xf800;
> +                          srcSurf->green_mask = 0x07e0;
> +                          srcSurf->blue_mask = 0x1f;
> +                      } else {
> +                          srcSurf->ss_type = -1;
> +                      }
> +                  }else{
> +                          srcSurf->ss_type = -1;
> +                  }
> +                  break;
> +              case StaticGray:
> +              case PseudoColor:
> +              case GrayScale:
> +              case StaticColor:
> +                  // TODO: Need to implement parsing of others visual types
> +                  srcSurf->ss_type = -1;
> +                  break;
> +              default:
> +                  srcSurf->ss_type = -1;
> +              }
> +          } else {
> +                 XGetSubImage(srcSurf->display, srcSurf->drawable, 0, 0,
> +                     srcSurf->width, srcSurf->height, ~(0L), ZPixmap, srcSurf->ximage, 0, 0);
> +          }
> +          srcDataPtr = srcSurf->ximage->data;
> +#endif
> +          srcType = srcSurf->ss_type;
>        }else{
>            srcDataPtr = env->GetPrimitiveArrayCritical((jarray)srcData, 0);
>        }
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/XGraphics2D.cpp
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/XGraphics2D.cpp?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/XGraphics2D.cpp (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/XGraphics2D.cpp Wed Jan 16 06:13:14 2008
> @@ -26,6 +26,7 @@
>  #include <X11/Xutil.h>
>  #include <X11/Xos.h>
>
> +#include "XSurfaceInfo.h"
>  #include "org_apache_harmony_awt_gl_linux_XGraphics2D.h"
>
>  JNIEXPORT jlong JNICALL
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/exports.txt
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/exports.txt?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/exports.txt (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/exports.txt Wed Jan 16 06:13:14 2008
> @@ -32,3 +32,12 @@
>  Java_org_apache_harmony_awt_gl_linux_XGraphics2D_setForeground
>  Java_org_apache_harmony_awt_gl_linux_XGraphics2D_setFunction
>  Java_org_apache_harmony_awt_gl_linux_XGraphics2D_setStroke
> +Java_org_apache_harmony_awt_gl_linux_XSurface_createSurfData
> +Java_org_apache_harmony_awt_gl_linux_XSurface_dispose
> +Java_org_apache_harmony_awt_gl_linux_PixmapSurface_createSurfData
> +Java_org_apache_harmony_awt_gl_linux_PixmapSurface_dispose
> +Java_org_apache_harmony_awt_gl_linux_XBlitter_bltImage
> +Java_org_apache_harmony_awt_gl_linux_XBlitter_bltPixmap
> +Java_org_apache_harmony_awt_gl_linux_XBlitter_xorImage
> +Java_org_apache_harmony_awt_gl_linux_XBlitter_xorPixmap
> +Java_org_apache_harmony_awt_wtk_linux_XServerConnection_init
>
> Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/makefile
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/makefile?rev=612466&r1=612465&r2=612466&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/makefile (original)
> +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/gl/unix/makefile Wed Jan 16 06:13:14 2008
> @@ -25,6 +25,8 @@
>    $(SHAREDSUB)/LUTTables.o \
>    $(SHAREDSUB)/pngdecoder.o \
>    $(SHAREDSUB)/SurfaceDataStructure.o \
> +  gl.o \
> +  XBlitter.o \
>    XGraphics2D.o \
>    libpng.a
>
>
>
>

Mime
View raw message