Mesh replaces Polygon
[org.ibex.core.git] / src / org / ibex / plat / OpenGL.java
index c5be9bf..674a80a 100644 (file)
@@ -55,14 +55,20 @@ abstract class OpenGL {
         public NotSupportedException(String s) { super(s); }
     }
 
-    public static abstract class GLPixelBuffer extends PixelBuffer {
+    public static abstract class GLPixelBuffer implements PixelBuffer {
         protected int width;
         protected int height;
+        public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, int argb) { throw new Error("not implemented"); }
+        public void drawPicture(Picture p, Affine a, Mesh h) { throw new Error("drawPicture() not implemented"); }
+        public void drawGlyph(Font.Glyph source,Affine a,Mesh h,int rgb,int bg) { throw new Error("drawGlyph() not implemented"); }
         public int getWidth() { return width; }
         public int getHeight() { return height; }
         
         private boolean glScissorEnabled = false;
         
+        // FIXME: HUGE HACK!
+        public GLPixelBuffer() { width = 500; height = 500; }
+
         public GLPixelBuffer(int width, int height) {
             this.width = width;
             this.height = height;
@@ -78,12 +84,17 @@ abstract class OpenGL {
         public native void setClip(int x, int y, int x2, int y2);
         public native void resetClip();
         public native void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color);
-            
-        public void drawString(String font, String text, int x, int y, int color) {
-            //System.out.println("drawString(): " + text);
+        public void drawLine(int x1, int y1, int x2, int y2, int color) {
+            // FIXME
+            fillTrapezoid(x1, x1, y1, x2, x2, y2, color);
         }
 
-        public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {
+        public void stroke(Mesh p, int color) { /*p.stroke(this, color);*/ }
+        public native void natFill(Mesh p, int color);
+        public void fill(Mesh p, Paint paint) { natFill(p, ((Paint.SingleColorPaint)paint).color); }
+
+        public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy,
+                              int cx1, int cy1, int cx2, int cy2, int rgb, int pc) {
             drawPicture_(((org.ibex.plat.Platform.DefaultGlyph)source).getPicture(), dx, dy, cx1, cy1, cx2, cy2, rgb);
         }
         public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) {
@@ -135,7 +146,7 @@ abstract class OpenGL {
     public void deleteTexture(final int tex) {
         // CHECKME: Is this safe to do from finalize()?
         // natDeleteTexture MUST be run from the message queue thread
-        Scheduler.add(new Task() { public void perform() { natDeleteTexture(tex); }});
+        Platform.Scheduler.add(new Callable() { public Object run(Object o) { natDeleteTexture(tex); return null; }});
     }
     
     private static abstract class GLPicture {