From c6069948906645d974f46bdb96617a9a6a504636 Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 07:35:53 +0000 Subject: [PATCH] 2003/09/19 05:26:47 darcs-hash:20040130073553-2ba56-b948149b4693f5fd9c772b9238e7489716a3ee0e.gz --- src/org/xwt/ByteStream.java | 134 ----------------------------------- src/org/xwt/DoubleBuffer.java | 14 ++-- src/org/xwt/Picture.java | 2 +- src/org/xwt/Platform.java | 6 +- src/org/xwt/Res.java | 154 ++++++++++++++++++++++++++++++++++++----- src/org/xwt/Surface.java | 14 ++-- src/org/xwt/plat/AWT.java | 14 ++-- src/org/xwt/plat/Darwin.cc | 10 +-- src/org/xwt/plat/Darwin.java | 26 +++---- src/org/xwt/plat/Java2.java | 10 +-- src/org/xwt/plat/OpenGL.cc | 14 ++-- src/org/xwt/plat/OpenGL.java | 4 +- src/org/xwt/plat/Win32.cc | 22 +++--- src/org/xwt/plat/Win32.java | 10 +-- src/org/xwt/plat/X11.cc | 26 +++---- src/org/xwt/plat/X11.java | 34 ++++----- 16 files changed, 241 insertions(+), 253 deletions(-) delete mode 100644 src/org/xwt/ByteStream.java diff --git a/src/org/xwt/ByteStream.java b/src/org/xwt/ByteStream.java deleted file mode 100644 index 69acc89..0000000 --- a/src/org/xwt/ByteStream.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL] - -package org.xwt; -import java.io.*; -import java.util.*; -import org.xwt.js.*; -import org.xwt.util.*; - -/** A ByteStream encapsulates a source of a stream of bytes -- - * currently either a local file or a Base64-encoded XMLRPC/SOAP element */ -public class ByteStream extends JS.Obj { - - private byte[] bytes = null; - private File file = null; - - private ByteStream() { setSeal(true); } - ByteStream(String filename) { this(); this.file = new File(filename); } - ByteStream(byte[] bytes) { this(); this.bytes = bytes; } - - public String toString() { return "ByteStream, source=" + (file == null ? "memory" : file.getAbsolutePath()); } - - public Object get(Object name) { - if (name.equals("getUTF")) return getUTF; - else if (name.equals("getDOM")) return getDOM; - else if (name.equals("fileName")) return file == null ? null : file.getAbsolutePath(); - else return null; - } - - private class XMLHelper extends XML { - Vector obStack = new Vector(); - - public XMLHelper() { super(BUFFER_SIZE); } - - public void startElement(XML.Element c) throws XML.SchemaException { - JS o = new JS.Obj(); - o.put("$name", c.localName); - for(int i=0; i= 1 ? (JS)obStack.elementAt(0) : null; - } - } - - public InputStream getInputStream() throws IOException { - return file == null ? - (InputStream)(new ByteArrayInputStream(bytes)) : - (InputStream)(new FileInputStream(file)); - } - - public void writeTo(OutputStream os) throws IOException { - InputStream is = getInputStream(); - byte[] buf = new byte[1024]; - while(true) { - int numread = is.read(buf, 0, 1024); - if (numread == -1) break; - if (Log.on) Log.log(this, "wrote " + numread + " bytes"); - os.write(buf, 0, numread); - } - os.flush(); - - // we have to close this because flush() doesn't work on Win32-GCJ - os.close(); - } - - private final JS.Callable getDOM = new JS.Callable() { - public Object call(JS.Array args) throws JS.Exn { - if (args.length() != 0) return null; - return new XMLHelper().doParse(); - } - }; - - private final JS.Callable getUTF = new JS.Callable() { - public Object call(JS.Array args) throws JS.Exn { - if (args.length() != 0) return null; - try { - CharArrayWriter caw = new CharArrayWriter(); - InputStream is = getInputStream(); - BufferedReader r = new BufferedReader(new InputStreamReader(is)); - char[] buf = new char[1024]; - while(true) { - int numread = r.read(buf, 0, 1024); - if (numread == -1) break; - caw.write(buf, 0, numread); - } - return caw.toString(); - } catch (IOException e) { - if (Log.on) Log.log(ByteStream.class, "IO Exception while reading from file"); - if (Log.on) Log.log(ByteStream.class, e); - throw new JS.Exn("error while reading from ByteStream"); - } - } - }; - -} - diff --git a/src/org/xwt/DoubleBuffer.java b/src/org/xwt/DoubleBuffer.java index 6529870..5e78e98 100644 --- a/src/org/xwt/DoubleBuffer.java +++ b/src/org/xwt/DoubleBuffer.java @@ -10,32 +10,32 @@ package org.xwt; * *

* Implementations of the Platform class should return objects - * supporting this interface from the _createDoubleBuffer() + * supporting this interface from the _createPixelBuffer() * method. These implementations may choose to use off-screen video * ram for this purpose (for example, a Pixmap on X11). *

* *

- * A note on coordinates: all members on DoubleBuffer specify + * A note on coordinates: all members on PixelBuffer specify * coordinates in terms of x1,y1,x2,y2 even though the Box class * represents regions internally as x,y,w,h. *

*/ -public abstract class DoubleBuffer { +public abstract class PixelBuffer { - /** Draw the region of source within (sx1, sy1, sx2, sy2) onto the region of this DoubleBuffer within (dx1, dy1, dx2, dy2), scaling as needed. */ + /** Draw the region of source within (sx1, sy1, sx2, sy2) onto the region of this PixelBuffer within (dx1, dy1, dx2, dy2), scaling as needed. */ public abstract void drawPicture(Picture source, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2); - /** Draw source onto this DoubleBuffer at (x,y) */ + /** Draw source onto this PixelBuffer at (x,y) */ public abstract void drawPicture(Picture source, int x, int y); - /** Draw text in font and color on this DoubleBuffer, with the upper left corner of the text at (x, y) */ + /** Draw text in font and color on this PixelBuffer, with the upper left corner of the text at (x, y) */ public abstract void drawString(String font, String text, int x, int y, int color); /** Fill the region (x1, y1, x2, y2) with color (AARRGGBB format); the alpha channel component is ignored */ public abstract void fillRect(int x1, int y1, int x2, int y2, int color); - /** Sets the clip region for this DoubleBuffer to (x,y,x2,y2) */ + /** Sets the clip region for this PixelBuffer to (x,y,x2,y2) */ public abstract void setClip(int x, int y, int x2, int y2); public abstract int getHeight(); diff --git a/src/org/xwt/Picture.java b/src/org/xwt/Picture.java index 1013cc4..8cd3c97 100644 --- a/src/org/xwt/Picture.java +++ b/src/org/xwt/Picture.java @@ -4,7 +4,7 @@ package org.xwt; /** *

* The in-memory representation of a PNG or GIF image. It is - * read-only. It is usually passed to DoubleBuffer.drawPicture() + * read-only. It is usually passed to PixelBuffer.drawPicture() *

* *

diff --git a/src/org/xwt/Platform.java b/src/org/xwt/Platform.java index 4426ca9..31062e0 100644 --- a/src/org/xwt/Platform.java +++ b/src/org/xwt/Platform.java @@ -116,10 +116,10 @@ public class Platform { protected void init() { } protected void postInit() { } - /** creates and returns a doublebuffer 'belonging' to owner; we need to associate DoubleBuffers to surfaces + /** creates and returns a doublebuffer 'belonging' to owner; we need to associate PixelBuffers to surfaces * due to AWT 1.1 requirements (definately for Navigator, possibly also for MSJVM). */ - protected DoubleBuffer _createDoubleBuffer(int w, int h, Surface owner) { return null; } + protected PixelBuffer _createDoubleBuffer(int w, int h, Surface owner) { return null; } /** creates and returns a new surface */ protected Surface _createSurface(Box b, boolean framed) { return null; } @@ -316,7 +316,7 @@ public class Platform { public static int getScreenHeight() { return platform._getScreenHeight(); } /** creates and returns a doublebuffer 'belonging' to owner */ - public static DoubleBuffer createDoubleBuffer(int w, int h, Surface s) { return platform._createDoubleBuffer(w, h, s); } + public static PixelBuffer createDoubleBuffer(int w, int h, Surface s) { return platform._createDoubleBuffer(w, h, s); } /** creates and returns a picture */ public static Picture createPicture(int[] data, int w, int h) { return platform._createPicture(data, w, h); } diff --git a/src/org/xwt/Res.java b/src/org/xwt/Res.java index bf7b6f8..5b1fc5f 100644 --- a/src/org/xwt/Res.java +++ b/src/org/xwt/Res.java @@ -2,12 +2,23 @@ package org.xwt; import java.io.*; +import org.xwt.js.*; +// FIXME: ByteStream fileName property /** base class for XWT resources */ -public abstract class Res { +public abstract class Res extends JS { - public abstract InputStream getInputStream(); - public Res getSubResource(String key) { return Null.singleton; } + public String toString() { return "Resource, source=FIXME"; } + + public final InputStream getInputStream() { return getInputStream(""); } + + public Res graft(Object newResource) { throw new JS.Exn("cannot graft onto this resource"); } + public Object get(Object key) { return new Ref(this, key); } + public void put(Object key, Object val) { throw new JS.Exn("cannot put to a resource"); } + public Object[] keys() { throw new JS.Exn("cannot enumerate a resource"); } + + public abstract InputStream getInputStream(String path) { return getInputStream(""); } + public abstract Res addExtension(String extension); public static Res stringToRes(String url) { if (url.indexOf('!') == -1) @@ -18,19 +29,11 @@ public abstract class Res { throw new JS.Exn("invalid resource specifier"); } - /** the invalid resource; only causes an error if you actually try to use it */ - public static class Null extends Res { - Null() { } - private static singleton = new Null(); - public InputStream getInputStream() throws JS.Exn { throw new JS.Exn("invalid resource"); } - } - /** HTTP or HTTPS resource */ public static class HTTP extends Res { private String url; HTTP(String url) { this.url = url; } - public InputStream getInputStream() { return new HTTP(url).GET(); } - public Res getSubResource(String key) { return new HTTP(url + "/" + key); } + public InputStream getInputStream(String path) { return new HTTP(url + path).GET(); } } /** wrap a Res around a preexisting InputStream */ @@ -38,21 +41,140 @@ public abstract class Res { InputStream parent; IS(InputStream parent) { this.parent = parent; } public InputStream getInputStream() { return parent; } + public InputStream getInputStream(String path) { + if (!"".equals(path)) throw new JS.Exn("can't access subresources of IS"); + return parent; + } } /** "unwrap" a Zip archive */ public static class Zip extends Res { private Res parent; - private String path = ""; - Zip(Res parent, String path) { this.parent = parent; this.path = path; } - public InputStream getInputStream() { + Zip(Res parent) { this.parent = parent; } + public InputStream getInputStream(String path) { ZipInputStream zis = new ZipInputStream(parent.getInputStream()); ZipEntry ze = zis.getNextEntry(); while(ze != null && !ze.getName().equals(path)) ze = zis.getNextEntry(); if (ze == null) throw new JS.Exn("zip file not found in archive"); return zis; } - public Res getSubResource(String key) { return new Zip(parent, path + '/' + key); } } + /** what you get when you reference a subresource */ + public static class Ref extends Res { + Res parent; + Object key; + Ref(Res parent, Object key) { this.parent = parent; this.key = key; } + public InputStream getInputStream(path) { + return parent.getInputStream("/" + key + path); + } + public Res graft(Object newResource) { return new Graft(parent, key, newResource); } + } + + /** shadow resource which replaces the graft */ + public static class Graft extends Res { + Res graftee; + Object replaced_key; + Object replaced_val; + Graft(Res graftee, Object key, Object val) { + this.graftee = graftee; replaced_key = key; replaced_val = val; } + public boolean equals(Object o) { return (this == o || graftee.equals(o)); } + public Object get(Object key) { + return replaced_key.equals(key) ? replaced_val : graftee.get(key); + } + } + + /////////////// bytestream + + public Object callMethod(Object method, Array args, boolean checkOnly) throws JS.Exn { + if (method.equals("getUTF")) { + if (checkOnly) return Boolean.TRUE; + if (args.length() != 0) return null; + try { + CharArrayWriter caw = new CharArrayWriter(); + InputStream is = getInputStream(); + BufferedReader r = new BufferedReader(new InputStreamReader(is)); + char[] buf = new char[1024]; + while(true) { + int numread = r.read(buf, 0, 1024); + if (numread == -1) break; + caw.write(buf, 0, numread); + } + return caw.toString(); + } catch (IOException e) { + if (Log.on) Log.log(ByteStream.class, "IO Exception while reading from file"); + if (Log.on) Log.log(ByteStream.class, e); + throw new JS.Exn("error while reading from ByteStream"); + } + } else if (name.equals("getDOM")) { + if (checkOnly) return Boolean.TRUE; + if (args.length() != 0) return null; + return new XMLHelper().doParse(); + } + if (checkOnly) return Boolean.FALSE; + return null; + } + + private class XMLHelper extends XML { + Vector obStack = new Vector(); + public XMLHelper() { super(BUFFER_SIZE); } + public void startElement(XML.Element c) throws XML.SchemaException { + JS o = new JS.Obj(); + o.put("$name", c.localName); + for(int i=0; i= 1 ? (JS)obStack.elementAt(0) : null; + } + } + + public void writeTo(OutputStream os) throws IOException { + InputStream is = getInputStream(); + byte[] buf = new byte[1024]; + while(true) { + int numread = is.read(buf, 0, 1024); + if (numread == -1) break; + if (Log.on) Log.log(this, "wrote " + numread + " bytes"); + os.write(buf, 0, numread); + } + os.flush(); + + // we have to close this because flush() doesn't work on Win32-GCJ + os.close(); + } } diff --git a/src/org/xwt/Surface.java b/src/org/xwt/Surface.java index 182558c..5f44098 100644 --- a/src/org/xwt/Surface.java +++ b/src/org/xwt/Surface.java @@ -127,7 +127,7 @@ public abstract class Surface { public abstract void setIcon(Picture i); /** copies a region from the doublebuffer to this surface */ - public abstract void blit(DoubleBuffer source, int sx, int sy, int dx, int dy, int dx2, int dy2); + public abstract void blit(PixelBuffer source, int sx, int sy, int dx, int dy, int dx2, int dy2); /** Destroy the surface */ public abstract void _dispose(); @@ -305,7 +305,7 @@ public abstract class Surface { // Private Instance Data ///////////////////////////////////////////////////////////////////////////////////////////// /** The automatic double buffer for the root box */ - DoubleBuffer backbuffer = null; + PixelBuffer backbuffer = null; /** Dirty regions on the backbuffer which need to be rebuilt using Box.render() */ private DirtyList backbufferDirtyRegions = new DirtyList(); @@ -320,10 +320,10 @@ public abstract class Surface { static volatile boolean abort = false; /** a solid red 10x10 double buffer */ - private DoubleBuffer showRenderBuf = null; + private PixelBuffer showRenderBuf = null; /** a striped 100x100 double buffer */ - private DoubleBuffer showRenderBuf2 = null; + private PixelBuffer showRenderBuf2 = null; /** true iff this window should be scarred */ private boolean scarred = true; @@ -399,7 +399,7 @@ public abstract class Surface { } while(abort); // this is a bit dangerous since we're passing ourselves to another method before subclasses' ctors have run... - backbuffer = Platform.createDoubleBuffer(Platform.getScreenWidth(), Platform.getScreenHeight(), this); + backbuffer = Platform.createPixelBuffer(Platform.getScreenWidth(), Platform.getScreenHeight(), this); root.dirty(); Refresh(); @@ -518,9 +518,9 @@ public abstract class Surface { if (Main.showRenders) { if (showRenderBuf == null) { - showRenderBuf = Platform.createDoubleBuffer(10, 10, this); + showRenderBuf = Platform.createPixelBuffer(10, 10, this); showRenderBuf.fillRect(0, 0, 10, 10, 0x00FF0000); - showRenderBuf2 = Platform.createDoubleBuffer(100, 100, this); + showRenderBuf2 = Platform.createPixelBuffer(100, 100, this); for(int y1 = 0; y1<100; y1++) for(int x1 = 0; x1<100; x1++) if ((x1 + y1) % 5 == 0) diff --git a/src/org/xwt/plat/AWT.java b/src/org/xwt/plat/AWT.java index 760c474..6e01352 100644 --- a/src/org/xwt/plat/AWT.java +++ b/src/org/xwt/plat/AWT.java @@ -15,7 +15,7 @@ import java.awt.event.*; public class AWT extends JVM { protected String getDescriptiveName() { return "Generic JDK 1.1+ with AWT"; } - protected DoubleBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new AWTDoubleBuffer(w, h); } + protected PixelBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new AWTDoubleBuffer(w, h); } protected Picture _createPicture(int[] b, int w, int h) { return new AWTPicture(b, w, h); } protected int _getScreenWidth() { return Toolkit.getDefaultToolkit().getScreenSize().width; } protected int _getScreenHeight() { return Toolkit.getDefaultToolkit().getScreenSize().height; } @@ -137,7 +137,7 @@ public class AWT extends JVM { } } - protected static class AWTDoubleBuffer extends DoubleBuffer { + protected static class AWTPixelBuffer extends DoubleBuffer { protected Image i = null; protected Graphics g = null; @@ -145,9 +145,9 @@ public class AWT extends JVM { /** JDK1.1 platforms require that a component be associated with each off-screen buffer */ static Component component = null; - protected AWTDoubleBuffer() { } - public AWTDoubleBuffer(int w, int h) { - synchronized(AWTDoubleBuffer.class) { + protected AWTPixelBuffer() { } + public AWTPixelBuffer(int w, int h) { + synchronized(AWTPixelBuffer.class) { if (component == null) { component = new Frame(); component.setVisible(false); @@ -189,9 +189,9 @@ public class AWT extends JVM { protected static class AWTSurface extends Surface implements MouseListener, MouseMotionListener, KeyListener, ComponentListener, WindowListener { - public void blit(DoubleBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2) { + public void blit(PixelBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2) { if (ourGraphics == null) ourGraphics = window.getGraphics(); - ourGraphics.drawImage(((AWTDoubleBuffer)s).i, dx + insets.left, dy + insets.top, dx2 + insets.left, dy2 + insets.top, + ourGraphics.drawImage(((AWTPixelBuffer)s).i, dx + insets.left, dy + insets.top, dx2 + insets.left, dy2 + insets.top, sx, sy, sx + (dx2 - dx), sy + (dy2 - dy), null); } diff --git a/src/org/xwt/plat/Darwin.cc b/src/org/xwt/plat/Darwin.cc index 716719f..c38f173 100644 --- a/src/org/xwt/plat/Darwin.cc +++ b/src/org/xwt/plat/Darwin.cc @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -899,7 +899,7 @@ void Darwin$CarbonOpenGL::initSharedContext() { checkStatus(rawSharedContext,"aglCreateContext"); } -void Darwin$GLCarbonDoubleBuffer::natInit() { +void Darwin$GLCarbonPixelBuffer::natInit() { WindowClass wc = kPlainWindowClass; WindowAttributes attr = 0; WindowRef window; @@ -948,19 +948,19 @@ void Darwin$GLCarbonDoubleBuffer::natInit() { rawCTX = (RawData*) ctx; } -void Darwin$GLCarbonDoubleBuffer::activateContext() { +void Darwin$GLCarbonPixelBuffer::activateContext() { AGLContext ctx = (AGLContext) rawCTX; aglSetCurrentContext(ctx); } -void Darwin$GLCarbonDoubleBuffer::natCleanup(RawData* rawWindowRef, RawData* rawCTX) { +void Darwin$GLCarbonPixelBuffer::natCleanup(RawData* rawWindowRef, RawData* rawCTX) { WindowRef window = (WindowRef) rawWindowRef; AGLContext ctx = (AGLContext) rawCTX; aglDestroyContext(ctx); DisposeWindow(window); } -void Darwin$GLCarbonSurface::natBlit(Darwin$GLCarbonDoubleBuffer *db, jint sx1, jint sy1, jint dx1, jint dy1, jint dx2, jint dy2) { +void Darwin$GLCarbonSurface::natBlit(Darwin$GLCarbonPixelBuffer *db, jint sx1, jint sy1, jint dx1, jint dy1, jint dx2, jint dy2) { AGLContext ctx = (AGLContext) rawCTX; int sx2 = sx1 + (dx2-dx1); int sy2 = sy1 + (dy2-dy1); diff --git a/src/org/xwt/plat/Darwin.java b/src/org/xwt/plat/Darwin.java index 5097cf0..34030ca 100644 --- a/src/org/xwt/plat/Darwin.java +++ b/src/org/xwt/plat/Darwin.java @@ -179,7 +179,7 @@ public class Darwin extends POSIX { public void _sizeChange(int w, int h) { SizeChange(w,h); } /* Drawing stuff */ - public abstract void blit(DoubleBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2); + public abstract void blit(PixelBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2); public final void _dispose() { CarbonMessage.add(new CarbonMessage() { public void perform() { natDispose(); } }); } public native void natDispose(); @@ -196,7 +196,7 @@ public class Darwin extends POSIX { public void reshape(int w, int h) { } } - static class GLCarbonDoubleBuffer extends OpenGL.GLDoubleBuffer { + static class GLCarbonPixelBuffer extends OpenGL.GLDoubleBuffer { RawData rawCTX; RawData rawWindowRef; int textureName; @@ -211,12 +211,12 @@ public class Darwin extends POSIX { if(!gl.rectangularTextures) n = OpenGL.roundToPowerOf2(n); return Math.min(n,gl.maxAglSurfaceTexSize); } - public GLCarbonDoubleBuffer(int w, int h, final CarbonOpenGL gl) { + public GLCarbonPixelBuffer(int w, int h, final CarbonOpenGL gl) { super(fixupDimension(gl,w),fixupDimension(gl,h)); this.gl = gl; rectTexture = gl.hasRectangularTextures(); final Semaphore sem = new Semaphore(); - CarbonMessage.add(new CarbonMessage() { public void perform() { GLCarbonDoubleBuffer.this.natInit(); sem.release(); } }); + CarbonMessage.add(new CarbonMessage() { public void perform() { GLCarbonPixelBuffer.this.natInit(); sem.release(); } }); sem.block(); } public native void activateContext(); @@ -256,9 +256,9 @@ public class Darwin extends POSIX { super.setSize(w,h); } - private native void natBlit(GLCarbonDoubleBuffer db, int sx, int sy, int dx, int dy, int dx2, int dy2); - public synchronized void blit(DoubleBuffer db, int sx, int sy, int dx, int dy, int dx2, int dy2) { - natBlit((GLCarbonDoubleBuffer)db,sx,sy,dx,dy,dx2,dy2); + private native void natBlit(GLCarbonPixelBuffer db, int sx, int sy, int dx, int dy, int dx2, int dy2); + public synchronized void blit(PixelBuffer db, int sx, int sy, int dx, int dy, int dx2, int dy2) { + natBlit((GLCarbonPixelBuffer)db,sx,sy,dx,dy,dx2,dy2); } private native void natReshape(int w, int h); @@ -267,16 +267,16 @@ public class Darwin extends POSIX { public native void natDispose(); } - /*private class QZCarbonDoubleBuffer extends DoubleBuffer { + /*private class QZCarbonPixelBuffer extends DoubleBuffer { - public QZCarbonDoubleBuffer(int width, int height) { + public QZCarbonPixelBuffer(int width, int height) { } } private class QZCarbonSurface extends CarbonSurface { public QZCarbonSurface(Box root, boolean framed) { super(b,root); } - public native void blit(DoubleBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2); + public native void blit(PixelBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2); } private class QZCarbonPicture extends Picture { @@ -292,11 +292,11 @@ public class Darwin extends POSIX { } }*/ - protected DoubleBuffer _createDoubleBuffer(int w, int h, Surface owner) { + protected PixelBuffer _createDoubleBuffer(int w, int h, Surface owner) { if(openGL != null) - return new GLCarbonDoubleBuffer(w,h,openGL); + return new GLCarbonPixelBuffer(w,h,openGL); else - return /*new QZCarbonDoubleBuffer(w,h)*/ null; + return /*new QZCarbonPixelBuffer(w,h)*/ null; } protected Surface _createSurface(Box b, boolean framed) { if(openGL != null) diff --git a/src/org/xwt/plat/Java2.java b/src/org/xwt/plat/Java2.java index 40ae9c3..e6a2ad4 100644 --- a/src/org/xwt/plat/Java2.java +++ b/src/org/xwt/plat/Java2.java @@ -106,7 +106,7 @@ public class Java2 extends AWT { }); } - protected DoubleBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new Java2DoubleBuffer(w, h); } + protected PixelBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new Java2DoubleBuffer(w, h); } protected Surface _createSurface(final Box root, final boolean framed) { return (Surface)java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() { public Object run() { @@ -137,14 +137,14 @@ public class Java2 extends AWT { public Java2Surface(Box root, boolean framed) { super(root, framed); } - public void blit(DoubleBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2) { + public void blit(PixelBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2) { if (ourGraphics == null) { ourGraphics = window.getGraphics(); // sometimes jdk1.4 doesn't set the clip properly when we're in the middle of a resize ourGraphics.setClip(insets.left, insets.top, root.width + insets.left, root.height + insets.top); } - _doDrawImage(window.getGraphics(), ((AWTDoubleBuffer)s).i, dx + insets.left, dy + insets.top, dx2 + insets.left, dy2 + insets.top, + _doDrawImage(window.getGraphics(), ((AWTPixelBuffer)s).i, dx + insets.left, dy + insets.top, dx2 + insets.left, dy2 + insets.top, sx, sy, sx + (dx2 - dx), sy + (dy2 - dy), null); } @@ -197,7 +197,7 @@ public class Java2 extends AWT { } } - protected static class Java2DoubleBuffer extends AWTDoubleBuffer { + protected static class Java2PixelBuffer extends AWTDoubleBuffer { private static ColorModel cm = Toolkit.getDefaultToolkit().getColorModel(); private static Hashtable emptyHashtable = new Hashtable(); private static short[] sbank = null; @@ -209,7 +209,7 @@ public class Java2 extends AWT { _doDrawImage(g, ((AWTPicture)source).i, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null); } - public Java2DoubleBuffer(int w, int h) { + public Java2PixelBuffer(int w, int h) { SampleModel sm = cm.createCompatibleSampleModel(w, h); int numSamples = w * h * sm.getNumDataElements(); DataBuffer buf = null; diff --git a/src/org/xwt/plat/OpenGL.cc b/src/org/xwt/plat/OpenGL.cc index 31b5228..c7a1002 100644 --- a/src/org/xwt/plat/OpenGL.cc +++ b/src/org/xwt/plat/OpenGL.cc @@ -4,7 +4,7 @@ // IMPROVMENT: use alpha testing? might be faster #include -#include +#include #include #include #include @@ -56,7 +56,7 @@ void OpenGL::natInit() { version = JvNewStringLatin1(s==0 ? "" : (char*)s); } -void OpenGL$GLDoubleBuffer::drawableInit(jint width, jint height) { +void OpenGL$GLPixelBuffer::drawableInit(jint width, jint height) { glClearColor (0.3f, 0.7f, 1.0f, 1.0f); glClearDepth( 0.0f ); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); @@ -77,7 +77,7 @@ void OpenGL$GLDoubleBuffer::drawableInit(jint width, jint height) { checkGLError(); } -void OpenGL$GLDoubleBuffer::setColor(jint argb) { +void OpenGL$GLPixelBuffer::setColor(jint argb) { float alpha = ((argb >> 24) & 0xff) / 255.0; float red = ((argb >> 16) & 0xff) / 255.0; float green = ((argb >> 8) & 0xff) / 255.0; @@ -85,7 +85,7 @@ void OpenGL$GLDoubleBuffer::setColor(jint argb) { glColor4f(red,green,blue,alpha); } -void OpenGL$GLDoubleBuffer::fillTrapezoid(jint x1, jint x2, jint y1, jint x3, jint x4, jint y2, jint color) { +void OpenGL$GLPixelBuffer::fillTrapezoid(jint x1, jint x2, jint y1, jint x3, jint x4, jint y2, jint color) { activateContext(); setColor(color); glBegin(GL_QUADS); @@ -96,7 +96,7 @@ void OpenGL$GLDoubleBuffer::fillTrapezoid(jint x1, jint x2, jint y1, jint x3, ji glEnd(); } -void OpenGL$GLDoubleBuffer::fillRect(jint x1, jint y1, jint x2, jint y2,jint color) { +void OpenGL$GLPixelBuffer::fillRect(jint x1, jint y1, jint x2, jint y2,jint color) { activateContext(); setColor(color); glBegin(GL_QUADS); @@ -107,7 +107,7 @@ void OpenGL$GLDoubleBuffer::fillRect(jint x1, jint y1, jint x2, jint y2,jint col glEnd(); } -void OpenGL$GLDoubleBuffer::setClip(jint x1, jint y1, jint x2, jint y2) { +void OpenGL$GLPixelBuffer::setClip(jint x1, jint y1, jint x2, jint y2) { //fprintf(stderr,"setClip: %d %d %d %d\n",x1,y1,x2,y2); if(x1==0 && y1==0 && x2==width && y2==height) { if(glScissorEnabled) { @@ -129,7 +129,7 @@ void OpenGL$GLDoubleBuffer::setClip(jint x1, jint y1, jint x2, jint y2) { checkGLError(); } -void OpenGL$GLDoubleBuffer::resetClip() { +void OpenGL$GLPixelBuffer::resetClip() { activateContext(); if(glScissorEnabled) { glDisable(GL_SCISSOR_TEST); diff --git a/src/org/xwt/plat/OpenGL.java b/src/org/xwt/plat/OpenGL.java index 2028ceb..d730e0e 100644 --- a/src/org/xwt/plat/OpenGL.java +++ b/src/org/xwt/plat/OpenGL.java @@ -52,7 +52,7 @@ abstract class OpenGL { public NotSupportedException(String s) { super(s); } } - public static abstract class GLDoubleBuffer extends DoubleBuffer { + public static abstract class GLPixelBuffer extends DoubleBuffer { protected int width; protected int height; public int getWidth() { return width; } @@ -60,7 +60,7 @@ abstract class OpenGL { private boolean glScissorEnabled = false; - public GLDoubleBuffer(int width, int height) { + public GLPixelBuffer(int width, int height) { this.width = width; this.height = height; } diff --git a/src/org/xwt/plat/Win32.cc b/src/org/xwt/plat/Win32.cc index 208c2c3..06c5195 100644 --- a/src/org/xwt/plat/Win32.cc +++ b/src/org/xwt/plat/Win32.cc @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -416,7 +416,7 @@ jboolean org::xwt::plat::Win32::_newBrowserWindow_(jstring url) { } -// Win32DoubleBuffer ///////////////////////////////////////////////////////////////////////// +// Win32PixelBuffer ///////////////////////////////////////////////////////////////////////// // This is a scratch area; when blitting a translucent image, we copy the underlying data here first. // Since all drawing operations are single-threaded, it's safe to use a global here. @@ -432,7 +432,7 @@ static jint scratch_h = 0; else \ StretchBlt(dest, dx1, dy1, dx2 - dx1, dy2 - dy1, src, sx1, sy1, sx2 - sx1, sy2 - sy1, op); -void org::xwt::plat::Win32$Win32DoubleBuffer::drawPicture(org::xwt::Picture* source0, +void org::xwt::plat::Win32$Win32PixelBuffer::drawPicture(org::xwt::Picture* source0, jint dx1, jint dy1, jint dx2, jint dy2, jint sx1, jint sy1, jint sx2, jint sy2) { org::xwt::plat::Win32$Win32Picture* source = (org::xwt::plat::Win32$Win32Picture*)source0; @@ -494,7 +494,7 @@ void org::xwt::plat::Win32$Win32DoubleBuffer::drawPicture(org::xwt::Picture* sou } -void org::xwt::plat::Win32$Win32DoubleBuffer::drawString(jstring font, jstring text, jint x, jint y, jint color) { +void org::xwt::plat::Win32$Win32PixelBuffer::drawString(jstring font, jstring text, jint x, jint y, jint color) { org::xwt::plat::Win32$Win32Font* wf = org::xwt::plat::Win32::getFont(font); SelectObject((HDC)hdc, (HFONT)(wf->hfont)); @@ -511,7 +511,7 @@ void org::xwt::plat::Win32$Win32DoubleBuffer::drawString(jstring font, jstring t TextOut((HDC)hdc, x, y, buf, len); } -void org::xwt::plat::Win32$Win32DoubleBuffer::fillRect(jint x, jint y, jint x2, jint y2, jint color) { +void org::xwt::plat::Win32$Win32PixelBuffer::fillRect(jint x, jint y, jint x2, jint y2, jint color) { jint w = x2 - x; jint h = y2 - y; @@ -523,27 +523,27 @@ void org::xwt::plat::Win32$Win32DoubleBuffer::fillRect(jint x, jint y, jint x2, DeleteObject(brush); } -void org::xwt::plat::Win32$Win32Surface::blit(org::xwt::DoubleBuffer* s, jint sx, jint sy, jint dx, jint dy, jint dx2, jint dy2) { +void org::xwt::plat::Win32$Win32Surface::blit(org::xwt::PixelBuffer* s, jint sx, jint sy, jint dx, jint dy, jint dx2, jint dy2) { // we create the DC lazily to get around some strange race condition in WinXP if (hdc == 0) hdc = (jint)GetDC((HWND)hwnd); - BitBlt((HDC)hdc, dx, dy, dx2 - dx, dy2 - dy, (HDC)(((org::xwt::plat::Win32$Win32DoubleBuffer*)s)->hdc), sx, sy, SRCCOPY); + BitBlt((HDC)hdc, dx, dy, dx2 - dx, dy2 - dy, (HDC)(((org::xwt::plat::Win32$Win32PixelBuffer*)s)->hdc), sx, sy, SRCCOPY); } -void org::xwt::plat::Win32$Win32DoubleBuffer::natInit() { +void org::xwt::plat::Win32$Win32PixelBuffer::natInit() { hbitmap = (jint)CreateCompatibleBitmap((HDC)org::xwt::plat::Win32::desktop_dc, w, h); hdc = (jint)CreateCompatibleDC((HDC)org::xwt::plat::Win32::desktop_dc); SetBkMode((HDC)hdc, TRANSPARENT); SelectObject((HDC)hdc, (HBITMAP)hbitmap); } -void org::xwt::plat::Win32$Win32DoubleBuffer::setClip(jint x, jint y, jint x2, jint y2) { +void org::xwt::plat::Win32$Win32PixelBuffer::setClip(jint x, jint y, jint x2, jint y2) { clipx1 = x; clipx2 = x2; clipy1 = y; clipy2 = y2; HRGN hrgn = CreateRectRgn(x, y, x2, y2); SelectClipRgn((HDC)hdc, hrgn); DeleteObject(hrgn); } -void org::xwt::plat::Win32$Win32DoubleBuffer::finalize() { +void org::xwt::plat::Win32$Win32PixelBuffer::finalize() { DeleteObject((void*)hdc); DeleteObject((void*)hbitmap); } diff --git a/src/org/xwt/plat/Win32.java b/src/org/xwt/plat/Win32.java index ddd6116..4a14394 100644 --- a/src/org/xwt/plat/Win32.java +++ b/src/org/xwt/plat/Win32.java @@ -119,7 +119,7 @@ public class Win32 extends GCJ { protected boolean _needsAutoClick() { return true; } protected String getDescriptiveName() { return "GCJ Win32 Binary"; } protected Surface _createSurface(Box b, boolean framed) { return new Win32Surface(b, framed); } - protected DoubleBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new Win32DoubleBuffer(w, h, (Win32Surface)owner); } + protected PixelBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new Win32DoubleBuffer(w, h, (Win32Surface)owner); } protected Picture _createPicture(int[] b, int w, int h) { return new Win32Picture(b, w, h); } protected native int _getScreenWidth(); protected native int _getScreenHeight(); @@ -253,7 +253,7 @@ public class Win32 extends GCJ { public native void setTitleBarText(String s); public native void setIcon(Picture p); public native void _dispose(); - public native void blit(DoubleBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2); + public native void blit(PixelBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2); } @@ -289,9 +289,9 @@ public class Win32 extends GCJ { } - // Win32DoubleBuffer ////////////////////////////////////////////////////////////////////////// + // Win32PixelBuffer ////////////////////////////////////////////////////////////////////////// - public static class Win32DoubleBuffer extends DoubleBuffer { + public static class Win32PixelBuffer extends DoubleBuffer { int w = 0; int h = 0; @@ -308,7 +308,7 @@ public class Win32 extends GCJ { public int getWidth() { return w; } public native void natInit(); - public Win32DoubleBuffer(int w, int h, Win32Surface owner) { + public Win32PixelBuffer(int w, int h, Win32Surface owner) { this.w = w; this.h = h; clipx2 = w; diff --git a/src/org/xwt/plat/X11.cc b/src/org/xwt/plat/X11.cc index ccbac13..2d146e6 100644 --- a/src/org/xwt/plat/X11.cc +++ b/src/org/xwt/plat/X11.cc @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ static int shm_size = 0; #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) < (b) ? (b) : (a)) -// X11DoubleBuffer ////////////////////////////////////////////////////////////////////// +// X11PixelBuffer ////////////////////////////////////////////////////////////////////// // ensures that the shared memory is at least size bytes; if not, allocates 3/2 * size static void ensureShmSize(int size) { @@ -66,7 +66,7 @@ static void ensureShmSize(int size) { } } -void org::xwt::plat::X11$X11DoubleBuffer::fastDrawPicture(org::xwt::Picture* s, +void org::xwt::plat::X11$X11PixelBuffer::fastDrawPicture(org::xwt::Picture* s, jint dx1, jint dy1, jint dx2, jint dy2, jint sx1, jint sy1, jint sx2, jint sy2) { org::xwt::plat::X11$X11Picture* source = (org::xwt::plat::X11$X11Picture*)s; @@ -88,7 +88,7 @@ void org::xwt::plat::X11$X11DoubleBuffer::fastDrawPicture(org::xwt::Picture* s, XCopyArea(display, *((Pixmap*)source->doublebuf->pm), (*((Pixmap*)pm)), (*((GC*)clipped_gc)), sx1, sy1, sx2 - sx1, sy2 - sy1, dx1, dy1); } -void org::xwt::plat::X11$X11DoubleBuffer::slowDrawPicture(org::xwt::Picture* s, +void org::xwt::plat::X11$X11PixelBuffer::slowDrawPicture(org::xwt::Picture* s, jint dx1, jint dy1, jint dx2, jint dy2, jint sx1, jint sy1, jint sx2, jint sy2) { org::xwt::plat::X11$X11Picture* source = (org::xwt::plat::X11$X11Picture*)s; @@ -189,7 +189,7 @@ void org::xwt::plat::X11$X11DoubleBuffer::slowDrawPicture(org::xwt::Picture* s, } } -void org::xwt::plat::X11$X11DoubleBuffer::finalize() { +void org::xwt::plat::X11$X11PixelBuffer::finalize() { if (shared_pixmap) { XShmSegmentInfo *sinfo = (XShmSegmentInfo*)shm_segment; XShmDetach(display, sinfo); @@ -207,7 +207,7 @@ void org::xwt::plat::X11$X11DoubleBuffer::finalize() { XFreeGC(display, *((GC*)clipped_gc)); } -void org::xwt::plat::X11$X11DoubleBuffer::natInit() { +void org::xwt::plat::X11$X11PixelBuffer::natInit() { if (width == 0 || height == 0) return; shared_pixmap &= shm_supported & shm_pixmaps_supported; // refuse to use shared pixmaps if we don't have shm @@ -240,7 +240,7 @@ void org::xwt::plat::X11$X11DoubleBuffer::natInit() { XChangeGC(display, (*((GC*)clipped_gc)), GCGraphicsExposures, &vm); } -void org::xwt::plat::X11$X11DoubleBuffer::createStipple(org::xwt::plat::X11$X11Picture* xpi) { +void org::xwt::plat::X11$X11PixelBuffer::createStipple(org::xwt::plat::X11$X11Picture* xpi) { stipple = (gnu::gcj::RawData*)malloc(sizeof(Pixmap)); (*((Pixmap*)stipple)) = XCreatePixmap(display, RootWindow(display, screen_num), width, height, 1); @@ -273,13 +273,13 @@ void org::xwt::plat::X11$X11DoubleBuffer::createStipple(org::xwt::plat::X11$X11P XPutImage(display, (*((Pixmap*)stipple)), stipple_gc, &xi, 0, 0, 0, 0, width, height); } -void org::xwt::plat::X11$X11Surface::blit(org::xwt::DoubleBuffer* db, jint sx, jint sy, jint dx, jint dy, jint dx2, jint dy2) { - org::xwt::plat::X11$X11DoubleBuffer *xdb = (org::xwt::plat::X11$X11DoubleBuffer*)db; +void org::xwt::plat::X11$X11Surface::blit(org::xwt::PixelBuffer* db, jint sx, jint sy, jint dx, jint dy, jint dx2, jint dy2) { + org::xwt::plat::X11$X11PixelBuffer *xdb = (org::xwt::plat::X11$X11DoubleBuffer*)db; XCopyArea(display, *((Pixmap*)xdb->pm), *((Window*)window), *((GC*)gc), sx, sy, dx2 - dx, dy2 - dy, dx, dy); XFlush(display); } -void org::xwt::plat::X11$X11DoubleBuffer::fillRect (jint x, jint y, jint x2, jint y2, jint argb) { +void org::xwt::plat::X11$X11PixelBuffer::fillRect (jint x, jint y, jint x2, jint y2, jint argb) { jint w = x2 - x; jint h = y2 - y; @@ -299,7 +299,7 @@ void org::xwt::plat::X11$X11DoubleBuffer::fillRect (jint x, jint y, jint x2, jin XFillRectangle(display, (*((Pixmap*)pm)), (*((GC*)gc)), x, y, w, h); } -void org::xwt::plat::X11$X11DoubleBuffer::drawString(::java::lang::String* font, ::java::lang::String* text, jint x, jint y, jint argb) { +void org::xwt::plat::X11$X11PixelBuffer::drawString(::java::lang::String* font, ::java::lang::String* text, jint x, jint y, jint argb) { XRectangle rect; rect.x = clipx, rect.y = clipy; rect.width = clipw; rect.height = cliph; @@ -334,8 +334,8 @@ void org::xwt::plat::X11$X11DoubleBuffer::drawString(::java::lang::String* font, void org::xwt::plat::X11$X11Surface::setIcon(org::xwt::Picture* pic) { org::xwt::plat::X11$X11Picture* p = ((org::xwt::plat::X11$X11Picture*)pic); - org::xwt::plat::X11$X11DoubleBuffer* old_dbuf = p->doublebuf; - p->buildDoubleBuffer(1); + org::xwt::plat::X11$X11PixelBuffer* old_dbuf = p->doublebuf; + p->buildPixelBuffer(1); XWMHints xwmh; memset(&xwmh, 0, sizeof(XWMHints)); xwmh.flags |= IconPixmapHint | IconMaskHint; diff --git a/src/org/xwt/plat/X11.java b/src/org/xwt/plat/X11.java index fec155c..da7be81 100644 --- a/src/org/xwt/plat/X11.java +++ b/src/org/xwt/plat/X11.java @@ -35,7 +35,7 @@ public class X11 extends POSIX { protected String[] _listFonts() { return fontList; } protected Picture _createPicture(int[] data, int w, int h) { return new X11Picture(data, w, h); } - protected DoubleBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new X11DoubleBuffer(w, h); } + protected PixelBuffer _createDoubleBuffer(int w, int h, Surface owner) { return new X11DoubleBuffer(w, h); } protected Surface _createSurface(Box b, boolean framed) { return new X11Surface(b, framed); } protected boolean _needsAutoClick() { return true; } protected native int _getScreenWidth(); @@ -79,7 +79,7 @@ public class X11 extends POSIX { public native void syncCursor(); public native void _dispose(); public native void setLimits(int minw, int minh, int maxw, int maxh); - public native void blit(DoubleBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2); + public native void blit(PixelBuffer s, int sx, int sy, int dx, int dy, int dx2, int dy2); public native void dispatchEvent(gnu.gcj.RawData ev); public X11Surface(Box root, boolean framed) { @@ -96,8 +96,8 @@ public class X11 extends POSIX { /** * Implements a Picture. No special X11 structure is created * unless the image has no alpha (in which case a - * non-shared-pixmap DoubleBuffer is created), or all-or-nothing - * alpha (in which case a non-shared-pixmap DoubleBuffer with a + * non-shared-pixmap PixelBuffer is created), or all-or-nothing + * alpha (in which case a non-shared-pixmap PixelBuffer with a * stipple bitmap is created). */ public static class X11Picture extends Picture { @@ -105,7 +105,7 @@ public class X11 extends POSIX { int width; int height; int[] data = null; - public X11DoubleBuffer doublebuf = null; + public X11PixelBuffer doublebuf = null; public int getWidth() { return width; } public int getHeight() { return height; } @@ -123,13 +123,13 @@ public class X11 extends POSIX { else if ((data[i] & 0xFF000000) != 0x00) return; - buildDoubleBuffer(needsStipple); + buildPixelBuffer(needsStipple); } - void buildDoubleBuffer(boolean needsStipple) { + void buildPixelBuffer(boolean needsStipple) { if (doublebuf != null) return; // no point in using a shared pixmap since we'll only write to this image once - X11DoubleBuffer b = new X11DoubleBuffer(width, height, false); + X11PixelBuffer b = new X11DoubleBuffer(width, height, false); b.drawPicture(this, 0, 0); if (needsStipple) b.createStipple(this); doublebuf = b; @@ -138,22 +138,22 @@ public class X11 extends POSIX { } /** - * An X11DoubleBuffer is implemented as an X11 pixmap. "Normal" - * DoubleBuffers will use XShm shared pixmaps if - * available. X11DoubleBuffers created to accelerate Pictures + * An X11PixelBuffer is implemented as an X11 pixmap. "Normal" + * PixelBuffers will use XShm shared pixmaps if + * available. X11PixelBuffers created to accelerate Pictures * with all-or-nothing alpha will not use shared pixmaps, however * (since they are only written to once. */ - public static class X11DoubleBuffer extends DoubleBuffer { + public static class X11PixelBuffer extends DoubleBuffer { int clipx, clipy, clipw, cliph; int width; int height; - /** DoubleBuffers of X11Pictures can have stipples -- the stipple of the Picture */ + /** PixelBuffers of X11Pictures can have stipples -- the stipple of the Picture */ RawData stipple = null; - /** Sets the DoubleBuffer's internal stipple to the alpha==0x00 regions of xpi */ + /** Sets the PixelBuffer's internal stipple to the alpha==0x00 regions of xpi */ public native void createStipple(X11Picture xpi); RawData pm; // Pixmap (if any) representing this Picture @@ -164,9 +164,9 @@ public class X11 extends POSIX { RawData gc; // Graphics Context on pm (never changes, so it's fast) RawData clipped_gc; // Graphics Context on pm, use this one if you need a clip/stipple - /** DoubleBuffer mode */ - public X11DoubleBuffer(int w, int h) { this(w, h, true); } - public X11DoubleBuffer(int w, int h, boolean shared_pixmap) { + /** PixelBuffer mode */ + public X11PixelBuffer(int w, int h) { this(w, h, true); } + public X11PixelBuffer(int w, int h, boolean shared_pixmap) { width = clipw = w; height = cliph = h; clipx = clipy = 0; -- 1.7.10.4