2012-12-12 20:13:26 +00:00
|
|
|
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
|
|
""" Helper functions to be used in bench_pictures.cfg. """
|
|
|
|
|
|
|
|
|
|
|
|
def Config(**kwargs):
|
|
|
|
config = {}
|
|
|
|
for key in kwargs:
|
|
|
|
config[key] = kwargs[key]
|
|
|
|
return config
|
|
|
|
|
|
|
|
|
2013-01-11 20:45:24 +00:00
|
|
|
def TileArgs(tile_x, tile_y):
|
|
|
|
return {'mode': ['tile', str(tile_x), str(tile_y)],
|
2013-02-06 16:27:38 +00:00
|
|
|
'timeIndividualTiles': True,
|
2013-01-15 15:50:42 +00:00
|
|
|
}
|
2013-01-11 20:45:24 +00:00
|
|
|
|
|
|
|
|
2012-12-12 20:13:26 +00:00
|
|
|
def BitmapConfig(**kwargs):
|
2013-03-04 16:41:06 +00:00
|
|
|
return Config(config='8888', **kwargs)
|
2012-12-12 20:13:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
def GPUConfig(**kwargs):
|
2013-03-04 16:41:06 +00:00
|
|
|
return Config(config='gpu', **kwargs)
|
2012-12-12 20:13:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
def TiledBitmapConfig(tile_x, tile_y, **kwargs):
|
2013-01-11 20:45:24 +00:00
|
|
|
return BitmapConfig(**dict(TileArgs(tile_x, tile_y).items() + kwargs.items()))
|
2012-12-12 20:13:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
def TiledGPUConfig(tile_x, tile_y, **kwargs):
|
2013-01-11 20:45:24 +00:00
|
|
|
return GPUConfig(**dict(TileArgs(tile_x, tile_y).items() + kwargs.items()))
|
2012-12-12 20:13:26 +00:00
|
|
|
|
|
|
|
|
2013-02-20 20:01:23 +00:00
|
|
|
def TiledConfig(tile_x, tile_y, **kwargs):
|
|
|
|
return Config(**dict(TileArgs(tile_x, tile_y).items() + kwargs.items()))
|
|
|
|
|
|
|
|
|
2012-12-18 21:44:53 +00:00
|
|
|
def ViewportBitmapConfig(viewport_x, viewport_y, **kwargs):
|
|
|
|
return BitmapConfig(viewport=[str(viewport_x), str(viewport_y)], **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
def ViewportGPUConfig(viewport_x, viewport_y, **kwargs):
|
|
|
|
return GPUConfig(viewport=[str(viewport_x), str(viewport_y)], **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
def ViewportRTreeConfig(viewport_x, viewport_y, **kwargs):
|
2012-12-19 14:47:53 +00:00
|
|
|
return RTreeConfig(mode='simple', viewport=[str(viewport_x), str(viewport_y)],
|
|
|
|
**kwargs)
|
2012-12-18 21:44:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
def ViewportGridConfig(viewport_x, viewport_y, **kwargs):
|
|
|
|
return GridConfig(viewport_x, viewport_y, mode='simple',
|
|
|
|
viewport=[str(viewport_x), str(viewport_y)], **kwargs)
|
|
|
|
|
|
|
|
|
2012-12-12 20:13:26 +00:00
|
|
|
def CopyTilesConfig(tile_x, tile_y, **kwargs):
|
|
|
|
return BitmapConfig(mode=['copyTile', str(tile_x), str(tile_y)], **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
def RecordConfig(**kwargs):
|
|
|
|
return BitmapConfig(mode='record', **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
def PlaybackCreationConfig(**kwargs):
|
|
|
|
return BitmapConfig(mode='playbackCreation', **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
def MultiThreadTileConfig(threads, tile_x, tile_y, **kwargs):
|
2012-12-14 14:56:37 +00:00
|
|
|
return TiledBitmapConfig(multi=str(threads), tile_x=tile_x, tile_y=tile_y,
|
|
|
|
**kwargs)
|
|
|
|
|
|
|
|
|
2012-12-19 14:47:53 +00:00
|
|
|
def RTreeConfig(**kwargs):
|
|
|
|
return BitmapConfig(bbh='rtree', **kwargs)
|
2012-12-14 14:56:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
def GridConfig(tile_x, tile_y, mode, **kwargs):
|
|
|
|
return BitmapConfig(mode=mode, bbh=['grid', str(tile_x), str(tile_y)],
|
|
|
|
**kwargs)
|
|
|
|
|
|
|
|
|
2012-12-19 14:47:53 +00:00
|
|
|
def RecordRTreeConfig(**kwargs):
|
|
|
|
return RTreeConfig(mode='record', **kwargs)
|
2012-12-14 14:56:37 +00:00
|
|
|
|
|
|
|
|
2012-12-19 14:47:53 +00:00
|
|
|
def PlaybackCreationRTreeConfig(**kwargs):
|
|
|
|
return RTreeConfig(mode='playbackCreation', **kwargs)
|
2012-12-14 14:56:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
def TileRTreeConfig(tile_x, tile_y, **kwargs):
|
2013-01-11 20:45:24 +00:00
|
|
|
return RTreeConfig(**dict(TileArgs(tile_x, tile_y).items() + kwargs.items()))
|
2012-12-14 14:56:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
def RecordGridConfig(tile_x, tile_y, **kwargs):
|
|
|
|
return GridConfig(tile_x=tile_x, tile_y=tile_y, mode='record', **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
def PlaybackCreationGridConfig(tile_x, tile_y, **kwargs):
|
|
|
|
return GridConfig(tile_x, tile_y, mode='playbackCreation')
|
|
|
|
|
|
|
|
|
|
|
|
def TileGridConfig(tile_x, tile_y, **kwargs):
|
2013-01-11 20:45:24 +00:00
|
|
|
return GridConfig(tile_x, tile_y,
|
2013-02-06 16:27:38 +00:00
|
|
|
**dict(TileArgs(tile_x, tile_y).items() + kwargs.items()))
|