questionable patch: merge of a lot of stuff from the svg branch
[org.ibex.core.git] / src / org / ibex / plat / Darwin.java
index 03eca37..be54028 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;
@@ -97,9 +94,9 @@ public class Darwin extends POSIX {
         natInit();
     }
     
-    protected Scheduler _getScheduler() { return new DarwinScheduler(); }
+    protected Platform.Scheduler _getScheduler() { return new DarwinScheduler(); }
     protected native void runApplicationEventLoop();
-    private class DarwinScheduler extends org.ibex.core.Scheduler {
+    private class DarwinScheduler extends Scheduler {
         public void run() {
             new Thread() { public void run() { defaultRun(); } }.start();
             runApplicationEventLoop();
@@ -136,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;
@@ -213,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);
@@ -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 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) {
@@ -277,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();