src/texture.cpp in rays-0.1.2 vs src/texture.cpp in rays-0.1.3
- old
+ new
@@ -1,9 +1,8 @@
#include "rays/texture.h"
-#include <boost/scoped_array.hpp>
#include <rays/bitmap.h>
namespace Rays
{
@@ -193,14 +192,17 @@
int dest_Bpp = dest->color_space().Bpp();
if (src_offset >= (src_Bpp / src_Bpc))
return false;
- for (int y = 0; y < dest->height(); ++y)
+ int width = std::min(src.width(), dest->width());
+ int height = std::min(src.height(), dest->height());
+
+ for (int y = 0; y < height; ++y)
{
const uchar* s = src. at<uchar>(0, y) + src_offset * src_Bpc;
uchar* d = dest->at<uchar>(0, y);
- copy_pixels(src_Bpp, dest->width(), d, dest_Bpp, s, src_Bpp);
+ copy_pixels(src_Bpp, width, d, dest_Bpp, s, src_Bpp);
}
return true;
}