2004/01/19 21:24:07
[org.ibex.core.git] / src / org / xwt / plat / Darwin.java
index 84bec1c..211c88c 100644 (file)
@@ -1,10 +1,11 @@
-// Copyright 2003 Adam Megacz, see the COPYING file for licensing [LGPL]
+// Copyright 2004 Adam Megacz, see the COPYING file for licensing [LGPL]
 // Authors: Brian Alliet and Evan Jones
 
 package org.xwt.plat;
 
 import gnu.gcj.RawData;
 import org.xwt.util.*;
+import org.xwt.js.*;
 import org.xwt.*;
 import java.util.*;
 
@@ -83,13 +84,14 @@ public class Darwin extends POSIX {
             openGL = new CarbonOpenGL();
             openGL.init();
         } catch(OpenGL.NotSupportedException e) {
-            Log.log(this,"WARNING: OpenGL support not available: " + e);
+            Log.info(this,"WARNING: OpenGL support not available: " + e);
             // FEATURE: fall back to quartz 2d
             throw new Error("No OpenGL support");
         }
         natInit();
     }
     
+    protected Scheduler _getScheduler() { return new DarwinScheduler(); }
     protected native void runApplicationEventLoop();
     private class DarwinScheduler extends org.xwt.Scheduler {
         public void run() {
@@ -100,20 +102,20 @@ public class Darwin extends POSIX {
     
     private final class CarbonOpenGL extends OpenGL {
         public RawData rawPixelFormat;
-        public RawData rawSharedInterpreter;
+        public RawData rawSharedContext;
         public int maxAglSurfaceTexSize;
         public int maxSurfaceWidth;
         public int maxSurfaceHeight;
         
         private native boolean initPixelFormat();
-        private native void initSharedInterpreter();
+        private native void initSharedContext();
         
         public CarbonOpenGL() throws NotSupportedException {
             if(!jaguar)
                 throw new NotSupportedException("OpenGL requires Mac OS X 10.2 or greater");
             if(!initPixelFormat())
                 throw new NotSupportedException("Couldn't get an acceptable pixel format");
-            initSharedInterpreter();
+            initSharedContext();
         }
         
         public void init() throws NotSupportedException {
@@ -121,11 +123,11 @@ public class Darwin extends POSIX {
             maxAglSurfaceTexSize = rectangularTextures ? maxRectTexSize : maxTexSize;
             if(renderer.startsWith("ATI Radeon 7500")) {
                 maxAglSurfaceTexSize = Math.min(rectangularTextures ? 1600 : 1024,maxAglSurfaceTexSize);
-                Log.log(this,"Working around Radeon 7500 bug: maxAglSurfaceTexSize: " + maxAglSurfaceTexSize);
+                Log.info(this,"Working around Radeon 7500 bug: maxAglSurfaceTexSize: " + maxAglSurfaceTexSize);
             }
             maxSurfaceWidth = maxSurfaceHeight = maxAglSurfaceTexSize;
         }
-        protected native void activateSharedInterpreter();
+        protected native void activateSharedContext();
     }
     
     static abstract class CarbonSurface extends Surface.DoubleBufferedSurface {  
@@ -218,7 +220,7 @@ public class Darwin extends POSIX {
             CarbonMessage.add(new CarbonMessage() { public void perform() { GLCarbonPixelBuffer.this.natInit(); sem.release(); } });
             sem.block();
         }
-        public native void activateInterpreter();
+        public native void activateContext();
         protected void finalize() {
             CarbonMessage.add(new CarbonMessage() { public void perform() { natCleanup(rawWindowRef,rawCTX); } });
             gl.deleteTexture(textureName);
@@ -259,19 +261,23 @@ public class Darwin extends POSIX {
         
         
         // The blit_lock ensures the window size does not change through the entire blit operation.
-        public void render_() {
+        public void render() {
+            /*
             blitLock();
             while(pendingResize) blitWait();
+            */
             if(needsReshape) {
                 needsReshape = false;
                 
                 reshape(winWidth,winHeight);
                 clear();
-                Dirty(0,0,getWidth(),getHeight());
+                Dirty(0,0,winWidth,winHeight);
             }
-            super.render_();
+            super.render();
             flush();
+            /*
             blitUnlock();
+            */
         }
         
         private native void reshape(int w, int h);
@@ -318,9 +324,9 @@ public class Darwin extends POSIX {
         else
             return /*new QZCarbonSufrace(b,framed)*/ null;
     }
-    protected Picture _createPicture() {
+    protected Picture _createPicture(JS r) {
         if(openGL != null)
-            return openGL._createPicture(true);
+            return openGL._createPicture(r, true);
         else
             return /*new QZCarbonPicture(data,w,h);*/ null;
     }