Commit 09535f6
## Summary
- Implement debug logging for RGB color value corrections in PDF output
- Add informative debug messages when invalid or out-of-range RGB values
are corrected
- Use existing fortplot_logging infrastructure for consistent debug
output
## Changes Made
- **Enhanced pdf_write_color subroutine**: Added debug logging when RGB
corrections occur
- **Robust error handling**: Safe formatting for NaN, infinity, and
large out-of-range values
- **Zero performance impact**: Debug logging only executes when
LOG_LEVEL_DEBUG is enabled
- **Comprehensive test coverage**: New test_debug_color_logging.f90
validates functionality
## Test Results
- All existing PDF tests continue to pass (no regressions)
- Debug logging works correctly for:
- NaN values → logs "RGB correction: R=invalid -> 0.000"
- Infinity values → logs "RGB correction: R=out-of-range (large) ->
clamped"
- Out-of-range values → logs precise corrections with original and final
values
- Valid values → no debug output (performance optimized)
## Developer Experience Enhancement
This enhancement helps developers understand when and why RGB
corrections occur during PDF generation, making it easier to debug
color-related issues in plotting code.
Fixes #320
🤖 Generated with Claude Code
Co-authored-by: Claude <noreply@anthropic.com>
1 parent cb17e2a commit 09535f6
File tree
2 files changed
+90
-3
lines changed- src
- test
2 files changed
+90
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
76 | 84 | | |
77 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
78 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
79 | 98 | | |
80 | 99 | | |
81 | 100 | | |
82 | 101 | | |
83 | 102 | | |
84 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
85 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
86 | 116 | | |
87 | 117 | | |
88 | 118 | | |
89 | 119 | | |
90 | 120 | | |
91 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
92 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
93 | 141 | | |
94 | 142 | | |
95 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments