summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/img.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ovision/see/img.cc')
-rw-r--r--2005/i/robert/src/ovision/see/img.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/2005/i/robert/src/ovision/see/img.cc b/2005/i/robert/src/ovision/see/img.cc
index fa38e4a..babddd0 100644
--- a/2005/i/robert/src/ovision/see/img.cc
+++ b/2005/i/robert/src/ovision/see/img.cc
@@ -41,6 +41,7 @@ void
Img::doTabY ()
{
delete [] tabY_;
+ delete [] tabData_;
tabY_ = new int[height_];
for (int i=0; i<height_; ++i)
tabY_[i] = i*width_;
@@ -102,16 +103,18 @@ Img::loadMultipeRaw (const std::vector<std::string> &imgList, const Image::Pixel
void
Img::load (ImageReader &loader)
{
- delete[] tabData_;
// Ouvre l'image
Image image;
image.read (loader);
- loader.getParam (width_, height_, colorMode_);
- doTabY ();
- nbPixels_ = width_ * height_;
- tabData_ = new unsigned char[image.getBufSize ()];
+ if (!tabData_)
+ {
+ loader.getParam (width_, height_, colorMode_);
+ // Récupère le format de couleur
+ colorMode_ = image.getPixelFormat ();
+ doTabY ();
+ nbPixels_ = width_ * height_;
+ tabData_ = new unsigned char[image.getBufSize ()];
+ }
memcpy (tabData_, image.getBuf (), image.getBufSize ());
- // Récupère le format de couleur
- colorMode_ = image.getPixelFormat ();
}