Use bytes.Set instead
This commit is contained in:
@@ -449,7 +449,7 @@ namespace lime {
|
||||
|
||||
#ifdef LIME_FREETYPE
|
||||
Resource resource;
|
||||
Bytes* bytes = NULL;
|
||||
Bytes bytes;
|
||||
|
||||
if (val_is_string (data)) {
|
||||
|
||||
@@ -457,19 +457,13 @@ namespace lime {
|
||||
|
||||
} else {
|
||||
|
||||
bytes = new Bytes (data);
|
||||
resource = Resource (bytes);
|
||||
bytes.Set (data);
|
||||
resource = Resource (&bytes);
|
||||
|
||||
}
|
||||
|
||||
Font *font = new Font (&resource, 0);
|
||||
|
||||
if (bytes) {
|
||||
|
||||
delete bytes;
|
||||
|
||||
}
|
||||
|
||||
if (font) {
|
||||
|
||||
if (font->face) {
|
||||
@@ -620,7 +614,7 @@ namespace lime {
|
||||
|
||||
ImageBuffer buffer;
|
||||
Resource resource;
|
||||
Bytes* bytes = NULL;
|
||||
Bytes bytes;
|
||||
|
||||
if (val_is_string (data)) {
|
||||
|
||||
@@ -628,20 +622,14 @@ namespace lime {
|
||||
|
||||
} else {
|
||||
|
||||
bytes = new Bytes (data);
|
||||
resource = Resource (bytes);
|
||||
bytes.Set (data);
|
||||
resource = Resource (&bytes);
|
||||
|
||||
}
|
||||
|
||||
#ifdef LIME_PNG
|
||||
if (PNG::Decode (&resource, &buffer)) {
|
||||
|
||||
if (bytes) {
|
||||
|
||||
delete bytes;
|
||||
|
||||
}
|
||||
|
||||
return buffer.Value ();
|
||||
|
||||
}
|
||||
@@ -650,23 +638,11 @@ namespace lime {
|
||||
#ifdef LIME_JPEG
|
||||
if (JPEG::Decode (&resource, &buffer)) {
|
||||
|
||||
if (bytes) {
|
||||
|
||||
delete bytes;
|
||||
|
||||
}
|
||||
|
||||
return buffer.Value ();
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
if (bytes) {
|
||||
|
||||
delete bytes;
|
||||
|
||||
}
|
||||
|
||||
return alloc_null ();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user