From 22c245ffd11a6ed7d1eae940c6d44ea09f37d92e Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sat, 16 Oct 2021 09:41:19 -0400 Subject: [PATCH] Update pdfioContentSetDashPattern to accept doubles (Issue #25) --- CHANGES.md | 1 + pdfio-content.c | 8 ++++---- pdfio-content.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0a89de8..2ed842c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ v1.0.0 (TBD) (Issue #21) - Fixed `all-shared` target (Issue #22) - Fixed memory leaks (Issue #23) +- Updated `pdfioContentSetDashPattern` to accept `double` values (Issue #25) - Fixed some issues identified by a Coverity scan. diff --git a/pdfio-content.c b/pdfio-content.c index c020960..0d27241 100644 --- a/pdfio-content.c +++ b/pdfio-content.c @@ -660,11 +660,11 @@ pdfioContentSave(pdfio_stream_t *st) // I - Stream bool // O - `true` on success, `false` on failure pdfioContentSetDashPattern( pdfio_stream_t *st, // I - Stream - int phase, // I - Phase (offset within pattern) - int on, // I - On length - int off) // I - Off length + double phase, // I - Phase (offset within pattern) + double on, // I - On length + double off) // I - Off length { - return (pdfioStreamPrintf(st, "[%d %d] %d d\n", on, off, phase)); + return (pdfioStreamPrintf(st, "[%g %g] %g d\n", on, off, phase)); } diff --git a/pdfio-content.h b/pdfio-content.h index 004b620..412b62f 100644 --- a/pdfio-content.h +++ b/pdfio-content.h @@ -96,7 +96,7 @@ extern bool pdfioContentPathMoveTo(pdfio_stream_t *st, double x, double y) _PDF extern bool pdfioContentPathRect(pdfio_stream_t *st, double x, double y, double width, double height) _PDFIO_PUBLIC; extern bool pdfioContentRestore(pdfio_stream_t *st) _PDFIO_PUBLIC; extern bool pdfioContentSave(pdfio_stream_t *st) _PDFIO_PUBLIC; -extern bool pdfioContentSetDashPattern(pdfio_stream_t *st, int phase, int on, int off) _PDFIO_PUBLIC; +extern bool pdfioContentSetDashPattern(pdfio_stream_t *st, double phase, double on, double off) _PDFIO_PUBLIC; extern bool pdfioContentSetFillColorDeviceCMYK(pdfio_stream_t *st, double c, double m, double y, double k) _PDFIO_PUBLIC; extern bool pdfioContentSetFillColorDeviceGray(pdfio_stream_t *st, double g) _PDFIO_PUBLIC; extern bool pdfioContentSetFillColorDeviceRGB(pdfio_stream_t *st, double r, double g, double b) _PDFIO_PUBLIC;