gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gzz client/Fallback.java client/awt/AWTScre...


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/gzz client/Fallback.java client/awt/AWTScre...
Date: Wed, 04 Sep 2002 18:15:40 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      02/09/04 18:15:40

Modified files:
        gzz/client     : Fallback.java 
        gzz/client/awt : AWTScreen.java 
        gzz/modules/pp : ViewportVob.java Win.java 
        gzz/vob        : DefaultVobMap.java OrthoCoorder.java 
                         OrthoRenderInfo.java SolidBgVob.java 

Log message:
        Make AWT backgrounds work again

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/Fallback.java.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/awt/AWTScreen.java.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/ViewportVob.java.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/Win.java.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/DefaultVobMap.java.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/OrthoCoorder.java.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/OrthoRenderInfo.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/SolidBgVob.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gzz/gzz/client/Fallback.java
diff -c gzz/gzz/client/Fallback.java:1.31 gzz/gzz/client/Fallback.java:1.32
*** gzz/gzz/client/Fallback.java:1.31   Thu Aug 29 05:41:16 2002
--- gzz/gzz/client/Fallback.java        Wed Sep  4 18:15:39 2002
***************
*** 72,78 ****
   * It implements a subset of the 0.6.0 bindings.
   */
  public class Fallback {
! public static final String rcsid = "$Id: Fallback.java,v 1.31 2002/08/29 
09:41:16 tjl Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
--- 72,78 ----
   * It implements a subset of the 0.6.0 bindings.
   */
  public class Fallback {
! public static final String rcsid = "$Id: Fallback.java,v 1.32 2002/09/04 
22:15:39 benja Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
***************
*** 167,172 ****
--- 167,173 ----
  
        public VobScene generate() {
            VobScene sc = this.screen.window.createVobScene();
+             sc.map.put(new SolidBgVob(bg), 0);
  
            for(Iterator i=decorators.iterator(); i.hasNext();) {
                FallbackSceneDecorator dec =
Index: gzz/gzz/client/awt/AWTScreen.java
diff -c gzz/gzz/client/awt/AWTScreen.java:1.18 
gzz/gzz/client/awt/AWTScreen.java:1.19
*** gzz/gzz/client/awt/AWTScreen.java:1.18      Thu Aug 29 05:41:16 2002
--- gzz/gzz/client/awt/AWTScreen.java   Wed Sep  4 18:15:39 2002
***************
*** 34,40 ****
  public abstract class AWTScreen
        extends GraphicsAPI.Window
        implements MouseListener, MouseMotionListener, Obs, 
JUpdateManager.EventProcessor {
!     public static final String rcsid = "$Id: AWTScreen.java,v 1.18 2002/08/29 
09:41:16 tjl Exp $";
  
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
--- 34,40 ----
  public abstract class AWTScreen
        extends GraphicsAPI.Window
        implements MouseListener, MouseMotionListener, Obs, 
JUpdateManager.EventProcessor {
!     public static final String rcsid = "$Id: AWTScreen.java,v 1.19 2002/09/04 
22:15:39 benja Exp $";
  
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
***************
*** 166,172 ****
            ((OrthoCoorder)sc.coords).renderVobs((DefaultVobMap)sc.map,
                                                 (OrthoCoorder)osc.coords,
                                                 fract,
!                                                gr, Color.white, fg
                                        );
        }
        gr.dispose();
--- 166,172 ----
            ((OrthoCoorder)sc.coords).renderVobs((DefaultVobMap)sc.map,
                                                 (OrthoCoorder)osc.coords,
                                                 fract,
!                                                gr, fg
                                        );
        }
        gr.dispose();
Index: gzz/gzz/modules/pp/ViewportVob.java
diff -c gzz/gzz/modules/pp/ViewportVob.java:1.15 
gzz/gzz/modules/pp/ViewportVob.java:1.16
*** gzz/gzz/modules/pp/ViewportVob.java:1.15    Wed Sep  4 09:07:52 2002
--- gzz/gzz/modules/pp/ViewportVob.java Wed Sep  4 18:15:39 2002
***************
*** 73,79 ****
  
  
        ((OrthoCoorder)vobs.coords).renderVobs((DefaultVobMap)vobs.map, null,
!                           0, g, Color.white, Color.black,
                            porig.x, porig.y,
                            (p11.x-porig.x)/1000.0f,
                                (p11.y-porig.y)/1000.0f);
--- 73,79 ----
  
  
        ((OrthoCoorder)vobs.coords).renderVobs((DefaultVobMap)vobs.map, null,
!                           0, g, Color.black,
                            porig.x, porig.y,
                            (p11.x-porig.x)/1000.0f,
                                (p11.y-porig.y)/1000.0f);
Index: gzz/gzz/modules/pp/Win.java
diff -c gzz/gzz/modules/pp/Win.java:1.48 gzz/gzz/modules/pp/Win.java:1.49
*** gzz/gzz/modules/pp/Win.java:1.48    Wed Sep  4 08:48:09 2002
--- gzz/gzz/modules/pp/Win.java Wed Sep  4 18:15:39 2002
***************
*** 36,42 ****
   */
  
  public class Win extends AbstractBinder implements Shower {
! public static final String rcsid = "$Id: Win.java,v 1.48 2002/09/04 12:48:09 
tjl Exp $";
      public static final boolean dbg = true;
      protected static void p(String s) { if(dbg) pa(s); }
      protected static void pa(String s) { System.err.println(s); }
--- 36,42 ----
   */
  
  public class Win extends AbstractBinder implements Shower {
! public static final String rcsid = "$Id: Win.java,v 1.49 2002/09/04 22:15:39 
benja Exp $";
      public static final boolean dbg = true;
      protected static void p(String s) { if(dbg) pa(s); }
      protected static void pa(String s) { System.err.println(s); }
***************
*** 156,163 ****
        // See UnifiedShower.generate for margins
        VobScene sc = this.screen.window.createVobScene();
        if(bg == null)
!           bg = new SolidBgVob(this.screen.window, new Color(0.4f,0.4f,0.8f));
!       sc.map.put(bg,-1);
  
        if(view != null)
            view.render(sc, 0, new ZZViewContext(cursor));
--- 156,163 ----
        // See UnifiedShower.generate for margins
        VobScene sc = this.screen.window.createVobScene();
        if(bg == null)
!           bg = new SolidBgVob(new Color(0.4f,0.4f,0.8f));
!       sc.map.put(bg, 0);
  
        if(view != null)
            view.render(sc, 0, new ZZViewContext(cursor));
Index: gzz/gzz/vob/DefaultVobMap.java
diff -c gzz/gzz/vob/DefaultVobMap.java:1.9 gzz/gzz/vob/DefaultVobMap.java:1.10
*** gzz/gzz/vob/DefaultVobMap.java:1.9  Mon Jul 15 12:39:37 2002
--- gzz/gzz/vob/DefaultVobMap.java      Wed Sep  4 18:15:39 2002
***************
*** 1,6 ****
  /*
  DefaultVobMap.java
!  *    
   *    Copyright (c) 2000-2002, Ted Nelson and Tuomas Lukka
   *
   *    You may use and distribute under the terms of either the GNU Lesser
--- 1,6 ----
  /*
  DefaultVobMap.java
!  *
   *    Copyright (c) 2000-2002, Ted Nelson and Tuomas Lukka
   *
   *    You may use and distribute under the terms of either the GNU Lesser
***************
*** 26,32 ****
  /** An implementation of VobMap.
   */
  public class DefaultVobMap implements VobMap {
! public static final String rcsid = "$Id: DefaultVobMap.java,v 1.9 2002/07/15 
16:39:37 benja Exp $";
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
      private static void pa(String s) { System.err.println(s); }
--- 26,32 ----
  /** An implementation of VobMap.
   */
  public class DefaultVobMap implements VobMap {
! public static final String rcsid = "$Id: DefaultVobMap.java,v 1.10 2002/09/04 
22:15:39 benja Exp $";
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
      private static void pa(String s) { System.err.println(s); }
***************
*** 51,56 ****
--- 51,57 ----
       * stored there.
       */
      int[] vstart = new int[100];
+ 
      /** For each vob, the index of the next vob in the same
       * coordinate system.
       */
***************
*** 63,74 ****
  
      int nvobs = 1;
  
  
  
      public Vob getVobByCS(int i) {
        i = vstart[i];
!       if(i<=0) return null;
!       for(; vnext[i] != 0; i = vnext[i]);
        return vobs[i];
      }
  
--- 64,79 ----
  
      int nvobs = 1;
  
+     public DefaultVobMap() {
+         for(int i=0; i<vstart.length; i++) vstart[i] = -1;
+     }
+ 
  
  
      public Vob getVobByCS(int i) {
        i = vstart[i];
!       if(i<0) return null;
!       for(; vnext[i] >= 0; i = vnext[i]);
        return vobs[i];
      }
  
***************
*** 79,85 ****
        try {
            vobs[nvobs] = vob;
            secondcs[nvobs] = coordsys2;
!           vnext[nvobs] = 0;
            nvobs++;
        } catch(ArrayIndexOutOfBoundsException e) {
            int n = vobs.length * 2;
--- 84,90 ----
        try {
            vobs[nvobs] = vob;
            secondcs[nvobs] = coordsys2;
!           vnext[nvobs] = -1;
            nvobs++;
        } catch(ArrayIndexOutOfBoundsException e) {
            int n = vobs.length * 2;
***************
*** 89,102 ****
            put(vob, coordsys);
            return;
        }
!       if(vstart.length <= coordsys) 
            vstart = moreInts(vstart, coordsys + 50);
!       if(vstart[coordsys] == 0) {
            vstart[coordsys] = nvobs-1;
        } else {
            // new one goes last;
           int i;
!          for(i = vstart[coordsys]; vnext[i] != 0; i = vnext[i]);
           vnext[i] = nvobs-1;
  
           /*
--- 94,111 ----
            put(vob, coordsys);
            return;
        }
!       if(vstart.length <= coordsys) {
!             int n = vstart.length;
            vstart = moreInts(vstart, coordsys + 50);
!             for(int i=n; i<vstart.length; i++)
!                 vstart[i] = -1;
!         }
!       if(vstart[coordsys] < 0) {
            vstart[coordsys] = nvobs-1;
        } else {
            // new one goes last;
           int i;
!          for(i = vstart[coordsys]; vnext[i] >= 0; i = vnext[i]);
           vnext[i] = nvobs-1;
  
           /*
***************
*** 109,114 ****
--- 118,124 ----
  
      public void clear() {
        nvobs = 1;
+         for(int i=0; i<vstart.length; i++) vstart[i] = -1;
        coorder.clear();
      }
  
***************
*** 129,137 ****
       */
      void renderCS(int cs, Vob.RenderInfo info, Graphics g, RenderInfoSetter 
setter,
                                                        Vob.RenderInfo info2) {
!       for(int i = vstart[cs]; i != 0; i = vnext[i]) {
            // pa("Render: "+vobs[i]);
!           if(secondcs[i] > 0 && setter != null) {
                if(setter.set(info2, secondcs[i]))
                    vobs[i].render(g, false, info, info2);
            } else {
--- 139,147 ----
       */
      void renderCS(int cs, Vob.RenderInfo info, Graphics g, RenderInfoSetter 
setter,
                                                        Vob.RenderInfo info2) {
!       for(int i = vstart[cs]; i >= 0; i = vnext[i]) {
            // pa("Render: "+vobs[i]);
!           if(secondcs[i] >= 0 && setter != null) {
                if(setter.set(info2, secondcs[i]))
                    vobs[i].render(g, false, info, info2);
            } else {
***************
*** 140,153 ****
        }
      }
      public void dump() {
-         if(!dbg)
-             return;
-         
        pa("VOBMAP");
        for(int i=0; i<vstart.length; i++) {
!           if(vstart[i] == 0) continue;
            pa("  CS "+i);
!           for(int j = vstart[i]; j != 0; j = vnext[j]) {
                pa("     "+j+" "+vobs[j]);
            }
  
--- 150,160 ----
        }
      }
      public void dump() {
        pa("VOBMAP");
        for(int i=0; i<vstart.length; i++) {
!           if(vstart[i] < 0) continue;
            pa("  CS "+i);
!           for(int j = vstart[i]; j >= 0; j = vnext[j]) {
                pa("     "+j+" "+vobs[j]);
            }
  
Index: gzz/gzz/vob/OrthoCoorder.java
diff -c gzz/gzz/vob/OrthoCoorder.java:1.30 gzz/gzz/vob/OrthoCoorder.java:1.31
*** gzz/gzz/vob/OrthoCoorder.java:1.30  Thu Aug 22 18:53:03 2002
--- gzz/gzz/vob/OrthoCoorder.java       Wed Sep  4 18:15:39 2002
***************
*** 28,34 ****
   */
  
  public class OrthoCoorder implements VobCoorder {
! public static final String rcsid = "$Id: OrthoCoorder.java,v 1.30 2002/08/22 
22:53:03 benja Exp $";
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
      private static void pa(String s) { System.err.println(s); }
--- 28,34 ----
   */
  
  public class OrthoCoorder implements VobCoorder {
! public static final String rcsid = "$Id: OrthoCoorder.java,v 1.31 2002/09/04 
22:15:39 benja Exp $";
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
      private static void pa(String s) { System.err.println(s); }
***************
*** 143,150 ****
      }
  
      public void renderVobs(DefaultVobMap map, OrthoCoorder interpTo,
!                           float fract, java.awt.Graphics g, Color bg, Color 
fg) {
!       renderVobs(map, interpTo, fract, g, bg, fg, 0, 0, 1, 1);
      }
  
      /** Get the CS matching a CS from another OrthoCoorder. */
--- 143,150 ----
      }
  
      public void renderVobs(DefaultVobMap map, OrthoCoorder interpTo,
!                           float fract, java.awt.Graphics g, Color fg) {
!       renderVobs(map, interpTo, fract, g, fg, 0, 0, 1, 1);
      }
  
      /** Get the CS matching a CS from another OrthoCoorder. */
***************
*** 160,166 ****
      /** Render the vobs, fract towards the interpTo coordinates.
       */
      public void renderVobs(final DefaultVobMap map, final OrthoCoorder 
interpTo,
!                           final float fract, java.awt.Graphics g, Color bg, 
Color fg,
                            final float xoffs,
                            final float yoffs,
                            final float xscale,
--- 160,166 ----
      /** Render the vobs, fract towards the interpTo coordinates.
       */
      public void renderVobs(final DefaultVobMap map, final OrthoCoorder 
interpTo,
!                           final float fract, java.awt.Graphics g, Color fg,
                            final float xoffs,
                            final float yoffs,
                            final float xscale,
***************
*** 169,174 ****
--- 169,184 ----
        p("Rendervobs "+xoffs+" "+yoffs+" "+xscale+" "+yscale);
        sys.sorter.sort();
        if(dbg) dump();
+         if(dbg) map.dump();
+         Color bg;
+         Vob bgvob = map.getVobByCS(0);
+         if(bgvob instanceof SolidBgVob) {
+             bg = ((SolidBgVob)bgvob).color;
+             if(dbg) pa("Background color: "+bg);
+         } else {
+             bg = Color.white;
+             if(dbg) pa("NO SOLIDBG VOB: Fall back on white bg color");
+         }
        OrthoRenderInfo info = new OrthoRenderInfo(bg, fg, maxdepth);
        OrthoRenderInfo info2 = new OrthoRenderInfo(bg, fg, maxdepth);
        DefaultVobMap.RenderInfoSetter setter = new 
DefaultVobMap.RenderInfoSetter() {
***************
*** 177,182 ****
--- 187,200 ----
                if(interpTo != null && sys.map.canInterpolate &&
                                         interpTo.sys.map.canInterpolate) {
                    p("...interpTo != null");
+                     if(my == 0) {
+                         p("...my == 0.");
+                         setInterpInfo(my, interpTo, 0, fract,
+                                       xoffs, yoffs, xscale, yscale,
+                                       (OrthoRenderInfo) info);
+                         return true;
+                     }
+ 
                      if(sys.key[my] == null) {
                        p("...my.key == null.");
                          return false;
***************
*** 204,210 ****
        p("Start rendering.");
        int[] sorted = sys.sorter.sorted;
        int nsorted = sys.sorter.nsorted;
!       for(int i=nsorted-1; i>0; i--) {
            p("...set: "+sorted[i]);
            if(setter.set(info, sorted[i])) {
                p("...render: "+sorted[i]+" "+sys.key[sorted[i]]);
--- 222,228 ----
        p("Start rendering.");
        int[] sorted = sys.sorter.sorted;
        int nsorted = sys.sorter.nsorted;
!       for(int i=nsorted-1; i>=0; i--) {
            p("...set: "+sorted[i]);
            if(setter.set(info, sorted[i])) {
                p("...render: "+sorted[i]+" "+sys.key[sorted[i]]);
Index: gzz/gzz/vob/OrthoRenderInfo.java
diff -c gzz/gzz/vob/OrthoRenderInfo.java:1.5 
gzz/gzz/vob/OrthoRenderInfo.java:1.6
*** gzz/gzz/vob/OrthoRenderInfo.java:1.5        Wed Aug 21 10:50:28 2002
--- gzz/gzz/vob/OrthoRenderInfo.java    Wed Sep  4 18:15:39 2002
***************
*** 37,43 ****
        this.fg = fg;
      }
      public OrthoRenderInfo() {
!         bg = Color.white; fg = Color.black;
      }
  
      public Color getBgColor() { return bg; }
--- 37,43 ----
        this.fg = fg;
      }
      public OrthoRenderInfo() {
!         bg = null; fg = null;
      }
  
      public Color getBgColor() { return bg; }
Index: gzz/gzz/vob/SolidBgVob.java
diff -c gzz/gzz/vob/SolidBgVob.java:1.1 gzz/gzz/vob/SolidBgVob.java:1.2
*** gzz/gzz/vob/SolidBgVob.java:1.1     Wed Sep  4 08:48:10 2002
--- gzz/gzz/vob/SolidBgVob.java Wed Sep  4 18:15:39 2002
***************
*** 3,9 ****
  package gzz.vob;
  import java.awt.Color;
  import java.awt.Graphics;
! import java.awt.Dimension;
  import gzz.gfx.gl.*;
  import gzz.client.GraphicsAPI;
  import gzz.util.ColorUtil;
--- 3,9 ----
  package gzz.vob;
  import java.awt.Color;
  import java.awt.Graphics;
! import java.awt.Rectangle;
  import gzz.gfx.gl.*;
  import gzz.client.GraphicsAPI;
  import gzz.util.ColorUtil;
***************
*** 11,39 ****
  /** A solid clear-and-paint-background vob.
   */
  public class SolidBgVob extends Vob{
!     GraphicsAPI.Window win;
      Color color;
  
      /** Create a new SolidBgVob.
-      * @param win The window this vob will be used in. This is
-      *                needed to get the dimensions of the rectangle
-      *                java.awt.Graphics needs to fill; OpenGL doesn't
-      *                need this.
       */
!     public SolidBgVob(GraphicsAPI.Window win, Color color) {
!       this.win = win;
        this.color = color;
      }
  
      // AWT
      public void render(Graphics g, boolean fast,
                Vob.RenderInfo info1,
                Vob.RenderInfo info2)
      {
!       Dimension dim = win.getSize();
  
        g.setColor(color);
!       g.fillRect(0, 0, dim.width, dim.height);
        g.setColor(Color.black);
      }
  
--- 11,39 ----
  /** A solid clear-and-paint-background vob.
   */
  public class SolidBgVob extends Vob{
!     public static boolean dbg = false;
!     private static void pa(String s) { System.err.println(s); }
! 
      Color color;
  
      /** Create a new SolidBgVob.
       */
!     public SolidBgVob(Color color) {
        this.color = color;
      }
  
      // AWT
+     static Rectangle rect = new Rectangle();
      public void render(Graphics g, boolean fast,
                Vob.RenderInfo info1,
                Vob.RenderInfo info2)
      {
!       info1.getExtRect(rect);
! 
!         if(dbg) pa("Render solidbg: "+rect.x+" "+rect.y+" "+rect.width+" 
"+rect.height+" "+color);
  
        g.setColor(color);
!       g.fillRect(rect.x, rect.y, rect.width, rect.height);
        g.setColor(Color.black);
      }
  




reply via email to

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