Image: modernize C++11

* use nullptr
This commit is contained in:
wmayer
2022-03-23 18:42:42 +01:00
parent d430940515
commit 58d1cc4818
5 changed files with 17 additions and 17 deletions

View File

@@ -74,7 +74,7 @@ private:
// Extract image into a general RGB format recognised by the ImageView class
int format = IB_CF_RGB24;
unsigned char *pPixelData = NULL;
unsigned char *pPixelData = nullptr;
if (imageq.isNull() == false) {
pPixelData = new unsigned char[3 * (unsigned long)imageq.width() * (unsigned long)imageq.height()];
unsigned char *pPix = pPixelData;

View File

@@ -101,7 +101,7 @@ GLImageBox::GLImageBox(QWidget * parent, Qt::WindowFlags f)
_zoomFactor = 1.0;
_base_x0 = 0;
_base_y0 = 0;
_pColorMap = 0;
_pColorMap = nullptr;
_numMapEntries = 0;
#if defined(_DEBUG) && 0
@@ -243,7 +243,7 @@ void GLImageBox::drawImage()
glPixelTransferf(GL_BLUE_SCALE, (float)scale);
// Load the color map if present
if (_pColorMap != 0)
if (_pColorMap != nullptr)
{
if (!haveMesa) glPixelTransferf(GL_MAP_COLOR, 1.0);
glPixelMapfv(GL_PIXEL_MAP_R_TO_R, _numMapEntries, _pColorMap);
@@ -254,10 +254,10 @@ void GLImageBox::drawImage()
else
{
glPixelTransferf(GL_MAP_COLOR, 0.0);
glPixelMapfv(GL_PIXEL_MAP_R_TO_R, 0, NULL);
glPixelMapfv(GL_PIXEL_MAP_G_TO_G, 0, NULL);
glPixelMapfv(GL_PIXEL_MAP_B_TO_B, 0, NULL);
glPixelMapfv(GL_PIXEL_MAP_A_TO_A, 0, NULL);
glPixelMapfv(GL_PIXEL_MAP_R_TO_R, 0, nullptr);
glPixelMapfv(GL_PIXEL_MAP_G_TO_G, 0, nullptr);
glPixelMapfv(GL_PIXEL_MAP_B_TO_B, 0, nullptr);
glPixelMapfv(GL_PIXEL_MAP_A_TO_A, 0, nullptr);
}
// Get the pixel format
@@ -698,7 +698,7 @@ void GLImageBox::resetDisplay()
void GLImageBox::clearColorMap()
{
delete [] _pColorMap;
_pColorMap = 0;
_pColorMap = nullptr;
_numMapEntries = 0;
}
@@ -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 != NULL)
if (_pColorMap != nullptr)
{
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);

View File

@@ -37,7 +37,7 @@ class ImageGuiExport GLImageBox : public QOpenGLWidget
public:
GLImageBox(QWidget * parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
GLImageBox(QWidget * parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~GLImageBox();
Image::ImageBase *getImageBasePtr() { return &_image; }