You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-18 14:21:41 +00:00
Make some Image methods static
This commit is contained in:
@@ -1588,9 +1588,7 @@ void TextServerFallback::_font_set_texture_image(const RID &p_font_rid, const Ve
|
||||
tex.texture_h = p_image->get_height();
|
||||
tex.format = p_image->get_format();
|
||||
|
||||
Ref<Image> img;
|
||||
img.instantiate();
|
||||
img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
Ref<Image> img = Image::create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
if (fd->mipmaps) {
|
||||
img->generate_mipmaps();
|
||||
}
|
||||
@@ -1609,11 +1607,7 @@ Ref<Image> TextServerFallback::_font_get_texture_image(const RID &p_font_rid, co
|
||||
ERR_FAIL_INDEX_V(p_texture_index, fd->cache[size]->textures.size(), Ref<Image>());
|
||||
|
||||
const FontTexture &tex = fd->cache[size]->textures[p_texture_index];
|
||||
Ref<Image> img;
|
||||
img.instantiate();
|
||||
img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
|
||||
return img;
|
||||
return Image::create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
}
|
||||
|
||||
void TextServerFallback::_font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offset) {
|
||||
@@ -1933,9 +1927,7 @@ RID TextServerFallback::_font_get_glyph_texture_rid(const RID &p_font_rid, const
|
||||
if (gl[p_glyph | mod].texture_idx != -1) {
|
||||
if (fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].dirty) {
|
||||
FontTexture &tex = fd->cache[size]->textures.write[gl[p_glyph | mod].texture_idx];
|
||||
Ref<Image> img;
|
||||
img.instantiate();
|
||||
img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
Ref<Image> img = Image::create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
if (fd->mipmaps) {
|
||||
img->generate_mipmaps();
|
||||
}
|
||||
@@ -1981,9 +1973,7 @@ Size2 TextServerFallback::_font_get_glyph_texture_size(const RID &p_font_rid, co
|
||||
if (gl[p_glyph | mod].texture_idx != -1) {
|
||||
if (fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].dirty) {
|
||||
FontTexture &tex = fd->cache[size]->textures.write[gl[p_glyph | mod].texture_idx];
|
||||
Ref<Image> img;
|
||||
img.instantiate();
|
||||
img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
Ref<Image> img = Image::create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
if (fd->mipmaps) {
|
||||
img->generate_mipmaps();
|
||||
}
|
||||
@@ -2310,9 +2300,7 @@ void TextServerFallback::_font_draw_glyph(const RID &p_font_rid, const RID &p_ca
|
||||
if (RenderingServer::get_singleton() != nullptr) {
|
||||
if (fd->cache[size]->textures[gl.texture_idx].dirty) {
|
||||
FontTexture &tex = fd->cache[size]->textures.write[gl.texture_idx];
|
||||
Ref<Image> img;
|
||||
img.instantiate();
|
||||
img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
Ref<Image> img = Image::create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
if (fd->mipmaps) {
|
||||
img->generate_mipmaps();
|
||||
}
|
||||
@@ -2402,9 +2390,7 @@ void TextServerFallback::_font_draw_glyph_outline(const RID &p_font_rid, const R
|
||||
if (RenderingServer::get_singleton() != nullptr) {
|
||||
if (fd->cache[size]->textures[gl.texture_idx].dirty) {
|
||||
FontTexture &tex = fd->cache[size]->textures.write[gl.texture_idx];
|
||||
Ref<Image> img;
|
||||
img.instantiate();
|
||||
img->create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
Ref<Image> img = Image::create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
|
||||
if (fd->mipmaps) {
|
||||
img->generate_mipmaps();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user