gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz gfx/jni/GzzGL-jni.cxx gzz/client/AbstractUp...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz gfx/jni/GzzGL-jni.cxx gzz/client/AbstractUp...
Date: Mon, 27 Jan 2003 09:33:20 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        03/01/27 09:33:20

Modified files:
        gfx/jni        : GzzGL-jni.cxx 
        gzz/client     : AbstractUpdateManager.java 
        gzz/gfx/gl     : PageSpanPaper.java Paper.java 
        test/gzz/gfx/gl: pagespanpaper.test 

Log message:
        Now the test works -- next: radeon

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.83&tr2=1.84&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/AbstractUpdateManager.java.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/PageSpanPaper.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/Paper.java.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/gfx/gl/pagespanpaper.test.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -u gzz/gfx/jni/GzzGL-jni.cxx:1.83 gzz/gfx/jni/GzzGL-jni.cxx:1.84
--- gzz/gfx/jni/GzzGL-jni.cxx:1.83      Sun Jan 26 16:25:58 2003
+++ gzz/gfx/jni/GzzGL-jni.cxx   Mon Jan 27 09:33:19 2003
@@ -1020,9 +1020,9 @@
 
 JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_interruptEventloop
   (JNIEnv *env, jclass) {
-      DBG(dbg) << "Interrupting C++ eventloop";
+      DBG(dbg) << "Interrupting C++ eventloop\n";
       ws->interrupt();
-      DBG(dbg) << "Done interrupting - should wake soon";
+      DBG(dbg) << "Done interrupting - should wake soon\n";
   }
 
 
@@ -1041,26 +1041,35 @@
        jintArray j_inds2, jfloatArray j_pts2, 
        jintArray j_codes,
        jfloat fract, jboolean standardcoords, jboolean showFinal) {
-       DBG(dbg) << "RENDER\n";
+       DBG(dbg) << "RENDER "<<window<<" "<<numinds<<" "
+               <<j_inds1<<" "<<j_pts1<<" "<<
+               j_interpinds<<" "<<j_inds2<<" "<<j_pts2<<" "<<j_codes<<"\n";
        GLERR
+       DBG(dbg) << "1\n";
        if(standardcoords) 
           setWindow(window);
+       DBG(dbg) << "2\n";
 
        if(sizeof(jint) != sizeof(jint) ||
         sizeof(jfloat) != sizeof(float))
          env->FatalError("Invalid data type sizes!");
+       DBG(dbg) << "3\n";
 
       jint *inds1 = env->GetIntArrayElements(j_inds1, 0);
+       DBG(dbg) << "4\n";
       jfloat *pts1 = env->GetFloatArrayElements(j_pts1, 0);
+       DBG(dbg) << "5\n";
 
       jint *inds2 = 0;
       jfloat *pts2 = 0;
       jint *interpinds = 0;
       if(j_inds2 != 0) {
+          DBG(dbg) << "6\n";
          inds2 = env->GetIntArrayElements(j_inds2, 0);
          pts2 = env->GetFloatArrayElements(j_pts2, 0);
          interpinds = env->GetIntArrayElements(j_interpinds, 0);
       }
+       DBG(dbg) << "7\n";
 
       jint *codes = env->GetIntArrayElements(j_codes, 0);
 
Index: gzz/gzz/client/AbstractUpdateManager.java
diff -u gzz/gzz/client/AbstractUpdateManager.java:1.34 
gzz/gzz/client/AbstractUpdateManager.java:1.35
--- gzz/gzz/client/AbstractUpdateManager.java:1.34      Fri Jan 24 04:06:27 2003
+++ gzz/gzz/client/AbstractUpdateManager.java   Mon Jan 27 09:33:19 2003
@@ -41,7 +41,7 @@
  */
 
 public abstract class AbstractUpdateManager implements Runnable {
-public static final String rcsid = "$Id: AbstractUpdateManager.java,v 1.34 
2003/01/24 09:06:27 tjl Exp $";
+public static final String rcsid = "$Id: AbstractUpdateManager.java,v 1.35 
2003/01/27 14:33:19 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -372,6 +372,14 @@
            if(dbg) pa("Updmanager No idle tasks");
        }
        return false;
+    }
+
+    /** Play the idle tasks one step; return true if something
+     * was done.
+     * Used mainly from tests.
+     */
+    static public boolean tickIdle() {
+       return instance.doIdle();
     }
 
     public void run() {
Index: gzz/gzz/gfx/gl/PageSpanPaper.java
diff -u gzz/gzz/gfx/gl/PageSpanPaper.java:1.1 
gzz/gzz/gfx/gl/PageSpanPaper.java:1.2
--- gzz/gzz/gfx/gl/PageSpanPaper.java:1.1       Mon Jan 27 06:35:43 2003
+++ gzz/gzz/gfx/gl/PageSpanPaper.java   Mon Jan 27 09:33:19 2003
@@ -1,6 +1,7 @@
 // (c): Tuomas J. Lukka
 
 package gzz.gfx.gl;
+import org.python.util.PythonInterpreter;
 
 /** Create libpaper papers for PageSpan pages.
  */
@@ -26,6 +27,7 @@
        return 
            "\n ActiveTexture TEXTURE"+i+" \n"+
            "\n BindTexture TEXTURE_2D "+p.getTexture(0,1).getTexId()+"\n"+
+           filter+
            "\n ActiveTexture TEXTURE0\n"
            ;
     }
