[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz ./TODO gzz/view/buoy/pagespanNodes.py gzz/u...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz ./TODO gzz/view/buoy/pagespanNodes.py gzz/u... |
Date: |
Thu, 13 Feb 2003 04:28:10 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 03/02/13 04:28:10
Modified files:
. : TODO
gzz/view/buoy : pagespanNodes.py
Added files:
gzz/util : CachingMap.java
test/gzz/util : cachingmap.test
Log message:
Some speedups through caching
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.572&tr2=1.573&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/util/CachingMap.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/buoy/pagespanNodes.py.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/util/cachingmap.test?rev=1.1
Patches:
Index: gzz/TODO
diff -u gzz/TODO:1.572 gzz/TODO:1.573
--- gzz/TODO:1.572 Wed Feb 12 11:07:21 2003
+++ gzz/TODO Thu Feb 13 04:28:09 2003
@@ -16,16 +16,9 @@
HT03 deadline:
tjl:
- the great buoy redesign
- - buoy anchors in the right place
- - make pagespan nodes show just the span, when
- shown as buoys!
- - figure out how scrollblock nodes shall be linked back
- with right
- coordsys
- - renderBuoy returns anchor CS
- - implement and test scrollblock nodes and zzstructure nodes.
- - combine with mudyc's PP nodes.
- + make buoys return the anchor
+ - irregu for pagespan nodes
+ - buoy sizes
+ - speedups
jvk:
- article: is buoy geometry and the reasons discussed?
projective lines easy, etc
Index: gzz/gzz/view/buoy/pagespanNodes.py
diff -u gzz/gzz/view/buoy/pagespanNodes.py:1.31
gzz/gzz/view/buoy/pagespanNodes.py:1.32
--- gzz/gzz/view/buoy/pagespanNodes.py:1.31 Wed Feb 12 11:07:21 2003
+++ gzz/gzz/view/buoy/pagespanNodes.py Thu Feb 13 04:28:10 2003
@@ -22,6 +22,21 @@
pscv = gzz.view.PageSpanCellView()
pscv.useBg = 1
+class ScrollblockData:
+ def __init__(self, scrollBlock):
+ self.layout = pscv.getLayout(scrollBlock)
+ self.irregu = gfx.libutil.effects.IrreguFrame(0, 0,
+ self.layout.w, self.layout.h, 50, 200)
+
+
+scrollblockDatas = gzz.util.CachingMap(40)
+def getScrollblockData(scrollBlock):
+ data = scrollblockDatas.get(scrollBlock)
+ if data == None:
+ data = ScrollblockData(scrollBlock)
+ scrollblockDatas.put(scrollBlock, data)
+ return data
+
def makeEnf(span):
return gzz.media.impl.Enfilade1DImpl.theMaker.makeEnfilade(span)
@@ -39,29 +54,30 @@
class WholePageSpanNodeType(AbstractPageSpanNodeType):
def getSize(self, linkId, anchorSpan, wh):
sb = anchorSpan.getScrollBlock();
- layout = pscv.getLayout(sb)
- wh[0] = layout.w
- wh[1] = layout.h
- return layout
+ data = getScrollblockData(sb)
+ layout = getLayout(sb)
+ wh[0] = data.layout.w
+ wh[1] = data.layout.h
+ return data
- def renderBuoy(self, vs, into, linkId, anchorSpan, layout):
- if layout == None:
- layout = pscv.getLayout(anchorSpan.getScrollBlock())
+ def renderBuoy(self, vs, into, linkId, anchorSpan, data):
+ if data == None:
+ data = getScrollblockData(anchorSpan.getScrollBlock)
# For now, we'll just squish to fit
- layout.placeBoxed(vs, into, .3, 100)
+ data.layout.placeBoxed(vs, into, .3, 100)
return into
class AnchorPageSpanNodeType(AbstractPageSpanNodeType):
- def renderBuoy(self, vs, into, linkId, anchorSpan, layout):
+ def renderBuoy(self, vs, into, linkId, anchorSpan, data):
if 0:
dbg1 = vs.unitSqCS(into, "U")
vs.put(coloredQuad((1,0,0)), dbg1)
- if layout == None:
- layout = pscv.getLayout(anchorSpan.getScrollBlock())
+ if data == None:
+ data = getScrollblockData(anchorSpan.getScrollBlock())
vs.coords.getSqSize(into, size)
- extents = layout.getExtents(anchorSpan, None)
+ extents = data.layout.getExtents(anchorSpan, None)
print "ExtentsInit: ", [i for i in extents]
print "size: ", [s for s in size]
scalex = size[0] / extents[2]
@@ -79,23 +95,18 @@
paperCS = vs.orthoCS(into, "paper", 0, -extents[0] * scale,
-extents[1] * scale, scale, scale)
- irregu = gfx.libutil.effects.IrreguFrame(0, 0, layout.w, layout.h,
- 50, 200, type="square")
-# irregu = gfx.libutil.effects.IrreguFrame(-100, -100, 100*layout.w,
100*layout.h,
-# .05, .25, type="square")
-
paperLoc = vs.coords.ortho(0, 0, extents[0], extents[1], extents[2],
extents[3])
vs.matcher.add(paperCS, paperLoc, "VIEWPORT")
class FrameR(java.lang.Runnable):
def run(rself):
- vs.map.put(irregu.frame, paperCS, paperLoc)
+ vs.map.put(data.irregu.frame, paperCS, paperLoc)
class ContentR(java.lang.Runnable):
def run(rself):
- vs.map.put(irregu.content, paperCS, paperLoc)
+ vs.map.put(data.irregu.content, paperCS, paperLoc)
class LayoutR(java.lang.Runnable):
def run(rself):
- layout.place(vs, paperCS, .6, 200, into)
+ data.layout.place(vs, paperCS, .6, 200, into)
gzz.gfx.gl.Stencil.drawStenciled(vs, ContentR(), None, FrameR(),
LayoutR(), 1)
# LayoutR().run()
@@ -117,9 +128,9 @@
self.enf = makeEnf(self.scrollBlock.getCurrent())
self.size = jarray.zeros(2, "f")
- self.layout = pscv.getLayout(self.enf)
+ self.data = getScrollblockData(self.scrollBlock)
- xywh = self.layout.getExtents(anchorSpan, None)
+ xywh = self.data.layout.getExtents(anchorSpan, None)
self.fisheye = gzz.view.FisheyeState(
1.1, .04, 5, 2, 1000
@@ -133,7 +144,7 @@
"""
for repr in gzz.zzutil.Media.getScrollBlockRepresentatives(enf):
if repr.getScrollBlock() == self.scrollBlock:
- xywh = self.layout.getExtents(repr, None)
+ xywh = self.data.layout.getExtents(repr, None)
return self.vs.orthoBoxCS(self.shift, key, -20,
xywh[0], xywh[1], 1, 1,xywh[2], xywh[3])
@@ -144,7 +155,7 @@
vs.coords.getSqSize(into, size)
print "SQ:", size[0], size[1]
- self.scale = size[1] / self.layout.h
+ self.scale = size[1] / self.data.layout.h
self.ctr = vs.translateCS(into, "ORIGIN", .5 * size[0],
.5 * size[1])
self.scale = vs.scaleCS(self.ctr, "SCALE", self.scale, self.scale)
@@ -153,7 +164,7 @@
# XXX This is not right: the distortion
# should be done here.
- self.layout.place(vs, self.shift, .7, 300)
+ self.data.layout.place(vs, self.shift, .7, 300)
if self.nodetype.scrollBlockLinker.enfiladeOverlap != None:
matches = (self.nodetype.scrollBlockLinker
@@ -182,7 +193,7 @@
self.doReq()
def doReq(self):
- self.layout.request(self.fisheye.curx, self.fisheye.cury, 0, 1, 2000)
+ self.data.layout.request(self.fisheye.curx, self.fisheye.cury, 0, 1,
2000)
def mouse(self, mouseEvent, oldVS):
if self.fisheye.event(mouseEvent):
@@ -209,8 +220,8 @@
y = size[1]
if x < 0: x = 0
if y < 0: y = 0
- if x > self.layout.w: x = self.layout.w
- if y > self.layout.h: y = self.layout.h
+ if x > self.data.layout.w: x = self.data.layout.w
+ if y > self.data.layout.h: y = self.data.layout.h
self.fisheye.setCenter(x, y)
gzz.client.AbstractUpdateManager.chg()
self.doReq()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz ./TODO gzz/view/buoy/pagespanNodes.py gzz/u...,
Tuomas J. Lukka <=