new PixelBuffer API (mainly tons of renames)
authoradam <adam@megacz.com>
Sun, 9 Jan 2005 10:59:11 +0000 (10:59 +0000)
committeradam <adam@megacz.com>
Sun, 9 Jan 2005 10:59:11 +0000 (10:59 +0000)
darcs-hash:20050109105911-5007d-c1b8ebd80ace0baadc16aae43490ce9daf9df9e2.gz

16 files changed:
src/org/ibex/core/Box.java
src/org/ibex/graphics/PixelBuffer.java
src/org/ibex/graphics/Polygon.java
src/org/ibex/graphics/Surface.java
src/org/ibex/plat/AWT.java
src/org/ibex/plat/Darwin.cc
src/org/ibex/plat/Darwin.java
src/org/ibex/plat/Java2.java
src/org/ibex/plat/Java4.java
src/org/ibex/plat/OpenGL.cc
src/org/ibex/plat/OpenGL.java
src/org/ibex/plat/Platform.java
src/org/ibex/plat/Win32.cc
src/org/ibex/plat/Win32.java
src/org/ibex/plat/X11.cc
src/org/ibex/plat/X11.java

index 17323c1..16bae85 100644 (file)
@@ -118,6 +118,10 @@ public final class Box extends JS.Obj implements Callable {
     public int maxwidth = Integer.MAX_VALUE;
     public int minheight = 0;
     public int maxheight = Integer.MAX_VALUE;
     public int maxwidth = Integer.MAX_VALUE;
     public int minheight = 0;
     public int maxheight = Integer.MAX_VALUE;
+    public int minwidth() { return minwidth; }
+    public int minheight() { return minheight; }
+    public int maxwidth() { return maxwidth; }
+    public int maxheight() { return maxheight; }
     private short rows = 1;
     private short cols = 0;
     private short rowspan = 1;
     private short rows = 1;
     private short cols = 0;
     private short rowspan = 1;
index 14c0d25..24c4b01 100644 (file)
@@ -20,6 +20,7 @@ import org.ibex.util.*;
 public interface PixelBuffer {
     public abstract void drawLine(int x1, int y1, int x2, int y2, int color);
     public abstract void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color);
 public interface PixelBuffer {
     public abstract void drawLine(int x1, int y1, int x2, int y2, int color);
     public abstract void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color);
+    public abstract void drawPicture(Picture p, int x, int y, int x1, int y1, int w, int h);  // names may be wrong
     public abstract void drawGlyph(Font.Glyph source, int dx1, int dy1, int cx1, int cy1, int cx2, int cy2, int rgb, int bg);
     public abstract void stroke(Polygon p, int color);
     public abstract void fill(Polygon p, Paint paint);
     public abstract void drawGlyph(Font.Glyph source, int dx1, int dy1, int cx1, int cy1, int cx2, int cy2, int rgb, int bg);
     public abstract void stroke(Polygon p, int color);
     public abstract void fill(Polygon p, Paint paint);
index 5870383..a5221c7 100644 (file)
@@ -198,7 +198,7 @@ public final class Polygon {
             float y1 = p.y[p.edges[i]];\r
             float x2 = p.x[p.edges[i]+1];\r
             float y2 = p.y[p.edges[i]+1];\r
             float y1 = p.y[p.edges[i]];\r
             float x2 = p.x[p.edges[i]+1];\r
             float y2 = p.y[p.edges[i]+1];\r
-            buf.drawLine((int)Math.floor(x1), (int)Math.floor(y1), (int)Math.ceil(x2), (int)Math.ceil(y2), 1, color, false);\r
+            buf.drawLine((int)Math.floor(x1), (int)Math.floor(y1), (int)Math.ceil(x2), (int)Math.ceil(y2), color);\r
         }\r
     }\r
 \r
         }\r
     }\r
 \r
index 82ac330..7658ec5 100644 (file)
@@ -217,10 +217,9 @@ public abstract class Surface implements Callable {
         }
     }
 
         }
     }
 
