Coverage Report

Created: 2025-06-24 07:01

/src/ghostpdl/base/gsrop.c
Line
Count
Source (jump to first uncovered line)
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
/* RasterOp / transparency accessing for library */
18
#include "gx.h"
19
#include "gserrors.h"
20
#include "gzstate.h"
21
#include "gsrop.h"
22
23
/* setrasterop */
24
int
25
gs_setrasterop(gs_gstate * pgs, gs_rop3_t rop)
26
0
{
27
0
    if (pgs->in_cachedevice)
28
0
        return_error(gs_error_undefined);
29
0
    pgs->log_op = (rop & rop3_1) | (pgs->log_op & ~rop3_1);
30
0
    return 0;
31
0
}
32
33
/* currentrasterop */
34
gs_rop3_t
35
gs_currentrasterop(const gs_gstate * pgs)
36
0
{
37
0
    return lop_rop(pgs->log_op);
38
0
}
39
40
/* setsourcetransparent */
41
int
42
gs_setsourcetransparent(gs_gstate * pgs, bool transparent)
43
0
{
44
0
    if (pgs->in_cachedevice)
45
0
        return_error(gs_error_undefined);
46
0
    pgs->log_op =
47
0
        (transparent ? pgs->log_op | lop_S_transparent :
48
0
         pgs->log_op & ~lop_S_transparent);
49
0
    return 0;
50
0
}
51
52
/* currentsourcetransparent */
53
bool
54
gs_currentsourcetransparent(const gs_gstate * pgs)
55
0
{
56
0
    return (pgs->log_op & lop_S_transparent) != 0;
57
0
}
58
59
/* settexturetransparent */
60
int
61
gs_settexturetransparent(gs_gstate * pgs, bool transparent)
62
0
{
63
0
    if (pgs->in_cachedevice)
64
0
        return_error(gs_error_undefined);
65
0
    pgs->log_op =
66
0
        (transparent ? pgs->log_op | lop_T_transparent :
67
0
         pgs->log_op & ~lop_T_transparent);
68
0
    return 0;
69
0
}
70
71
/* currenttexturetransparent */
72
bool
73
gs_currenttexturetransparent(const gs_gstate * pgs)
74
0
{
75
0
    return (pgs->log_op & lop_T_transparent) != 0;
76
0
}
77
78
/* Save/restore logical operation.  (For internal use only.) */
79
int
80
gs_set_logical_op(gs_gstate * pgs, gs_logical_operation_t lop)
81
27.6k
{
82
27.6k
    pgs->log_op = lop;
83
27.6k
    return 0;
84
27.6k
}
85
gs_logical_operation_t
86
gs_current_logical_op(const gs_gstate * pgs)
87
0
{
88
0
    return pgs->log_op;
89
0
}