Browse files

Update more code to use Array.New

  • Loading branch information...
1 parent f3e9049 commit db55f8b6619767b49e8d58fd3f087b2a73e2e3b1 @kg kg committed Jul 4, 2012
Showing with 8 additions and 7 deletions.
  1. +1 −0 Libraries/JSIL.IO.js
  2. +1 −1 Libraries/JSIL.Storage.js
  3. +6 −6 Libraries/JSIL.XNACore.js
View
1 Libraries/JSIL.IO.js
@@ -601,6 +601,7 @@ JSIL.ImplementExternals("System.IO.BinaryReader", function ($) {
function ReadChars (count) {
var result = new Array(count);
for (var i = 0; i < count; i++) {
+ // FIXME: This should probably be ReadChar?
var b = this.m_stream.ReadByte();
if (b === -1)
return result.slice(0, i - 1);
View
2 Libraries/JSIL.Storage.js
@@ -505,7 +505,7 @@ JSIL.MakeClass($jsilcore.System.Object, "VirtualFile", true, [], function ($) {
this.inode.metadata.lastRead = Date.now();
if (!bytes)
- return new Array(this.inode.metadata.length || 0);
+ return JSIL.Array.New(System.Byte, this.inode.metadata.length || 0);
return bytes;
});
View
12 Libraries/JSIL.XNACore.js
@@ -980,7 +980,7 @@ JSIL.ImplementExternals("Microsoft.Xna.Framework.Content.ArrayReader`1", functio
function Read (input, existingInstance) {
var count = input.ReadInt32();
if (existingInstance === null) {
- existingInstance = new Array(count);
+ existingInstance = JSIL.Array.New(this.T, count);
}
for (var i = 0; i < count; i++) {
@@ -6547,7 +6547,7 @@ $jsilxna.makePixelWriter = function (buffer, width, x, y) {
$jsilxna.DecodeDxt1 = function (width, height, bytes, offset, count) {
var totalSizeBytes = width * height * 4;
- var result = new Array(totalSizeBytes);
+ var result = JSIL.Array.New(System.Byte, totalSizeBytes);
var blockCountX = Math.floor((width + 3) / 4);
var blockCountY = Math.floor((height + 3) / 4);
@@ -6571,7 +6571,7 @@ $jsilxna.DecodeDxt1 = function (width, height, bytes, offset, count) {
$jsilxna.DecodeDxt3 = function (width, height, bytes, offset, count) {
var totalSizeBytes = width * height * 4;
- var result = new Array(totalSizeBytes);
+ var result = JSIL.Array.New(System.Byte, totalSizeBytes);
var blockCountX = Math.floor((width + 3) / 4);
var blockCountY = Math.floor((height + 3) / 4);
@@ -6601,7 +6601,7 @@ $jsilxna.DecodeDxt3 = function (width, height, bytes, offset, count) {
$jsilxna.DecodeDxt5 = function (width, height, bytes, offset, count) {
var totalSizeBytes = width * height * 4;
- var result = new Array(totalSizeBytes);
+ var result = JSIL.Array.New(System.Byte, totalSizeBytes);
var blockCountX = Math.floor((width + 3) / 4);
var blockCountY = Math.floor((height + 3) / 4);
@@ -6630,7 +6630,7 @@ $jsilxna.DecodeDxt5 = function (width, height, bytes, offset, count) {
};
$jsilxna.ColorToCanvas = function (width, height, bytes, offset, count, swapRedAndBlue) {
- var result = new Array(count);
+ var result = JSIL.Array.New(System.Byte, count);
if (swapRedAndBlue) {
for (var i = 0, l = count; i < l; i += 4) {
@@ -6649,7 +6649,7 @@ $jsilxna.ColorToCanvas = function (width, height, bytes, offset, count, swapRedA
};
$jsilxna.UnpackColorsToColorBytes = function (colors, startIndex, elementCount) {
- var result = new Array(colors.length * 4);
+ var result = JSIL.Array.New(System.Byte, colors.length * 4);
for (var i = 0, l = elementCount; i < l; i++) {
var item = colors[startIndex + i];

0 comments on commit db55f8b

Please sign in to comment.