OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 """ Helper functions to be used in bench_pictures.cfg. """ | 6 """ Helper functions to be used in bench_pictures.cfg. """ |
7 | 7 |
8 | 8 |
9 def Config(**kwargs): | 9 def Config(**kwargs): |
10 config = {} | 10 config = {} |
11 for key in kwargs: | 11 for key in kwargs: |
12 config[key] = kwargs[key] | 12 config[key] = kwargs[key] |
13 return config | 13 return config |
14 | 14 |
15 | 15 |
16 def TileArgs(tile_x, tile_y): | 16 def TileArgs(tile_x, tile_y, timeIndividualTiles=True): |
17 return {'mode': ['tile', str(tile_x), str(tile_y)], | 17 config = {'mode': ['tile', str(tile_x), str(tile_y)]} |
18 'timeIndividualTiles': True, | 18 if timeIndividualTiles: |
19 } | 19 config['timeIndividualTiles'] = True |
| 20 return config |
20 | 21 |
21 | 22 |
22 def BitmapConfig(**kwargs): | 23 def BitmapConfig(**kwargs): |
23 return Config(device='bitmap', **kwargs) | 24 return Config(device='bitmap', **kwargs) |
24 | 25 |
25 | 26 |
26 def GPUConfig(**kwargs): | 27 def GPUConfig(**kwargs): |
27 return Config(device='gpu', **kwargs) | 28 return Config(device='gpu', **kwargs) |
28 | 29 |
29 | 30 |
30 def TiledBitmapConfig(tile_x, tile_y, **kwargs): | 31 def TiledBitmapConfig(tile_x, tile_y, timeIndividualTiles=True, **kwargs): |
31 return BitmapConfig(**dict(TileArgs(tile_x, tile_y).items() + kwargs.items())) | 32 return BitmapConfig(**dict(TileArgs(tile_x, tile_y, |
| 33 timeIndividualTiles=timeIndividualTiles).items() + kwargs.items())) |
32 | 34 |
33 | 35 |
34 def TiledGPUConfig(tile_x, tile_y, **kwargs): | 36 def TiledGPUConfig(tile_x, tile_y, **kwargs): |
35 return GPUConfig(**dict(TileArgs(tile_x, tile_y).items() + kwargs.items())) | 37 return GPUConfig(**dict(TileArgs(tile_x, tile_y).items() + kwargs.items())) |
36 | 38 |
37 | 39 |
38 def TiledConfig(tile_x, tile_y, **kwargs): | 40 def TiledConfig(tile_x, tile_y, timeIndividualTiles=True, **kwargs): |
39 return Config(**dict(TileArgs(tile_x, tile_y).items() + kwargs.items())) | 41 return Config(**dict(TileArgs(tile_x, tile_y, |
| 42 timeIndividualTiles=timeIndividualTiles).items() + kwargs.items())) |
40 | 43 |
41 | 44 |
42 def ViewportBitmapConfig(viewport_x, viewport_y, **kwargs): | 45 def ViewportBitmapConfig(viewport_x, viewport_y, **kwargs): |
43 return BitmapConfig(viewport=[str(viewport_x), str(viewport_y)], **kwargs) | 46 return BitmapConfig(viewport=[str(viewport_x), str(viewport_y)], **kwargs) |
44 | 47 |
45 | 48 |
46 def ViewportGPUConfig(viewport_x, viewport_y, **kwargs): | 49 def ViewportGPUConfig(viewport_x, viewport_y, **kwargs): |
47 return GPUConfig(viewport=[str(viewport_x), str(viewport_y)], **kwargs) | 50 return GPUConfig(viewport=[str(viewport_x), str(viewport_y)], **kwargs) |
48 | 51 |
49 | 52 |
(...skipping 13 matching lines...) Expand all Loading... |
63 | 66 |
64 def RecordConfig(**kwargs): | 67 def RecordConfig(**kwargs): |
65 return BitmapConfig(mode='record', **kwargs) | 68 return BitmapConfig(mode='record', **kwargs) |
66 | 69 |
67 | 70 |
68 def PlaybackCreationConfig(**kwargs): | 71 def PlaybackCreationConfig(**kwargs): |
69 return BitmapConfig(mode='playbackCreation', **kwargs) | 72 return BitmapConfig(mode='playbackCreation', **kwargs) |
70 | 73 |
71 | 74 |
72 def MultiThreadTileConfig(threads, tile_x, tile_y, **kwargs): | 75 def MultiThreadTileConfig(threads, tile_x, tile_y, **kwargs): |
73 return TiledBitmapConfig(multi=str(threads), tile_x=tile_x, tile_y=tile_y, | 76 return TiledBitmapConfig(tile_x=tile_x, tile_y=tile_y, |
| 77 timeIndividualTiles=False, multi=str(threads), |
74 **kwargs) | 78 **kwargs) |
75 | 79 |
76 | 80 |
77 def RTreeConfig(**kwargs): | 81 def RTreeConfig(**kwargs): |
78 return BitmapConfig(bbh='rtree', **kwargs) | 82 return BitmapConfig(bbh='rtree', **kwargs) |
79 | 83 |
80 | 84 |
81 def GridConfig(tile_x, tile_y, mode, **kwargs): | 85 def GridConfig(tile_x, tile_y, mode, **kwargs): |
82 return BitmapConfig(mode=mode, bbh=['grid', str(tile_x), str(tile_y)], | 86 return BitmapConfig(mode=mode, bbh=['grid', str(tile_x), str(tile_y)], |
83 **kwargs) | 87 **kwargs) |
(...skipping 15 matching lines...) Expand all Loading... |
99 return GridConfig(tile_x=tile_x, tile_y=tile_y, mode='record', **kwargs) | 103 return GridConfig(tile_x=tile_x, tile_y=tile_y, mode='record', **kwargs) |
100 | 104 |
101 | 105 |
102 def PlaybackCreationGridConfig(tile_x, tile_y, **kwargs): | 106 def PlaybackCreationGridConfig(tile_x, tile_y, **kwargs): |
103 return GridConfig(tile_x, tile_y, mode='playbackCreation') | 107 return GridConfig(tile_x, tile_y, mode='playbackCreation') |
104 | 108 |
105 | 109 |
106 def TileGridConfig(tile_x, tile_y, **kwargs): | 110 def TileGridConfig(tile_x, tile_y, **kwargs): |
107 return GridConfig(tile_x, tile_y, | 111 return GridConfig(tile_x, tile_y, |
108 **dict(TileArgs(tile_x, tile_y).items() + kwargs.items())) | 112 **dict(TileArgs(tile_x, tile_y).items() + kwargs.items())) |
OLD | NEW |