| Index: third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js b/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js
|
| index e1adb37f900b8f226572636d60f727be9996cc34..6d8e58c9f470c7291fa286324213da89ae0cd4b0 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js
|
| @@ -310,9 +310,9 @@ WebInspector.FlameChart.Events = {
|
| /**
|
| * @constructor
|
| * @param {!{min: number, max: number}|number=} hueSpace
|
| - * @param {!{min: number, max: number, count: number}|number=} satSpace
|
| - * @param {!{min: number, max: number, count: number}|number=} lightnessSpace
|
| - * @param {!{min: number, max: number, count: number}|number=} alphaSpace
|
| + * @param {!{min: number, max: number, count: (number|undefined)}|number=} satSpace
|
| + * @param {!{min: number, max: number, count: (number|undefined)}|number=} lightnessSpace
|
| + * @param {!{min: number, max: number, count: (number|undefined)}|number=} alphaSpace
|
| */
|
| WebInspector.FlameChart.ColorGenerator = function(hueSpace, satSpace, lightnessSpace, alphaSpace)
|
| {
|
| @@ -355,46 +355,25 @@ WebInspector.FlameChart.ColorGenerator.prototype = {
|
| _generateColorForID: function(id)
|
| {
|
| var hash = String.hashCode(id);
|
| - var h = this._indexToDistinctValueInSpace(this._colors.size, this._hueSpace);
|
| - var s = this._indexToValueInSpace(hash, this._satSpace);
|
| - var l = this._indexToValueInSpace(hash, this._lightnessSpace);
|
| - var a = this._indexToValueInSpace(hash, this._alphaSpace);
|
| + var h = this._indexToValueInSpace(hash, this._hueSpace);
|
| + var s = this._indexToValueInSpace(hash >> 8, this._satSpace);
|
| + var l = this._indexToValueInSpace(hash >> 16, this._lightnessSpace);
|
| + var a = this._indexToValueInSpace(hash >> 24, this._alphaSpace);
|
| return "hsla(" + h + ", " + s + "%, " + l + "%, " + a + ")";
|
| },
|
|
|
| /**
|
| * @param {number} index
|
| - * @param {!{min: number, max: number, count: number}|number} space
|
| + * @param {!{min: number, max: number, count: (number|undefined)}|number} space
|
| * @return {number}
|
| */
|
| _indexToValueInSpace: function(index, space)
|
| {
|
| if (typeof space === "number")
|
| return space;
|
| - index %= space.count;
|
| - return space.min + Math.floor(index / (space.count - 1) * (space.max - space.min));
|
| - },
|
| -
|
| - /**
|
| - * @param {number} index
|
| - * @param {!{min: number, max: number}|number} space
|
| - * @return {number}
|
| - */
|
| - _indexToDistinctValueInSpace: function(index, space)
|
| - {
|
| - if (typeof space === "number")
|
| - return space;
|
| - index |= 0;
|
| - var result = 0;
|
| - var count = 0;
|
| - // Reverse bits in index.
|
| - do {
|
| - result = (result << 1) | (index & 1);
|
| - index >>= 1;
|
| - ++count;
|
| - } while (index);
|
| - result /= 1 << count;
|
| - return space.min + Math.floor(result * (space.max - space.min));
|
| + var count = space.count || space.max - space.min;
|
| + index %= count;
|
| + return space.min + Math.floor(index / (count - 1) * (space.max - space.min));
|
| }
|
| }
|
|
|
|
|