[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/demo coords_benchmark.py text_benchmark.py
From: |
Matti Katila |
Subject: |
[Gzz-commits] gzz/gfx/demo coords_benchmark.py text_benchmark.py |
Date: |
Tue, 18 Mar 2003 10:13:55 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 03/03/18 10:13:55
Modified files:
gfx/demo : coords_benchmark.py
Added files:
gfx/demo : text_benchmark.py
Log message:
foo
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/text_benchmark.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/coords_benchmark.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/coords_benchmark.py
diff -u gzz/gfx/demo/coords_benchmark.py:1.4
gzz/gfx/demo/coords_benchmark.py:1.5
--- gzz/gfx/demo/coords_benchmark.py:1.4 Mon Mar 17 19:42:17 2003
+++ gzz/gfx/demo/coords_benchmark.py Tue Mar 18 10:13:55 2003
@@ -27,79 +27,53 @@
from gzz.vob.vobs import *
-dbg = 1
-
class ViewScene:
def __init__(self):
+ self.cs = 0
self.nested = 0
self.count = 500
- self.letters = 0
def scene(self, vs):
size = vs.getSize()
- w = size.width*2/4
- h = size.height*2/4
+ w = size.width
+ h = size.height
r = java.util.Random()
- # moves
- movx = size.width/2
- movy = size.height/2
-
bgcolor = (0.6, 0.7, 0.8)
putnoc(vs, background(bgcolor))
- alph = 'abcdefghijklmnopqrstuvwxyz'
-
- # clipping area
- clip = vs.orthoCS(0,"CLIP",0, 0,0, size.width, size.height)
- tr = vs.translateCS(0, 'tr', movx,movy)
-
- if not hasattr(self, "letters"):
- return
-
- for nested in range(0, self.nested):
- if nested%4 == 0:
- tr = vs.translateCS(tr, 'tra'+str(nested), 0, -movy)
- elif nested%4 == 1:
- tr = vs.translateCS(tr, 'trb'+str(nested), -movx,0)
- elif nested%4 == 2:
- tr = vs.translateCS(tr, 'trc'+str(nested), 0, movy)
- else:
- tr = vs.translateCS(tr, 'trd'+str(nested), movx,0)
+ tr = vs.translateCS(0, 'tr', w*1/5, h*1/5)
- for count in range(0, self.count):
- cs = vs.translateCS(tr, 'TEXT'+str(count),
- r.nextFloat()*w, r.nextFloat()*h)
- cs = vs.cullCS(cs, 'CULL'+str(count), clip)
- a = count % len(alph)
- b = (count + self.letters) % len(alph)
- string = ''
- if a > b:
- tmp = 2*alph[:len(alph)]
- string = tmp[a:(b+len(alph))]
- else:
- string = alph[a:b]
- putText(vs, cs, string, color=(0,0,0), h=14, y=10)
-
-
+ # translate cs
+ if self.cs:
+ for count in range(0, self.count):
+ cs = vs.translateCS(0, 'TR'+str(count),0,0)
+ for nested in range(0,self.nested):
+ cs = vs.translateCS(cs, 'AF'+str(count)+'TEX'+str(nested),
+ r.nextFloat()*w*3/5,
+ r.nextFloat()*h*3/5)
+
+ # affine cs
+ else:
+ for count in range(0, self.count):
+ cs = vs.coords.affineCoordsys(0,0,0,0 ,1,0,0,1)
+ for nested in range(0,self.nested):
+ cs = vs.coords.affineCoordsys(cs,0,0,0, 1,0,0,1)
+
def benchmark(self):
- for self.nested in range(0,13,3):
- for self.count in range(100,701,200):
- for self.letters in range(1,20,4):
+ for self.cs in range(0,2):
+ for self.nested in range(0,50,5):
+ for self.count in range(0,501,100):
vs = w.createVobScene()
self.scene(vs)
- AbstractUpdateManager.chg()
+ time = w.timeRender(vs, 1000)
+ print self.cs, self.nested, self.count, time
+ print 'Done!'
- print self.nested,' nested CS, ',\
- self.count, ' text vobs, ',\
- self.letters, ' letters ',\
- 'time: ', w.timeRender(vs, 100)
-
def key(self, k):
if k == "Ctrl-B":
self.benchmark()
-
currentScene = ViewScene()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx/demo coords_benchmark.py text_benchmark.py,
Matti Katila <=