From 3205a92ad872f918c8322cdcd1434c231a1fd251 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 17 Feb 2020 18:06:54 -0300 Subject: PoolVector is gone, replaced by Vector Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector`. --- drivers/png/png_driver_common.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/png/png_driver_common.cpp') diff --git a/drivers/png/png_driver_common.cpp b/drivers/png/png_driver_common.cpp index 750d00eb59..efd488fd5c 100644 --- a/drivers/png/png_driver_common.cpp +++ b/drivers/png/png_driver_common.cpp @@ -101,16 +101,16 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, Ref p_image) { } const png_uint_32 stride = PNG_IMAGE_ROW_STRIDE(png_img); - PoolVector buffer; + Vector buffer; Error err = buffer.resize(PNG_IMAGE_BUFFER_SIZE(png_img, stride)); if (err) { png_image_free(&png_img); // only required when we return before finish_read return err; } - PoolVector::Write writer = buffer.write(); + uint8_t *writer = buffer.ptrw(); // read image data to buffer and release libpng resources - success = png_image_finish_read(&png_img, NULL, writer.ptr(), stride, NULL); + success = png_image_finish_read(&png_img, NULL, writer, stride, NULL); ERR_FAIL_COND_V_MSG(check_error(png_img), ERR_FILE_CORRUPT, png_img.message); ERR_FAIL_COND_V(!success, ERR_FILE_CORRUPT); @@ -120,7 +120,7 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, Ref p_image) { return OK; } -Error image_to_png(const Ref &p_image, PoolVector &p_buffer) { +Error image_to_png(const Ref &p_image, Vector &p_buffer) { Ref source_image = p_image->duplicate(); @@ -158,8 +158,8 @@ Error image_to_png(const Ref &p_image, PoolVector &p_buffer) { } } - const PoolVector image_data = source_image->get_data(); - const PoolVector::Read reader = image_data.read(); + const Vector image_data = source_image->get_data(); + const uint8_t *reader = image_data.ptr(); // we may be passed a buffer with existing content we're expected to append to const int buffer_offset = p_buffer.size(); @@ -173,9 +173,9 @@ Error image_to_png(const Ref &p_image, PoolVector &p_buffer) { Error err = p_buffer.resize(buffer_offset + png_size_estimate); ERR_FAIL_COND_V(err, err); - PoolVector::Write writer = p_buffer.write(); + uint8_t *writer = p_buffer.ptrw(); success = png_image_write_to_memory(&png_img, &writer[buffer_offset], - &compressed_size, 0, reader.ptr(), 0, NULL); + &compressed_size, 0, reader, 0, NULL); ERR_FAIL_COND_V_MSG(check_error(png_img), FAILED, png_img.message); } if (!success) { @@ -187,9 +187,9 @@ Error image_to_png(const Ref &p_image, PoolVector &p_buffer) { Error err = p_buffer.resize(buffer_offset + compressed_size); ERR_FAIL_COND_V(err, err); - PoolVector::Write writer = p_buffer.write(); + uint8_t *writer = p_buffer.ptrw(); success = png_image_write_to_memory(&png_img, &writer[buffer_offset], - &compressed_size, 0, reader.ptr(), 0, NULL); + &compressed_size, 0, reader, 0, NULL); ERR_FAIL_COND_V_MSG(check_error(png_img), FAILED, png_img.message); ERR_FAIL_COND_V(!success, FAILED); } -- cgit v1.2.3