new PixelBuffer API (mainly tons of renames)
[org.ibex.core.git] / src / org / ibex / plat / Darwin.java
index 2735182..c5c7e9c 100644 (file)
@@ -133,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;
@@ -210,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);
@@ -238,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) {
@@ -274,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();