MCPcopy Create free account
hub / github.com/baldurk/renderdoc / disassembly_buttonReleased

Method disassembly_buttonReleased

qrenderdoc/Windows/ShaderViewer.cpp:2149–2216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2147}
2148
2149void ShaderViewer::disassembly_buttonReleased(QMouseEvent *event)
2150{
2151 if(event->button() == Qt::LeftButton)
2152 {
2153 sptr_t scintillaPos = m_DisassemblyView->positionFromPoint(event->x(), event->y());
2154
2155 sptr_t start = m_DisassemblyView->wordStartPosition(scintillaPos, true);
2156 sptr_t end = m_DisassemblyView->wordEndPosition(scintillaPos, true);
2157
2158 QString text = QString::fromUtf8(m_DisassemblyView->textRange(start, end));
2159
2160 QRegularExpression regexp(lit("^[xyzwrgba]+$"));
2161
2162 // if we match a swizzle look before that for the variable
2163 if(regexp.match(text).hasMatch())
2164 {
2165 start--;
2166 while(isspace(m_DisassemblyView->charAt(start)))
2167 start--;
2168
2169 if(m_DisassemblyView->charAt(start) == '.')
2170 {
2171 end = m_DisassemblyView->wordEndPosition(start - 1, true);
2172 start = m_DisassemblyView->wordStartPosition(start - 1, true);
2173
2174 text = QString::fromUtf8(m_DisassemblyView->textRange(start, end));
2175 }
2176 }
2177
2178 if(!text.isEmpty())
2179 {
2180 if(getVarFromPath(text))
2181 {
2182 start = 0;
2183 end = m_DisassemblyView->length();
2184
2185 QColor highlightColor = QColor::fromHslF(
2186 0.333f, 1.0f, qBound(0.25, palette().color(QPalette::Base).lightnessF(), 0.85));
2187
2188 highlightMatchingVars(ui->debugVars->invisibleRootItem(), text, highlightColor);
2189 highlightMatchingVars(ui->constants->invisibleRootItem(), text, highlightColor);
2190 highlightMatchingVars(ui->accessedResources->invisibleRootItem(), text, highlightColor);
2191 highlightMatchingVars(ui->sourceVars->invisibleRootItem(), text, highlightColor);
2192
2193 m_DisassemblyView->setIndicatorCurrent(INDICATOR_REGHIGHLIGHT);
2194 m_DisassemblyView->indicatorClearRange(start, end);
2195
2196 sptr_t flags = SCFIND_MATCHCASE | SCFIND_WHOLEWORD | SCFIND_REGEXP | SCFIND_POSIX;
2197 text += lit("\\.[xyzwrgba]+");
2198
2199 QByteArray findUtf8 = text.toUtf8();
2200
2201 QPair<int, int> result;
2202
2203 do
2204 {
2205 result = m_DisassemblyView->findText(flags, findUtf8.data(), start, end);
2206

Callers

nothing calls this directly

Calls 15

positionFromPointMethod · 0.80
wordStartPositionMethod · 0.80
wordEndPositionMethod · 0.80
charAtMethod · 0.80
invisibleRootItemMethod · 0.80
setIndicatorCurrentMethod · 0.80
indicatorClearRangeMethod · 0.80
toUtf8Method · 0.80
findTextMethod · 0.80
indicatorFillRangeMethod · 0.80
fromUtf8Function · 0.50
xMethod · 0.45

Tested by

no test coverage detected