[Image] [Inspection] remove superfluous nullptr checks
This commit is contained in:
@@ -201,7 +201,7 @@ int ImageBase::_setColorFormat(int format, unsigned short numSigBitsPerSample)
|
||||
int ImageBase::_allocate()
|
||||
{
|
||||
// Check that pixel data pointer is null
|
||||
if (_pPixelData != nullptr)
|
||||
if (_pPixelData)
|
||||
return -1;
|
||||
|
||||
// Allocate the space needed to store the pixel data
|
||||
@@ -296,7 +296,7 @@ int ImageBase::pointTo(void* pSrcPixelData, unsigned long width, unsigned long h
|
||||
// if there is no image data
|
||||
int ImageBase::getSample(int x, int y, unsigned short sampleIndex, double &value)
|
||||
{
|
||||
if ((_pPixelData == nullptr) ||
|
||||
if ((!_pPixelData) ||
|
||||
(sampleIndex >= _numSamples) ||
|
||||
(x < 0) || (x >= (int)_width) ||
|
||||
(y < 0) || (y >= (int)_height))
|
||||
|
||||
@@ -243,7 +243,7 @@ void GLImageBox::drawImage()
|
||||
glPixelTransferf(GL_BLUE_SCALE, (float)scale);
|
||||
|
||||
// Load the color map if present
|
||||
if (_pColorMap != nullptr)
|
||||
if (_pColorMap)
|
||||
{
|
||||
if (!haveMesa) glPixelTransferf(GL_MAP_COLOR, 1.0);
|
||||
glPixelMapfv(GL_PIXEL_MAP_R_TO_R, _numMapEntries, _pColorMap);
|
||||
@@ -851,7 +851,7 @@ int GLImageBox::setColorMapAlphaValue(int index, float value)
|
||||
// Helper function to convert a pixel's value (of a sample) to the color map index (i.e. the map index that will be used for that pixel value)
|
||||
unsigned int GLImageBox::pixValToMapIndex(double PixVal)
|
||||
{
|
||||
if (_pColorMap != nullptr)
|
||||
if (_pColorMap)
|
||||
{
|
||||
double MaxVal = pow(2.0, _image.getNumBitsPerSample()) - 1.0;
|
||||
double Scale = (pow(2.0, _image.getNumBitsPerSample()) - 1.0) / (pow(2.0, _image.getNumSigBitsPerSample()) - 1.0);
|
||||
|
||||
Reference in New Issue
Block a user