better asserts

This commit is contained in:
David Rose 2003-04-14 17:11:56 +00:00
parent 064955a02b
commit 53fee65d08
2 changed files with 3 additions and 0 deletions

View File

@ -192,6 +192,7 @@ is_valid() const {
////////////////////////////////////////////////////////////////////
INLINE void PNMImage::
set_num_channels(int num_channels) {
nassertv(num_channels >= 1 && num_channels <= 4);
set_color_type((ColorType)num_channels);
}

View File

@ -54,6 +54,7 @@ void PNMImage::
clear(int x_size, int y_size, int num_channels,
xelval maxval, PNMFileType *type) {
clear();
nassertv(num_channels >= 1 && num_channels <= 4);
_x_size = x_size;
_y_size = y_size;
@ -273,6 +274,7 @@ write(PNMWriter *writer) const {
////////////////////////////////////////////////////////////////////
void PNMImage::
set_color_type(PNMImage::ColorType color_type) {
nassertv((int)color_type >= 1 && (int)color_type <= 4);
if (color_type == get_color_type()) {
return;
}