diff --git a/src/Mod/Image/Gui/AppImageGuiPy.cpp b/src/Mod/Image/Gui/AppImageGuiPy.cpp index 0b67532756..389b3f4966 100644 --- a/src/Mod/Image/Gui/AppImageGuiPy.cpp +++ b/src/Mod/Image/Gui/AppImageGuiPy.cpp @@ -75,7 +75,7 @@ private: // Extract image into a general RGB format recognised by the ImageView class int format = IB_CF_RGB24; unsigned char *pPixelData = nullptr; - if (imageq.isNull() == false) { + if (!imageq.isNull()) { pPixelData = new unsigned char[3 * (unsigned long)imageq.width() * (unsigned long)imageq.height()]; unsigned char *pPix = pPixelData; for (int r = 0; r < imageq.height(); r++) { diff --git a/src/Mod/Image/Gui/ImageView.cpp b/src/Mod/Image/Gui/ImageView.cpp index 5d084733aa..548b0c1b7b 100644 --- a/src/Mod/Image/Gui/ImageView.cpp +++ b/src/Mod/Image/Gui/ImageView.cpp @@ -134,7 +134,7 @@ QSize ImageView::minimumSizeHint () const // Enable or disable the status bar void ImageView::enableStatusBar(bool Enable) { - if (Enable == true) + if (Enable) { // Create the default status bar for displaying messages and disable the gripper _statusBarEnabled = true; @@ -328,7 +328,7 @@ int ImageView::pointImageTo(void* pSrcPixelData, unsigned long width, unsigned l // called when user presses X void ImageView::closeEvent(QCloseEvent *e) { - if (_ignoreCloseEvent == true) + if (_ignoreCloseEvent) { // ignore the close event e->ignore(); @@ -343,7 +343,7 @@ void ImageView::closeEvent(QCloseEvent *e) // Mouse press event void ImageView::mousePressEvent(QMouseEvent* cEvent) { - if (_mouseEventsEnabled == true) + if (_mouseEventsEnabled) { // Mouse event coordinates are relative to top-left of image view (including toolbar!) // Get current cursor position relative to top-left of image box @@ -379,7 +379,7 @@ void ImageView::mousePressEvent(QMouseEvent* cEvent) void ImageView::mouseDoubleClickEvent(QMouseEvent* cEvent) { - if (_mouseEventsEnabled == true) + if (_mouseEventsEnabled) { // Mouse event coordinates are relative to top-left of image view (including toolbar!) // Get current cursor position relative to top-left of image box @@ -413,7 +413,7 @@ void ImageView::mouseMoveEvent(QMouseEvent* cEvent) QPoint offset = _pGLImageBox->pos(); int box_x = cEvent->x() - offset.x(); int box_y = cEvent->y() - offset.y(); - if (_mouseEventsEnabled == true) + if (_mouseEventsEnabled) { switch(_currMode) { @@ -439,7 +439,7 @@ void ImageView::mouseMoveEvent(QMouseEvent* cEvent) // Mouse release event void ImageView::mouseReleaseEvent(QMouseEvent* cEvent) { - if (_mouseEventsEnabled == true) + if (_mouseEventsEnabled) { // Mouse event coordinates are relative to top-left of image view (including toolbar!) // Get current cursor position relative to top-left of image box @@ -467,7 +467,7 @@ void ImageView::mouseReleaseEvent(QMouseEvent* cEvent) // Mouse wheel event void ImageView::wheelEvent(QWheelEvent * cEvent) { - if (_mouseEventsEnabled == true) + if (_mouseEventsEnabled) { // Mouse event coordinates are relative to top-left of image view (including toolbar!) // Get current cursor position relative to top-left of image box @@ -506,7 +506,7 @@ void ImageView::showEvent (QShowEvent *) // Update the status bar with the image parameters for the current mouse position void ImageView::updateStatusBar() { - if (_statusBarEnabled == true) + if (_statusBarEnabled) { // Create the text string to display in the status bar QString txt = createStatusBarText(); diff --git a/src/Mod/Image/Gui/OpenGLImageBox.cpp b/src/Mod/Image/Gui/OpenGLImageBox.cpp index 7ee2e0c045..0ce37dcf5f 100644 --- a/src/Mod/Image/Gui/OpenGLImageBox.cpp +++ b/src/Mod/Image/Gui/OpenGLImageBox.cpp @@ -187,7 +187,7 @@ void GLImageBox::paintGL() drawImage(); // Emit a signal for owners to draw any graphics that is needed. - if (_image.hasValidData() == true) + if (_image.hasValidData()) drawGraphics(); // flush the OpenGL graphical pipeline @@ -203,7 +203,7 @@ void GLImageBox::paintGL() // Draw the image void GLImageBox::drawImage() { - if (_image.hasValidData() == false) + if (!_image.hasValidData()) return; // Gets the size of the displayed image area using the current display settings @@ -275,7 +275,7 @@ void GLImageBox::drawImage() // (in units of image pixels) void GLImageBox::getDisplayedImageAreaSize(int &dx, int &dy) { - if (_image.hasValidData() == false) + if (!_image.hasValidData()) { dx = 0; dy = 0; @@ -399,7 +399,7 @@ void GLImageBox::getPixFormat(GLenum &pixFormat, GLenum &pixType) // Currently we don't limit it! void GLImageBox::limitCurrPos() { - if (_image.hasValidData() == false) + if (!_image.hasValidData()) return; /* @@ -435,7 +435,7 @@ void GLImageBox::setCurrPos(int x0, int y0) // Fixes a base position at the current position void GLImageBox::fixBasePosCurr() { - if (_image.hasValidData() == false) + if (!_image.hasValidData()) { _base_x0 = 0; _base_y0 = 0; @@ -452,7 +452,7 @@ void GLImageBox::fixBasePosCurr() // This function does not redraw (call redraw afterwards) void GLImageBox::setZoomFactor(double zoomFactor, bool useCentrePt, int ICx, int ICy) { - if ((useCentrePt == false) || (_image.hasValidData() == false)) + if (!useCentrePt || !_image.hasValidData()) { _zoomFactor = zoomFactor; limitZoomFactor(); @@ -478,7 +478,7 @@ void GLImageBox::setZoomFactor(double zoomFactor, bool useCentrePt, int ICx, int // This function redraws void GLImageBox::stretchToFit() { - if (_image.hasValidData() == false) + if (!_image.hasValidData()) return; setToFit(); @@ -490,7 +490,7 @@ void GLImageBox::stretchToFit() // This function does not redraw (call redraw afterwards) void GLImageBox::setToFit() { - if (_image.hasValidData() == false) + if (!_image.hasValidData()) return; // Compute ideal zoom factor to fit the image @@ -512,7 +512,7 @@ void GLImageBox::setToFit() // This function does not redraw (call redraw afterwards) void GLImageBox::setNormal() { - if (_image.hasValidData() == false) + if (!_image.hasValidData()) return; if (((int)(_image.getWidth()) < width()) && ((int)(_image.getHeight()) < height())) @@ -711,7 +711,7 @@ int GLImageBox::calcNumColorMapEntries() GLint maxMapEntries; glGetIntegerv(GL_MAX_PIXEL_MAP_TABLE, &maxMapEntries); int NumEntries = maxMapEntries; - if (_image.hasValidData() == true) + if (_image.hasValidData()) NumEntries = (int)std::min(pow(2.0, (double)(_image.getNumSigBitsPerSample())), (double)maxMapEntries); return NumEntries; } @@ -750,7 +750,7 @@ int GLImageBox::createColorMap(int numEntriesReq, bool Initialise) // Initialise the color map if requested // (All red entries come first, then green, then blue, then alpha) - if (Initialise == true) + if (Initialise) { // For each RGB channel int arrayIndex = 0;