From 796513579667d0aa48c9d98bf01586ea6ac329f1 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 9 Oct 2017 10:18:19 +0200 Subject: [PATCH] [DEBUG] correct viewer --- egami/Image.cpp | 7 ++++++- egami/Image.hpp | 3 ++- tools/viewer/appl/MainWindows.cpp | 12 ++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/egami/Image.cpp b/egami/Image.cpp index e1fcc30..ceb42ee 100644 --- a/egami/Image.cpp +++ b/egami/Image.cpp @@ -99,9 +99,14 @@ egami::Image::~Image() { } -egami::Image::Image(const ivec2& _size, enum colorType _type) : +egami::Image::Image(const ivec2& _size, + enum colorType _type, + const void* _dataToCopy) : m_data(nullptr) { configure(_size, _type); + if (_dataToCopy != nullptr) { + memcpy(getTextureDataPointer(), _dataToCopy, getSize().x()*getSize().y()*egami::getFormatColorSize(getType())); + } } void egami::Image::swap(egami::Image& _obj) { diff --git a/egami/Image.hpp b/egami/Image.hpp index 61091d4..94337ea 100644 --- a/egami/Image.hpp +++ b/egami/Image.hpp @@ -82,7 +82,8 @@ namespace egami { Image(const egami::Image& _image); Image& operator=(const egami::Image& _image); Image(const ivec2& _size, - enum colorType _type = egami::colorType::undefined); + enum colorType _type = egami::colorType::undefined, + const void* _dataToCopy = nullptr); ~Image(); // TODO : IMplement move operator ... and copy operator... public: diff --git a/tools/viewer/appl/MainWindows.cpp b/tools/viewer/appl/MainWindows.cpp index fff792c..c1469e0 100644 --- a/tools/viewer/appl/MainWindows.cpp +++ b/tools/viewer/appl/MainWindows.cpp @@ -74,7 +74,7 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) { return true; } m_image->propertySource.set(m_listImages[m_idDisplayed]); - propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size())); + propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size())); return true; } if (_event.getType() == gale::key::keyboard::left) { @@ -84,7 +84,7 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) { return true; } m_image->propertySource.set(m_listImages[m_idDisplayed]); - propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size())); + propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size())); return true; } if (_event.getType() == gale::key::keyboard::down) { @@ -93,7 +93,7 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) { m_idDisplayed = m_listImages.size()-1; } m_image->propertySource.set(m_listImages[m_idDisplayed]); - propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size())); + propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size())); return true; } if (_event.getType() == gale::key::keyboard::up) { @@ -102,19 +102,19 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) { m_idDisplayed = 0; } m_image->propertySource.set(m_listImages[m_idDisplayed]); - propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size())); + propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size())); return true; } if (_event.getType() == gale::key::keyboard::pageDown) { m_idDisplayed = m_listImages.size()-1; m_image->propertySource.set(m_listImages[m_idDisplayed]); - propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size())); + propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size())); return true; } if (_event.getType() == gale::key::keyboard::pageUp) { m_idDisplayed = 0; m_image->propertySource.set(m_listImages[m_idDisplayed]); - propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size())); + propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size())); return true; } }