From abbd55db30d455710092f58053c66d8c931af60b Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Wed, 20 May 2020 14:43:27 -0600 Subject: DRTVWR-510: Fix coord error in 'Show Color Under Cursor' --- indra/newview/llviewerwindow.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'indra') 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()) -- cgit v1.2.3