[DEV] correction of the multiple load of the images

This commit is contained in:
Edouard DUPIN 2013-07-24 23:25:01 +02:00
parent 1682a44288
commit d535450eb5
7 changed files with 69 additions and 41 deletions

2
external/esvg vendored

@ -1 +1 @@
Subproject commit 1b0c7b47044a757d99128d3fb89476526324e7f0
Subproject commit 51c6650a0a0ef3c49246dd71f7c240102f2939c6

2
external/etk vendored

@ -1 +1 @@
Subproject commit 2e664009f86bfa1d8d28bbbcb3b3dbaca16d33bb
Subproject commit f2edd2def61f19ec5db846a522fb056a9c7cee0c

View File

@ -136,6 +136,26 @@ namespace ewol
}
return *this;
}
/*****************************************************
* == operator
*****************************************************/
bool operator== (const Dimension& _obj) const {
if( m_data == _obj.m_data
&& m_type == _obj.m_type) {
return true;
}
return false;
}
/*****************************************************
* != operator
*****************************************************/
bool operator!= (const Dimension& _obj) const {
if( m_data != _obj.m_data
|| m_type != _obj.m_type) {
return true;
}
return false;
}
/**
* @breif get the dimension type
* @return the type

View File

@ -317,9 +317,9 @@ bool ewol::EObject::StoreXML(exml::Element* _node) const
bool ewol::EObject::OnSetConfig(const ewol::EConfig& _conf)
{
EWOL_DEBUG("[" << GetId() << "] {" << GetObjectType() << "} set config : " << _conf);
EWOL_VERBOSE("[" << GetId() << "] {" << GetObjectType() << "} set config : " << _conf);
if (_conf.GetConfig() == ewol::EObject::configName) {
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} Set config name : \"" << _conf.GetData() << "\"");
EWOL_VERBOSE("[" << GetId() << "] {" << GetObjectType() << "} Set config name : \"" << _conf.GetData() << "\"");
SetName(_conf.GetData());
return true;
}

View File

@ -282,7 +282,7 @@ bool ewol::resource::Keep(ewol::Colored3DObject*& object)
LocalAdd(object);
return true;
}
#ifdef __TARGET_OS__Android
/**
* @brief get the next power 2 if the input
* @param[in] value Value that we want the next power of 2
@ -300,35 +300,41 @@ static int32_t nextP2(int32_t value)
EWOL_CRITICAL("impossible CASE.... request P2 of " << value);
return val;
}
#endif
bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _object, ivec2 _size)
{
EWOL_ERROR("11111111111111 " << _filename << " " << _size);
EWOL_VERBOSE(" keep image file : " << _filename << " " << _size);
if (_size.x()==0) {
_size.setX(-1);
EWOL_ERROR("Error Request the image size.x() =0 ???");
//EWOL_ERROR("Error Request the image size.x() =0 ???");
}
if (_size.y()==0) {
_size.setY(-1);
EWOL_ERROR("Error Request the image size.y() =0 ???");
//EWOL_ERROR("Error Request the image size.y() =0 ???");
}
EWOL_ERROR("222222222222222222 " << _size);
etk::UString TmpFilename = _filename;
if (false == _filename.EndWith(".svg") ) {
_size = ivec2(-1,-1);
}
EWOL_ERROR("3333333333333333 " << _size);
#ifdef __TARGET_OS__MacOs
EWOL_WARNING("TODO : Remove this strange hack");
EWOL_ERROR("TODO : Remove this strange hack");
_size = ivec2(64,64);
#endif
if (_size.x()>0 && _size.y()>0) {
EWOL_ERROR("44444444444444 " << _size);
ivec2 size2(nextP2(_size.x()), nextP2(_size.y()));
TmpFilename += ":";
TmpFilename += size2.x();
TmpFilename += "x";
TmpFilename += size2.y();
EWOL_VERBOSE(" ==> specific size : " << _size);
#ifdef __TARGET_OS__Android
ivec2 size2(nextP2(_size.x()), nextP2(_size.y()));
TmpFilename += ":";
TmpFilename += size2.x();
TmpFilename += "x";
TmpFilename += size2.y();
#else
TmpFilename += ":";
TmpFilename += _size.x();
TmpFilename += "x";
TmpFilename += _size.y();
#endif
}
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" basic size=" << _size);

View File

@ -54,19 +54,20 @@ widget::Image::Image(const etk::UString& _file, const ewol::Dimension& _border)
void widget::Image::SetFile(const etk::UString& _file)
{
EWOL_DEBUG("Set Image : " << _file);
// copy data :
m_fileName = _file;
// Force redraw all :
MarkToRedraw();
ewol::RequestUpdateSize();
EWOL_DEBUG("Set sources : " << m_fileName << " size=" << vec2(64,64));
m_compositing.SetSource(m_fileName, vec2(64,64));
EWOL_VERBOSE("Set Image : " << _file);
if (m_fileName != _file) {
// copy data :
m_fileName = _file;
// Force redraw all :
MarkToRedraw();
EWOL_VERBOSE("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.SetSource(m_fileName, m_imageSize.GetPixel());
}
}
void widget::Image::SetBorder(const ewol::Dimension& _border)
{
EWOL_DEBUG("Set border=" << _border);
EWOL_VERBOSE("Set border=" << _border);
// copy data :
m_border = _border;
// Force redraw all :
@ -88,25 +89,26 @@ void widget::Image::SetKeepRatio(bool _keep)
void widget::Image::SetImageSize(const ewol::Dimension& _size)
{
EWOL_DEBUG("Set Image size : " << _size);
m_imageSize = _size;
MarkToRedraw();
ewol::RequestUpdateSize();
EWOL_DEBUG("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.SetSource(m_fileName, m_imageSize.GetPixel());
EWOL_VERBOSE("Set Image size : " << _size);
if (_size != m_imageSize) {
m_imageSize = _size;
MarkToRedraw();
ewol::RequestUpdateSize();
EWOL_VERBOSE("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.SetSource(m_fileName, m_imageSize.GetPixel());
}
}
void widget::Image::Set(const etk::UString& _file, const ewol::Dimension& _border)
{
EWOL_DEBUG("Set Image : " << _file << " border=" << _border);
EWOL_VERBOSE("Set Image : " << _file << " border=" << _border);
// copy data :
m_border = _border;
m_fileName = _file;
// Force redraw all :
MarkToRedraw();
ewol::RequestUpdateSize();
EWOL_DEBUG("Set sources : " << m_fileName << " size=" << m_imageSize);
m_compositing.SetSource(m_fileName, m_imageSize.GetPixel());
if (m_border != _border) {
m_border = _border;
ewol::RequestUpdateSize();
MarkToRedraw();
}
SetFile(_file);
}

View File

@ -739,7 +739,7 @@ bool ewol::Widget::LoadXML(exml::Element* _node)
ewol::Widget* ewol::Widget::GetWidgetNamed(const etk::UString& _widgetName)
{
EWOL_DEBUG("[" << GetId() << "] {" << GetObjectType() << "} compare : " << GetName() << "==" << _widgetName );
EWOL_VERBOSE("[" << GetId() << "] {" << GetObjectType() << "} compare : " << GetName() << "==" << _widgetName );
if (GetName()==_widgetName) {
return this;
}