Coverage Report

Created: 2025-08-28 07:06

/src/ghostpdl/pdf/pdf_path.c
Line
Count
Source (jump to first uncovered line)
1
/* Copyright (C) 2018-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
/* Path operations for the PDF interpreter */
17
18
#include "pdf_int.h"
19
#include "pdf_font_types.h"
20
#include "pdf_gstate.h"
21
#include "pdf_path.h"
22
#include "pdf_stack.h"
23
#include "pdf_trans.h"
24
#include "gstypes.h"
25
#include "pdf_optcontent.h"
26
#include "gspath.h"         /* For gs_moveto() and friends */
27
#include "gspaint.h"        /* For gs_fill() and friends */
28
29
typedef enum path_segment_e {
30
    pdfi_moveto_seg,
31
    pdfi_lineto_seg,
32
    pdfi_curveto_seg,
33
    pdfi_re_seg,
34
    pdfi_v_curveto_seg,
35
    pdfi_y_curveto_seg,
36
    pdfi_closepath_seg
37
} pdfi_path_segment;
38
39
static int StorePathSegment(pdf_context *ctx, pdfi_path_segment segment, double *pts)
40
42.0M
{
41
42.0M
    int size = 0;
42
43
42.0M
    switch (segment)
44
42.0M
    {
45
7.63M
        case pdfi_moveto_seg:
46
23.6M
        case pdfi_lineto_seg:
47
23.6M
            size = 2;
48
23.6M
            break;
49
4.00M
        case pdfi_re_seg:
50
4.18M
        case pdfi_v_curveto_seg:
51
4.37M
        case pdfi_y_curveto_seg:
52
4.37M
            size = 4;
53
4.37M
                break;
54
13.0M
        case pdfi_curveto_seg:
55
13.0M
            size = 6;
56
13.0M
            break;
57
988k
        case pdfi_closepath_seg:
58
988k
            break;
59
0
        default:
60
0
            return_error(gs_error_undefined);
61
0
            break;
62
42.0M
    }
63
42.0M
    if (ctx->PathSegments == NULL) {
64
8.27M
        ctx->PathSegments = (char *)gs_alloc_bytes(ctx->memory, 1024, "StorePathSegment");
65
8.27M
        if (ctx->PathSegments == NULL)
66
0
            return_error(gs_error_VMerror);
67
8.27M
        ctx->PathSegmentsCurrent = ctx->PathSegments;
68
8.27M
        ctx->PathSegmentsTop = ctx->PathSegments + 1024;
69
8.27M
    }
70
42.0M
    if (ctx->PathSegmentsCurrent == ctx->PathSegmentsTop) {
71
3.81k
        char *new_accumulator = NULL;
72
3.81k
        uint64_t old_size;
73
74
3.81k
        old_size = ctx->PathSegmentsCurrent - ctx->PathSegments;
75
3.81k
        new_accumulator = (char *)gs_alloc_bytes(ctx->memory, old_size + 1024, "StorePathSegment");
76
3.81k
        if (new_accumulator == NULL)
77
0
            return_error(gs_error_VMerror);
78
3.81k
        memcpy(new_accumulator, ctx->PathSegments, old_size);
79
3.81k
        ctx->PathSegmentsCurrent = new_accumulator + old_size;
80
3.81k
        gs_free_object(ctx->memory, ctx->PathSegments, "StorePathSegment");
81
3.81k
        ctx->PathSegments = new_accumulator;
82
3.81k
        ctx->PathSegmentsTop = ctx->PathSegments + old_size + 1024;
83
3.81k
    }
84
85
42.0M
    if (ctx->PathPts == NULL) {
86
8.27M
        ctx->PathPts = (double *)gs_alloc_bytes(ctx->memory, 4096, "StorePathSegment");
87
8.27M
        if (ctx->PathPts == NULL)
88
0
            return_error(gs_error_VMerror);
89
8.27M
        ctx->PathPtsCurrent = ctx->PathPts;
90
8.27M
        ctx->PathPtsTop = ctx->PathPts + (4096 / sizeof(double));
91
8.27M
    }
92
42.0M
    if (ctx->PathPtsCurrent + size > ctx->PathPtsTop) {
93
50.3k
        double *new_accumulator = NULL;
94
50.3k
        uint64_t old_size;
95
96
50.3k
        old_size = (char *)ctx->PathPtsCurrent - (char *)ctx->PathPts;
97
50.3k
        new_accumulator = (double *)gs_alloc_bytes(ctx->memory, old_size + 4096, "StorePathSegment");
98
50.3k
        if (new_accumulator == NULL)
99
0
            return_error(gs_error_VMerror);
100
50.3k
        memcpy(new_accumulator, ctx->PathPts, old_size);
101
50.3k
        ctx->PathPtsCurrent = new_accumulator + (old_size / sizeof(double));
102
50.3k
        gs_free_object(ctx->memory, ctx->PathPts, "StorePathSegment");
103
50.3k
        ctx->PathPts = new_accumulator;
104
50.3k
        ctx->PathPtsTop = ctx->PathPts + ((old_size + 4096) / sizeof(double));
105
50.3k
    }
106
107
42.0M
    *(ctx->PathSegmentsCurrent++) = (char)segment;
108
42.0M
    switch (segment)
109
42.0M
    {
110
7.63M
        case pdfi_moveto_seg:
111
23.6M
        case pdfi_lineto_seg:
112
23.6M
            memcpy(ctx->PathPtsCurrent, pts, 2 * sizeof(double));
113
23.6M
            ctx->PathPtsCurrent += 2;
114
23.6M
            break;
115
4.00M
        case pdfi_re_seg:
116
4.18M
        case pdfi_v_curveto_seg:
117
4.37M
        case pdfi_y_curveto_seg:
118
4.37M
            memcpy(ctx->PathPtsCurrent, pts, 4 * sizeof(double));
119
4.37M
            ctx->PathPtsCurrent += 4;
120
4.37M
            break;
121
13.0M
        case pdfi_curveto_seg:
122
13.0M
            memcpy(ctx->PathPtsCurrent, pts, 6 * sizeof(double));
123
13.0M
            ctx->PathPtsCurrent += 6;
124
13.0M
            break;
125
988k
        case pdfi_closepath_seg:
126
988k
            break;
127
42.0M
    }
128
42.0M
    return 0;
129
42.0M
}
130
131
static int ApplyStoredPath(pdf_context *ctx)
132
8.75M
{
133
8.75M
    int code = 0;
134
8.75M
    char *op = NULL;
135
8.75M
    double *dpts = NULL;
136
8.75M
    double *current;
137
138
8.75M
    if (ctx->PathSegments == NULL)
139
592k
        return 0;
140
141
8.15M
    if (ctx->PathPts == NULL) {
142
0
        code = gs_note_error(gs_error_unknownerror);
143
0
        goto error;
144
0
    }
145
146
8.15M
    if (ctx->pgs->current_point_valid) {
147
24.4k
        code = gs_newpath(ctx->pgs);
148
24.4k
        if (code < 0)
149
0
            goto error;
150
24.4k
    }
151
152
8.15M
    op = ctx->PathSegments;
153
8.15M
    dpts = ctx->PathPts;
154
8.15M
    current = dpts; /* Stop stupid compilers complaining. */
155
156
47.9M
    while (op < ctx->PathSegmentsCurrent) {
157
40.0M
        if (dpts > ctx->PathPtsCurrent) {
158
0
            code = gs_note_error(gs_error_unknownerror);
159
0
            goto error;
160
0
        }
161
162
40.0M
        switch(*op++) {
163
7.26M
            case pdfi_moveto_seg:
164
7.26M
                code = gs_moveto(ctx->pgs, dpts[0], dpts[1]);
165
7.26M
                current = dpts;
166
7.26M
                dpts+= 2;
167
7.26M
                break;
168
14.9M
            case pdfi_lineto_seg:
169
14.9M
                code = gs_lineto(ctx->pgs, dpts[0], dpts[1]);
170
14.9M
                current = dpts;
171
14.9M
                dpts+= 2;
172
14.9M
                break;
173
3.92M
            case pdfi_re_seg:
174
3.92M
                code = gs_moveto(ctx->pgs, dpts[0], dpts[1]);
175
3.92M
                if (code >= 0) {
176
3.92M
                    code = gs_rlineto(ctx->pgs, dpts[2], 0);
177
3.92M
                    if (code >= 0) {
178
3.92M
                        code = gs_rlineto(ctx->pgs, 0, dpts[3]);
179
3.92M
                        if (code >= 0) {
180
3.92M
                            code = gs_rlineto(ctx->pgs, -dpts[2], 0);
181
3.92M
                            if (code >= 0)
182
3.92M
                                code = gs_closepath(ctx->pgs);
183
3.92M
                        }
184
3.92M
                    }
185
3.92M
                }
186
3.92M
                current = dpts;
187
3.92M
                dpts+= 4;
188
3.92M
                break;
189
176k
            case pdfi_v_curveto_seg:
190
176k
                code = gs_curveto(ctx->pgs, current[0], current[1], dpts[0], dpts[1], dpts[2], dpts[3]);
191
176k
                current = dpts + 2;
192
176k
                dpts+= 4;
193
176k
                break;
194
187k
            case pdfi_y_curveto_seg:
195
187k
                code = gs_curveto(ctx->pgs, dpts[0], dpts[1], dpts[2], dpts[3], dpts[2], dpts[3]);
196
187k
                current = dpts + 2;
197
187k
                dpts+= 4;
198
187k
                break;
199
12.5M
            case pdfi_curveto_seg:
200
12.5M
                code = gs_curveto(ctx->pgs, dpts[0], dpts[1], dpts[2], dpts[3], dpts[4], dpts[5]);
201
12.5M
                current = dpts + 4;
202
12.5M
                dpts+= 6;
203
12.5M
                break;
204
910k
            case pdfi_closepath_seg:
205
910k
                code = gs_closepath(ctx->pgs);
206
910k
                break;
207
0
            default:
208
0
                code = gs_note_error(gs_error_rangecheck);
209
0
                break;
210
40.0M
        }
211
40.0M
        if (code < 0)
212
259k
            break;
213
40.0M
    }
214
215
8.15M
error:
216
8.15M
    gs_free_object(ctx->memory, ctx->PathSegments, "ApplyStoredPath");
217
8.15M
    ctx->PathSegmentsTop = ctx->PathSegmentsCurrent = ctx->PathSegments = NULL;
218
8.15M
    gs_free_object(ctx->memory, ctx->PathPts, "ApplyStoredPath");
219
8.15M
    ctx->PathPtsTop = ctx->PathPtsCurrent = ctx->PathPts = NULL;
220
8.15M
    return code;
221
8.15M
}
222
223
int pdfi_moveto (pdf_context *ctx)
224
8.62M
{
225
8.62M
    int code;
226
8.62M
    double xy[2];
227
228
8.62M
    if (ctx->text.BlockDepth != 0)
229
314k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_moveto", NULL);
230
231
8.62M
    code = pdfi_destack_reals(ctx, xy, 2);
232
8.62M
    if (code < 0)
233
988k
        return code;
234
235
7.63M
    return StorePathSegment(ctx, pdfi_moveto_seg, (double *)&xy);
236
8.62M
}
237
238
int pdfi_lineto (pdf_context *ctx)
239
16.8M
{
240
16.8M
    int code;
241
16.8M
    double xy[2];
242
243
16.8M
    if (ctx->text.BlockDepth != 0)
244
306k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_lineto", NULL);
245
246
16.8M
    code = pdfi_destack_reals(ctx, xy, 2);
247
16.8M
    if (code < 0)
248
819k
        return code;
249
250
15.9M
    return StorePathSegment(ctx, pdfi_lineto_seg, (double *)&xy);
251
16.8M
}
252
253
static int pdfi_fill_inner(pdf_context *ctx, bool use_eofill)
254
3.13M
{
255
3.13M
    int code=0, code1;
256
3.13M
    pdfi_trans_state_t state;
257
258
3.13M
    if (ctx->text.BlockDepth != 0)
259
166k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_fill_inner", NULL);
260
261
3.13M
    if (pdfi_oc_is_off(ctx))
262
66.1k
        goto exit;
263
264
3.06M
    code = ApplyStoredPath(ctx);
265
3.06M
    if (code < 0)
266
18.8k
        return code;
267
268
3.04M
    code = pdfi_trans_setup(ctx, &state, NULL, TRANSPARENCY_Caller_Fill);
269
3.04M
    if (code == 0) {
270
        /* If we don't gsave/grestore round the fill, then the file
271
         * /tests_private/pdf/sumatra/954_-_dashed_lines_hardly_visible.pdf renders
272
         * incorrectly. However we must not gsave/grestore round the trans_setup
273
         * trans_teardown, because that might set pgs->soft_mask_id and if we restore
274
         * back to a point where that is not set then pdfwrite doesn't work properly.
275
         */
276
3.04M
        code = pdfi_gsave(ctx);
277
3.04M
        if (code < 0) goto exit;
278
279
3.04M
        if (use_eofill)
280
104k
            code = gs_eofill(ctx->pgs);
281
2.94M
        else
282
2.94M
            code = gs_fill(ctx->pgs);
283
3.04M
        code1 = pdfi_grestore(ctx);
284
3.04M
        if (code == 0) code = code1;
285
286
3.04M
        code1 = pdfi_trans_teardown(ctx, &state);
287
3.04M
        if (code == 0) code = code1;
288
3.04M
    }
289
290
3.11M
 exit:
291
3.11M
    code1 = pdfi_newpath(ctx);
292
3.11M
    if (code == 0) code = code1;
293
294
3.11M
    return code;
295
3.04M
}
296
297
int pdfi_fill(pdf_context *ctx)
298
3.02M
{
299
3.02M
    return pdfi_fill_inner(ctx, false);
300
3.02M
}
301
302
int pdfi_eofill(pdf_context *ctx)
303
108k
{
304
108k
    return pdfi_fill_inner(ctx, true);
305
108k
}
306
307
int pdfi_stroke(pdf_context *ctx)
308
4.61M
{
309
4.61M
    int code=0, code1;
310
4.61M
    pdfi_trans_state_t state;
311
312
4.61M
    if (ctx->text.BlockDepth != 0)
313
281k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_stroke", NULL);
314
315
4.61M
    if (pdfi_oc_is_off(ctx))
316
53
        goto exit;
317
318
4.61M
    code = ApplyStoredPath(ctx);
319
4.61M
    if (code < 0)
320
187k
        return code;
321
322
4.42M
    gs_swapcolors_quick(ctx->pgs);
323
4.42M
    code = pdfi_trans_setup(ctx, &state, NULL, TRANSPARENCY_Caller_Stroke);
324
4.42M
    if (code == 0) {
325
4.42M
        code = pdfi_gsave(ctx);
326
4.42M
        if (code < 0) goto exit;
327
328
4.42M
        code = gs_stroke(ctx->pgs);
329
330
4.42M
        code1 = pdfi_grestore(ctx);
331
4.42M
        if (code == 0) code = code1;
332
333
4.42M
        code1 = pdfi_trans_teardown(ctx, &state);
334
4.42M
        if (code == 0) code = code1;
335
4.42M
    }
336
4.42M
    gs_swapcolors_quick(ctx->pgs);
337
338
4.42M
 exit:
339
4.42M
    code1 = pdfi_newpath(ctx);
340
4.42M
    if (code == 0) code = code1;
341
342
4.42M
    return code;
343
4.42M
}
344
345
int pdfi_closepath_stroke(pdf_context *ctx)
346
108k
{
347
108k
    int code;
348
349
108k
    if (ctx->text.BlockDepth != 0)
350
32.4k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_closepath_stroke", NULL);
351
352
108k
    code = StorePathSegment(ctx, pdfi_closepath_seg, NULL);
353
108k
    if (code < 0)
354
0
        return code;
355
356
108k
    return pdfi_stroke(ctx);
357
108k
}
358
359
int pdfi_curveto(pdf_context *ctx)
360
13.6M
{
361
13.6M
    int code;
362
13.6M
    double Values[6];
363
364
13.6M
    code = pdfi_destack_reals(ctx, Values, 6);
365
13.6M
    if (code < 0)
366
595k
        return code;
367
368
13.0M
    if (ctx->text.BlockDepth != 0)
369
16.0k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_curveto", NULL);
370
371
13.0M
    return StorePathSegment(ctx, pdfi_curveto_seg, (double *)&Values);
372
13.6M
}
373
374
int pdfi_v_curveto(pdf_context *ctx)
375
184k
{
376
184k
    int code;
377
184k
    double Values[4];
378
379
184k
    code = pdfi_destack_reals(ctx, Values, 4);
380
184k
    if (code < 0)
381
6.87k
        return code;
382
383
177k
    if (ctx->text.BlockDepth != 0)
384
62
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_v_curveto", NULL);
385
386
177k
    return StorePathSegment(ctx, pdfi_v_curveto_seg, (double *)&Values);
387
184k
}
388
389
int pdfi_y_curveto(pdf_context *ctx)
390
211k
{
391
211k
    int code;
392
211k
    double Values[4];
393
394
211k
    code = pdfi_destack_reals(ctx, Values, 4);
395
211k
    if (code < 0)
396
23.3k
        return code;
397
398
187k
    if (ctx->text.BlockDepth != 0)
399
60
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_y_curveto", NULL);
400
401
187k
    return StorePathSegment(ctx, pdfi_y_curveto_seg, (double *)&Values);
402
211k
}
403
404
int pdfi_closepath(pdf_context *ctx)
405
859k
{
406
859k
    if (ctx->text.BlockDepth != 0)
407
61.7k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_closepath", NULL);
408
409
859k
    return StorePathSegment(ctx, pdfi_closepath_seg, NULL);
410
859k
}
411
412
int pdfi_newpath(pdf_context *ctx)
413
9.34M
{
414
9.34M
    int code = 0, code1;
415
416
    /* This code is to deal with the wacky W and W* operators */
417
9.34M
    if (ctx->clip_active) {
418
1.05M
        if (ctx->PathSegments != NULL) {
419
996k
            code = ApplyStoredPath(ctx);
420
996k
            if (code < 0)
421
50.3k
                return code;
422
996k
        }
423
1.00M
        if (ctx->pgs->current_point_valid) {
424
943k
            if (ctx->do_eoclip)
425
63.2k
                code = gs_eoclip(ctx->pgs);
426
880k
            else
427
880k
                code = gs_clip(ctx->pgs);
428
943k
        }
429
1.00M
    }
430
9.29M
    ctx->clip_active = false;
431
432
9.29M
    if (ctx->PathSegments != NULL){
433
114k
        gs_free_object(ctx->memory, ctx->PathSegments, "ApplyStoredPath");
434
114k
        ctx->PathSegmentsTop = ctx->PathSegmentsCurrent = ctx->PathSegments = NULL;
435
114k
        gs_free_object(ctx->memory, ctx->PathPts, "ApplyStoredPath");
436
114k
        ctx->PathPtsTop = ctx->PathPtsCurrent = ctx->PathPts = NULL;
437
114k
    }
438
439
9.29M
    code1 = gs_newpath(ctx->pgs);
440
9.29M
    if (code == 0) code = code1;
441
442
9.29M
    if (ctx->text.BlockDepth != 0)
443
522k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_newpath", NULL);
444
445
9.29M
    return code;
446
9.34M
}
447
448
int pdfi_b(pdf_context *ctx)
449
19.0k
{
450
19.0k
    int code;
451
452
19.0k
    if (ctx->text.BlockDepth != 0)
453
9.07k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_b", NULL);
454
455
19.0k
    code = StorePathSegment(ctx, pdfi_closepath_seg, NULL);
456
19.0k
    if (code < 0)
457
0
        return code;
458
459
19.0k
    return pdfi_B(ctx);
460
19.0k
}
461
462
int pdfi_b_star(pdf_context *ctx)
463
525
{
464
525
    int code;
465
466
525
    if (ctx->text.BlockDepth != 0)
467
2
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_b_star", NULL);
468
469
525
    code = StorePathSegment(ctx, pdfi_closepath_seg, NULL);
470
525
    if (code < 0)
471
0
        return code;
472
473
525
    return pdfi_B_star(ctx);
474
525
}
475
476
/* common code for B and B* */
477
static int pdfi_B_inner(pdf_context *ctx, bool use_eofill)
478
72.1k
{
479
72.1k
    int code=0, code1=0;
480
72.1k
    pdfi_trans_state_t state;
481
482
72.1k
    if (ctx->text.BlockDepth != 0)
483
34.2k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_B_inner", NULL);
484
485
72.1k
    if (pdfi_oc_is_off(ctx))
486
6
        goto exit;
487
488
72.0k
    code = ApplyStoredPath(ctx);
489
72.0k
    if (code < 0)
490
2.71k
        return code;
491
492
69.3k
    code = pdfi_trans_setup(ctx, &state, NULL, TRANSPARENCY_Caller_FillStroke);
493
69.3k
    if (code == 0) {
494
69.3k
        code = pdfi_gsave(ctx);
495
69.3k
        if (code < 0) goto exit;
496
497
69.3k
        if (use_eofill)
498
2.49k
            code = gs_eofillstroke(ctx->pgs, &code1);
499
66.8k
        else
500
66.8k
            code = gs_fillstroke(ctx->pgs, &code1);
501
502
69.3k
        code1 = pdfi_grestore(ctx);
503
69.3k
        if (code == 0) code = code1;
504
505
69.3k
        code1 = pdfi_trans_teardown(ctx, &state);
506
69.3k
        if (code >= 0) code = code1;
507
69.3k
    }
508
509
69.3k
 exit:
510
69.3k
    code1 = pdfi_newpath(ctx);
511
69.3k
    if (code == 0) code = code1;
512
513
69.3k
    return code;
514
69.3k
}
515
516
int pdfi_B(pdf_context *ctx)
517
69.4k
{
518
69.4k
    return pdfi_B_inner(ctx, false);
519
69.4k
}
520
521
int pdfi_B_star(pdf_context *ctx)
522
2.63k
{
523
2.63k
    return pdfi_B_inner(ctx, true);
524
2.63k
}
525
526
int pdfi_clip(pdf_context *ctx)
527
0
{
528
0
    int code = gs_clip(ctx->pgs);
529
530
0
    if (ctx->text.BlockDepth != 0)
531
0
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_B_clip", NULL);
532
533
0
    return code;
534
0
}
535
536
int pdfi_eoclip(pdf_context *ctx)
537
0
{
538
0
    int code = gs_eoclip(ctx->pgs);
539
540
0
    if (ctx->text.BlockDepth != 0)
541
0
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_eoclip", NULL);
542
543
0
     return code;
544
0
}
545
546
int pdfi_rectpath(pdf_context *ctx)
547
4.20M
{
548
4.20M
    int code;
549
4.20M
    double Values[4];
550
551
4.20M
    code = pdfi_destack_reals(ctx, Values, 4);
552
4.20M
    if (code < 0)
553
202k
        return code;
554
555
4.00M
    if (ctx->text.BlockDepth != 0)
556
179k
        pdfi_set_warning(ctx, 0, NULL, W_PDF_OPINVALIDINTEXT, "pdfi_rectpath", NULL);
557
558
4.00M
    return StorePathSegment(ctx, pdfi_re_seg, (double *)&Values);
559
4.20M
}