2003/11/18 10:47:27
[org.ibex.core.git] / src / org / xwt / plat / X11.java
index ba739ec..afaf975 100644 (file)
@@ -155,8 +155,8 @@ public class X11 extends POSIX {
         RawData fake_ximage = null;    // a 'fake' XImage corresponding to the shared pixmap; gives us the address and depth parameters
         RawData shm_segment = null;    // XShmSegmentInfo
 
-        RawData gc;                    // Graphics Context on pm (never changes, so it's fast)
-        RawData clipped_gc;            // Graphics Context on pm, use this one if you need a clip/stipple
+        RawData gc;                    // Graphics Interpreter on pm (never changes, so it's fast)
+        RawData clipped_gc;            // Graphics Interpreter on pm, use this one if you need a clip/stipple
 
         /** PixelBuffer mode */
         public X11PixelBuffer(int w, int h) { this(w, h, true); }
@@ -169,9 +169,19 @@ public class X11 extends POSIX {
         }
 
         public void drawPictureAlphaOnly(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {        
+           cx1 = Math.max(dx, cx1);
+           cy1 = Math.max(dy, cy1);
+           cx2 = Math.min(dx + source.getWidth(), cx2); 
+           cy2 = Math.min(dy + source.getHeight(), cy2); 
+           if (cx1 >= cx2 || cy1 >= cy2) return;
             slowDrawPicture(source, dx, dy, cx1, cy1, cx2, cy2, rgb, true);
         }
         public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) {
+           cx1 = Math.max(dx, cx1);
+           cy1 = Math.max(dy, cy1);
+           cx2 = Math.min(dx + source.getWidth(), cx2); 
+           cy2 = Math.min(dy + source.getHeight(), cy2); 
+           if (cx1 >= cx2 || cy1 >= cy2) return;
             if (((X11Picture)source).doublebuf != null)
                 fastDrawPicture(source, dx, dy, cx1, cy1, cx2, cy2);
             else