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

Method DrawSwatch

editor/TextureDialog.cpp:646–673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

644}
645
646void CTextureDialog::DrawSwatch(int handle, float r, float g, float b) {
647 CWnd *texwnd;
648 RECT rect;
649 int w, h;
650 float rmax = std::max(r, g);
651 rmax = std::max(rmax, b);
652
653 if (rmax >= .001) {
654 r /= rmax;
655 g /= rmax;
656 b /= rmax;
657 }
658
659 texwnd = GetDlgItem(handle);
660 texwnd->GetWindowRect(&rect);
661 ScreenToClient(&rect);
662
663 Desktop_surf->attach_to_window((unsigned)m_hWnd);
664
665 w = rect.right - rect.left;
666 h = rect.bottom - rect.top;
667
668 ddgr_color color = GR_RGB(r * 255, g * 255, b * 255);
669
670 Desktop_surf->clear(rect.left, rect.top, w, h, color);
671
672 Desktop_surf->attach_to_window(NULL);
673}
674
675void CTextureDialog::OnKillfocusTexscaleEdit() {
676 CEdit *ebox;

Callers 1

OnItemSelectedMethod · 0.45

Calls 3

attach_to_windowMethod · 0.80
GR_RGBFunction · 0.50
clearMethod · 0.45

Tested by

no test coverage detected