Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: tools/cc-frame-viewer/src/color_mappings.js

Issue 12287014: [cc-frame-viewer] Show layers and levels of detail (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/cc-frame-viewer/src/base/deps.js ('k') | tools/cc-frame-viewer/src/layer_impl_view.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'use strict'; 5 'use strict';
6 6
7 base.require('base.color'); 7 base.require('base.color');
8 base.require('model.constants'); 8 base.require('model.constants');
9 9
10 base.exportTo('ccfv', function() { 10 base.exportTo('ccfv', function() {
(...skipping 12 matching lines...) Expand all
23 title: 'None', 23 title: 'None',
24 getValueForTile: function(tile, priority) { 24 getValueForTile: function(tile, priority) {
25 return undefined; 25 return undefined;
26 }, 26 },
27 getBackgroundColorForValue: function(value) { 27 getBackgroundColorForValue: function(value) {
28 }, 28 },
29 } 29 }
30 ]; 30 ];
31 31
32 // time_to_visible_in_seconds. 32 // time_to_visible_in_seconds.
33 var colorRedLo = new Color(255, 0, 0, 0.5); 33 var colorRedLo = new Color(255, 0, 0, 1);
34 var colorRedHi = new Color(0, 0, 255, 0.5); 34 var colorRedHi = new Color(0, 0, 255, 1);
35 allTileColorMaps.push({ 35 allTileColorMaps.push({
36 title: 'time_to_visible_in_seconds', 36 title: 'time_to_visible_in_seconds',
37 getValueForTile: function(tile, priority) { 37 getValueForTile: function(tile, priority) {
38 return priority.time_to_visible_in_seconds; 38 return priority.time_to_visible_in_seconds;
39 }, 39 },
40 getBackgroundColorForValue: function(value) { 40 getBackgroundColorForValue: function(value) {
41 if (value > 1e9) 41 if (value > 1e9)
42 return colorInfAsString; 42 return colorInfAsString;
43 var percentage = Math.max(0, value / 10); 43 var percentage = Math.max(0, value / 10);
44 var res = Color.lerpRGBA(colorRedLo, colorRedHi, 44 var res = Color.lerpRGBA(colorRedLo, colorRedHi,
45 1 - percentage) 45 1 - percentage)
46 return res.toString(); 46 return res.toString();
47 }, 47 },
48 }); 48 });
49 49
50 // Distance. 50 // Distance.
51 var colorGreenLo = new Color(0, 0, 255, 0.4); 51 var colorGreenLo = new Color(0, 0, 255, 1);
52 var colorGreenHi = new Color(0, 255, 0, 0.4); 52 var colorGreenHi = new Color(0, 255, 0, 1);
53 allTileColorMaps.push({ 53 allTileColorMaps.push({
54 title: 'distance_to_visible_in_pixels', 54 title: 'distance_to_visible_in_pixels',
55 getValueForTile: function(tile, priority) { 55 getValueForTile: function(tile, priority) {
56 return priority.distance_to_visible_in_pixels; 56 return priority.distance_to_visible_in_pixels;
57 }, 57 },
58 getBackgroundColorForValue: function(value) { 58 getBackgroundColorForValue: function(value) {
59 if (value > 1e9) 59 if (value > 1e9)
60 return colorInfAsString; 60 return colorInfAsString;
61 var percentage = Math.max(0, value / 2000); 61 var percentage = Math.max(0, value / 2000);
62 var res = Color.lerpRGBA(colorGreenLo, colorGreenHi, 62 var res = Color.lerpRGBA(colorGreenLo, colorGreenHi,
(...skipping 19 matching lines...) Expand all
82 getValueForTile: function(tile, priority) { 82 getValueForTile: function(tile, priority) {
83 return tile.managedState.has_resource; 83 return tile.managedState.has_resource;
84 }, 84 },
85 getBackgroundColorForValue: function(value) { 85 getBackgroundColorForValue: function(value) {
86 return value ? colorYesAsString : undefined; 86 return value ? colorYesAsString : undefined;
87 }, 87 },
88 }); 88 });
89 89
90 // bins of various types 90 // bins of various types
91 var binToColorAsString = { 91 var binToColorAsString = {
92 'NOW_BIN': new Color(0, 0, 255, 0.5).toString(), 92 'NOW_BIN': new Color(0, 0, 255, 1).toString(),
93 'SOON_BIN': new Color(255, 255, 0, 0.5).toString(), 93 'SOON_BIN': new Color(255, 255, 0, 1).toString(),
94 'EVENTUALLY_BIN': new Color(0, 255, 255, 0.5).toString(), 94 'EVENTUALLY_BIN': new Color(0, 255, 255, 1).toString(),
95 'NEVER_BIN': new Color(128, 128, 128, 0.25).toString() 95 'NEVER_BIN': new Color(128, 128, 128, 1).toString(),
96 '<unknown TileManagerBin value>': new Color(255, 0, 0, 1).toString()
96 }; 97 };
97 98
98 allTileColorMaps.push({ 99 allTileColorMaps.push({
99 title: 'bin[HIGH_PRIORITY]', 100 title: 'bin[HIGH_PRIORITY]',
100 getValueForTile: function(tile, priority) { 101 getValueForTile: function(tile, priority) {
101 var bin = tile.managedState.bin[constants.HIGH_PRIORITY_BIN]; 102 var bin = tile.managedState.bin[constants.HIGH_PRIORITY_BIN];
102 if (binToColorAsString[bin] === undefined) 103 if (binToColorAsString[bin] === undefined)
103 throw new Error('Something has gone very wrong'); 104 throw new Error('Something has gone very wrong');
104 return bin; 105 return bin;
105 }, 106 },
(...skipping 25 matching lines...) Expand all
131 }, 132 },
132 getBackgroundColorForValue: function(value) { 133 getBackgroundColorForValue: function(value) {
133 return binToColorAsString[value]; 134 return binToColorAsString[value];
134 }, 135 },
135 }); 136 });
136 137
137 return { 138 return {
138 ALL_TILE_COLOR_MAPS: allTileColorMaps 139 ALL_TILE_COLOR_MAPS: allTileColorMaps
139 }; 140 };
140 }) 141 })
OLDNEW
« no previous file with comments | « tools/cc-frame-viewer/src/base/deps.js ('k') | tools/cc-frame-viewer/src/layer_impl_view.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698