[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob/vob/util mipzipmaker.py
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] libvob/vob/util mipzipmaker.py |
Date: |
Tue, 22 Apr 2003 15:49:12 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Changes by: Tuomas J. Lukka <address@hidden> 03/04/22 15:49:12
Modified files:
vob/util : mipzipmaker.py
Log message:
twid
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/util/mipzipmaker.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: libvob/vob/util/mipzipmaker.py
diff -u libvob/vob/util/mipzipmaker.py:1.1 libvob/vob/util/mipzipmaker.py:1.2
--- libvob/vob/util/mipzipmaker.py:1.1 Tue Apr 15 09:54:20 2003
+++ libvob/vob/util/mipzipmaker.py Tue Apr 22 15:49:12 2003
@@ -54,78 +54,88 @@
n /= 4
return 4 * n
+def _init(w):
+ global format, suffix
+
+ if GL.workaroundStupidBuggyAtiDrivers:
+ format = "RGB"
+ suffix = ".mipzipBLAH"
+ else:
+ format = "COMPRESSED_RGB_S3TC_DXT1_EXT"
+ suffix = ".mipzip"
+
+def makeMipzip(image, mipzip):
+ GL.freeQueue()
+
+ im = GL.createImage(texfile)
+ d = im.getSize();
+ print d
+ w = roundup2(d.width)
+ h = roundup2(d.height)
+ tex = GL.createTexture()
+ tex.loadNull2D(0, format, w, h, 0, "RGB", "BYTE")
+ print "WH: ",w, h
+ tex.loadSubImage(0, im, 0, 0, 0, 0, chomp4(d.width), chomp4(d.height))
+
+ print "Write ",of
+
+ out = zip.ZipOutputStream(io.FileOutputStream(of))
+
+ entry = zip.ZipEntry("texformat")
+ entry.setComment(format)
+ entry.setSize(0)
+ out.putNextEntry(entry)
+ out.closeEntry()
+
+ l = 0
+ while 1:
+ w = int(tex.getLevelParameter(l, "TEXTURE_WIDTH")[0])
+ h = int(tex.getLevelParameter(l, "TEXTURE_HEIGHT")[0])
+ print "WH: ", w, h
+ if GL.workaroundStupidBuggyAtiDrivers:
+ bytes = jarray.zeros(4 * w * h, "b")
+ tex.getTexImage(l, "RGB", "BYTE", bytes)
+ else:
+ bytes = tex.getCompressedTexImage(l)
+ print "Bytes: ",l, len(bytes)
+ entry = zip.ZipEntry(str(l))
+ entry.setComment("%sx%s" % (int(w),int(h)))
+ entry.setSize(len(bytes))
+ out.putNextEntry(entry)
+ out.write(bytes)
+ out.closeEntry()
+ if w == 1 and h == 1 : break
+ l += 1
+ out.close()
+ del tex
+ java.lang.System.gc()
+ GL.freeQueue()
+
+
class Main(Runnable):
def __init__(self, texfiles):
self.texfiles = texfiles
def run(self):
- global format, suffix
-
- if GL.workaroundStupidBuggyAtiDrivers:
- format = "RGB"
- suffix = ".mipzipBLAH"
- else:
- format = "COMPRESSED_RGB_S3TC_DXT1_EXT"
- suffix = ".mipzip"
w = gfxapi.createWindow()
for texfile in self.texfiles:
self.handle(texfile)
System.exit(0)
def handle(self, texfile):
- GL.freeQueue()
- im = GL.createImage(texfile)
- d = im.getSize();
- print d
- w = roundup2(d.width)
- h = roundup2(d.height)
- tex = GL.createTexture()
- tex.loadNull2D(0, format, w, h, 0, "RGB", "BYTE")
- print "WH: ",w, h
- tex.loadSubImage(0, im, 0, 0, 0, 0, chomp4(d.width), chomp4(d.height))
-
of = texfile + suffix
+ makeMipzip(texfile, of)
- print "Write ",of
-
- out = zip.ZipOutputStream(io.FileOutputStream(of))
-
- entry = zip.ZipEntry("texformat")
- entry.setComment(format)
- entry.setSize(0)
- out.putNextEntry(entry)
- out.closeEntry()
+if __name__ == '__main__':
- l = 0
- while 1:
- w = int(tex.getLevelParameter(l, "TEXTURE_WIDTH")[0])
- h = int(tex.getLevelParameter(l, "TEXTURE_HEIGHT")[0])
- print "WH: ", w, h
- if GL.workaroundStupidBuggyAtiDrivers:
- bytes = jarray.zeros(4 * w * h, "b")
- tex.getTexImage(l, "RGB", "BYTE", bytes)
- else:
- bytes = tex.getCompressedTexImage(l)
- print "Bytes: ",l, len(bytes)
- entry = zip.ZipEntry(str(l))
- entry.setComment("%sx%s" % (int(w),int(h)))
- entry.setSize(len(bytes))
- out.putNextEntry(entry)
- out.write(bytes)
- out.closeEntry()
- if w == 1 and h == 1 : break
- l += 1
- out.close()
-
-
-opts, args = getopt.getopt(sys.argv[1:],
- vob.util.dbg.short,
- vob.util.dbg.long)
-for o,a in opts:
- print "Opt: ",o,a
- if o in vob.util.dbg.all:
- vob.util.dbg.option(o,a)
+ opts, args = getopt.getopt(sys.argv[1:],
+ vob.util.dbg.short,
+ vob.util.dbg.long)
+ for o,a in opts:
+ print "Opt: ",o,a
+ if o in vob.util.dbg.all:
+ vob.util.dbg.option(o,a)
-gfxapi = vob.GraphicsAPI.getInstance()
-gfxapi.startUpdateManager(Main(args))
+ gfxapi = vob.GraphicsAPI.getInstance()
+ gfxapi.startUpdateManager(Main(args))
- [Gzz-commits] libvob/vob/util mipzipmaker.py,
Tuomas J. Lukka <=