diff --git a/lime/audio/AudioBuffer.hx b/lime/audio/AudioBuffer.hx index 3babbbe58..7534e5ca4 100644 --- a/lime/audio/AudioBuffer.hx +++ b/lime/audio/AudioBuffer.hx @@ -87,7 +87,7 @@ class AudioBuffer { var audioBuffer = new AudioBuffer (); audioBuffer.bitsPerSample = data.bitsPerSample; audioBuffer.channels = data.channels; - audioBuffer.data = new UInt8Array (@:privateAccess new Bytes (data.data.length, data.data.b)); + audioBuffer.data = new UInt8Array (@:privateAccess new Bytes (data.length, data.b)); audioBuffer.sampleRate = data.sampleRate; return audioBuffer; @@ -127,7 +127,7 @@ class AudioBuffer { var audioBuffer = new AudioBuffer (); audioBuffer.bitsPerSample = data.bitsPerSample; audioBuffer.channels = data.channels; - audioBuffer.data = new UInt8Array (@:privateAccess new Bytes (data.data.length, data.data.b)); + audioBuffer.data = new UInt8Array (@:privateAccess new Bytes (data.length, data.b)); audioBuffer.sampleRate = data.sampleRate; return audioBuffer; diff --git a/lime/graphics/Image.hx b/lime/graphics/Image.hx index aca216b5a..326be9597 100644 --- a/lime/graphics/Image.hx +++ b/lime/graphics/Image.hx @@ -1089,7 +1089,7 @@ class Image { if (data != null) { - __fromImageBuffer (new ImageBuffer (new UInt8Array (@:privateAccess new Bytes (data.data.length, data.data.b)), data.width, data.height, data.bitsPerPixel)); + __fromImageBuffer (new ImageBuffer (new UInt8Array (@:privateAccess new Bytes (data.length, data.b)), data.width, data.height, data.bitsPerPixel)); if (onload != null) { @@ -1209,7 +1209,7 @@ class Image { if (data != null) { - var u8a = new UInt8Array (@:privateAccess new Bytes (data.data.length, data.data.b)); + var u8a = new UInt8Array (@:privateAccess new Bytes (data.length, data.b)); buffer = new ImageBuffer (u8a, data.width, data.height, data.bitsPerPixel); } diff --git a/project/include/graphics/Image.h b/project/include/graphics/Image.h index 50e631aa1..ef8bd6eb9 100644 --- a/project/include/graphics/Image.h +++ b/project/include/graphics/Image.h @@ -4,7 +4,6 @@ #include #include -#include namespace lime { diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index a07f9d250..d301a3936 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -155,6 +155,7 @@ namespace lime { AudioBuffer audioBuffer; Resource resource; + Bytes bytes; if (val_is_string (data)) { @@ -162,7 +163,7 @@ namespace lime { } else { - Bytes bytes (data); + bytes = Bytes (data); resource = Resource (&bytes); } @@ -448,6 +449,7 @@ namespace lime { #ifdef LIME_FREETYPE Resource resource; + Bytes bytes; if (val_is_string (data)) { @@ -455,7 +457,7 @@ namespace lime { } else { - Bytes bytes (data); + bytes = Bytes (data); resource = Resource (&bytes); } @@ -612,6 +614,7 @@ namespace lime { ImageBuffer buffer; Resource resource; + Bytes bytes; if (val_is_string (data)) { @@ -619,7 +622,7 @@ namespace lime { } else { - Bytes bytes (data); + bytes = Bytes (data); resource = Resource (&bytes); } diff --git a/project/src/audio/AudioBuffer.cpp b/project/src/audio/AudioBuffer.cpp index 4f7100355..9db75bfd4 100644 --- a/project/src/audio/AudioBuffer.cpp +++ b/project/src/audio/AudioBuffer.cpp @@ -4,9 +4,10 @@ namespace lime { + static int id_b; static int id_bitsPerSample; static int id_channels; - static int id_data; + static int id_length; static int id_sampleRate; static bool init = false; @@ -32,18 +33,20 @@ namespace lime { if (!init) { + id_b = val_id ("b"); id_bitsPerSample = val_id ("bitsPerSample"); id_channels = val_id ("channels"); - id_data = val_id ("data"); + id_length = val_id ("length"); id_sampleRate = val_id ("sampleRate"); init = true; } mValue = alloc_empty_object (); + alloc_field (mValue, id_b, data ? val_field (data->Value (), id_b) : alloc_null ()); alloc_field (mValue, id_bitsPerSample, alloc_int (bitsPerSample)); alloc_field (mValue, id_channels, alloc_int (channels)); - alloc_field (mValue, id_data, data ? data->Value () : alloc_null ()); + alloc_field (mValue, id_length, data ? val_field (data->Value (), id_length) : alloc_null ()); alloc_field (mValue, id_sampleRate, alloc_int (sampleRate)); return mValue; diff --git a/project/src/graphics/ImageBuffer.cpp b/project/src/graphics/ImageBuffer.cpp index 4129d06fa..1677dabd3 100644 --- a/project/src/graphics/ImageBuffer.cpp +++ b/project/src/graphics/ImageBuffer.cpp @@ -4,11 +4,13 @@ namespace lime { + static int id_b; static int id_bitsPerPixel; static int id_buffer; static int id_data; static int id_format; static int id_height; + static int id_length; static int id_premultiplied; static int id_transparent; static int id_width; @@ -32,13 +34,15 @@ namespace lime { if (!init) { + id_b = val_id ("b"); id_bitsPerPixel = val_id ("bitsPerPixel"); id_transparent = val_id ("transparent"); id_buffer = val_id ("buffer"); + id_data = val_id ("data"); id_width = val_id ("width"); id_height = val_id ("height"); - id_data = val_id ("data"); id_format = val_id ("format"); + id_length = val_id ("length"); id_premultiplied = val_id ("premultiplied"); init = true; @@ -116,13 +120,14 @@ namespace lime { if (!init) { + id_b = val_id ("b"); id_bitsPerPixel = val_id ("bitsPerPixel"); id_transparent = val_id ("transparent"); id_buffer = val_id ("buffer"); id_width = val_id ("width"); id_height = val_id ("height"); - id_data = val_id ("data"); id_format = val_id ("format"); + id_length = val_id ("length"); id_premultiplied = val_id ("premultiplied"); init = true; @@ -132,7 +137,8 @@ namespace lime { alloc_field (mValue, id_width, alloc_int (width)); alloc_field (mValue, id_height, alloc_int (height)); alloc_field (mValue, id_bitsPerPixel, alloc_int (bitsPerPixel)); - alloc_field (mValue, id_data, data ? data->Value () : alloc_null ()); + alloc_field (mValue, id_b, data ? val_field (data->Value (), id_b) : alloc_null ()); + alloc_field (mValue, id_length, data ? val_field (data->Value (), id_length) : alloc_null ()); alloc_field (mValue, id_transparent, alloc_bool (transparent)); alloc_field (mValue, id_format, alloc_int (format)); alloc_field (mValue, id_premultiplied, alloc_bool (premultiplied));