1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Merge pull request #38717 from madmiraal/fix-image-uninitialized-warning

Silence 'w' may be used uninitialized in image.cpp warning.
This commit is contained in:
Rémi Verschelde
2020-05-15 18:05:53 +02:00
committed by GitHub

View File

@@ -1993,7 +1993,7 @@ void Image::create(const char **p_xpm) {
HashMap<String, Color> colormap; HashMap<String, Color> colormap;
int colormap_size = 0; int colormap_size = 0;
uint32_t pixel_size = 0; uint32_t pixel_size = 0;
uint8_t *w; uint8_t *data_write = nullptr;
while (status != DONE) { while (status != DONE) {
const char *line_ptr = p_xpm[line]; const char *line_ptr = p_xpm[line];
@@ -2089,7 +2089,7 @@ void Image::create(const char **p_xpm) {
if (line == colormap_size) { if (line == colormap_size) {
status = READING_PIXELS; status = READING_PIXELS;
create(size_width, size_height, false, has_alpha ? FORMAT_RGBA8 : FORMAT_RGB8); create(size_width, size_height, false, has_alpha ? FORMAT_RGBA8 : FORMAT_RGB8);
w = data.ptrw(); data_write = data.ptrw();
pixel_size = has_alpha ? 4 : 3; pixel_size = has_alpha ? 4 : 3;
} }
} break; } break;
@@ -2107,7 +2107,7 @@ void Image::create(const char **p_xpm) {
for (uint32_t i = 0; i < pixel_size; i++) { for (uint32_t i = 0; i < pixel_size; i++) {
pixel[i] = CLAMP((*colorptr)[i] * 255, 0, 255); pixel[i] = CLAMP((*colorptr)[i] * 255, 0, 255);
} }
_put_pixelb(x, y, pixel_size, w, pixel); _put_pixelb(x, y, pixel_size, data_write, pixel);
} }
if (y == (size_height - 1)) { if (y == (size_height - 1)) {