| 2469 | } |
| 2470 | |
| 2471 | int CColorCopDlg::DecimaltoWebsafe(int originalDec) { |
| 2472 | // Convert an RGB component (0–255) to the nearest web‑safe value. |
| 2473 | // Web‑safe colors use steps of 51: {0, 51, 102, 153, 204, 255}. |
| 2474 | // We compute how far 'originalDec' is from the nearest step and |
| 2475 | // round down if the offset is small, otherwise round up. |
| 2476 | // |
| 2477 | // Example: 128 → offset 128 % 51 = 26 → round up to 153. |
| 2478 | |
| 2479 | const int offset = originalDec % WEBSAFE_STEP; |
| 2480 | |
| 2481 | if (offset == 0) { |
| 2482 | // Already exactly on a web‑safe boundary |
| 2483 | return originalDec; |
| 2484 | } |
| 2485 | |
| 2486 | // If we're closer to the lower boundary (offset < 25), round down. |
| 2487 | // Otherwise, round up to the next 51‑multiple. |
| 2488 | return (offset < WEBSAFE_STEP / 2) |
| 2489 | ? (originalDec - offset) |
| 2490 | : (originalDec + (WEBSAFE_STEP - offset)); |
| 2491 | } |
| 2492 | |
| 2493 | void CColorCopDlg::OnOptionsOmitsymbol() { |
| 2494 | m_Appflags ^= OmitPound; |
nothing calls this directly
no outgoing calls
no test coverage detected