new PixelBuffer API (mainly tons of renames)
[org.ibex.core.git] / src / org / ibex / plat / Darwin.java
index 10a73af..c5c7e9c 100644 (file)
@@ -11,6 +11,7 @@ import org.ibex.core.*;
 import org.ibex.net.*;
 
 public class Darwin extends POSIX {
+    public static void main(String[] s) throws Exception { org.ibex.core.Main.main(s); }
     private static final Class openGLClass = OpenGL.class;
     static Darwin singleton;
     private CarbonOpenGL openGL;
@@ -95,7 +96,7 @@ public class Darwin extends POSIX {
     
     protected Scheduler _getScheduler() { return new DarwinScheduler(); }
     protected native void runApplicationEventLoop();
-    private class DarwinScheduler extends org.ibex.Scheduler {
+    private class DarwinScheduler extends org.ibex.core.Scheduler {
         public void run() {
             new Thread() { public void run() { defaultRun(); } }.start();
             runApplicationEventLoop();
@@ -132,7 +133,7 @@ public class Darwin extends POSIX {
         protected native void activateSharedContext();
     }
     
-    static abstract class CarbonSurface extends Surface.DoubleBufferedSurface {  
+    static abstract class CarbonSurface extends Surface {  
         RawData rawWindowRef;
         int modifiers;
         int winWidth;
@@ -209,7 +210,6 @@ public class Darwin extends POSIX {
         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);
@@ -237,11 +237,24 @@ public class Darwin extends POSIX {
         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();
+            pb = new GLCarbonSurfacePixelBuffer(rawCTX, gl);
         }
         
         public void setLimits(int mnw,int mnh, int mxw, int mxh) {
@@ -273,7 +286,7 @@ public class Darwin extends POSIX {
                 
                 reshape(winWidth,winHeight);
                 clear();
-                Dirty(0,0,winWidth,winHeight);
+                dirty(0,0,winWidth,winHeight);
             }
             super.render();
             flush();
@@ -332,7 +345,7 @@ public class Darwin extends POSIX {
         else
             return /*new QZCarbonPicture(data,w,h);*/ null;
     }
-    protected org.ibex.Font.Glyph  _createGlyph(org.ibex.Font f, char c) {
+    protected org.ibex.graphics.Font.Glyph  _createGlyph(org.ibex.graphics.Font f, char c) {
         if(openGL != null)
             return openGL._createGlyph(f, c);
         else