-    public void dirty(int x, int y, int w, int h) {
-        dirtyRegions.dirty(x, y, w, h);
-        Refresh();
-    }
+    // This is how subclasses signal a 'shallow dirty', indicating that although the backbuffer is valid, the screen is not
+    public void Dirty(int x, int y, int w, int h) { dirty(x,y,w,h); }
+    public void dirty(int x, int y, int w, int h) { dirtyRegions.dirty(x, y, w, h); Refresh(); }
 
     public static Surface fromBox(Box b) {
         // FIXME use a hash table here
 
     public static Surface fromBox(Box b) {
         // FIXME use a hash table here
@@ -291,8 +290,8 @@ public abstract class Surface implements Callable {
             if (y+h > root.height) h = root.height - y;
             if (w <= 0 || h <= 0) continue;
 
             if (y+h > root.height) h = root.height - y;
             if (w <= 0 || h <= 0) continue;
 
-            root.render(0, 0, x, y, x + w, y + h, this, identity);
-            drawPicture(scarImage, 0, root.height - scarImage.height, x, y, x+w, y+h);
+            root.render(0, 0, x, y, x + w, y + h, this.getPixelBuffer(), identity);
+            getPixelBuffer().drawPicture(scarImage, 0, root.height - scarImage.height, x, y, x+w, y+h);
             
             if (abort) {
                 // x,y,w,h is only partially reconstructed, so we must be careful not to re-blit it
             
             if (abort) {
                 // x,y,w,h is only partially reconstructed, so we must be careful not to re-blit it
@@ -354,25 +353,42 @@ public abstract class Surface implements Callable {
 
     // Default PixelBuffer implementation /////////////////////////////////////////////////////////
 
 
     // Default PixelBuffer implementation /////////////////////////////////////////////////////////
 
-    public static abstract class DoubleBufferedSurface extends Surface {
+    public static abstract class DoubleBufferedSurface extends Surface implements PixelBuffer {
 
         public DoubleBufferedSurface(Box root) { super(root); }
         PixelBuffer backbuffer = Platform.createPixelBuffer(Platform.getScreenWidth(), Platform.getScreenHeight(), this);
         DirtyList screenDirtyRegions = new DirtyList();
 
 
         public DoubleBufferedSurface(Box root) { super(root); }
         PixelBuffer backbuffer = Platform.createPixelBuffer(Platform.getScreenWidth(), Platform.getScreenHeight(), this);
         DirtyList screenDirtyRegions = new DirtyList();
 
+        public PixelBuffer getPixelBuffer() { return this; }
         public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) {
             screenDirtyRegions.dirty(cx1, cy1, cx2 - cx1, cy2 - cy1);
             backbuffer.drawPicture(source, dx, dy, cx1, cy1, cx2, cy2);
         }
 
         public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) {
             screenDirtyRegions.dirty(cx1, cy1, cx2 - cx1, cy2 - cy1);
             backbuffer.drawPicture(source, dx, dy, cx1, cy1, cx2, cy2);
         }
 
-        public void drawGlyph(Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int argb) {
+        public void drawGlyph(Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int argb, int bc) {
             screenDirtyRegions.dirty(cx1, cy1, cx2 - cx1, cy2 - cy1);
             screenDirtyRegions.dirty(cx1, cy1, cx2 - cx1, cy2 - cy1);
-            backbuffer.drawGlyph(source, dx, dy, cx1, cy1, cx2, cy2, argb);
+            backbuffer.drawGlyph(source, dx, dy, cx1, cy1, cx2, cy2, argb, bc);
+        }
+
+        public void stroke(Polygon p, int color) {
+            // FIXME
+        }
+        
+        public void fill(Polygon p, Paint paint) {
+            // FIXME
+        }
+
+        public void drawLine(int x1, int y1, int x2, int y2, int color) {
+            screenDirtyRegions.dirty(x1, y1, x2, y2);
+            backbuffer.drawLine(x1, y1, x2, y2, color);
         }
 
         }
 
+        public abstract void _fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color);
         public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color) {
         public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color) {
+            // we don't dirty trapezoid-fills since it's faster to just do them directly than to copy from the backbuffer
             screenDirtyRegions.dirty(Math.min(x1, x3), y1, Math.max(x2, x4) - Math.min(x1, x3), y2 - y1);
             backbuffer.fillTrapezoid(x1, x2, y1, x3, x4, y2, color);
             screenDirtyRegions.dirty(Math.min(x1, x3), y1, Math.max(x2, x4) - Math.min(x1, x3), y2 - y1);
             backbuffer.fillTrapezoid(x1, x2, y1, x3, x4, y2, color);
+            //_fillTrapezoid(x1, x2, y1, x3, x4, y2, color);
         }
 
         public void render() {
         }
 
         public void render() {
@@ -395,7 +411,7 @@ public abstract class Surface implements Callable {
             }
         }
 
             }
         }
 
-        /** This is how subclasses signal a 'shallow dirty', indicating that although the backbuffer is valid, the screen is not */
+        // This is how subclasses signal a 'shallow dirty', indicating that although the backbuffer is valid, the screen is not
         public final void Dirty(int x, int y, int w, int h) {
             screenDirtyRegions.dirty(x, y, w, h);
             Scheduler.renderAll();
         public final void Dirty(int x, int y, int w, int h) {
             screenDirtyRegions.dirty(x, y, w, h);
             Scheduler.renderAll();
@@ -406,9 +422,11 @@ public abstract class Surface implements Callable {
             super.dirty(x, y, w, h);
         }
 
             super.dirty(x, y, w, h);
         }
 
-        /** copies a region from the doublebuffer to this surface */
+        // copies a region from the doublebuffer to this surface
         public abstract void blit(PixelBuffer source, int sx, int sy, int dx, int dy, int dx2, int dy2);
         public abstract void blit(PixelBuffer source, int sx, int sy, int dx, int dy, int dx2, int dy2);
-
+        protected void blit(int x, int y, int w, int h) {
+            blit(backbuffer, x, y, x, y, w + x, h + y);
+        }
     }
 
 }
     }
 
 }
