[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gzz/view/pagespanview.py test/gzz/gfx/gl/gl...
From: |
Asko Soukka |
Subject: |
[Gzz-commits] gzz gzz/view/pagespanview.py test/gzz/gfx/gl/gl... |
Date: |
Tue, 29 Oct 2002 05:29:57 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Asko Soukka <address@hidden> 02/10/29 05:29:57
Modified files:
gzz/view : pagespanview.py
test/gzz/gfx/gl: glvobcoorder.test basicrender.test
Log message:
CullingCoordsys xupdf, tests
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/pagespanview.py.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/gfx/gl/glvobcoorder.test.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/gfx/gl/basicrender.test.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
Patches:
Index: gzz/gzz/view/pagespanview.py
diff -u gzz/gzz/view/pagespanview.py:1.16 gzz/gzz/view/pagespanview.py:1.17
--- gzz/gzz/view/pagespanview.py:1.16 Wed Oct 23 15:50:17 2002
+++ gzz/gzz/view/pagespanview.py Tue Oct 29 05:29:57 2002
@@ -235,41 +235,37 @@
def run(rself):
for i in range(0, len(papers)):
# create always all cs, gets interpolation better
- cs1 = vs.coords.affineCoordsys(cs1into, 100,
- self.curx, ycoord, self.scale, 0, 0, self.scale)
- vs.matcher.add(cs1, key+"_p_"+str(i))
+ cs1c = vs.coords.affineCoordsys(cs1into, 100,
+ self.curx-self.scale, ycoord-self.scale,
+ self.scale*2, 0, 0, self.scale*2)
+ vs.matcher.add(cs1c, key+"_pc_"+str(i))
+
# If cliprect is defined, create coordsys transformation
from
# IrregularQuad's object coordsys into CulledPaperQuad's
object
# coordsys. Then create CulledPaperQuad's instead of
# regular renderable2 PaperQuads.
if cliprect:
- irreg_orig_x = (cliprect[0]+cliprect[2])/2
- irreg_orig_y = (cliprect[1]+cliprect[3])/2
- irreg_orig_x_on_pq = (irreg_orig_x - self.curx) /
self.scale
- irreg_orig_y_on_pq = (irreg_orig_y - ycoord) /
self.scale
- cs3 = vs.coords.affineCoordsys(0, 0,
- irreg_orig_x_on_pq, irreg_orig_y_on_pq,
- ((cliprect[2]-cliprect[0])/2) / self.scale, 0, 0,
- ((cliprect[3]-cliprect[1])/2) / self.scale)
+ clip = vs.coords.affineCoordsys(cs1into, 0,
+ cliprect[0], cliprect[1],
+ cliprect[2]-cliprect[0], 0, 0,
+ cliprect[3]-cliprect[1])
- vs.matcher.add(cs3, key+"_cp_"+str(i))
+ vs.matcher.add(clip, key+"_clip_"+str(i))
+ cs_cull = vs.coords.cull(cs1c, clip);
+ vs.matcher.add(cs_cull, key+"_cull_"+str(i))
+
+ cs1 = vs.coords.affineCoordsys(cs_cull, 100, 0.5, 0.5,
0.5, 0, 0, 0.5)
+ vs.matcher.add(cs1, key+"_p_"+str(i))
+ else:
+ cs1 = cs1c
+
if onlypages == None or i in onlypages:
if fancy:
- if cliprect:
- pq = GLRen.createCulledPaperQuad(
- papers[i][3], *corners)
- vs.map.put(pq, cs1, cs2, cs3)
- else:
pq = GLRen.createPaperQuad(
papers[i][3], *corners)
vs.map.put(pq, cs1, cs2)
else:
- if cliprect:
- pq = GLRen.createCulledPaperQuad(
- papers[i][0], *corners)
- vs.map.put(pq, cs1, cs2, cs3)
- else:
- pq = GLRen.createPaperQuad(
+ pq = GLRen.createPaperQuadq(
papers[i][0], *corners)
vs.map.put(pq, cs1, cs2)
Index: gzz/test/gzz/gfx/gl/basicrender.test
diff -u gzz/test/gzz/gfx/gl/basicrender.test:1.5
gzz/test/gzz/gfx/gl/basicrender.test:1.6
--- gzz/test/gzz/gfx/gl/basicrender.test:1.5 Tue Oct 15 09:29:19 2002
+++ gzz/test/gzz/gfx/gl/basicrender.test Tue Oct 29 05:29:57 2002
@@ -22,6 +22,14 @@
checkAvgColor(10, 10, 2, 2, (255, 0, 0), 2)
checkAvgColor(110, 110, 2, 2, (0, 255, 0), 2)
-
+def testOvalBgVob():
+ vs = getvs()
+ vs.map.put(SolidBgVob(Color.red))
+ cs1 = vs.coords.affineCoordsys(0, 0, 100, 100, 100, 0, 0, 100)
+ vs.matcher.add(cs1, "cs")
+ vs.map.put(OvalBgVob(), cs1)
+ render(vs)
+ checkAvgColor(10, 10, 2, 2, (255, 0, 0), 2)
+ checkAvgColor(150, 150, 2, 2, (255, 255, 255), 2)
# : vim: set syntax=python :
Index: gzz/test/gzz/gfx/gl/glvobcoorder.test
diff -u gzz/test/gzz/gfx/gl/glvobcoorder.test:1.14
gzz/test/gzz/gfx/gl/glvobcoorder.test:1.15
--- gzz/test/gzz/gfx/gl/glvobcoorder.test:1.14 Sun Oct 20 07:55:00 2002
+++ gzz/test/gzz/gfx/gl/glvobcoorder.test Tue Oct 29 05:29:57 2002
@@ -76,6 +76,10 @@
c.setRotateParams(r, 90)
checkTrans(vs, r, [0, 0, 0, 0, 50, 0], [100, 100, 0, 50, 100, 0])
+ cs4 = c.affineCoordsys(0, 0, 0, 0, 100, 0, 0, 100)
+ cs4clip = c.affineCoordsys(0, 0, 50, 50, 10, 0, 0, 10)
+ cs4cull = c.cull(cs4, cs4clip)
+ checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100,
1, 200, 200, 2])
def checkInverse(c, cs):
# unit cube
@@ -135,6 +139,11 @@
checkInverse(c, cs_dist)
+ cs_affine = c.affineCoordsys(0, 0, 0, 0, 100, 0, 0, 100)
+ cs_affine_clip = c.affineCoordsys(0, 0, 50, 50, 10, 0, 0, 10)
+ cs_cull = c.cull(cs_affine, cs_affine_clip)
+ checkInverse(c, cs_cull)
+
def testInterpolateTranslation():
cs_trans1 = c1.translate(0, 10, 10)
@@ -182,9 +191,125 @@
[20, 100, 0, 30, 100, 0],
.1)
+import gfx.libpaper.papermill
+from gfx.libpaper.papermill import ThePaperMill
+
+def testCulling():
+#test cull-clip interface
+ font = GL.createFont("gfx/fonts/a010013l.pfb", 16)
+ renderable = GLRen.createHorizText2(font, "FOO", 1, 1, 1, 1)
+
+ cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
+ cs_clip = c.affineCoordsys(0, 0, 0, 0, 200, 0, 0, 200)
+ cs_cull = c.cull(cs, cs_clip)
+
+ vs.map.clear()
+ vs.map.put(SolidBgVob(Color.red))
+ vs.map.put(renderable, cs_cull)
+ render(vs)
+
+ checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
+
+ pap = ThePaperMill().getPaper(0, passmask=[1,1,1,1])
+ renderable = GLRen.createPaperQuad(pap, 0, 0, 1, 1, 1)
+
+ vs.map.clear()
+ vs.map.put(SolidBgVob(Color.red))
+ vs.map.put(renderable, cs_cull)
+ render(vs)
+ checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
+
+#test same area
+ cs_clip = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
+ cs_cull = c.cull(cs, cs_clip)
+
+ vs.map.clear()
+ vs.map.put(SolidBgVob(Color.red))
+ vs.map.put(gzz.vob.RectBgVob(), cs_cull)
+ render(vs)
+ checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
+
+#test normal intersection
+ cs_clip = c.affineCoordsys(0, 0, 60, 60, 100, 0, 0, 100)
+ cs_cull = c.cull(cs, cs_clip)
+
+ vs.map.clear()
+ vs.map.put(SolidBgVob(Color.red))
+ vs.map.put(gzz.vob.RectBgVob(), cs_cull)
+ render(vs)
+ checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
+
+#test clip inside
+ cs_clip = c.affineCoordsys(0, 0, 60, 60, 10, 0, 0, 10)
+ cs_cull = c.cull(cs, cs_clip)
+
+ vs.map.clear()
+ vs.map.put(SolidBgVob(Color.red))
+ vs.map.put(gzz.vob.RectBgVob(), cs_cull)
+ render(vs)
+ checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
+
+#test side touch (should not be drawn)
+ cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
+ cs_clip = c.affineCoordsys(0, 0, 110, 60, 10, 0, 0, 10)
+ cs_cull = c.cull(cs, cs_clip)
+
+ vs.map.clear()
+ vs.map.put(SolidBgVob(Color.red))
+ vs.map.put(gzz.vob.RectBgVob(), cs_cull)
+ render(vs)
+ checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
+
+#test corner-touch (should not be drawn)
+ cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
+ cs_clip = c.affineCoordsys(0, 0, 110, 110, 10, 0, 0, 10)
+ cs_cull = c.cull(cs, cs_clip)
+
+ vs.map.clear()
+ vs.map.put(SolidBgVob(Color.red))
+ vs.map.put(gzz.vob.RectBgVob(), cs_cull)
+ render(vs)
+ checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
+
+#test clip outside (should not be drawn)
+ cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
+ cs_clip = c.affineCoordsys(0, 0, 120, 60, 10, 0, 0, 10)
+ cs_cull = c.cull(cs, cs_clip)
+
+ vs.map.clear()
+ vs.map.put(SolidBgVob(Color.red))
+ vs.map.put(gzz.vob.RectBgVob(), cs_cull)
+ render(vs)
+ checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
+
+#test distorted inside (should be drawn)
+ cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
+ cs_d = c.distort(cs, 0, 0, 1, 1, 1, 0.1)
+ cs_clip = c.affineCoordsys(0, 0, 10, 90, 100, 0, 0, 100)
+ cs_cull = c.cull(cs_d, cs_clip)
+
+ vs.map.clear()
+ vs.map.put(SolidBgVob(Color.red))
+ vs.map.put(renderable, cs_cull)
+ render(vs)
+ checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
+
+#test distorted outside (should not be drawn)
+ cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)
+ cs_d = c.distort(cs, 0, 0, 1, 1, 1, 0.1)
+ #normally without distortion this should be drawn
+ cs_clip = c.affineCoordsys(0, 0, 10, 100, 100, 0, 0, 100)
+ cs_cull = c.cull(cs_d, cs_clip)
+
+ vs.map.clear()
+ vs.map.put(SolidBgVob(Color.red))
+ vs.map.put(renderable, cs_cull)
+ render(vs)
+ checkAvgColor(10, 10, 80, 80, (255, 0, 0), delta=50)
+
+# : vim: set syntax=python :
-# : vim: set syntax=python :
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz gzz/view/pagespanview.py test/gzz/gfx/gl/gl...,
Asko Soukka <=