projects
/
org.ibex.core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2004/01/14 05:18:34
[org.ibex.core.git]
/
src
/
org
/
xwt
/
plat
/
Darwin.java
diff --git
a/src/org/xwt/plat/Darwin.java
b/src/org/xwt/plat/Darwin.java
index
907b937
..
7743441
100644
(file)
--- a/
src/org/xwt/plat/Darwin.java
+++ b/
src/org/xwt/plat/Darwin.java
@@
-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.*;
// 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.*;
import org.xwt.*;
import java.util.*;
@@
-77,41
+78,43
@@
public class Darwin extends POSIX {
private static native final boolean isJaguar();
private static native final boolean isJaguar();
- // Called by main thread after initialization, this is the event handler
- protected native void runApplicationEventLoop();
-
- public void init() {
- super.init();
+ public void postInit() {
jaguar = isJaguar();
try {
openGL = new CarbonOpenGL();
openGL.init();
} catch(OpenGL.NotSupportedException e) {
jaguar = isJaguar();
try {
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();
}
// FEATURE: fall back to quartz 2d
throw new Error("No OpenGL support");
}
natInit();
}
- public void _running() { runApplicationEventLoop(); }
+ protected native void runApplicationEventLoop();
+ private class DarwinScheduler extends org.xwt.Scheduler {
+ public void run() {
+ new Thread() { public void run() { defaultRun(); } }.start();
+ runApplicationEventLoop();
+ }
+ }
private final class CarbonOpenGL extends OpenGL {
public RawData rawPixelFormat;
private final class CarbonOpenGL extends OpenGL {
public RawData rawPixelFormat;
- public RawData rawSharedJSContext;
+ public RawData rawSharedContext;
public int maxAglSurfaceTexSize;
public int maxSurfaceWidth;
public int maxSurfaceHeight;
private native boolean initPixelFormat();
public int maxAglSurfaceTexSize;
public int maxSurfaceWidth;
public int maxSurfaceHeight;
private native boolean initPixelFormat();
- private native void initSharedJSContext();
+ 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");
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");
- initSharedJSContext();
+ initSharedContext();
}
public void init() throws NotSupportedException {
}
public void init() throws NotSupportedException {
@@
-119,11
+122,11
@@
public class Darwin extends POSIX {
maxAglSurfaceTexSize = rectangularTextures ? maxRectTexSize : maxTexSize;
if(renderer.startsWith("ATI Radeon 7500")) {
maxAglSurfaceTexSize = Math.min(rectangularTextures ? 1600 : 1024,maxAglSurfaceTexSize);
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;
}
}
maxSurfaceWidth = maxSurfaceHeight = maxAglSurfaceTexSize;
}
- protected native void activateSharedJSContext();
+ protected native void activateSharedContext();
}
static abstract class CarbonSurface extends Surface.DoubleBufferedSurface {
}
static abstract class CarbonSurface extends Surface.DoubleBufferedSurface {
@@
-216,7
+219,7
@@
public class Darwin extends POSIX {
CarbonMessage.add(new CarbonMessage() { public void perform() { GLCarbonPixelBuffer.this.natInit(); sem.release(); } });
sem.block();
}
CarbonMessage.add(new CarbonMessage() { public void perform() { GLCarbonPixelBuffer.this.natInit(); sem.release(); } });
sem.block();
}
- public native void activateJSContext();
+ public native void activateContext();
protected void finalize() {
CarbonMessage.add(new CarbonMessage() { public void perform() { natCleanup(rawWindowRef,rawCTX); } });
gl.deleteTexture(textureName);
protected void finalize() {
CarbonMessage.add(new CarbonMessage() { public void perform() { natCleanup(rawWindowRef,rawCTX); } });
gl.deleteTexture(textureName);
@@
-257,7
+260,7
@@
public class Darwin extends POSIX {
// The blit_lock ensures the window size does not change through the entire blit operation.
// 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) {
blitLock();
while(pendingResize) blitWait();
if(needsReshape) {
@@
-265,9
+268,10
@@
public class Darwin extends POSIX {
reshape(winWidth,winHeight);
clear();
reshape(winWidth,winHeight);
clear();
- Dirty(0,0,getWidth(),getHeight());
+ Dirty(0,0,winWidth,winHeight);
+ //Dirty(0,0,getWidth(),getHeight());
}
}
- super.render_();
+ super.render();
flush();
blitUnlock();
}
flush();
blitUnlock();
}
@@
-316,17
+320,17
@@
public class Darwin extends POSIX {
else
return /*new QZCarbonSufrace(b,framed)*/ null;
}
else
return /*new QZCarbonSufrace(b,framed)*/ null;
}
- protected Picture _createPicture(int[] data, int w, int h) {
+ protected Picture _createPicture(JS r) {
if(openGL != null)
if(openGL != null)
- return openGL.createPicture(data,w,h);
+ return openGL._createPicture(r, true);
else
return /*new QZCarbonPicture(data,w,h);*/ null;
}
else
return /*new QZCarbonPicture(data,w,h);*/ null;
}
- protected Picture _createAlphaOnlyPicture(byte[] data, int w, int h) {
+ protected org.xwt.Font.Glyph _createGlyph(org.xwt.Font f, char c) {
if(openGL != null)
if(openGL != null)
- return openGL.createAlphaOnlyPicture(data,w,h);
+ return openGL._createGlyph(f, c);
else
else
- return super.createAlphaOnlyPicture(data,w,h);
+ return super.createGlyph(f, c);
}
/* A message that is sent through the carbon event queue */
}
/* A message that is sent through the carbon event queue */