]> git.cworth.org Git - apitrace/commitdiff
gui: fix pixel info on flipped images
authorZack Rusin <zack@kde.org>
Fri, 11 Oct 2013 22:32:25 +0000 (18:32 -0400)
committerZack Rusin <zack@kde.org>
Fri, 11 Oct 2013 22:34:12 +0000 (18:34 -0400)
Flipped images were still using the original image instead of
flipping the coordinates, thus returning the wrong data. Let's just
flip the y-axis to find the right location in the original image.

gui/imageviewer.cpp

index eced83b63dd3eba1ae64fc36ced0c512e71b1a9d..867fa61a48cf31ed540616ca8b03b4b5e630ee30 100644 (file)
@@ -151,6 +151,11 @@ void ImageViewer::showPixel(int x, int y)
 
     QString label = tr("Pixel: ");
 
+    /* If the image is flipped, substitute y to match */
+    if (flipCheckBox->isChecked()) {
+        y = m_convertedImage.height() - y - 1;
+    }
+
     if (m_image->channelType == image::TYPE_UNORM8) {
         label += createPixelLabel<unsigned char>(m_image, x, y);
     } else {