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) {
- 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();
}
- 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;
- public RawData rawSharedContext;
+ public RawData rawSharedInterpreter;
public int maxAglSurfaceTexSize;
public int maxSurfaceWidth;
public int maxSurfaceHeight;
private native boolean initPixelFormat();
- private native void initSharedContext();
+ private native void initSharedInterpreter();
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");
- initSharedContext();
+ initSharedInterpreter();
}
public void init() throws NotSupportedException {
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 activateSharedContext();
+ protected native void activateSharedInterpreter();
}
static abstract class CarbonSurface extends Surface.DoubleBufferedSurface {
private native void natSetTitleBarText(String s);
public void setTitleBarText(final String s) { CarbonMessage.add(new CarbonMessage() { public void perform() { natSetTitleBarText(s); } }); }
private native void natSetSize(int w, int h);
- public void setSize(final int w, final int h) { CarbonMessage.add(new CarbonMessage() { public void perform() { natSetSize(w,h); } }); }
+ public void _setSize(final int w, final int h) { CarbonMessage.add(new CarbonMessage() { public void perform() { natSetSize(w,h); } }); }
private native void natSetLocation();
public void setLocation() { CarbonMessage.add(new CarbonMessage() { public void perform() { natSetLocation(); } }); }
private native void natToFront();
CarbonMessage.add(new CarbonMessage() { public void perform() { GLCarbonPixelBuffer.this.natInit(); sem.release(); } });
sem.block();
}
- public native void activateContext();
+ public native void activateInterpreter();
protected void finalize() {
CarbonMessage.add(new CarbonMessage() { public void perform() { natCleanup(rawWindowRef,rawCTX); } });
gl.deleteTexture(textureName);
super.setLimits(mnw,mnh,mxw,mxh);
}
- public void setSize(int w, int h) {
+ public void _setSize(int w, int h) {
w = Math.min(w,gl.maxSurfaceWidth);
h = Math.min(h,gl.maxSurfaceWidth);
- super.setSize(w,h);
+ super._setSize(w,h);
}
private native void natBlit(GLCarbonPixelBuffer db, int sx, int sy, int dx, int dy, int dx2, int dy2);
// 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) {
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();
}
else
return /*new QZCarbonSufrace(b,framed)*/ null;
}
- protected Picture _createPicture(int[] data, int w, int h) {
+ protected Picture _createPicture() {
if(openGL != null)
- return openGL.createPicture(data,w,h);
+ return openGL._createPicture(true);
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)
- return openGL.createAlphaOnlyPicture(data,w,h);
+ return openGL._createGlyph(f, c);
else
- return super.createAlphaOnlyPicture(data,w,h);
+ return super.createGlyph(f, c);
}
/* A message that is sent through the carbon event queue */