summaryrefslogtreecommitdiff
path: root/src/lib/image.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-12-20 23:37:57 +0000
committerCarl Hetherington <cth@carlh.net>2014-12-20 23:37:57 +0000
commit4dbc6ef917aeceb906b1ef1caf6911033e7e2c54 (patch)
tree203675d00d5cc004be6205218f835b6d7a10e925 /src/lib/image.cc
parentab32f60c2c9f2ad01dc8d96dc375df256dba0c41 (diff)
Hand-apply d849d411cff28ef5453085791d0b4d7cd73bd070 from master; replace all assert()s with thrown exceptions.
Diffstat (limited to 'src/lib/image.cc')
-rw-r--r--src/lib/image.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc
index 3c6769068..847ad1046 100644
--- a/src/lib/image.cc
+++ b/src/lib/image.cc
@@ -88,14 +88,14 @@ Image::components () const
shared_ptr<Image>
Image::crop_scale_window (Crop crop, dcp::Size inter_size, dcp::Size out_size, Scaler const * scaler, AVPixelFormat out_format, bool out_aligned) const
{
- assert (scaler);
+ DCPOMATIC_ASSERT (scaler);
/* Empirical testing suggests that sws_scale() will crash if
the input image is not aligned.
*/
- assert (aligned ());
+ DCPOMATIC_ASSERT (aligned ());
- assert (out_size.width >= inter_size.width);
- assert (out_size.height >= inter_size.height);
+ DCPOMATIC_ASSERT (out_size.width >= inter_size.width);
+ DCPOMATIC_ASSERT (out_size.height >= inter_size.height);
/* Here's an image of out_size */
shared_ptr<Image> out (new Image (out_format, out_size, out_aligned));
@@ -144,11 +144,11 @@ Image::crop_scale_window (Crop crop, dcp::Size inter_size, dcp::Size out_size, S
shared_ptr<Image>
Image::scale (dcp::Size out_size, Scaler const * scaler, AVPixelFormat out_format, bool out_aligned) const
{
- assert (scaler);
+ DCPOMATIC_ASSERT (scaler);
/* Empirical testing suggests that sws_scale() will crash if
the input image is not aligned.
*/
- assert (aligned ());
+ DCPOMATIC_ASSERT (aligned ());
shared_ptr<Image> scaled (new Image (out_format, out_size, out_aligned));
@@ -361,7 +361,7 @@ Image::make_transparent ()
void
Image::alpha_blend (shared_ptr<const Image> other, Position<int> position)
{
- assert (other->pixel_format() == PIX_FMT_RGBA);
+ DCPOMATIC_ASSERT (other->pixel_format() == PIX_FMT_RGBA);
int const other_bpp = 4;
int start_tx = position.x;
@@ -439,7 +439,7 @@ Image::alpha_blend (shared_ptr<const Image> other, Position<int> position)
break;
}
default:
- assert (false);
+ DCPOMATIC_ASSERT (false);
}
}
@@ -447,8 +447,8 @@ void
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);
- assert (position.x >= 0 && position.y >= 0);
+ DCPOMATIC_ASSERT (_pixel_format == PIX_FMT_RGB24 && other->pixel_format() == PIX_FMT_RGB24);
+ DCPOMATIC_ASSERT (position.x >= 0 && position.y >= 0);
int const N = min (position.x + other->size().width, size().width) - position.x;
for (int ty = position.y, oy = 0; ty < size().height && oy < other->size().height; ++ty, ++oy) {
@@ -609,7 +609,7 @@ Image::Image (shared_ptr<const Image> other, bool aligned)
allocate ();
for (int i = 0; i < components(); ++i) {
- assert(line_size()[i] == other->line_size()[i]);
+ DCPOMATIC_ASSERT (line_size()[i] == other->line_size()[i]);
uint8_t* p = _data[i];
uint8_t* q = other->data()[i];
for (int j = 0; j < lines(i); ++j) {