mirror of
https://git.yoctoproject.org/poky
synced 2026-04-17 00:32:13 +02:00
pybootchartgui: add the original code
This is from: http://pybootchartgui.googlecode.com/files/pybootchartgui-r124.tar.gz Will modify it to make the build profiling in pictures. Remove the examples since they would not work any more, and they cost much disk space. [YOCTO #2403] (From OE-Core rev: 1f0791109e1aed715f02945834d6d7fdb9a411b4) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
bc19f8bc9c
commit
3d78bc19c5
23
scripts/pybootchartgui/pybootchartgui/batch.py
Normal file
23
scripts/pybootchartgui/pybootchartgui/batch.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import cairo
|
||||
|
||||
import draw
|
||||
|
||||
def render(res, format, filename):
|
||||
handlers = {
|
||||
"png": (lambda w,h: cairo.ImageSurface(cairo.FORMAT_ARGB32,w,h), lambda sfc: sfc.write_to_png(filename)),
|
||||
"pdf": (lambda w,h: cairo.PDFSurface(filename, w, h), lambda sfc: 0),
|
||||
"svg": (lambda w,h: cairo.SVGSurface(filename, w, h), lambda sfc: 0)
|
||||
}
|
||||
|
||||
if not(handlers.has_key(format)):
|
||||
print "Unknown format '%s'." % format
|
||||
return 10
|
||||
|
||||
make_surface, write_surface = handlers[format]
|
||||
w,h = draw.extents(*res)
|
||||
w = max(w, draw.MIN_IMG_W)
|
||||
surface = make_surface(w,h)
|
||||
ctx = cairo.Context(surface)
|
||||
draw.render(ctx, *res)
|
||||
write_surface(surface)
|
||||
|
||||
Reference in New Issue
Block a user