| 1 |
#!/usr/bin/env python |
|---|
| 2 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 3 |
##~ License |
|---|
| 4 |
##~ |
|---|
| 5 |
##- The RuneBlade Foundation library is intended to ease some |
|---|
| 6 |
##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.) |
|---|
| 7 |
##- applications, while providing the flexibility to modularly change the |
|---|
| 8 |
##- architecture. Enjoy. |
|---|
| 9 |
##~ |
|---|
| 10 |
##~ Copyright (C) 2002 TechGame Networks, LLC. |
|---|
| 11 |
##~ |
|---|
| 12 |
##~ This library is free software; you can redistribute it and/or |
|---|
| 13 |
##~ modify it under the terms of the BSD style License as found in the |
|---|
| 14 |
##~ LICENSE file included with this distribution. |
|---|
| 15 |
##~ |
|---|
| 16 |
##~ TechGame Networks, LLC can be reached at: |
|---|
| 17 |
##~ 3578 E. Hartsel Drive #211 |
|---|
| 18 |
##~ Colorado Springs, Colorado, USA, 80920 |
|---|
| 19 |
##~ |
|---|
| 20 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 21 |
|
|---|
| 22 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 23 |
#~ Imports |
|---|
| 24 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 25 |
|
|---|
| 26 |
import sys |
|---|
| 27 |
import time |
|---|
| 28 |
from RBRapier.Formats.SVG.SVGSkinner import SkinFile |
|---|
| 29 |
from RBRapier.Formats.SVG import RapierRenderItems |
|---|
| 30 |
|
|---|
| 31 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 32 |
#~ Main |
|---|
| 33 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 34 |
|
|---|
| 35 |
if __name__ == '__main__': |
|---|
| 36 |
for svgfile in sys.argv[1:]: |
|---|
| 37 |
print |
|---|
| 38 |
print "Started \"" + svgfile + "\" on", time.asctime() |
|---|
| 39 |
times = [time.clock()] |
|---|
| 40 |
skin = SkinFile(svgfile, SVGRenderItemFactory=RapierRenderItems.RapierSVGRenderItemFactory()) |
|---|
| 41 |
times.append(time.clock()) |
|---|
| 42 |
print "Completed on", time.asctime() |
|---|
| 43 |
print |
|---|
| 44 |
|
|---|
| 45 |
result = skin.object.Compile() |
|---|
| 46 |
times.append(time.clock()) |
|---|
| 47 |
|
|---|
| 48 |
print "Renderable Items:" |
|---|
| 49 |
for each in result: |
|---|
| 50 |
print ' ', each |
|---|
| 51 |
print |
|---|
| 52 |
|
|---|
| 53 |
times = [b-a for a, b in zip(times[:-1], times[1:])] |
|---|
| 54 |
|
|---|
| 55 |
MBsize = len(file(svgfile).read())/(1024.**2) |
|---|
| 56 |
|
|---|
| 57 |
parsetime, compiletime, frametimes = times[0], times[1], times[2:] |
|---|
| 58 |
print "Parse time: %1.5f s" % (parsetime,) |
|---|
| 59 |
print "Parse time/MB: %1.5f s" % (parsetime/MBsize,) |
|---|
| 60 |
print |
|---|
| 61 |
|
|---|
| 62 |
print "Compile time: %1.5f s" % (compiletime,) |
|---|
| 63 |
print "Compile time/MB: %1.5f s" % (compiletime/MBsize,) |
|---|
| 64 |
print |
|---|
| 65 |
|
|---|