diff --git a/include/eepp/graphics/image.hpp b/include/eepp/graphics/image.hpp index d0e189e25..e667d479f 100644 --- a/include/eepp/graphics/image.hpp +++ b/include/eepp/graphics/image.hpp @@ -61,7 +61,8 @@ class EE_API Image { SAVE_TYPE_BMP = 1, SAVE_TYPE_PNG = 2, SAVE_TYPE_DDS = 3, - SAVE_TYPE_JPG = 4 + SAVE_TYPE_JPG = 4, + SAVE_TYPE_QOI = 5 }; class FormatConfiguration { diff --git a/src/eepp/graphics/image.cpp b/src/eepp/graphics/image.cpp index cc7cdd3b8..7014ab220 100644 --- a/src/eepp/graphics/image.cpp +++ b/src/eepp/graphics/image.cpp @@ -265,6 +265,8 @@ std::string Image::saveTypeToExtension( const Int32& Format ) { return "dds"; case Image::SaveType::SAVE_TYPE_JPG: return "jpg"; + case Image::SaveType::SAVE_TYPE_QOI: + return "qoi"; case Image::SaveType::SAVE_TYPE_UNKNOWN: default: break; @@ -286,6 +288,8 @@ Image::SaveType Image::extensionToSaveType( const std::string& Extension ) { saveType = SaveType::SAVE_TYPE_DDS; else if ( Extension == "jpg" || Extension == "jpeg" ) saveType = SaveType::SAVE_TYPE_JPG; + else if ( Extension == "qoi" ) + saveType = SaveType::SAVE_TYPE_QOI; return saveType; } @@ -362,7 +366,7 @@ bool Image::isImageExtension( const std::string& path ) { const std::string ext( FileSystem::fileExtension( path ) ); return ( ext == "png" || ext == "tga" || ext == "bmp" || ext == "jpg" || ext == "gif" || ext == "jpeg" || ext == "dds" || ext == "psd" || ext == "hdr" || ext == "pic" || - ext == "pvr" || ext == "pkm" || ext == "svg" ); + ext == "pvr" || ext == "pkm" || ext == "svg" || ext == "qoi" ); } std::string Image::getLastFailureReason() { diff --git a/src/eepp/ui/doc/syntaxhighlighter.cpp b/src/eepp/ui/doc/syntaxhighlighter.cpp index 32080d000..e0bf9bbac 100644 --- a/src/eepp/ui/doc/syntaxhighlighter.cpp +++ b/src/eepp/ui/doc/syntaxhighlighter.cpp @@ -38,6 +38,11 @@ TokenizedLine SyntaxHighlighter::tokenizeLine( const size_t& line, const Uint64& } const std::vector& SyntaxHighlighter::getLine( const size_t& index ) { + if ( mDoc->getSyntaxDefinition().getPatterns().empty() ) { + static std::vector noHighlightVector = { { "normal", 0 } }; + noHighlightVector[0].len = mDoc->line( index ).size(); + return noHighlightVector; + } const auto& it = mLines.find( index ); if ( it == mLines.end() || ( index < mDoc->linesCount() && mDoc->line( index ).getHash() != it->second.hash ) ) { diff --git a/src/eepp/ui/doc/textdocument.cpp b/src/eepp/ui/doc/textdocument.cpp index ba8790242..fa9b89d06 100644 --- a/src/eepp/ui/doc/textdocument.cpp +++ b/src/eepp/ui/doc/textdocument.cpp @@ -138,7 +138,7 @@ TextDocument::LoadStatus TextDocument::loadFromStream( IOStream& file, std::stri } } - while ( consume ) { + while ( consume && mLoading ) { lineBuffer += ptrGetLine( bufferPtr, consume, position ); bufferPtr += position; consume -= position; @@ -200,10 +200,8 @@ TextDocument::LoadStatus TextDocument::loadFromStream( IOStream& file, std::stri clock.getElapsedTime().asMilliseconds() ); bool wasInterrupted = !mLoading; - if ( wasInterrupted ) { - mLines.clear(); - mLines.push_back( String( "\n" ) ); - } + if ( wasInterrupted ) + reset(); mLoading = false; return wasInterrupted ? LoadStatus::Interrupted : ( file.isOpen() ? LoadStatus::Loaded : LoadStatus::Failed ); diff --git a/src/eepp/ui/tools/textureatlasnew.cpp b/src/eepp/ui/tools/textureatlasnew.cpp index 8b8731536..622a4f06a 100644 --- a/src/eepp/ui/tools/textureatlasnew.cpp +++ b/src/eepp/ui/tools/textureatlasnew.cpp @@ -152,7 +152,8 @@ void TextureAtlasNew::windowClose( const Event* ) { } static bool isValidExtension( const std::string& ext ) { - return ext == "png" || ext == "bmp" || ext == "dds" || ext == "tga" || ext == "jpg"; + return ext == "png" || ext == "bmp" || ext == "dds" || ext == "tga" || ext == "jpg" || + ext == "qoi"; } void TextureAtlasNew::textureAtlasSave( const Event* Event ) { diff --git a/src/eepp/ui/uiscenenode.cpp b/src/eepp/ui/uiscenenode.cpp index f105dc68d..7c74d466c 100644 --- a/src/eepp/ui/uiscenenode.cpp +++ b/src/eepp/ui/uiscenenode.cpp @@ -66,6 +66,11 @@ UISceneNode::~UISceneNode() { for ( auto& font : mFontFaces ) { FontManager::instance()->remove( font ); } + + // UISceneNode can now destroy the ThreadPool shared to him. If that's the case, + // We need to ensure that the childs are destroyed before the thread pool, + // since its childs could be consuming it and need to uninitialize gracefully. + childDeleteAll(); } void UISceneNode::resizeNode( EE::Window::Window* ) { diff --git a/src/thirdparty/SOIL2 b/src/thirdparty/SOIL2 index 957d538a5..58a945833 160000 --- a/src/thirdparty/SOIL2 +++ b/src/thirdparty/SOIL2 @@ -1 +1 @@ -Subproject commit 957d538a5561f029a0760914979426693edc4c7e +Subproject commit 58a94583381a341485636ee7feec821acb898540 diff --git a/src/tools/texturepacker/texturepacker.cpp b/src/tools/texturepacker/texturepacker.cpp index c5d423fdf..d8a7a9a55 100644 --- a/src/tools/texturepacker/texturepacker.cpp +++ b/src/tools/texturepacker/texturepacker.cpp @@ -22,11 +22,9 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) { parser, "output-file", "Texture atlas file output path. Extension must be: \".eta\"", { 'o', "output-file" }, "", args::Options::Required | args::Options::Single ); std::unordered_map saveTypeFormat{ - { "PNG", Image::SaveType::SAVE_TYPE_PNG }, - { "DDS", Image::SaveType::SAVE_TYPE_DDS }, - { "TGA", Image::SaveType::SAVE_TYPE_TGA }, - { "BMP", Image::SaveType::SAVE_TYPE_BMP }, - { "JPG", Image::SaveType::SAVE_TYPE_JPG } }; + { "PNG", Image::SaveType::SAVE_TYPE_PNG }, { "DDS", Image::SaveType::SAVE_TYPE_DDS }, + { "TGA", Image::SaveType::SAVE_TYPE_TGA }, { "BMP", Image::SaveType::SAVE_TYPE_BMP }, + { "JPG", Image::SaveType::SAVE_TYPE_JPG }, { "QOI", Image::SaveType::SAVE_TYPE_QOI } }; args::MapFlag saveType( parser, "image-format", "Output image format.", { 'f', "image-format" }, saveTypeFormat, Image::SaveType::SAVE_TYPE_PNG, args::Options::Single );