Merge pull request #43780 from lawnjelly/ewok_zero_texture
Put in check for zero sized textures
This commit is contained in:
commit
f6c0dc33c3
1 changed files with 13 additions and 4 deletions
|
@ -906,13 +906,22 @@ PREAMBLE(int)::_batch_find_or_create_tex(const RID &p_texture, const RID &p_norm
|
||||||
typename T_STORAGE::Texture *texture = _get_canvas_texture(p_texture);
|
typename T_STORAGE::Texture *texture = _get_canvas_texture(p_texture);
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
new_batch_tex.tex_pixel_size.x = 1.0 / texture->width;
|
// special case, there can be textures with no width or height
|
||||||
new_batch_tex.tex_pixel_size.y = 1.0 / texture->height;
|
int w = texture->width;
|
||||||
|
int h = texture->height;
|
||||||
|
|
||||||
|
if (!w || !h) {
|
||||||
|
w = 1;
|
||||||
|
h = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new_batch_tex.tex_pixel_size.x = 1.0 / w;
|
||||||
|
new_batch_tex.tex_pixel_size.y = 1.0 / h;
|
||||||
new_batch_tex.flags = texture->flags;
|
new_batch_tex.flags = texture->flags;
|
||||||
} else {
|
} else {
|
||||||
// maybe doesn't need doing...
|
// maybe doesn't need doing...
|
||||||
new_batch_tex.tex_pixel_size.x = 1.0;
|
new_batch_tex.tex_pixel_size.x = 1.0f;
|
||||||
new_batch_tex.tex_pixel_size.y = 1.0;
|
new_batch_tex.tex_pixel_size.y = 1.0f;
|
||||||
new_batch_tex.flags = 0;
|
new_batch_tex.flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue