Skip to content

Commit

Permalink
Merge pull request #179 from CartoDB/clamped
Browse files Browse the repository at this point in the history
Changes value array type to UInt8ClampedArray
  • Loading branch information
fdansv committed Apr 28, 2015
2 parents 58345d2 + a27960f commit 7080079
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/torque/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
// types
var types = {
Uint8Array: typeof(global['Uint8Array']) !== 'undefined' ? global.Uint8Array : Array,
Uint8ClampedArray: typeof(global['Uint8ClampedArray']) !== 'undefined' ? global.Uint8ClampedArray: Array,
Uint32Array: typeof(global['Uint32Array']) !== 'undefined' ? global.Uint32Array : Array,
Int16Array: typeof(global['Int16Array']) !== 'undefined' ? global.Int16Array : Array,
Int32Array: typeof(global['Int32Array']) !== 'undefined' ? global.Int32Array: Array
Expand Down
3 changes: 2 additions & 1 deletion lib/torque/provider/windshaft.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
var Uint8Array = torque.types.Uint8Array;
var Int32Array = torque.types.Int32Array;
var Uint32Array = torque.types.Uint32Array;
var Uint8ClampedArray = torque.types.Uint8ClampedArray;

// format('hello, {0}', 'rambo') -> "hello, rambo"
function format(str) {
Expand Down Expand Up @@ -82,7 +83,7 @@
dates = (1 + maxDateSlots) * rows.length;
}

var type = this.options.cumulative ? Uint32Array: Uint8Array;
var type = this.options.cumulative ? Uint32Array: Uint8ClampedArray;

// reserve memory for all the dates
var timeIndex = new Int32Array(maxDateSlots + 1); //index-size
Expand Down

0 comments on commit 7080079

Please sign in to comment.