using std::string;
using std::min;
+using std::cout;
using boost::shared_ptr;
using libdcp::Size;
for (int c = 0; c < components(); ++c) {
int const crop_left_in_bytes = bytes_per_pixel(c) * crop.left;
- int const cropped_width_in_bytes = bytes_per_pixel(c) * cropped_size.width;
+ /* bytes_per_pixel() could be a fraction; in this case the stride will be rounded
+ up, and we need to make sure that we copy over the width (up to the stride)
+ rather than short of the width; hence the ceil() here.
+ */
+ int const cropped_width_in_bytes = ceil (bytes_per_pixel(c) * cropped_size.width);
/* Start of the source line, cropped from the top but not the left */
uint8_t* in_p = data()[c] + (crop.top / out->line_factor(c)) * stride()[c];
}
void
-Image::alpha_blend (shared_ptr<const Image> other, Position position)
+Image::alpha_blend (shared_ptr<const Image> other, Position<int> position)
{
/* Only implemented for RGBA onto RGB24 so far */
assert (_pixel_format == PIX_FMT_RGB24 && other->pixel_format() == PIX_FMT_RGBA);
}
void
-Image::copy (shared_ptr<const Image> other, Position position)
+Image::copy (shared_ptr<const Image> other, Position<int> position)
{
/* Only implemented for RGB24 onto RGB24 so far */
assert (_pixel_format == PIX_FMT_RGB24 && other->pixel_format() == PIX_FMT_RGB24);