Skip to content

Commit

Permalink
Merge pull request #1480 from AnalyticalGraphicsInc/chromeCrashWorkar…
Browse files Browse the repository at this point in the history
…ound

Workaround Chrome bug
  • Loading branch information
emackey committed Feb 18, 2014
2 parents cead79e + f37aeb8 commit 1a49160
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Source/Scene/PolylineCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1398,13 +1398,27 @@ define([
return scratchSegments;
};

var scratchPositionsArray;
var scratchTexCoordArray;

PolylineBucket.prototype.writeUpdate = function(index, polyline, positionBuffer, texCoordExpandWidthAndShowBuffer) {
var mode = this.mode;
var positionsLength = polyline._actualLength;
if (positionsLength) {
index += this.getPolylineStartIndex(polyline);
var positionArray = new Float32Array(6 * positionsLength * 3);
var texCoordExpandWidthAndShowArray = new Float32Array(positionsLength * 4);

var positionArray = scratchPositionsArray;
var texCoordExpandWidthAndShowArray = scratchTexCoordArray;

var positionsArrayLength = 6 * positionsLength * 3;

if (!defined(positionArray) || positionArray.length < positionsArrayLength) {
positionArray = scratchPositionsArray = new Float32Array(positionsArrayLength);
texCoordExpandWidthAndShowArray = scratchTexCoordArray = new Float32Array(positionsLength * 4);
} else if (positionArray.length > positionsArrayLength) {
positionArray = new Float32Array(positionArray.buffer, 0, positionsArrayLength);
texCoordExpandWidthAndShowArray = new Float32Array(texCoordExpandWidthAndShowArray.buffer, 0, positionsLength * 4);
}

var positionIndex = 0;
var texCoordExpandWidthAndShowIndex = 0;
Expand Down

0 comments on commit 1a49160

Please sign in to comment.