Coverage Report

Created: 2026-04-01 07:17

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ghostpdl/pcl/pl/plht.c
Line
Count
Source
1
/* Copyright (C) 2001-2023 Artifex Software, Inc.
2
   All Rights Reserved.
3
4
   This software is provided AS-IS with no warranty, either express or
5
   implied.
6
7
   This software is distributed under license and may not be copied,
8
   modified or distributed except as expressly authorized under the terms
9
   of the license contained in the file LICENSE in this distribution.
10
11
   Refer to licensing information at http://www.artifex.com or contact
12
   Artifex Software, Inc.,  39 Mesa Street, Suite 108A, San Francisco,
13
   CA 94129, USA, for further information.
14
*/
15
16
17
/* plht.c - shared halftone resource. */
18
#include "stdpre.h"
19
#include "gstypes.h"
20
#include "gsmemory.h"
21
#include "gxtmap.h"
22
#include "gsstate.h"
23
#include "gxht.h"
24
#include "gxdevice.h"
25
#include "plht.h"
26
27
int
28
pl_set_pcl_halftone(gs_gstate * pgs, gs_mapping_proc transfer_proc,
29
                    int width, int height,
30
                    gs_string threshold_data, int phase_x, int phase_y)
31
8.67k
{
32
33
8.67k
    int code;
34
8.67k
    gs_halftone ht;
35
36
    /* nothing to do for a contone device */
37
8.67k
    if (!gx_device_must_halftone(gs_currentdevice(pgs)))
38
0
        return 0;
39
8.67k
    code = gs_settransfer(pgs, transfer_proc);
40
8.67k
    if (code < 0)
41
0
        return code;
42
8.67k
    memset(&ht.rc, 0x00, sizeof(ht.rc));
43
8.67k
    ht.type = ht_type_threshold;
44
8.67k
    ht.objtype = HT_OBJTYPE_DEFAULT;
45
8.67k
    ht.params.threshold.width = width;
46
8.67k
    ht.params.threshold.height = height;
47
8.67k
    ht.params.threshold.thresholds.data = threshold_data.data;
48
8.67k
    ht.params.threshold.thresholds.size = threshold_data.size;
49
8.67k
    ht.params.threshold.transfer = 0;
50
8.67k
    ht.params.threshold.transfer_closure.proc = 0;
51
8.67k
    code = gs_sethalftone(pgs, &ht);
52
8.67k
    if (code < 0)
53
0
        return code;
54
8.67k
    return gs_sethalftonephase(pgs, phase_x, phase_y);
55
8.67k
}