index 0f6143a..d937588 100644 (file)
@@ -121,6 +121,7 @@ public class AWT extends JVM {
     protected org.ibex.graphics.Font.Glyph _createGlyph(org.ibex.graphics.Font f, char c) { return new AWTGlyph(f, c); }
     protected static class AWTGlyph extends org.ibex.graphics.Font.Glyph {
         private Image i = null;
     protected org.ibex.graphics.Font.Glyph _createGlyph(org.ibex.graphics.Font f, char c) { return new AWTGlyph(f, c); }
     protected static class AWTGlyph extends org.ibex.graphics.Font.Glyph {
         private Image i = null;
+        private Image i2 = null;
         private static ColorModel cmodel = new DirectColorModel(32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
 
         // this doesn't work on Win32 because the JVM is broken
         private static ColorModel cmodel = new DirectColorModel(32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
 
         // this doesn't work on Win32 because the JVM is broken
@@ -186,15 +187,17 @@ public class AWT extends JVM {
         }
     }
     
         }
     }
     
-    protected static class AWTPixelBuffer extends PixelBuffer {
+    protected static class AWTPixelBuffer implements PixelBuffer {
         
         protected Image i = null;
         protected Graphics g = null;
         
         protected Image i = null;
         protected Graphics g = null;
-        
+        protected AWTSurface surface = null;
+
         /** JDK1.1 platforms require that a component be associated with each off-screen buffer */
         static Component component = null;
 
         /** JDK1.1 platforms require that a component be associated with each off-screen buffer */
         static Component component = null;
 
-        protected AWTPixelBuffer() { }
+        public AWTPixelBuffer(Image i) { this.i = i; }
+        public AWTPixelBuffer(AWTSurface s) { this.surface = s; }
         public AWTPixelBuffer(int w, int h) {
             synchronized(AWTPixelBuffer.class) {
                 if (component == null) {
         public AWTPixelBuffer(int w, int h) {
             synchronized(AWTPixelBuffer.class) {
                 if (component == null) {
@@ -204,55 +207,69 @@ public class AWT extends JVM {
                 }
             }
             i = component.createImage(w, h);
                 }
             }
             i = component.createImage(w, h);
-            g = i.getGraphics();
+        }
+        Graphics getGraphics() {
+            if (surface != null) return surface.getGraphics();
+            if (g != null) return g;
+            if (i != null) { g = i.getGraphics(); return g; }
+            return null;
         }
         
         }
         
-        public int getHeight() { return i == null ? 0 : i.getHeight(null); }
-        public int getWidth() { return i == null ? 0 : i.getWidth(null); }
-
         public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) {
             ((AWTPicture)source).init();
         public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) {
             ((AWTPicture)source).init();
+            Graphics g = getGraphics();
             g.setClip(cx1, cy1, cx2 - cx1, cy2 - cy1);
             g.drawImage(((AWTPicture)source).i, dx, dy, null);
             g.setClip(cx1, cy1, cx2 - cx1, cy2 - cy1);
             g.drawImage(((AWTPicture)source).i, dx, dy, null);
-            g.setClip(0, 0, i.getWidth(null), i.getHeight(null));
+            if (i != null) g.setClip(0, 0, i.getWidth(null), i.getHeight(null));
         }
 
         }
 
-        /** implemented with java.awt 1.1's setXORMode() */
-        public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {
-
-            // XOR the target region
-            g.setXORMode(new java.awt.Color((rgb & 0x00ff0000) >> 16, (rgb & 0x0000ff00) >> 8, rgb & 0x000000ff));
-            g.setColor(new java.awt.Color(0x0, 0x0, 0x0));
-            g.fillRect(cx1, cy1, cx2 - cx1, cy2 - cy1);
-
-            // blacken the area we want the glyph to cover
-            g.setPaintMode();
-            g.setClip(cx1, cy1, cx2 - cx1, cy2 - cy1);
-            g.drawImage(((AWTGlyph)source).getImage(), dx, dy, null);
-            g.setClip(0, 0, i.getWidth(null), i.getHeight(null));
+        public void drawLine(int x1, int y1, int x2, int y2, int rgb) {
+            Graphics g = getGraphics();
+            ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 
+            g.setColor(new java.awt.Color((rgb & 0x00ff0000) >> 16, (rgb & 0x0000ff00) >> 8, rgb & 0x000000ff));
+            g.drawLine(x1, y1, x2, y2);
+        }
 
 
-            // XOR back, turning black into the chosen rgb color
-            g.setXORMode(new java.awt.Color((rgb & 0x00ff0000) >> 16, (rgb & 0x0000ff00) >> 8, rgb & 0x000000ff));
-            g.setColor(new java.awt.Color(0x0, 0x0, 0x0));
-            g.fillRect(cx1, cy1, cx2 - cx1, cy2 - cy1);
+        public void stroke(org.ibex.graphics.Polygon p, int color) { p.stroke(this, color); }
+        public void fill(org.ibex.graphics.Polygon p, org.ibex.graphics.Paint paint) { p.fill(this, paint); }
 
 
-            // restore the graphics context
-            g.setPaintMode();
+        private static int[] xa = new int[4];
+        private static int[] ya = new int[4];
+        public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int argb) {
+            Graphics g = getGraphics();
+            ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); 
+            g.setColor(new java.awt.Color((argb & 0x00FF0000) >> 16, (argb & 0x0000FF00) >> 8, (argb & 0x000000FF)));
+            xa[0]=x1;
+            xa[1]=x2;
+            xa[2]=x4;
+            xa[3]=x3;
+            ya[0]=y1;
+            ya[1]=y1;
+            ya[2]=y2;
+            ya[3]=y2;
+            g.fillPolygon(xa, ya, 4);
         }
 
         }
 
-        // FIXME: try to use os acceleration
-        public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int argb) {
+        // this doens't seem to work on Windows
+        public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2,
+                              int rgb, int argb) {
+            Image i = ((AWTGlyph)source).getImage();
+            if (((AWTGlyph)source).i2 == null)
+                ((AWTGlyph)source).i2 = new BufferedImage(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_ARGB);
+            Image i2 = ((AWTGlyph)source).i2;
+            Graphics g2 = i2.getGraphics();
+            g2.setColor(new java.awt.Color((argb & 0x00FF0000) >> 16, (argb & 0x0000FF00) >> 8, (argb & 0x000000FF)));
+            g2.fillRect(0, 0, i2.getWidth(null), i2.getHeight(null));
+            g2.drawImage(i, 0, 0, null);
+            Graphics g = getGraphics();
+            g.setClip(cx1, cy1, cx2 - cx1, cy2 - cy1);
+            g.drawImage(i2, dx, dy, i2.getWidth(null), i2.getHeight(null), null);
             g.setColor(new java.awt.Color((argb & 0x00FF0000) >> 16, (argb & 0x0000FF00) >> 8, (argb & 0x000000FF)));
             g.setColor(new java.awt.Color((argb & 0x00FF0000) >> 16, (argb & 0x0000FF00) >> 8, (argb & 0x000000FF)));
-            if (x1 == x3 && x2 == x4) {
-                g.fillRect(x1, y1, x4 - x1, y2 - y1);
-            } else for(int y=y1; y<y2; y++) {
-                int _x1 = (int)Math.floor((y - y1) * (x3 - x1) / (y2 - y1) + x1);
-                int _y1 = (int)Math.floor(y);
-                int _x2 = (int)Math.ceil((y - y1) * (x4 - x2) / (y2 - y1) + x2);
-                int _y2 = (int)Math.floor(y) + 1;
-                if (_x1 > _x2) { int _x0 = _x1; _x1 = _x2; _x2 = _x0; }
-                g.fillRect(_x1, _y1, _x2 - _x1, _y2 - _y1);
-            }
+            g.fillRect(cx1, cy1, dx - cx1,  cy2 - cy1);
+            g.fillRect(cx1, cy1, cx2 - cx1, dy - cy1);
+            g.fillRect(dx+i2.getWidth(null), cy1, cx2 - (dx+i2.getWidth(null)), cy2 - cy1);
+            g.fillRect(cx1, dy+i2.getHeight(null), cx2 - cx1, cy2 - (dy+i2.getHeight(null)));
+            g.setClip(0, 0, 1000, 1000);
         }
     }
     
         }
     }
     
@@ -260,32 +277,32 @@ public class AWT extends JVM {
     protected static class AWTSurface extends Surface.DoubleBufferedSurface
         implements MouseListener, MouseMotionListener, KeyListener, ComponentListener, WindowListener {
 
     protected static class AWTSurface extends Surface.DoubleBufferedSurface
         implements MouseListener, MouseMotionListener, KeyListener, ComponentListener, WindowListener {
 
-        public void blit(PixelBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2) {
-            insets = (frame == null ? window : frame).getInsets();
-            window.getGraphics().drawImage(((AWTPixelBuffer)s).i,
-                                  dx + insets.left,
-                                  dy + insets.top,
-                                  dx2 + insets.left,
-                                  dy2 + insets.top,
-                                  sx, sy, sx + (dx2 - dx), sy + (dy2 - dy), null);
-        }
-        
-        /** if (component instanceof Frame) then frame == window else frame == null */
+        protected AWTPixelBuffer pb = null;
+        private Graphics g = null;
         Frame frame = null;
         Window window = null;
         Frame frame = null;
         Window window = null;
+
+        public void blit(PixelBuffer source, int sx, int sy, int dx, int dy, int dx2, int dy2) {
+            getGraphics().drawImage(((AWTPixelBuffer)source).i, sx, sy, sx+(dx2-dx), sy+(dy2-dy), dx, dy, dx2, dy2, null);
+        }
         
         /** our component's insets */
         protected Insets insets = new Insets(0, 0, 0, 0);
         
         /** our component's insets */
         protected Insets insets = new Insets(0, 0, 0, 0);
-        
-        /** some JDKs let us recycle a single Dimension object when calling getSize() */
-        Dimension singleSize = new Dimension();
-        
+        Graphics getGraphics() { if (g==null) g=window==null ? frame.getGraphics() : window.getGraphics(); return g; }
+        public void _fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color) {
+            if (pb ==null) pb = new AWTPixelBuffer(this);
+            pb.fillTrapezoid(x1, x2, y1, x3, x4, y2, color);
+        }
+        //public PixelBuffer getPixelBuffer() { return pb != null ? pb : (pb = new AWTPixelBuffer(this)); } 
+        public void setMinimumSize(int minx, int miny, boolean resizable) { if (frame != null) frame.setResizable(resizable); }
         public void toBack() { if (window != null) window.toBack(); }
         public void toFront() { if (window != null) window.toFront(); }
         public void setLocation() { window.setLocation(root.x, root.y); }
         public void setTitleBarText(String s) { if (frame != null) frame.setTitle(s); }
         public void setIcon(Picture i) { if (frame != null) frame.setIconImage(((AWTPicture)i).i); }
         public void toBack() { if (window != null) window.toBack(); }
         public void toFront() { if (window != null) window.toFront(); }
         public void setLocation() { window.setLocation(root.x, root.y); }
         public void setTitleBarText(String s) { if (frame != null) frame.setTitle(s); }
         public void setIcon(Picture i) { if (frame != null) frame.setIconImage(((AWTPicture)i).i); }
-        public void _setSize(int width, int height) { window.setSize(width + (insets.left + insets.right), height + (insets.top + insets.bottom)); }
+        public void _setSize(int width, int height) {
+            g = null;
+            window.setSize(width + (insets.left + insets.right), height + (insets.top + insets.bottom)); }
         public void setInvisible(boolean b) { window.setVisible(!b); }
         protected void _setMinimized(boolean b) { if (Log.on) Log.info(this, "JDK 1.1 platforms cannot minimize or unminimize windows"); }
         protected void _setMaximized(boolean b) {
         public void setInvisible(boolean b) { window.setVisible(!b); }
         protected void _setMinimized(boolean b) { if (Log.on) Log.info(this, "JDK 1.1 platforms cannot minimize or unminimize windows"); }
         protected void _setMaximized(boolean b) {
@@ -295,14 +312,15 @@ public class AWT extends JVM {
             }
             window.setLocation(new Point(0, 0));
             window.setSize(Toolkit.getDefaultToolkit().getScreenSize());
             }
             window.setLocation(new Point(0, 0));
             window.setSize(Toolkit.getDefaultToolkit().getScreenSize());
+            g = null;
         }
 
         class InnerFrame extends Frame {
             public InnerFrame() throws java.lang.UnsupportedOperationException { }
         }
 
         class InnerFrame extends Frame {
             public InnerFrame() throws java.lang.UnsupportedOperationException { }
-            public Dimension getMinimumSize() {
-                return new Dimension(root == null ? 0 : root.minwidth, root == null ? 0 : root.minheight); }
+            public Dimension getMinimumSize() { return new Dimension(root.minwidth(), root.minheight()); }
             public void update(Graphics gr) { paint(gr); }
             public void paint(Graphics gr) {
             public void update(Graphics gr) { paint(gr); }
             public void paint(Graphics gr) {
+                // Mac OS X Jdk1.4 Bug: after a componentResized(), you must wait for the paint() before you redraw
                 Rectangle r = gr.getClipBounds();
 
                 // ugly hack for Java1.4 dynamicLayout on Win32 -- this catches expansions during smooth resize
                 Rectangle r = gr.getClipBounds();
 
                 // ugly hack for Java1.4 dynamicLayout on Win32 -- this catches expansions during smooth resize
@@ -312,23 +330,24 @@ public class AWT extends JVM {
                     componentResized(window.getWidth() - insets.left - insets.right,
                                      window.getHeight() - insets.top - insets.bottom);
 
                     componentResized(window.getWidth() - insets.left - insets.right,
                                      window.getHeight() - insets.top - insets.bottom);
 
-                Dirty(r.x - insets.left, r.y - insets.top, r.width, r.height);
+                //Dirty(r.x - insets.left, r.y - insets.top, r.width, r.height);
+                g = gr;
+                blit(r.x - insets.left, r.y - insets.top, r.width, r.height);
+                g.setClip(0, 0, getWidth(), getHeight());
             }
         }
 
         class InnerWindow extends Window {
             public InnerWindow() throws java.lang.UnsupportedOperationException { super(new Frame()); }
             }
         }
 
         class InnerWindow extends Window {
             public InnerWindow() throws java.lang.UnsupportedOperationException { super(new Frame()); }
-            public Dimension getMinimumSize() {
-                return new Dimension(root == null ? 0 : root.minwidth, root == null ? 0 : root.minheight); }
+            public Dimension getMinimumSize() { return new Dimension(root.minwidth(), root.minheight()); }
             public void update(Graphics gr) { paint(gr); }
             public void paint(Graphics gr) {
             public void update(Graphics gr) { paint(gr); }
             public void paint(Graphics gr) {
+                g = null;
                 Rectangle r = gr.getClipBounds();
                 Dirty(r.x - insets.left, r.y - insets.top, r.width, r.height);
             }
         }
 
                 Rectangle r = gr.getClipBounds();
                 Dirty(r.x - insets.left, r.y - insets.top, r.width, r.height);
             }
         }
 
-        public void setMinimumSize(int minx, int miny, boolean resizable) { if (frame != null) frame.setResizable(resizable); }
-
         private int oldfill = 0x0;
         public void render() {
             // useful optimizatin;
         private int oldfill = 0x0;
         public void render() {
             // useful optimizatin;
@@ -425,7 +444,11 @@ public class AWT extends JVM {
             componentResized(window.getWidth() - insets.left - insets.right, window.getHeight() - insets.top - insets.bottom);
         }
 
             componentResized(window.getWidth() - insets.left - insets.right, window.getHeight() - insets.top - insets.bottom);
         }
 
-        public void componentResized(int newwidth, int newheight) { SizeChange(newwidth, newheight); }
+        public void componentResized(int newwidth, int newheight) {
+            SizeChange(newwidth, newheight);
+            //if (newwidth > root.width) Dirty(root.width, 0, newwidth-root.width, newheight);
+            //if (newheight > root.height) Dirty(0, root.height, newwidth, newheight-root.height);
+        }
 
         public void keyTyped(KeyEvent k) { }
         public void keyPressed(KeyEvent k) { KeyPressed(translateKey(k)); }
 
         public void keyTyped(KeyEvent k) { }
         public void keyPressed(KeyEvent k) { KeyPressed(translateKey(k)); }
index 9a77ae0..ed01572 100644 (file)
@@ -1,7 +1,4 @@
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
-
+// Copyright 2003 Adam Megacz, see the COPYING file for licensing [LGPL]
 // Authors: Brian Alliet and Evan Jones
 #ifndef __APPLE_CC__
 #define FSF_GCC
 // Authors: Brian Alliet and Evan Jones
 #ifndef __APPLE_CC__
 #define FSF_GCC
@@ -21,6 +18,7 @@
 
 #include <org/ibex/plat/Darwin.h>
 #include <org/ibex/plat/Darwin$CarbonSurface.h>
 
 #include <org/ibex/plat/Darwin.h>
 #include <org/ibex/plat/Darwin$CarbonSurface.h>
+#include <org/ibex/plat/Darwin$GLCarbonSurface$GLCarbonSurfacePixelBuffer.h>
 #include <org/ibex/plat/Darwin$GLCarbonSurface.h>
 #include <org/ibex/plat/Darwin$GLCarbonPixelBuffer.h>
 #include <org/ibex/plat/Darwin$CarbonMessage.h>
 #include <org/ibex/plat/Darwin$GLCarbonSurface.h>
 #include <org/ibex/plat/Darwin$GLCarbonPixelBuffer.h>
 #include <org/ibex/plat/Darwin$CarbonMessage.h>
@@ -705,7 +703,7 @@ static OSStatus paintProc (
     Darwin$CarbonSurface *surface = (Darwin$CarbonSurface*) userData;
     Rect rect;
     WC(GetRegionBounds)(inClientPaintRgn, &rect);
     Darwin$CarbonSurface *surface = (Darwin$CarbonSurface*) userData;
     Rect rect;
     WC(GetRegionBounds)(inClientPaintRgn, &rect);
-    surface->Dirty(rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top);
+    surface->dirty(rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top);
     return noErr;
 }
 
     return noErr;
 }
 
@@ -718,9 +716,9 @@ void Darwin$CarbonSurface::natInit(jboolean framed) {
     WindowAttributes attr =  kWindowStandardHandlerAttribute|
       (framed ? kWindowInWindowMenuAttribute|kWindowStandardDocumentAttributes|kWindowLiveResizeAttribute : 0);
     OSStatus r;
     WindowAttributes attr =  kWindowStandardHandlerAttribute|
       (framed ? kWindowInWindowMenuAttribute|kWindowStandardDocumentAttributes|kWindowLiveResizeAttribute : 0);
     OSStatus r;
-    rect.top = rect.left = 0;
-    rect.bottom = rect.right = 10;
-    winWidth = winHeight = 10;
+    rect.top = rect.left = 100;
+    rect.bottom = rect.right = 200;
+    winWidth = winHeight = 100;
     
     r = WC(CreateNewWindow)(wc, attr, &rect, &window);
     checkStatus(r,"CreateNewWindow");
     
     r = WC(CreateNewWindow)(wc, attr, &rect, &window);
     checkStatus(r,"CreateNewWindow");
@@ -1142,6 +1140,12 @@ void Darwin$GLCarbonPixelBuffer::activateContext() {
     WC(aglSetCurrentContext)(ctx);
 }
 
     WC(aglSetCurrentContext)(ctx);
 }
 
+void Darwin$GLCarbonSurface$GLCarbonSurfacePixelBuffer::activateContext() {
+    // hooray for Brian's forward-thinking design abstractions, because I have no idea what the fuck this does, but it works
+    AGLContext ctx = (AGLContext) rawCTX;
+    WC(aglSetCurrentContext)(ctx);
+}
+
 void Darwin$GLCarbonPixelBuffer::natCleanup(RawData* rawWindowRef, RawData* rawCTX) {
     WindowRef window = (WindowRef) rawWindowRef;
     AGLContext ctx = (AGLContext) rawCTX;
 void Darwin$GLCarbonPixelBuffer::natCleanup(RawData* rawWindowRef, RawData* rawCTX) {
     WindowRef window = (WindowRef) rawWindowRef;
     AGLContext ctx = (AGLContext) rawCTX;
index 03eca37..c5c7e9c 100644 (file)
@@ -1,7 +1,4 @@
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
-
+// Copyright 2004 Adam Megacz, see the COPYING file for licensing [LGPL]
 // Authors: Brian Alliet and Evan Jones
 
 package org.ibex.plat;
 // Authors: Brian Alliet and Evan Jones
 
 package org.ibex.plat;
@@ -136,7 +133,7 @@ public class Darwin extends POSIX {
         protected native void activateSharedContext();
     }
     
         protected native void activateSharedContext();
     }
     
-    static abstract class CarbonSurface extends Surface.DoubleBufferedSurface {  
+    static abstract class CarbonSurface extends Surface {  
         RawData rawWindowRef;
         int modifiers;
         int winWidth;
         RawData rawWindowRef;
         int modifiers;
         int winWidth;
@@ -213,7 +210,6 @@ public class Darwin extends POSIX {
         private native void natInit();
         private static native void natCleanup(RawData rawWindowRef, RawData rawCTX);
         
         private native void natInit();
         private static native void natCleanup(RawData rawWindowRef, RawData rawCTX);
         
-        
         private static final int fixupDimension(CarbonOpenGL gl, int n) {
             if(!gl.rectangularTextures) n = OpenGL.roundToPowerOf2(n);
             return Math.min(n,gl.maxAglSurfaceTexSize);
         private static final int fixupDimension(CarbonOpenGL gl, int n) {
             if(!gl.rectangularTextures) n = OpenGL.roundToPowerOf2(n);
             return Math.min(n,gl.maxAglSurfaceTexSize);
@@ -241,11 +237,24 @@ public class Darwin extends POSIX {
         private final native void natInit();
         private final native void flush();
         private final native void clear();
         private final native void natInit();
         private final native void flush();
         private final native void clear();
+
+        private PixelBuffer pb;
+        public PixelBuffer getPixelBuffer() { return pb; }
+
+        static class GLCarbonSurfacePixelBuffer extends GLCarbonPixelBuffer {
+            RawData rawCTX;
+            public native void activateContext();
+            public GLCarbonSurfacePixelBuffer(RawData rawCTX, CarbonOpenGL gl) {
+                super(500, 500, gl);
+                this.rawCTX = rawCTX;
+            }
+        }
         
         public GLCarbonSurface(Box root, boolean framed, CarbonOpenGL gl) {
             super(root,framed);
             this.gl = gl;
             natInit();
         
         public GLCarbonSurface(Box root, boolean framed, CarbonOpenGL gl) {
             super(root,framed);
             this.gl = gl;
             natInit();
+            pb = new GLCarbonSurfacePixelBuffer(rawCTX, gl);
         }
         
         public void setLimits(int mnw,int mnh, int mxw, int mxh) {
         }
         
         public void setLimits(int mnw,int mnh, int mxw, int mxh) {
@@ -277,7 +286,7 @@ public class Darwin extends POSIX {
                 
                 reshape(winWidth,winHeight);
                 clear();
                 
                 reshape(winWidth,winHeight);
                 clear();
-                Dirty(0,0,winWidth,winHeight);
+                dirty(0,0,winWidth,winHeight);
             }
             super.render();
             flush();
             }
             super.render();
             flush();
index d8b5dc4..fd6b216 100644 (file)
@@ -7,6 +7,7 @@ package org.ibex.plat;
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.image.*;
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.image.*;
+import java.awt.geom.*;
 import java.net.*;
 import java.util.*;
 import org.ibex.util.*;
 import java.net.*;
 import java.util.*;
 import org.ibex.util.*;
@@ -96,7 +97,6 @@ public class Java2 extends AWT {
 
     public static class Java2Surface extends AWTSurface {
         public Java2Surface(Box root, boolean framed) { super(root, framed); }
 
     public static class Java2Surface extends AWTSurface {
         public Java2Surface(Box root, boolean framed) { super(root, framed); }
-
         protected void _setMinimized(boolean b) {
             if (frame == null) Log.info(this, "JDK 1.2 can only minimize frames, not windows");
             else if (b) frame.setState(java.awt.Frame.ICONIFIED);
         protected void _setMinimized(boolean b) {
             if (frame == null) Log.info(this, "JDK 1.2 can only minimize frames, not windows");
             else if (b) frame.setState(java.awt.Frame.ICONIFIED);
@@ -119,18 +119,27 @@ public class Java2 extends AWT {
         private SampleModel sm = null;
         private DataBuffer buf = null;
 
         private SampleModel sm = null;
         private DataBuffer buf = null;
 
-        // this doens't seem to work on Windows
-        public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {
-            Image i2 = ((AWTGlyph)source).getImage();
-            Graphics2D g2 = (Graphics2D)i.getGraphics();
-            g2.setComposite(AlphaComposite.DstOut);
-            g2.setClip(cx1, cy1, cx2 - cx1, cy2 - cy1);
-            g2.drawImage(i2, dx, dy, null);
-            g2.setComposite(AlphaComposite.DstOver);
-            g2.setColor(new java.awt.Color((rgb & 0x00FF0000) >> 16, (rgb & 0x0000FF00) >> 8, (rgb & 0x000000FF)));
-            g2.fillRect(dx, dy, cx2 - dx, cy2 - dy);
-            g2.drawImage(i2, 0, 0, null);
-            g2.setClip(0, 0, i.getWidth(null), i.getHeight(null));
+        private static int[] xs = new int[65535];
+        private static int[] ys = new int[65535];
+        private static GeneralPath gp = new GeneralPath();
+
+        public void fill(org.ibex.graphics.Polygon p, org.ibex.graphics.Paint paint) { fillStroke(p, paint, true, false); }
+        public void stroke(org.ibex.graphics.Polygon p, org.ibex.graphics.Paint paint) { fillStroke(p, paint, false, true); }
+        public void fillStroke(org.ibex.graphics.Polygon p, org.ibex.graphics.Paint paint, boolean fill, boolean stroke) {
+            if (g == null) g = getGraphics();
+            ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); 
+            int argb = ((org.ibex.graphics.Paint.SingleColorPaint)paint).color;
+            g.setColor(new java.awt.Color((argb & 0x00FF0000) >> 16, (argb & 0x0000FF00) >> 8, (argb & 0x000000FF)));
+            gp.reset();
+            gp.setWindingRule(GeneralPath.WIND_EVEN_ODD);
+            for(int j=0; j<p.numcontours; j++) {
+                if (p.contours[j+1] <= p.contours[j]) continue;
+                gp.moveTo(p.x[p.contours[j]], p.y[p.contours[j]]);
+                for(int i=p.contours[j]+1; i<p.contours[j+1]; i++) gp.lineTo(p.x[i], p.y[i]);
+                gp.closePath();
+            }
+            if (fill) ((Graphics2D)g).fill(gp);
+            if (stroke) ((Graphics2D)g).draw(gp);
         }
 
         public Java2PixelBuffer(int w, int h) {
         }
 
         public Java2PixelBuffer(int w, int h) {
index 1611d4f..8b8dcd7 100644 (file)
@@ -18,13 +18,14 @@ public class Java4 extends Java2 {
     protected String getDescriptiveName() { return "Java 1.4+ JVM"; }
     public Java4() {
         java.awt.Toolkit.getDefaultToolkit().setDynamicLayout(true);
     protected String getDescriptiveName() { return "Java 1.4+ JVM"; }
     public Java4() {
         java.awt.Toolkit.getDefaultToolkit().setDynamicLayout(true);
-
+        /*
         // Properties for Apple JDK 1.4
         System.setProperty("apple.awt.showGrowBox", "false");
         System.setProperty("apple.awt.graphics.EnableLazyDrawing", "40");
         System.setProperty("apple.awt.graphics.EnableLazyDrawing", "true");
         System.setProperty("apple.awt.window.position.forceSafeUserPositioning", "true");
         System.setProperty("apple.awt.window.position.forceSafeCreation", "true");
         // Properties for Apple JDK 1.4
         System.setProperty("apple.awt.showGrowBox", "false");
         System.setProperty("apple.awt.graphics.EnableLazyDrawing", "40");
         System.setProperty("apple.awt.graphics.EnableLazyDrawing", "true");
         System.setProperty("apple.awt.window.position.forceSafeUserPositioning", "true");
         System.setProperty("apple.awt.window.position.forceSafeCreation", "true");
+        */
     }
     protected Surface __createSurface(final Box root, final boolean framed) { return new Java4Surface(root, framed); }
     public static class Java4Surface extends Java2Surface implements WindowStateListener, MouseWheelListener {
     }
     protected Surface __createSurface(final Box root, final boolean framed) { return new Java4Surface(root, framed); }
     public static class Java4Surface extends Java2Surface implements WindowStateListener, MouseWheelListener {
index ada1498..9e53586 100644 (file)
@@ -1,12 +1,11 @@
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
-
+// Copyright 2003 Adam Megacz, see the COPYING file for licensing [LGPL]
 // Author: Brian Alliet
 
 // IMPROVMENT: use alpha testing? might be faster
 
 #include <org/ibex/plat/OpenGL.h>
 // Author: Brian Alliet
 
 // IMPROVMENT: use alpha testing? might be faster
 
 #include <org/ibex/plat/OpenGL.h>
+#include <org/ibex/graphics/PixelBuffer.h>
+#include <org/ibex/graphics/Polygon.h>
 #include <org/ibex/plat/OpenGL$GLPixelBuffer.h>
 #include <org/ibex/plat/OpenGL$GLPicture.h>
 #include <org/ibex/plat/OpenGL$RectGLPicture.h>
 #include <org/ibex/plat/OpenGL$GLPixelBuffer.h>
 #include <org/ibex/plat/OpenGL$GLPicture.h>
 #include <org/ibex/plat/OpenGL$RectGLPicture.h>
@@ -102,6 +101,18 @@ void OpenGL$GLPixelBuffer::fillTrapezoid(jint x1, jint x2, jint y1, jint x3, jin
     } glEnd();
 }
 
     } glEnd();
 }
 
+void OpenGL$GLPixelBuffer::natFill(org::ibex::graphics::Polygon* p, jint argb) {
+    activateContext();
+    setColor(argb);
+    for(jint contour=0; contour < p->numcontours; contour++) {
+        glBegin(GL_POLYGON); {
+        for(jint i = elements(p->contours)[contour]; i < elements(p->contours)[contour+1]; i++) {
+            glVertex3f(elements(p->x)[i], elements(p->y)[i], 0.0f );   
+        } glEnd();
+        }
+    }
+}
+
 void OpenGL$GLPixelBuffer::setClip(jint x1, jint y1, jint x2, jint y2) {
     //fprintf(stderr,"setClip: %d %d %d %d\n",x1,y1,x2,y2);
     if(x1==0 && y1==0 && x2==width && y2==height) {
 void OpenGL$GLPixelBuffer::setClip(jint x1, jint y1, jint x2, jint y2) {
     //fprintf(stderr,"setClip: %d %d %d %d\n",x1,y1,x2,y2);
     if(x1==0 && y1==0 && x2==width && y2==height) {
index 3d0e7cd..5b9590a 100644 (file)
@@ -1,7 +1,4 @@
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
-
+// Copyright 2004 Adam Megacz, see the COPYING file for licensing [LGPL]
 // Author: Brian Alliet
 
 package org.ibex.plat;
 // Author: Brian Alliet
 
 package org.ibex.plat;
@@ -58,7 +55,7 @@ abstract class OpenGL {
         public NotSupportedException(String s) { super(s); }
     }
 
         public NotSupportedException(String s) { super(s); }
     }
 
-    public static abstract class GLPixelBuffer extends PixelBuffer {
+    public static abstract class GLPixelBuffer implements PixelBuffer {
         protected int width;
         protected int height;
         public int getWidth() { return width; }
         protected int width;
         protected int height;
         public int getWidth() { return width; }
@@ -66,6 +63,9 @@ abstract class OpenGL {
         
         private boolean glScissorEnabled = false;
         
         
         private boolean glScissorEnabled = false;
         
+        // FIXME: HUGE HACK!
+        public GLPixelBuffer() { width = 500; height = 500; }
+
         public GLPixelBuffer(int width, int height) {
             this.width = width;
             this.height = height;
         public GLPixelBuffer(int width, int height) {
             this.width = width;
             this.height = height;
@@ -81,12 +81,17 @@ abstract class OpenGL {
         public native void setClip(int x, int y, int x2, int y2);
         public native void resetClip();
         public native void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color);
         public native void setClip(int x, int y, int x2, int y2);
         public native void resetClip();
         public native void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color);
-            
-        public void drawString(String font, String text, int x, int y, int color) {
-            //System.out.println("drawString(): " + text);
+        public void drawLine(int x1, int y1, int x2, int y2, int color) {
+            // FIXME
+            fillTrapezoid(x1, x1, y1, x2, x2, y2, color);
         }
 
         }
 
-        public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {
+        public void stroke(Polygon p, int color) { p.stroke(this, color); }
+        public native void natFill(Polygon p, int color);
+        public void fill(Polygon p, Paint paint) { natFill(p, ((Paint.SingleColorPaint)paint).color); }
+
+        public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy,
+                              int cx1, int cy1, int cx2, int cy2, int rgb, int pc) {
             drawPicture_(((org.ibex.plat.Platform.DefaultGlyph)source).getPicture(), dx, dy, cx1, cy1, cx2, cy2, rgb);
         }
         public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) {
             drawPicture_(((org.ibex.plat.Platform.DefaultGlyph)source).getPicture(), dx, dy, cx1, cy1, cx2, cy2, rgb);
         }
         public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) {
index f0161ee..321a80d 100644 (file)
@@ -51,7 +51,7 @@ public abstract class Platform {
             String os_name = System.getProperty("os.name", "");
             String os_version = System.getProperty("os.version", "");
             String platform_class = null;
             String os_name = System.getProperty("os.name", "");
             String os_version = System.getProperty("os.version", "");
             String platform_class = null;
-            
+
             if (vendor.startsWith("Free Software Foundation")) {
                 if (os_name.startsWith("Window")) platform_class = "Win32";
                 else if (os_name.startsWith("Linux")) platform_class = "Linux";
             if (vendor.startsWith("Free Software Foundation")) {
                 if (os_name.startsWith("Window")) platform_class = "Win32";
                 else if (os_name.startsWith("Linux")) platform_class = "Linux";
index 8e0caae..d6016d6 100644 (file)
@@ -1,7 +1,4 @@
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
-
+// Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL]
 #include "GCJ.cc"
 
 // we have to do this because the jpeg libraries use the symbol 'INT32'
 #include "GCJ.cc"
 
 // we have to do this because the jpeg libraries use the symbol 'INT32'
index 550bdaf..86f79a3 100644 (file)
@@ -1,7 +1,4 @@
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
-
+// Copyright 2004 Adam Megacz, see the COPYING file for licensing [LGPL]
 package org.ibex.plat;
 
 import org.ibex.util.*;
 package org.ibex.plat;
 
 import org.ibex.util.*;
@@ -88,7 +85,7 @@ public class Win32 extends GCJ {
 
         HTTP.Proxy ret = new HTTP.Proxy();
         if (container[2] != null) {
 
         HTTP.Proxy ret = new HTTP.Proxy();
         if (container[2] != null) {
-           // FIXME!!!
+            // FIXME
             //ret.proxyAutoConfigFunction = HTTP.Proxy.getProxyAutoConfigFunction(container[2]);
             if (ret.proxyAutoConfigFunction != null) return ret;
         }
             //ret.proxyAutoConfigFunction = HTTP.Proxy.getProxyAutoConfigFunction(container[2]);
             if (ret.proxyAutoConfigFunction != null) return ret;
         }
@@ -140,8 +137,13 @@ public class Win32 extends GCJ {
 
     // Win32Surface ////////////////////////////////////////////////////////////////////////////
 
 
     // Win32Surface ////////////////////////////////////////////////////////////////////////////
 
-    public static class Win32Surface extends Surface.DoubleBufferedSurface {
+    public static class Win32Surface extends Surface {
+
+    public PixelBuffer getPixelBuffer() { return null; }  // FIXME
 
 
+        // hack
+        String cursor;
+        
         /** used to block while waiting for the message pump thread to create a hwnd for us */
         public Semaphore hwndCreated = new Semaphore();
 
         /** used to block while waiting for the message pump thread to create a hwnd for us */
         public Semaphore hwndCreated = new Semaphore();
 
@@ -233,8 +235,12 @@ public class Win32 extends GCJ {
 
     // Win32PixelBuffer //////////////////////////////////////////////////////////////////////////
 
 
     // Win32PixelBuffer //////////////////////////////////////////////////////////////////////////
 
-    public static class Win32PixelBuffer extends PixelBuffer {
+    public static class Win32PixelBuffer implements PixelBuffer {
 
 
+    public void drawLine(int x1, int y1, int x2, int y2, int color) { }
+    public void drawGlyph(Font.Glyph source, int dx1, int dy1, int cx1, int cy1, int cx2, int cy2, int rgb, int pc){}
+    public void stroke(Polygon p, int color){}
+    public void fill(Polygon p, Paint paint){}
         int w = 0;
         int h = 0;
 
         int w = 0;
         int h = 0;
 
@@ -263,7 +269,7 @@ public class Win32 extends GCJ {
             ((Win32Picture)source).init();
             drawPicture(source, dx, dy, cx1, cy1, cx2, cy2, 0, false);
         }
             ((Win32Picture)source).init();
             drawPicture(source, dx, dy, cx1, cy1, cx2, cy2, 0, false);
         }
-        public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {
+        public void drawGlyph(Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {
             Win32Picture p = ((Win32Picture)((Platform.DefaultGlyph)source).getPicture());
             p.init();
             drawPicture(p, dx, dy, cx1, cy1, cx2, cy2, rgb, true);
             Win32Picture p = ((Win32Picture)((Platform.DefaultGlyph)source).getPicture());
             p.init();
             drawPicture(p, dx, dy, cx1, cy1, cx2, cy2, rgb, true);
index 3d64218..f8bd199 100644 (file)
@@ -1,6 +1,5 @@
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
+// Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL]
+// see below for copyright information on the second portion of this file
 
 #include <X11/Xlib.h>
 #include <X11/extensions/XShm.h>
 
 #include <X11/Xlib.h>
 #include <X11/extensions/XShm.h>
index 3d2d1dc..cc1bea6 100644 (file)
@@ -1,7 +1,4 @@
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
-
+// Copyright 2004 Adam Megacz, see the COPYING file for licensing [LGPL]
 package org.ibex.plat;
 
 import gnu.gcj.RawData;
 package org.ibex.plat;
 
 import gnu.gcj.RawData;
@@ -56,9 +53,12 @@ public class X11 extends POSIX {
 
     // X11Surface /////////////////////////////////////////////////////
 
 
     // X11Surface /////////////////////////////////////////////////////
 
+
     /** Implements a Surface as an X11 Window */
     /** Implements a Surface as an X11 Window */
-    public static class X11Surface extends Surface.DoubleBufferedSurface {
+    public static class X11Surface extends Surface {
         
         
+        public PixelBuffer getPixelBuffer() { return null; }  // FIXME
+
         gnu.gcj.RawData window;
         gnu.gcj.RawData gc;
         boolean framed = false;
         gnu.gcj.RawData window;
         gnu.gcj.RawData gc;
         boolean framed = false;
@@ -141,7 +141,12 @@ public class X11 extends POSIX {
      *  with all-or-nothing alpha will not use shared pixmaps, however
      *  (since they are only written to once.
      */
      *  with all-or-nothing alpha will not use shared pixmaps, however
      *  (since they are only written to once.
      */
-    public static class X11PixelBuffer extends PixelBuffer {
+    public static class X11PixelBuffer implements PixelBuffer {
+
+    public void drawLine(int x1, int y1, int x2, int y2, int color) { }
+    public void drawGlyph(Font.Glyph source, int dx1, int dy1, int cx1, int cy1, int cx2, int cy2, int rgb, int pc){}
+    public void stroke(Polygon p, int color){}
+    public void fill(Polygon p, Paint paint){}
 
         int clipx, clipy, clipw, cliph;
         int width;
 
         int clipx, clipy, clipw, cliph;
         int width;