mirror of
https://github.com/Relintai/sfw.git
synced 2024-11-08 07:52:09 +01:00
Fixed Image initialization.
This commit is contained in:
parent
66387cf635
commit
51fd0951af
@ -138,6 +138,7 @@ GameScene::GameScene() {
|
|||||||
|
|
||||||
image.instance();
|
image.instance();
|
||||||
image->load_from_file("icon.png");
|
image->load_from_file("icon.png");
|
||||||
|
//image->bumpmap_to_normalmap();
|
||||||
|
|
||||||
texture = new Texture();
|
texture = new Texture();
|
||||||
//texture->load_image("icon.png");
|
//texture->load_image("icon.png");
|
||||||
|
@ -1461,9 +1461,9 @@ void Image::load_from_file(const String &file_name, Format p_format) {
|
|||||||
|
|
||||||
int size = x * y * get_format_pixel_size(FORMAT_RGBA8);
|
int size = x * y * get_format_pixel_size(FORMAT_RGBA8);
|
||||||
|
|
||||||
|
data.resize(size);
|
||||||
{
|
{
|
||||||
write_lock = true;
|
write_lock = true;
|
||||||
data.resize(size);
|
|
||||||
memcpy(data.ptrw(), pixels, size);
|
memcpy(data.ptrw(), pixels, size);
|
||||||
write_lock = false;
|
write_lock = false;
|
||||||
}
|
}
|
||||||
@ -1812,6 +1812,7 @@ Image::Image(int p_width, int p_height, bool p_use_mipmaps, Format p_format) {
|
|||||||
height = 0;
|
height = 0;
|
||||||
mipmaps = p_use_mipmaps;
|
mipmaps = p_use_mipmaps;
|
||||||
format = FORMAT_L8;
|
format = FORMAT_L8;
|
||||||
|
write_lock = false;
|
||||||
|
|
||||||
create(p_width, p_height, p_use_mipmaps, p_format);
|
create(p_width, p_height, p_use_mipmaps, p_format);
|
||||||
}
|
}
|
||||||
@ -1821,6 +1822,7 @@ Image::Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const V
|
|||||||
height = 0;
|
height = 0;
|
||||||
mipmaps = p_mipmaps;
|
mipmaps = p_mipmaps;
|
||||||
format = FORMAT_L8;
|
format = FORMAT_L8;
|
||||||
|
write_lock = false;
|
||||||
|
|
||||||
create(p_width, p_height, p_mipmaps, p_format, p_data);
|
create(p_width, p_height, p_mipmaps, p_format, p_data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user