diff options
Diffstat (limited to 'modules/bmp')
-rw-r--r-- | modules/bmp/image_loader_bmp.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp index 5ce6d59daa..71e5076e78 100644 --- a/modules/bmp/image_loader_bmp.cpp +++ b/modules/bmp/image_loader_bmp.cpp @@ -65,7 +65,7 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image, } // Image data (might be indexed) - PoolVector<uint8_t> data; + Vector<uint8_t> data; int data_len = 0; if (bits_per_pixel <= 8) { // indexed @@ -76,8 +76,8 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image, ERR_FAIL_COND_V(data_len == 0, ERR_BUG); err = data.resize(data_len); - PoolVector<uint8_t>::Write data_w = data.write(); - uint8_t *write_buffer = data_w.ptr(); + uint8_t *data_w = data.ptrw(); + uint8_t *write_buffer = data_w; const uint32_t width_bytes = width * bits_per_pixel / 8; const uint32_t line_width = (width_bytes + 3) & ~3; @@ -158,11 +158,11 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image, } else { // data is in indexed format, extend it // Palette data - PoolVector<uint8_t> palette_data; + Vector<uint8_t> palette_data; palette_data.resize(color_table_size * 4); - PoolVector<uint8_t>::Write palette_data_w = palette_data.write(); - uint8_t *pal = palette_data_w.ptr(); + uint8_t *palette_data_w = palette_data.ptrw(); + uint8_t *pal = palette_data_w; const uint8_t *cb = p_color_buffer; @@ -177,11 +177,11 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image, cb += 4; } // Extend palette to image - PoolVector<uint8_t> extended_data; + Vector<uint8_t> extended_data; extended_data.resize(data.size() * 4); - PoolVector<uint8_t>::Write ex_w = extended_data.write(); - uint8_t *dest = ex_w.ptr(); + uint8_t *ex_w = extended_data.ptrw(); + uint8_t *dest = ex_w; const int num_pixels = width * height; @@ -260,27 +260,27 @@ Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f, ERR_FAIL_COND_V(color_table_size == 0, ERR_BUG); } - PoolVector<uint8_t> bmp_color_table; + Vector<uint8_t> bmp_color_table; // Color table is usually 4 bytes per color -> [B][G][R][0] bmp_color_table.resize(color_table_size * 4); - PoolVector<uint8_t>::Write bmp_color_table_w = bmp_color_table.write(); - f->get_buffer(bmp_color_table_w.ptr(), color_table_size * 4); + uint8_t *bmp_color_table_w = bmp_color_table.ptrw(); + f->get_buffer(bmp_color_table_w, color_table_size * 4); f->seek(bmp_header.bmp_file_header.bmp_file_offset); uint32_t bmp_buffer_size = (bmp_header.bmp_file_header.bmp_file_size - bmp_header.bmp_file_header.bmp_file_offset); - PoolVector<uint8_t> bmp_buffer; + Vector<uint8_t> bmp_buffer; err = bmp_buffer.resize(bmp_buffer_size); if (err == OK) { - PoolVector<uint8_t>::Write bmp_buffer_w = bmp_buffer.write(); - f->get_buffer(bmp_buffer_w.ptr(), bmp_buffer_size); + uint8_t *bmp_buffer_w = bmp_buffer.ptrw(); + f->get_buffer(bmp_buffer_w, bmp_buffer_size); - PoolVector<uint8_t>::Read bmp_buffer_r = bmp_buffer.read(); - PoolVector<uint8_t>::Read bmp_color_table_r = bmp_color_table.read(); - err = convert_to_image(p_image, bmp_buffer_r.ptr(), - bmp_color_table_r.ptr(), color_table_size, bmp_header); + const uint8_t *bmp_buffer_r = bmp_buffer.ptr(); + const uint8_t *bmp_color_table_r = bmp_color_table.ptr(); + err = convert_to_image(p_image, bmp_buffer_r, + bmp_color_table_r, color_table_size, bmp_header); } f->close(); } |