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

Function MakeSwatchIcon

qrenderdoc/Code/QRDUtils.cpp:1851–1870  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1849}
1850
1851QIcon MakeSwatchIcon(QWidget *parentWidget, QColor swatchColor)
1852{
1853 int h = parentWidget->fontMetrics().height();
1854 QPixmap pm(1, 1);
1855 pm.fill(swatchColor);
1856 pm = pm.scaled(QSize(h, h));
1857
1858 {
1859 QPainter painter(&pm);
1860
1861 QPen pen(parentWidget->palette().foreground(), 1.0);
1862 painter.setPen(pen);
1863 painter.drawLine(QPoint(0, 0), QPoint(h - 1, 0));
1864 painter.drawLine(QPoint(h - 1, 0), QPoint(h - 1, h - 1));
1865 painter.drawLine(QPoint(h - 1, h - 1), QPoint(0, h - 1));
1866 painter.drawLine(QPoint(0, h - 1), QPoint(0, 0));
1867 }
1868
1869 return QIcon(pm);
1870}
1871
1872float ConvertLinearToSRGB(float linear)
1873{

Callers 2

updateWatchVariableMethod · 0.85
UI_AddFixedVariablesMethod · 0.85

Calls 10

fontMetricsMethod · 0.80
scaledMethod · 0.80
foregroundMethod · 0.80
paletteMethod · 0.80
QSizeClass · 0.50
QPointClass · 0.50
QIconFunction · 0.50
heightMethod · 0.45
fillMethod · 0.45
drawLineMethod · 0.45

Tested by

no test coverage detected