mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-30 01:56:31 +03:00
eepp: Added QOI image format support (inherited from SOIL2).
ecode: Fixed a crash while unloading documents that were still loading. Fixed an incorrect un-initialization of the thread pool when consumed by the UISceneNode.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -38,6 +38,11 @@ TokenizedLine SyntaxHighlighter::tokenizeLine( const size_t& line, const Uint64&
|
||||
}
|
||||
|
||||
const std::vector<SyntaxToken>& SyntaxHighlighter::getLine( const size_t& index ) {
|
||||
if ( mDoc->getSyntaxDefinition().getPatterns().empty() ) {
|
||||
static std::vector<SyntaxToken> 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 ) ) {
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -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* ) {
|
||||
|
||||
2
src/thirdparty/SOIL2
vendored
2
src/thirdparty/SOIL2
vendored
Submodule src/thirdparty/SOIL2 updated: 957d538a55...58a9458338
@@ -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<std::string, Image::SaveType> 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<std::string, Image::SaveType> saveType(
|
||||
parser, "image-format", "Output image format.", { 'f', "image-format" }, saveTypeFormat,
|
||||
Image::SaveType::SAVE_TYPE_PNG, args::Options::Single );
|
||||
|
||||
Reference in New Issue
Block a user