mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
avoid division by zero
Origin commit data
------------------
Commit: 49c86a38b4
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2016-04-21 (Thu, 21 Apr 2016)
This commit is contained in:
@@ -774,10 +774,11 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy,
|
||||
r+=q[0]; g+=q[1]; b+=q[2]; a+=q[3];
|
||||
}
|
||||
}
|
||||
p[0]= uint8_t(r/sq);
|
||||
p[1]= uint8_t(g/sq);
|
||||
p[2]= uint8_t(b/sq);
|
||||
p[3]= uint8_t(a/sq);
|
||||
int sq_tmp = sq ? sq : 1;//avoid division by zero
|
||||
p[0]= uint8_t(r/sq_tmp);
|
||||
p[1]= uint8_t(g/sq_tmp);
|
||||
p[2]= uint8_t(b/sq_tmp);
|
||||
p[3]= uint8_t(a/sq_tmp);
|
||||
}
|
||||
}
|
||||
}else
|
||||
@@ -796,9 +797,10 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy,
|
||||
r+=q[0]; g+=q[1]; b+=q[2];
|
||||
}
|
||||
}
|
||||
p[0]= uint8_t(r/sq);
|
||||
p[1]= uint8_t(g/sq);
|
||||
p[2]= uint8_t(b/sq);
|
||||
int sq_tmp = sq ? sq : 1;//avoid division by zero
|
||||
p[0]= uint8_t(r/sq_tmp);
|
||||
p[1]= uint8_t(g/sq_tmp);
|
||||
p[2]= uint8_t(b/sq_tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user