PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
This commit is contained in:
committed by
Juan Linietsky
parent
fb8c93c10b
commit
3205a92ad8
@ -51,15 +51,15 @@ Error ResourceSaverPNG::save(const String &p_path, const RES &p_resource, uint32
|
||||
|
||||
Error ResourceSaverPNG::save_image(const String &p_path, const Ref<Image> &p_img) {
|
||||
|
||||
PoolVector<uint8_t> buffer;
|
||||
Vector<uint8_t> buffer;
|
||||
Error err = PNGDriverCommon::image_to_png(p_img, buffer);
|
||||
ERR_FAIL_COND_V_MSG(err, err, "Can't convert image to PNG.");
|
||||
FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err);
|
||||
ERR_FAIL_COND_V_MSG(err, err, vformat("Can't save PNG at path: '%s'.", p_path));
|
||||
|
||||
PoolVector<uint8_t>::Read reader = buffer.read();
|
||||
const uint8_t *reader = buffer.ptr();
|
||||
|
||||
file->store_buffer(reader.ptr(), buffer.size());
|
||||
file->store_buffer(reader, buffer.size());
|
||||
if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) {
|
||||
memdelete(file);
|
||||
return ERR_CANT_CREATE;
|
||||
@ -71,11 +71,11 @@ Error ResourceSaverPNG::save_image(const String &p_path, const Ref<Image> &p_img
|
||||
return OK;
|
||||
}
|
||||
|
||||
PoolVector<uint8_t> ResourceSaverPNG::save_image_to_buffer(const Ref<Image> &p_img) {
|
||||
Vector<uint8_t> ResourceSaverPNG::save_image_to_buffer(const Ref<Image> &p_img) {
|
||||
|
||||
PoolVector<uint8_t> buffer;
|
||||
Vector<uint8_t> buffer;
|
||||
Error err = PNGDriverCommon::image_to_png(p_img, buffer);
|
||||
ERR_FAIL_COND_V_MSG(err, PoolVector<uint8_t>(), "Can't convert image to PNG.");
|
||||
ERR_FAIL_COND_V_MSG(err, Vector<uint8_t>(), "Can't convert image to PNG.");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user