Skip to content

Commit

Permalink
Fix the color depth returned when reading the gray.cpt master CPT. (#…
Browse files Browse the repository at this point in the history
…8522)

* Fix the color depth returned when reading the gray.cpt master CPT.

* Fix typo.
  • Loading branch information
joa-quim authored Jun 17, 2024
1 parent 1befd6f commit f9064b2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gmt_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -8788,6 +8788,9 @@ struct GMT_PALETTE * gmtlib_read_cpt (struct GMT_CTRL *GMT, void *source, unsign
if (n < n_alloc) X->data = gmt_M_memory (GMT, X->data, n, struct GMT_LUT);
X->n_colors = n;

/* The master gray.cpt has only one slice and hence it comes out as both gray & bw, but it can only be one of them. */
if (X->n_colors == 1 && X->is_gray && X->is_bw) X->is_bw = false; /* Prefer gray over bw (would crash grdimage with externals). */

if (X->categorical) { /* Set up fake ranges so CPT is continuous */
dz = 1.0; /* This will presumably get reset in the loop */
for (i = 0; i < X->n_colors; i++) {
Expand Down

0 comments on commit f9064b2

Please sign in to comment.