MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DrawSwatch

Method DrawSwatch

editor/WorldTexturesDialog.cpp:2133–2160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2131}
2132
2133void CWorldTexturesDialog::DrawSwatch(int handle, float r, float g, float b) {
2134 CWnd *texwnd;
2135 RECT rect;
2136 int w, h;
2137 float rmax = std::max(r, g);
2138 rmax = std::max(rmax, b);
2139
2140 if (rmax >= .001) {
2141 r /= rmax;
2142 g /= rmax;
2143 b /= rmax;
2144 }
2145
2146 texwnd = GetDlgItem(handle);
2147 texwnd->GetWindowRect(&rect);
2148 ScreenToClient(&rect);
2149
2150 Desktop_surf->attach_to_window((unsigned)m_hWnd);
2151
2152 w = rect.right - rect.left;
2153 h = rect.bottom - rect.top;
2154
2155 ddgr_color color = GR_RGB(r * 255, g * 255, b * 255);
2156
2157 Desktop_surf->clear(rect.left, rect.top, w, h, color);
2158
2159 Desktop_surf->attach_to_window(NULL);
2160}
2161
2162void CWorldTexturesDialog::ChangeSize(int w, int h) {
2163 int n = D3EditState.texdlg_texture;

Callers

nothing calls this directly

Calls 3

attach_to_windowMethod · 0.80
GR_RGBFunction · 0.50
clearMethod · 0.45

Tested by

no test coverage detected