Coverage Report

Created: 2026-04-01 07:17

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ghostpdl/xps/xpsvisual.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
/* XPS interpreter - visual brush functions */
18
19
#include "ghostxps.h"
20
21
enum { TILE_NONE, TILE_TILE, TILE_FLIP_X, TILE_FLIP_Y, TILE_FLIP_X_Y };
22
23
struct userdata
24
{
25
    xps_context_t *ctx;
26
    xps_resource_t *dict;
27
    xps_item_t *visual_tag;
28
};
29
30
static int
31
xps_paint_visual_brush(xps_context_t *ctx, char *base_uri, xps_resource_t *dict, xps_item_t *root, void *visual_tag)
32
0
{
33
0
    return xps_parse_element(ctx, base_uri, dict, (xps_item_t *)visual_tag);
34
0
}
35
36
int
37
xps_parse_visual_brush(xps_context_t *ctx, char *base_uri, xps_resource_t *dict, xps_item_t *root)
38
0
{
39
0
    xps_item_t *node;
40
0
    int code;
41
42
0
    char *visual_uri;
43
0
    char *visual_att;
44
0
    xps_item_t *visual_tag = NULL;
45
46
0
    visual_att = xps_att(root, "Visual");
47
48
0
    for (node = xps_down(root); node; node = xps_next(node))
49
0
    {
50
0
        if (!strcmp(xps_tag(node), "VisualBrush.Visual"))
51
0
            visual_tag = xps_down(node);
52
0
    }
53
54
0
    visual_uri = base_uri;
55
0
    xps_resolve_resource_reference(ctx, dict, &visual_att, &visual_tag, &visual_uri);
56
57
0
    if (visual_tag)
58
0
    {
59
0
        code = xps_parse_tiling_brush(ctx, visual_uri, dict, root, xps_paint_visual_brush, visual_tag);
60
0
        if (code)
61
0
            return gs_rethrow(code, "cannot parse tiling brush");
62
0
    }
63
64
0
    return 0;
65
0
}