[DEBUG] correct image sizing

This commit is contained in:
Edouard DUPIN 2017-10-03 10:24:00 +02:00
parent 94e69dbdec
commit d2ce3d279c
7 changed files with 11 additions and 8 deletions

View File

@ -180,6 +180,7 @@ void ewol::compositing::Image::printPart(const vec2& _size,
vec2 ratio = usefullSize/openGLSize; vec2 ratio = usefullSize/openGLSize;
_sourcePosStart *= ratio; _sourcePosStart *= ratio;
_sourcePosStop *= ratio; _sourcePosStop *= ratio;
EWOL_VERBOSE(" openGLSize=" << openGLSize << " usableSize=" << usefullSize << " start=" << _sourcePosStart << " stop=" << _sourcePosStop);
//EWOL_ERROR("Debug image " << m_filename << " ==> " << m_position << " " << _size << " " << _sourcePosStart << " " << _sourcePosStop); //EWOL_ERROR("Debug image " << m_filename << " ==> " << m_position << " " << _size << " " << _sourcePosStart << " " << _sourcePosStop);
if (m_angle == 0.0f) { if (m_angle == 0.0f) {

View File

@ -58,10 +58,10 @@ void ewol::resource::TextureFile::init(etk::String _genName, const etk::String&
m_realImageSize = vec2(tmp.x(), tmp.y()); m_realImageSize = vec2(tmp.x(), tmp.y());
vec2 compatibilityHWSize = vec2(nextP2(tmp.x()), nextP2(tmp.y())); vec2 compatibilityHWSize = vec2(nextP2(tmp.x()), nextP2(tmp.y()));
if (m_realImageSize != compatibilityHWSize) { if (m_realImageSize != compatibilityHWSize) {
EWOL_ERROR("RESIZE Image for HArwareCompatibility:" << m_realImageSize << " => " << compatibilityHWSize); EWOL_DEBUG("RESIZE Image for HArwareCompatibility:" << m_realImageSize << " => " << compatibilityHWSize);
m_data.resize(ivec2(compatibilityHWSize.x(),compatibilityHWSize.y())); m_data.resize(ivec2(compatibilityHWSize.x(),compatibilityHWSize.y()));
} }
m_lastSize = m_realImageSize; //m_lastSize = m_realImageSize;
#ifdef GENERATE_DISTANCE_FIELD_MODE #ifdef GENERATE_DISTANCE_FIELD_MODE
//egami::generateDistanceFieldFile(_tmpFilename, etk::String(_tmpFilename, 0, _tmpFilename.size()-4) + ".bmp"); //egami::generateDistanceFieldFile(_tmpFilename, etk::String(_tmpFilename, 0, _tmpFilename.size()-4) + ".bmp");
egami::generateDistanceFieldFile(_tmpFilename, etk::String(_tmpFilename, 0, _tmpFilename.size()-4) + ".edf"); egami::generateDistanceFieldFile(_tmpFilename, etk::String(_tmpFilename, 0, _tmpFilename.size()-4) + ".edf");

View File

@ -19,8 +19,6 @@ namespace ewol {
public: public:
static const ivec2 sizeAuto; static const ivec2 sizeAuto;
static const ivec2 sizeDefault; static const ivec2 sizeDefault;
private:
vec2 m_realImageSize;
protected: protected:
TextureFile(); TextureFile();
void init(); void init();

View File

@ -45,6 +45,7 @@ ewol::resource::Texture::Texture() :
m_texPboId(0), m_texPboId(0),
#endif #endif
m_data(ivec2(32,32),egami::colorType::RGBA8), m_data(ivec2(32,32),egami::colorType::RGBA8),
m_realImageSize(1,1),
m_lastSize(1,1), m_lastSize(1,1),
m_loaded(false), m_loaded(false),
m_lastTypeObject(0), m_lastTypeObject(0),

View File

@ -26,8 +26,10 @@ namespace ewol {
#endif #endif
// openGl Context propoerties : // openGl Context propoerties :
egami::Image m_data; egami::Image m_data;
// some image are not square == > we need to sqared it to prevent some openGl api error the the displayable size is not all the time 0.0 -> 1.0 //! Last loaded size in the system openGL
vec2 m_lastSize; vec2 m_lastSize;
//! some image are not square == > we need to sqared it to prevent some openGl api error the the displayable size is not all the time 0.0 -> 1.0
vec2 m_realImageSize;
// internal state of the openGl system : // internal state of the openGl system :
bool m_loaded; bool m_loaded;
int32_t m_lastTypeObject; int32_t m_lastTypeObject;
@ -72,7 +74,7 @@ namespace ewol {
return m_data.getSize(); return m_data.getSize();
}; };
const vec2& getUsableSize() const { const vec2& getUsableSize() const {
return m_lastSize; return m_realImageSize;
}; };
uint32_t getRendererId() const { uint32_t getRendererId() const {
return m_texId; return m_texId;

View File

@ -113,7 +113,8 @@ void ewol::widget::Image::onRegenerateDisplay() {
} }
m_compositing.printPart(imageRealSize, *propertyPosStart, *propertyPosStop); m_compositing.printPart(imageRealSize, *propertyPosStart, *propertyPosStop);
//EWOL_DEBUG("Paint Image at : " << origin << " size=" << imageRealSize << " origin=" << origin); //EWOL_DEBUG("Paint Image at : " << origin << " size=" << imageRealSize << " origin=" << origin);
EWOL_VERBOSE("Paint Image :" << *propertySource << " realsize=" << *m_compositing.getRealSize() << " size=" << imageRealSize); EWOL_WARNING("Paint Image :" << *propertySource << " realsize=" << m_compositing.getRealSize() << " size=" << imageRealSize);
EWOL_WARNING(" start=" << *propertyPosStart << " stop=" << *propertyPosStop);
} }
void ewol::widget::Image::calculateMinMaxSize() { void ewol::widget::Image::calculateMinMaxSize() {

View File

@ -12,7 +12,7 @@
#include <gale/renderer/openGL/openGL-include.hpp> #include <gale/renderer/openGL/openGL-include.hpp>
#include <ewol/context/Context.hpp> #include <ewol/context/Context.hpp>
#include <etk/typeInfo.hpp> #include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(ewol::Widget::Widget); ETK_DECLARE_TYPE(ewol::Widget);
ewol::Widget::Widget() : ewol::Widget::Widget() :
propertyMinSize(this, "min-size", propertyMinSize(this, "min-size",