mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-19 13:06:38 +00:00
Scroll selected pixel to centre on goto. Refs #1885
This commit is contained in:
@@ -1979,13 +1979,22 @@ void TextureViewer::GotoLocation(int x, int y)
|
||||
if(tex == NULL)
|
||||
return;
|
||||
|
||||
x = qMin(x << m_TexDisplay.subresource.mip, int(tex->width - 1));
|
||||
y = qMin(y << m_TexDisplay.subresource.mip, int(tex->height - 1));
|
||||
|
||||
m_PickedPoint = QPoint(x, y);
|
||||
|
||||
uint32_t mipHeight = qMax(1U, tex->height >> (int)m_TexDisplay.subresource.mip);
|
||||
if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL)
|
||||
m_PickedPoint.setY((int)(mipHeight - 1) - m_PickedPoint.y());
|
||||
m_PickedPoint.setY((int)(tex->height - 1) - m_PickedPoint.y());
|
||||
if(m_TexDisplay.flipY)
|
||||
m_PickedPoint.setY((int)(mipHeight - 1) - m_PickedPoint.x());
|
||||
m_PickedPoint.setY((int)(tex->height - 1) - m_PickedPoint.x());
|
||||
|
||||
// centre the picked point.
|
||||
QPoint scrollPos;
|
||||
scrollPos.setX(-m_PickedPoint.x() * m_TexDisplay.scale + realRenderWidth() / 2);
|
||||
scrollPos.setY(-m_PickedPoint.y() * m_TexDisplay.scale + realRenderHeight() / 2);
|
||||
|
||||
setScrollPosition(scrollPos);
|
||||
|
||||
if(m_Output != NULL)
|
||||
INVOKE_MEMFN(RT_PickPixelsAndUpdate);
|
||||
@@ -3630,6 +3639,9 @@ void TextureViewer::ShowGotoPopup()
|
||||
{
|
||||
QPoint p = m_PickedPoint;
|
||||
|
||||
p.setX(p.x() >> (int)m_TexDisplay.subresource.mip);
|
||||
p.setY(p.y() >> (int)m_TexDisplay.subresource.mip);
|
||||
|
||||
uint32_t mipHeight = qMax(1U, texptr->height >> (int)m_TexDisplay.subresource.mip);
|
||||
|
||||
if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL)
|
||||
|
||||
Reference in New Issue
Block a user