[DEBUG] try to find the problem of opening png file
This commit is contained in:
parent
06842eeafb
commit
f471429ac3
@ -248,8 +248,8 @@ void ewol::compositing::Image::printPart(const vec2& _size,
|
||||
|
||||
void ewol::compositing::Image::setSource(const std::string& _newFile, const vec2& _size) {
|
||||
clear();
|
||||
std::shared_ptr<ewol::resource::TextureFile> resource(m_resource);
|
||||
std::shared_ptr<ewol::resource::ImageDF> resourceDF(m_resourceDF);
|
||||
std::shared_ptr<ewol::resource::TextureFile> resource = m_resource;
|
||||
std::shared_ptr<ewol::resource::ImageDF> resourceDF = m_resourceDF;
|
||||
m_filename = _newFile;
|
||||
m_requestSize = _size;
|
||||
m_resource.reset();
|
||||
@ -284,7 +284,8 @@ void ewol::compositing::Image::setSource(const std::string& _newFile, const vec2
|
||||
}
|
||||
|
||||
bool ewol::compositing::Image::hasSources() {
|
||||
return (m_resource != nullptr || m_resourceDF != nullptr);
|
||||
return m_resource != nullptr
|
||||
|| m_resourceDF != nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,18 +26,19 @@ void ewol::resource::TextureFile::init() {
|
||||
ewol::resource::Texture::init();
|
||||
}
|
||||
|
||||
void ewol::resource::TextureFile::init(std::string _genName, const std::string& _tmpfileName, const ivec2& _size) {
|
||||
void ewol::resource::TextureFile::init(std::string _genName, const std::string& _tmpFilename, const ivec2& _size) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ewol::resource::Texture::init(_genName);
|
||||
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _tmpfileName=" << _tmpfileName << " size=" << _size);
|
||||
if (egami::load(m_data, _tmpfileName, _size) == false) {
|
||||
EWOL_ERROR("ERROR when loading the image : " << _tmpfileName);
|
||||
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _tmpFilename=" << _tmpFilename << " size=" << _size);
|
||||
if (egami::load(m_data, _tmpFilename, _size) == false) {
|
||||
EWOL_ERROR("ERROR when loading the image : " << _tmpFilename);
|
||||
}
|
||||
//egami::store(m_data, "tmpResult.bmp");
|
||||
ivec2 tmp = m_data.getSize();
|
||||
m_realImageSize = vec2(tmp.x(), tmp.y());
|
||||
#ifdef GENERATE_DISTANCE_FIELD_MODE
|
||||
//egami::generateDistanceFieldFile(_tmpfileName, std::string(_tmpfileName, 0, _tmpfileName.size()-4) + ".bmp");
|
||||
egami::generateDistanceFieldFile(_tmpfileName, std::string(_tmpfileName, 0, _tmpfileName.size()-4) + ".edf");
|
||||
//egami::generateDistanceFieldFile(_tmpFilename, std::string(_tmpFilename, 0, _tmpFilename.size()-4) + ".bmp");
|
||||
egami::generateDistanceFieldFile(_tmpFilename, std::string(_tmpFilename, 0, _tmpFilename.size()-4) + ".edf");
|
||||
#endif
|
||||
flush();
|
||||
}
|
||||
@ -84,7 +85,7 @@ std::shared_ptr<ewol::resource::TextureFile> ewol::resource::TextureFile::create
|
||||
_size.setY(-1);
|
||||
//EWOL_ERROR("Error Request the image size.y() =0 ???");
|
||||
}
|
||||
std::string TmpFilename = _filename;
|
||||
std::string tmpFilename = _filename;
|
||||
if (etk::end_with(_filename, ".svg") == false) {
|
||||
_size = ewol::resource::TextureFile::sizeAuto;
|
||||
}
|
||||
@ -99,35 +100,35 @@ std::shared_ptr<ewol::resource::TextureFile> ewol::resource::TextureFile::create
|
||||
#endif
|
||||
if (_sizeRegister != ewol::resource::TextureFile::sizeAuto) {
|
||||
if (_sizeRegister != ewol::resource::TextureFile::sizeDefault) {
|
||||
TmpFilename += ":";
|
||||
TmpFilename += etk::to_string(_size.x());
|
||||
TmpFilename += "x";
|
||||
TmpFilename += etk::to_string(_size.y());
|
||||
tmpFilename += ":";
|
||||
tmpFilename += etk::to_string(_size.x());
|
||||
tmpFilename += "x";
|
||||
tmpFilename += etk::to_string(_size.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size);
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size);
|
||||
std::shared_ptr<ewol::resource::TextureFile> object = nullptr;
|
||||
std::shared_ptr<gale::Resource> object2 = getManager().localKeep(TmpFilename);
|
||||
std::shared_ptr<gale::Resource> object2 = getManager().localKeep(tmpFilename);
|
||||
if (object2 != nullptr) {
|
||||
object = std::dynamic_pointer_cast<ewol::resource::TextureFile>(object2);
|
||||
if (object == nullptr) {
|
||||
EWOL_CRITICAL("Request resource file : '" << TmpFilename << "' With the wrong type (dynamic cast error)");
|
||||
EWOL_CRITICAL("Request resource file : '" << tmpFilename << "' With the wrong type (dynamic cast error)");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
if (object != nullptr) {
|
||||
return object;
|
||||
}
|
||||
EWOL_INFO("CREATE: TextureFile: '" << TmpFilename << "' size=" << _size);
|
||||
EWOL_INFO("CREATE: TextureFile: '" << tmpFilename << "' size=" << _size);
|
||||
// need to crate a new one ...
|
||||
object = std::shared_ptr<ewol::resource::TextureFile>(new ewol::resource::TextureFile());
|
||||
if (object == nullptr) {
|
||||
EWOL_ERROR("allocation error of a resource : " << _filename);
|
||||
return nullptr;
|
||||
}
|
||||
object->init(TmpFilename, _filename, _size);
|
||||
object->init(tmpFilename, _filename, _size);
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ ewol::resource::Texture::~Texture() {
|
||||
//#include <egami/wrapperBMP.h>
|
||||
|
||||
bool ewol::resource::Texture::updateContext() {
|
||||
EWOL_INFO("updateContext [START]");
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex, std::defer_lock);
|
||||
if (lock.try_lock() == false) {
|
||||
//Lock error ==> try later ...
|
||||
@ -60,7 +61,7 @@ bool ewol::resource::Texture::updateContext() {
|
||||
// Request a new texture at openGl :
|
||||
glGenTextures(1, &m_texId);
|
||||
}
|
||||
EWOL_VERBOSE("load the image:" << m_name);
|
||||
EWOL_INFO("load the image:" << m_name);
|
||||
// in all case we set the texture properties :
|
||||
// TODO : check error ???
|
||||
glBindTexture(GL_TEXTURE_2D, m_texId);
|
||||
@ -73,7 +74,7 @@ bool ewol::resource::Texture::updateContext() {
|
||||
//--- Mode linear
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
EWOL_INFO("TEXTURE: add [" << getId() << "]=" << m_data.getSize() << " OGl_Id=" <<m_texId);
|
||||
EWOL_INFO("TEXTURE: add [" << getId() << "]=" << m_data.getSize() << " OGl_Id=" << m_texId << " type=" << m_data.getType());
|
||||
//egami::storeBMP("~/bbb_image.bmp", m_data);
|
||||
glTexImage2D(GL_TEXTURE_2D, // Target
|
||||
0, // Level
|
||||
@ -86,6 +87,7 @@ bool ewol::resource::Texture::updateContext() {
|
||||
m_data.getTextureDataPointer() );
|
||||
// now the data is loaded
|
||||
m_loaded = true;
|
||||
EWOL_INFO("updateContext [STOP]");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -108,6 +110,7 @@ void ewol::resource::Texture::removeContextToLate() {
|
||||
void ewol::resource::Texture::flush() {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
// request to the manager to be call at the next update ...
|
||||
EWOL_INFO("Request UPDATE of Element");
|
||||
getManager().update(std::dynamic_pointer_cast<gale::Resource>(shared_from_this()));
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,18 @@ void appl::MainWindows::init() {
|
||||
if (m_subWidget == nullptr) {
|
||||
APPL_CRITICAL("Can not get subWidget pointer");
|
||||
}
|
||||
shortCutAdd("F12", "menu:reloade-shader");
|
||||
signalShortcut.connect(shared_from_this(), &appl::MainWindows::onCallbackShortCut);
|
||||
}
|
||||
|
||||
void appl::MainWindows::onCallbackShortCut(const std::string& _value) {
|
||||
APPL_WARNING("Event from ShortCut : " << _value);
|
||||
if (_value == "menu:reloade-shader") {
|
||||
ewol::getContext().getResourcesManager().reLoadResources();
|
||||
ewol::getContext().forceRedrawAll();
|
||||
} else {
|
||||
APPL_ERROR("Event from Menu UNKNOW : '" << _value << "'");
|
||||
}
|
||||
}
|
||||
|
||||
void appl::MainWindows::onCallbackThemeChange(const bool& _value) {
|
||||
|
@ -37,6 +37,7 @@ namespace appl {
|
||||
void onCallbackThemeChange(const bool& _value);
|
||||
void onCallbackWidgetChange(int32_t _increment);
|
||||
void updateProperty();
|
||||
void onCallbackShortCut(const std::string& _value);
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user