Permalink
Browse files

From Marcel Pursche, fixed checking of destination dimensions in osg:…

…:copyImage.
  • Loading branch information...
1 parent 3ceb941 commit 22e49af6c2a7ad75fa3337c2f6dec25b0a093b38 @osg-training-guest osg-training-guest committed Jun 28, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/osg/ImageUtils.cpp
View
@@ -200,23 +200,23 @@ struct WriteRowOperator
bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int width, int height, int depth,
osg::Image* destImage, int dest_s, int dest_t, int dest_r, bool doRescale)
{
- if ((src_s+width) > (dest_s + destImage->s()))
+ if ((dest_s+width) > (destImage->s()))
{
OSG_NOTICE<<"copyImage("<<srcImage<<", "<<src_s<<", "<< src_t<<", "<<src_r<<", "<<width<<", "<<height<<", "<<depth<<std::endl;
OSG_NOTICE<<" "<<destImage<<", "<<dest_s<<", "<< dest_t<<", "<<dest_r<<", "<<doRescale<<")"<<std::endl;
OSG_NOTICE<<" input width too large."<<std::endl;
return false;
}
- if ((src_t+height) > (dest_t + destImage->t()))
+ if ((dest_t+height) > (destImage->t()))
{
OSG_NOTICE<<"copyImage("<<srcImage<<", "<<src_s<<", "<< src_t<<", "<<src_r<<", "<<width<<", "<<height<<", "<<depth<<std::endl;
OSG_NOTICE<<" "<<destImage<<", "<<dest_s<<", "<< dest_t<<", "<<dest_r<<", "<<doRescale<<")"<<std::endl;
OSG_NOTICE<<" input height too large."<<std::endl;
return false;
}
- if ((src_r+depth) > (dest_r + destImage->r()))
+ if ((dest_r+depth) > (destImage->r()))
{
OSG_NOTICE<<"copyImage("<<srcImage<<", "<<src_s<<", "<< src_t<<", "<<src_r<<", "<<width<<", "<<height<<", "<<depth<<std::endl;
OSG_NOTICE<<" "<<destImage<<", "<<dest_s<<", "<< dest_t<<", "<<dest_r<<", "<<doRescale<<")"<<std::endl;
@@ -316,7 +316,7 @@ bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int
}
}
- return false;
+ return true;
}
}

0 comments on commit 22e49af

Please sign in to comment.