summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2020-05-20 14:43:27 -0600
committerDave Houlton <euclid@lindenlab.com>2020-05-20 14:43:27 -0600
commitabbd55db30d455710092f58053c66d8c931af60b (patch)
tree5a189ac3c46493484aabc9513fb9ae8d86da216b
parent9edfdf06cc50739682458ef54c62676f5882e949 (diff)
DRTVWR-510: Fix coord error in 'Show Color Under Cursor'
-rw-r--r--indra/newview/llviewerwindow.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 0b5ca0b79c..09f86ae391 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -841,16 +841,21 @@ public:
ypos += y_inc;
}
// disable use of glReadPixels which messes up nVidia nSight graphics debugging
- if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport)
- {
- U8 color[4];
- LLCoordGL coord = gViewerWindow->getCurrentMouse();
- glReadPixels(coord.mX, coord.mY, 1,1,GL_RGBA, GL_UNSIGNED_BYTE, color);
- addText(xpos, ypos, llformat("%d %d %d %d", color[0], color[1], color[2], color[3]));
- ypos += y_inc;
- }
+ if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport)
+ {
+ U8 color[4];
+ LLCoordGL coord = gViewerWindow->getCurrentMouse();
+
+ // Convert x,y to raw pixel coords
+ S32 x_raw = llround(coord.mX * gViewerWindow->getWindowWidthRaw() / (F32) gViewerWindow->getWindowWidthScaled());
+ S32 y_raw = llround(coord.mY * gViewerWindow->getWindowHeightRaw() / (F32) gViewerWindow->getWindowHeightScaled());
+
+ glReadPixels(x_raw, y_raw, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color);
+ addText(xpos, ypos, llformat("Pixel <%1d, %1d> R:%1d G:%1d B:%1d A:%1d", x_raw, y_raw, color[0], color[1], color[2], color[3]));
+ ypos += y_inc;
+ }
- // only display these messages if we are actually rendering beacons at this moment
+ // only display these messages if we are actually rendering beacons at this moment
if (LLPipeline::getRenderBeacons() && LLFloaterReg::instanceVisible("beacons"))
{
if (LLPipeline::getRenderMOAPBeacons())