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

Method cacheDocument

qrenderdoc/Code/QRDUtils.cpp:290–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288 }
289
290 void cacheDocument(const QWidget *widget)
291 {
292 if(!ctxptr)
293 ctxptr = getCaptureContext(widget);
294
295 if(!ctxptr)
296 return;
297
298 ICaptureContext &ctx = *(ICaptureContext *)ctxptr;
299
300 int refCache = ctx.ResourceNameCacheID();
301
302 if(cacheId == refCache && textCacheId == refCache)
303 return;
304
305 cacheId = refCache;
306 textCacheId = refCache;
307
308 // use a table to ensure images don't screw up the baseline for text. DON'T JUDGE ME.
309 QString html = lit("<table><tr>");
310
311 int i = 0;
312
313 bool highdpi = widget && widget->devicePixelRatioF() > 1.0;
314
315 QVector<int> fragmentIndexFromBlockIndex;
316
317 // there's an empty block at the start.
318 fragmentIndexFromBlockIndex.push_back(-1);
319
320 text.clear();
321
322 numLines = 1;
323
324 for(const QVariant &v : fragments)
325 {
326 if(v.userType() == qMetaTypeId<ResourceId>())
327 {
328 QString resname = GetTruncatedResourceName(ctx, v.value<ResourceId>()).toHtmlEscaped();
329 html += lit("<td valign=\"middle\" style=\"line-height: 14px\"><b>%1</b></td>"
330 "<td valign=\"middle\" style=\"line-height: 14px\">"
331 "<img width=\"16\" src=':/link%3.png'></td>")
332 .arg(resname)
333 .arg(highdpi ? lit("@2x") : QString());
334 text += resname;
335
336 // these generate two blocks (one for each cell)
337 fragmentIndexFromBlockIndex.push_back(i);
338 fragmentIndexFromBlockIndex.push_back(i);
339 }
340 else if(v.userType() == qMetaTypeId<ShaderMessageLink>())
341 {
342 ShaderMessageLink link = v.value<ShaderMessageLink>();
343
344 QString msgstr =
345 QApplication::translate("qrenderdoc", "%n msg(s)", "Shader messages", link.numMessages);
346
347 html += lit("<td valign=\"middle\" style=\"line-height: 14px\">"

Callers 4

RichResourceTextPaintFunction · 0.80

Calls 14

getCaptureContextFunction · 0.85
GetTruncatedResourceNameFunction · 0.85
QLatin1CharClass · 0.85
toLatin1Method · 0.80
QStringFunction · 0.50
translateFunction · 0.50
ResourceNameCacheIDMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45
argMethod · 0.45
typeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected