harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r601321 - /harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java
Date Wed, 05 Dec 2007 12:37:06 GMT
Author: apetrenko
Date: Wed Dec  5 04:37:04 2007
New Revision: 601321

URL: http://svn.apache.org/viewvc?rev=601321&view=rev
Log:
Patch for HARMONY-5258 "[classlib][awt] Graphics draw and fill methods 
work incorrectly with AlphaComposite different from AlphaComposite.Src"

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XGraphics2D.java

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=601321&r1=601320&r2=601321&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 Dec  5 04:37:04 2007
@@ -521,12 +521,58 @@
         super.setComposite(composite);
         if (composite instanceof AlphaComposite) {
             AlphaComposite acomp = (AlphaComposite) composite;
-            if (acomp.getRule() == AlphaComposite.SRC) {
-                simpleComposite = true;
-            } else if (acomp.getAlpha() != 1.0f) {
-                simpleComposite = false;
-            } else {
-                simpleComposite = true;
+            int rule = acomp.getRule();
+            float srca = acomp.getAlpha();
+
+            switch(rule){
+                case AlphaComposite.CLEAR:
+                case AlphaComposite.SRC_OUT:
+                    x11.XSetFunction(display, gc, X11Defs.GXclear);                
+                    simpleComposite = true;
+                    break;
+
+                case AlphaComposite.SRC:
+                case AlphaComposite.SRC_IN:
+                    if(srca == 0.0f) x11.XSetFunction(display, gc, X11Defs.GXclear);
+                    else x11.XSetFunction(display, gc, X11Defs.GXcopy);
+                    simpleComposite = true;
+                    break;
+
+                case AlphaComposite.DST:
+                case AlphaComposite.DST_OVER:
+                    x11.XSetFunction(display, gc, X11Defs.GXnoop);                
+                    simpleComposite = true;
+                    break;
+
+                case AlphaComposite.SRC_ATOP:
+                case AlphaComposite.SRC_OVER:
+                    x11.XSetFunction(display, gc, X11Defs.GXcopy);                
+                    if(srca == 1.0f){
+                        simpleComposite = true;
+                    }else{
+                        simpleComposite = false;
+                    }
+                    break;
+
+                case AlphaComposite.DST_IN:
+                case AlphaComposite.DST_ATOP:
+                    if(srca != 0.0f){
+                        x11.XSetFunction(display, gc, X11Defs.GXnoop);                
+                    } else {
+                        x11.XSetFunction(display, gc, X11Defs.GXclear);                
+                    }
+                    simpleComposite = true;
+                    break;
+
+                case AlphaComposite.DST_OUT:
+                case AlphaComposite.XOR:
+                    if(srca != 1.0f){
+                        x11.XSetFunction(display, gc, X11Defs.GXnoop);                
+                    } else {
+                        x11.XSetFunction(display, gc, X11Defs.GXclear);                
+                    }
+                    simpleComposite = true;
+                    break;
             }
         } else {
             simpleComposite = false;



Mime
View raw message