@@ -110,6 +112,11 @@
 
 
     public PageSpanPaper(Paper background, GLSpanner.SpanPage p) {
+       if(filter == null) {
+           PythonInterpreter jython = new PythonInterpreter();
+           jython.execfile("gzz/gfx/gl/pagespanpaper.py");
+           jython.cleanup();
+       }
        this.bg = background;
        this.identity = identity;
        this.p = p;
Index: gzz/gzz/gfx/gl/Paper.java
diff -u gzz/gzz/gfx/gl/Paper.java:1.7 gzz/gzz/gfx/gl/Paper.java:1.8
--- gzz/gzz/gfx/gl/Paper.java:1.7       Wed Dec  4 04:47:09 2002
+++ gzz/gzz/gfx/gl/Paper.java   Mon Jan 27 09:33:19 2003
@@ -66,7 +66,11 @@
     public int getNPasses() { return impl_getNPasses(c_id); }
     public void setNPasses(int i) { impl_setNPasses(c_id, i); }
 
-    public Pass getPass(int p) { return new Pass(p); }
+    public Pass getPass(int p) { 
+       if(p < 0 || p >= getNPasses())
+           throw new ArrayIndexOutOfBoundsException();
+       return new Pass(p); 
+    }
 
     public Object clone() { Paper p = new Paper(); impl_clone(c_id, p.c_id); 
return p; }
 
Index: gzz/test/gzz/gfx/gl/pagespanpaper.test
diff -u gzz/test/gzz/gfx/gl/pagespanpaper.test:1.2 
gzz/test/gzz/gfx/gl/pagespanpaper.test:1.3
--- gzz/test/gzz/gfx/gl/pagespanpaper.test:1.2  Mon Jan 27 07:28:00 2003
+++ gzz/test/gzz/gfx/gl/pagespanpaper.test      Mon Jan 27 09:33:19 2003
@@ -1,9 +1,14 @@
 from __future__ import nested_scopes
+import sys
+import traceback
 needGL()
 
 import gzz
 from gzz.gfx.gl import GLVobCoorder, GL
 from gzz.gfx.gl import GL, GLRen, GLCache, PaperMill, GLSpanner, PageSpanPaper
+from java.lang import Thread
+
+from test.tools.gfx import *
 
 id = "01ACE8A2E202A26072012715A94A270CD012F9B0F2"
 
@@ -16,10 +21,33 @@
     """
     failUnlessEqual(sc.getCurrent().length(), 2)
 
+def checkColors():
+    try:
+       # Check that the green rectangle is there
+       checkAvgColor(160,150,50,50, (0, 255, 0))
+       # Check that the red rectangle is there
+       checkAvgColor(260,150,50,50, (255, 0, 0))
+       # Check that the black rectangle is there
+       checkAvgColor(150,225,20,50, (0, 0, 0))
+       checkAvgColor(330,225,20,50, (0, 0, 0))
+
+       # Check that the border is yellow
+       checkAvgColor(45, 0, 2, 500, (255, 255, 0))
+       checkAvgColor(453, 0, 2, 500, (255, 255, 0))
+    except:
+       return 0
+       # Let these run to print out the errors
+       typ, val, tra = sys.exc_info()
+       print (repr((typ, val)))
+       print str(val)
+       l = traceback.format_list(traceback.extract_tb(tra))
+       print "\n".join(l)
+       return 0
+    return 1
+
 def testNobg():
     """Test that the image gets loaded correctly from GLSpanner.
 
-    fail: *
     """
 
     pagespan = GLSpanner.getSpanRect(sc.getCurrent()).page
@@ -30,16 +58,22 @@
     vs = getvs()
     vs.map.put(SolidBgVob(Color.yellow))
 
-    pcs = vs.orthoCS(0, "A", 0, 50, 50, 400, 400)
+    pcs = vs.orthoCS(0, "A", 0, 50, 50, 400.0 / p.w, 400.0 / p.h)
     vs.map.put(
        GLRen.createPaperQuad(pap, 0, 0, p.w, p.h, 1, 1, 0),
        pcs, 0)
 
-    for i in range(0, 10):
-       pagespan.request(1, 5000)
+    for i in range(0, 30):
+       pagespan.getTexture(1, 5000)
+       gzz.client.AbstractUpdateManager.tickIdle()
        render(vs)
+
+       # check the rendered image's color
+       if checkColors(): return
+
        Thread.sleep(100)
 
 
+    failUnlessEqual("didn't get the image", 0, 1)
 
-    failUnlessEqual(0, 1)
+# : vim: set syntax=python :




reply via email to

[Prev in Thread] Current Thread [Next in Thread]