try to decode the image header as soon as some data is available
This commit is contained in:
@@ -135,9 +135,18 @@ bool NodeImage::set_image(const std::string& path)
|
||||
|
||||
void NodeImage::load_url(const std::string& url)
|
||||
{
|
||||
m_remote_header_decoded = false;
|
||||
m_remote_asset = std::make_shared<Asset>();
|
||||
m_remote_asset->open_url_async(url,
|
||||
[this] (float progress) -> bool {
|
||||
int w, h, c;
|
||||
if (!m_remote_header_decoded &&
|
||||
stbi_info_from_memory(m_remote_asset->tmp_data.data(), m_remote_asset->tmp_data.size(), &w, &h, &c))
|
||||
{
|
||||
if (m_autosize)
|
||||
SetAspectRatio((float)w / (float)h);
|
||||
m_remote_header_decoded = true;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
[this] (bool success) {
|
||||
|
||||
Reference in New Issue
Block a user