Coverage Report

Created: 2025-12-03 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/mupdf/source/fitz/draw-affine.c
Line
Count
Source
1
// Copyright (C) 2004-2025 Artifex Software, Inc.
2
//
3
// This file is part of MuPDF.
4
//
5
// MuPDF is free software: you can redistribute it and/or modify it under the
6
// terms of the GNU Affero General Public License as published by the Free
7
// Software Foundation, either version 3 of the License, or (at your option)
8
// any later version.
9
//
10
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
// details.
14
//
15
// You should have received a copy of the GNU Affero General Public License
16
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
17
//
18
// Alternative licensing terms are available from the licensor.
19
// For commercial licensing, see <https://www.artifex.com/> or contact
20
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
21
// CA 94129, USA, for further information.
22
23
#include "mupdf/fitz.h"
24
#include "draw-imp.h"
25
26
#include <math.h>
27
#include <float.h>
28
#include <assert.h>
29
30
typedef int64_t affint;
31
32
/* Number of fraction bits for fixed point math */
33
6.56M
#define PREC 14
34
12
#define ONE (((affint)1)<<PREC)
35
0
#define MASK (ONE-1)
36
0
#define HALF (((affint)1)<<(PREC-1))
37
6
#define LIMIT (((affint)1)<<((sizeof(affint)*8-1)-PREC))
38
39
typedef unsigned char byte;
40
41
typedef void (paintfn_t)(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop);
42
43
static fz_forceinline int lerp(int a, int b, int f)
44
0
{
45
0
  return a + (((b - a) * f) >> PREC);
46
0
}
47
48
static fz_forceinline int bilerp(int a, int b, int c, int d, int uf, int vf)
49
0
{
50
0
  return lerp(lerp(a, b, uf), lerp(c, d, uf), vf);
51
0
}
52
53
static fz_forceinline const byte *sample_nearest(const byte *s, affint w, affint h, ptrdiff_t str, int n, affint u, affint v)
54
0
{
55
0
  if (u < 0) u = 0;
56
0
  if (v < 0) v = 0;
57
0
  if (u >= (w>>PREC)) u = (w>>PREC) - 1;
58
0
  if (v >= (h>>PREC)) v = (h>>PREC) - 1;
59
0
  return s + v * str + u * n;
60
0
}
61
62
/* Blend premultiplied source image in constant alpha over destination */
63
64
static fz_forceinline void
65
template_affine_alpha_N_lerp(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
66
0
{
67
0
  int k;
68
69
0
  do
70
0
  {
71
0
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
72
0
    {
73
0
      affint ui = u >> PREC;
74
0
      affint vi = v >> PREC;
75
0
      int uf = u & MASK;
76
0
      int vf = v & MASK;
77
0
      const byte *a = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi);
78
0
      const byte *b = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi);
79
0
      const byte *c = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi+1);
80
0
      const byte *d = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi+1);
81
0
      int x = sa ? bilerp(a[sn1], b[sn1], c[sn1], d[sn1], uf, vf) : 255;
82
0
      int xa = sa ? fz_mul255(x, alpha) : alpha;
83
0
      if (xa != 0)
84
0
      {
85
0
        int t = 255 - xa;
86
0
        for (k = 0; k < sn1; k++)
87
0
        {
88
0
          int z = bilerp(a[k], b[k], c[k], d[k], uf, vf);
89
0
          dp[k] = fz_mul255(z, alpha) + fz_mul255(dp[k], t);
90
0
        }
91
0
        for (; k < dn1; k++)
92
0
          dp[k] = 0;
93
0
        if (da)
94
0
          dp[dn1] = xa + fz_mul255(dp[dn1], t);
95
0
        if (hp)
96
0
          hp[0] = x + fz_mul255(hp[0], 255 - x);
97
0
        if (gp)
98
0
          gp[0] = xa + fz_mul255(gp[0], t);
99
0
      }
100
0
    }
101
0
    dp += dn1+da;
102
0
    if (hp)
103
0
      hp++;
104
0
    if (gp)
105
0
      gp++;
106
0
    u += fa;
107
0
    v += fb;
108
0
  }
109
0
  while (--w);
110
0
}
111
112
static fz_forceinline void
113
template_affine_alpha_N_lerp_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
114
0
{
115
0
  int k;
116
117
0
  do
118
0
  {
119
0
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
120
0
    {
121
0
      affint ui = u >> PREC;
122
0
      affint vi = v >> PREC;
123
0
      int uf = u & MASK;
124
0
      int vf = v & MASK;
125
0
      const byte *a = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi);
126
0
      const byte *b = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi);
127
0
      const byte *c = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi+1);
128
0
      const byte *d = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi+1);
129
0
      int x = sa ? bilerp(a[sn1], b[sn1], c[sn1], d[sn1], uf, vf) : 255;
130
0
      int xa = sa ? fz_mul255(x, alpha) : alpha;
131
0
      if (xa != 0)
132
0
      {
133
0
        int t = 255 - xa;
134
0
        for (k = 0; k < sn1; k++)
135
0
        {
136
0
          if (fz_overprint_component(eop, k))
137
0
          {
138
0
            int z = bilerp(a[k], b[k], c[k], d[k], uf, vf);
139
0
            dp[k] = fz_mul255(z, alpha) + fz_mul255(dp[k], t);
140
0
          }
141
0
        }
142
0
        for (; k < dn1; k++)
143
0
          if (fz_overprint_component(eop, k))
144
0
            dp[k] = 0;
145
0
        if (da)
146
0
          dp[dn1] = xa + fz_mul255(dp[dn1], t);
147
0
        if (hp)
148
0
          hp[0] = x + fz_mul255(hp[0], 255-x);
149
0
        if (gp)
150
0
          gp[0] = xa + fz_mul255(gp[0], t);
151
0
      }
152
0
    }
153
0
    dp += dn1+da;
154
0
    if (hp)
155
0
      hp++;
156
0
    if (gp)
157
0
      gp++;
158
0
    u += fa;
159
0
    v += fb;
160
0
  }
161
0
  while (--w);
162
0
}
163
164
/* Special case code for gray -> rgb */
165
static fz_forceinline void
166
template_affine_alpha_g2rgb_lerp(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int alpha, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
167
0
{
168
0
  do
169
0
  {
170
0
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
171
0
    {
172
0
      affint ui = u >> PREC;
173
0
      affint vi = v >> PREC;
174
0
      int uf = u & MASK;
175
0
      int vf = v & MASK;
176
0
      const byte *a = sample_nearest(sp, sw, sh, ss, 1+sa, ui, vi);
177
0
      const byte *b = sample_nearest(sp, sw, sh, ss, 1+sa, ui+1, vi);
178
0
      const byte *c = sample_nearest(sp, sw, sh, ss, 1+sa, ui, vi+1);
179
0
      const byte *d = sample_nearest(sp, sw, sh, ss, 1+sa, ui+1, vi+1);
180
0
      int y = sa ? bilerp(a[1], b[1], c[1], d[1], uf, vf) : 255;
181
0
      int ya = (sa ? fz_mul255(y, alpha) : alpha);
182
0
      if (ya != 0)
183
0
      {
184
0
        int x = bilerp(a[0], b[0], c[0], d[0], uf, vf);
185
0
        int t = 255 - ya;
186
0
        x = fz_mul255(x, alpha);
187
0
        dp[0] = x + fz_mul255(dp[0], t);
188
0
        dp[1] = x + fz_mul255(dp[1], t);
189
0
        dp[2] = x + fz_mul255(dp[2], t);
190
0
        if (da)
191
0
          dp[3] = ya + fz_mul255(dp[3], t);
192
0
        if (hp)
193
0
          hp[0] = y + fz_mul255(hp[0], 255 - y);
194
0
        if (gp)
195
0
          gp[0] = ya + fz_mul255(gp[0], t);
196
0
      }
197
0
    }
198
0
    dp += 3+da;
199
0
    if (hp)
200
0
      hp++;
201
0
    if (gp)
202
0
      gp++;
203
0
    u += fa;
204
0
    v += fb;
205
0
  }
206
0
  while (--w);
207
0
}
208
209
static fz_forceinline void
210
template_affine_alpha_N_near_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
211
0
{
212
0
  int k;
213
0
  affint ui = u >> PREC;
214
0
  TRACK_FN();
215
0
  if (ui < 0 || ui >= sw)
216
0
    return;
217
0
  sp += ui * (sn1+sa);
218
0
  do
219
0
  {
220
0
    affint vi = v >> PREC;
221
0
    if (vi >= 0 && vi < sh)
222
0
    {
223
0
      const byte *sample = sp + (vi * ss);
224
0
      int a = sa ? sample[sn1] : 255;
225
0
      int aa = (sa ? fz_mul255(a, alpha) : alpha);
226
0
      if (aa != 0)
227
0
      {
228
0
        int t = 255 - aa;
229
0
        for (k = 0; k < sn1; k++)
230
0
          dp[k] = fz_mul255(sample[k], alpha) + fz_mul255(dp[k], t);
231
0
        for (; k < dn1; k++)
232
0
          dp[k] = 0;
233
0
        if (da)
234
0
          dp[dn1] = aa + fz_mul255(dp[dn1], t);
235
0
        if (hp)
236
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
237
0
        if (gp)
238
0
          gp[0] = aa + fz_mul255(gp[0], t);
239
0
      }
240
0
    }
241
0
    dp += dn1+da;
242
0
    if (hp)
243
0
      hp++;
244
0
    if (gp)
245
0
      gp++;
246
0
    v += fb;
247
0
  }
248
0
  while (--w);
249
0
}
250
251
static fz_forceinline void
252
template_affine_alpha_N_near_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
253
0
{
254
0
  int k;
255
0
  affint vi = v >> PREC;
256
0
  if (vi < 0 || vi >= sh)
257
0
    return;
258
0
  sp += vi * ss;
259
0
  do
260
0
  {
261
0
    affint ui = u >> PREC;
262
0
    if (ui >= 0 && ui < sw)
263
0
    {
264
0
      const byte *sample = sp + (ui * (sn1+sa));
265
0
      int a = sa ? sample[sn1] : 255;
266
0
      int aa = (sa ? fz_mul255(a, alpha) : alpha);
267
0
      if (aa != 0)
268
0
      {
269
0
        int t = 255 - aa;
270
0
        for (k = 0; k < sn1; k++)
271
0
          dp[k] = fz_mul255(sample[k], alpha) + fz_mul255(dp[k], t);
272
0
        for (; k < dn1; k++)
273
0
          dp[k] = 0;
274
0
        if (da)
275
0
          dp[dn1] = aa + fz_mul255(dp[dn1], t);
276
0
        if (hp)
277
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
278
0
        if (gp)
279
0
          gp[0] = aa + fz_mul255(gp[0], t);
280
0
      }
281
0
    }
282
0
    dp += dn1+da;
283
0
    if (hp)
284
0
      hp++;
285
0
    if (gp)
286
0
      gp++;
287
0
    u += fa;
288
0
  }
289
0
  while (--w);
290
0
}
291
292
static fz_forceinline void
293
template_affine_alpha_N_near(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
294
0
{
295
0
  int k;
296
297
0
  do
298
0
  {
299
0
    affint ui = u >> PREC;
300
0
    affint vi = v >> PREC;
301
0
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
302
0
    {
303
0
      const byte *sample = sp + (vi * ss) + (ui * (sn1+sa));
304
0
      int a = sa ? sample[sn1] : 255;
305
0
      int aa = (sa ? fz_mul255(a, alpha) : alpha);
306
0
      if (aa != 0)
307
0
      {
308
0
        int t = 255 - aa;
309
0
        for (k = 0; k < sn1; k++)
310
0
          dp[k] = fz_mul255(sample[k], alpha) + fz_mul255(dp[k], t);
311
0
        for (; k < dn1; k++)
312
0
          dp[k] = 0;
313
0
        if (da)
314
0
          dp[dn1] = aa + fz_mul255(dp[dn1], t);
315
0
        if (hp)
316
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
317
0
        if (gp)
318
0
          gp[0] = aa + fz_mul255(gp[0], t);
319
0
      }
320
0
    }
321
0
    dp += dn1+da;
322
0
    if (hp)
323
0
      hp++;
324
0
    if (gp)
325
0
      gp++;
326
0
    u += fa;
327
0
    v += fb;
328
0
  }
329
0
  while (--w);
330
0
}
331
332
static fz_forceinline void
333
template_affine_alpha_N_near_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
334
0
{
335
0
  int k;
336
337
0
  do
338
0
  {
339
0
    affint ui = u >> PREC;
340
0
    affint vi = v >> PREC;
341
0
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
342
0
    {
343
0
      const byte *sample = sp + (vi * ss) + (ui * (sn1+sa));
344
0
      int a = sa ? sample[sn1] : 255;
345
0
      int aa = (sa ? fz_mul255(a, alpha) : alpha);
346
0
      if (aa != 0)
347
0
      {
348
0
        int t = 255 - aa;
349
0
        for (k = 0; k < sn1; k++)
350
0
          if (fz_overprint_component(eop, k))
351
0
            dp[k] = fz_mul255(sample[k], alpha) + fz_mul255(dp[k], t);
352
0
        for (; k < dn1; k++)
353
0
          if (fz_overprint_component(eop, k))
354
0
            dp[k] = 0;
355
0
        if (da)
356
0
          dp[dn1] = aa + fz_mul255(dp[dn1], t);
357
0
        if (hp)
358
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
359
0
        if (gp)
360
0
          gp[0] = aa + fz_mul255(gp[0], t);
361
0
      }
362
0
    }
363
0
    dp += dn1+da;
364
0
    if (hp)
365
0
      hp++;
366
0
    if (gp)
367
0
      gp++;
368
0
    u += fa;
369
0
    v += fb;
370
0
  }
371
0
  while (--w);
372
0
}
373
374
static fz_forceinline void
375
template_affine_alpha_g2rgb_near_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int alpha, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
376
0
{
377
0
  affint ui = u >> PREC;
378
0
  if (ui < 0 || ui >= sw)
379
0
    return;
380
0
  sp += ui * (1+sa);
381
0
  do
382
0
  {
383
0
    affint vi = v >> PREC;
384
0
    if (vi >= 0 && vi < sh)
385
0
    {
386
0
      const byte *sample = sp + (vi * ss);
387
0
      int x = fz_mul255(sample[0], alpha);
388
0
      int a = sa ? sample[1] : 255;
389
0
      int aa = (sa ? fz_mul255(a, alpha) : alpha);
390
0
      if (aa != 0)
391
0
      {
392
0
        int t = 255 - aa;
393
0
        dp[0] = x + fz_mul255(dp[0], t);
394
0
        dp[1] = x + fz_mul255(dp[1], t);
395
0
        dp[2] = x + fz_mul255(dp[2], t);
396
0
        if (da)
397
0
          dp[3] = aa + fz_mul255(dp[3], t);
398
0
        if (hp)
399
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
400
0
        if (gp)
401
0
          gp[0] = aa + fz_mul255(gp[0], t);
402
0
      }
403
0
    }
404
0
    dp += 3 + da;
405
0
    if (hp)
406
0
      hp++;
407
0
    if (gp)
408
0
      gp++;
409
0
    v += fb;
410
0
  }
411
0
  while (--w);
412
0
}
413
414
static fz_forceinline void
415
template_affine_alpha_g2rgb_near_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int alpha, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
416
0
{
417
0
  affint vi = v >> PREC;
418
0
  if (vi < 0 || vi >= sh)
419
0
    return;
420
0
  sp += vi * ss;
421
0
  do
422
0
  {
423
0
    affint ui = u >> PREC;
424
0
    if (ui >= 0 && ui < sw)
425
0
    {
426
0
      const byte *sample = sp + (ui * (1+sa));
427
0
      int x = fz_mul255(sample[0], alpha);
428
0
      int a = sa ? sample[1] : 255;
429
0
      int aa = (sa ? fz_mul255(a, alpha) : alpha);
430
0
      if (aa != 0)
431
0
      {
432
0
        int t = 255 - aa;
433
0
        dp[0] = x + fz_mul255(dp[0], t);
434
0
        dp[1] = x + fz_mul255(dp[1], t);
435
0
        dp[2] = x + fz_mul255(dp[2], t);
436
0
        if (da)
437
0
          dp[3] = aa + fz_mul255(dp[3], t);
438
0
        if (hp)
439
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
440
0
        if (gp)
441
0
          gp[0] = aa + fz_mul255(gp[0], t);
442
0
      }
443
0
    }
444
0
    dp += 3 + da;
445
0
    if (hp)
446
0
      hp++;
447
0
    if (gp)
448
0
      gp++;
449
0
    u += fa;
450
0
  }
451
0
  while (--w);
452
0
}
453
454
static fz_forceinline void
455
template_affine_alpha_g2rgb_near(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int alpha, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
456
0
{
457
0
  do
458
0
  {
459
0
    affint ui = u >> PREC;
460
0
    affint vi = v >> PREC;
461
0
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
462
0
    {
463
0
      const byte *sample = sp + (vi * ss) + (ui * (1+sa));
464
0
      int x = fz_mul255(sample[0], alpha);
465
0
      int a = sa ? sample[1] : 255;
466
0
      int aa = (sa ? fz_mul255(a, alpha): alpha);
467
0
      if (aa != 0)
468
0
      {
469
0
        int t = 255 - aa;
470
0
        dp[0] = x + fz_mul255(dp[0], t);
471
0
        dp[1] = x + fz_mul255(dp[1], t);
472
0
        dp[2] = x + fz_mul255(dp[2], t);
473
0
        if (da)
474
0
          dp[3] = aa + fz_mul255(dp[3], t);
475
0
        if (hp)
476
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
477
0
        if (gp)
478
0
          gp[0] = aa + fz_mul255(gp[0], t);
479
0
      }
480
0
    }
481
0
    dp += 3 + da;
482
0
    if (hp)
483
0
      hp++;
484
0
    if (gp)
485
0
      gp++;
486
0
    u += fa;
487
0
    v += fb;
488
0
  }
489
0
  while (--w);
490
0
}
491
492
/* Blend premultiplied source image over destination */
493
static fz_forceinline void
494
template_affine_N_lerp(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
495
0
{
496
0
  int k;
497
498
0
  do
499
0
  {
500
0
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
501
0
    {
502
0
      affint ui = u >> PREC;
503
0
      affint vi = v >> PREC;
504
0
      int uf = u & MASK;
505
0
      int vf = v & MASK;
506
0
      const byte *a = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi);
507
0
      const byte *b = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi);
508
0
      const byte *c = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi+1);
509
0
      const byte *d = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi+1);
510
0
      int y = sa ? bilerp(a[sn1], b[sn1], c[sn1], d[sn1], uf, vf) : 255;
511
0
      if (y != 0)
512
0
      {
513
0
        int t = 255 - y;
514
0
        for (k = 0; k < sn1; k++)
515
0
        {
516
0
          int x = bilerp(a[k], b[k], c[k], d[k], uf, vf);
517
0
          dp[k] = x + fz_mul255(dp[k], t);
518
0
        }
519
0
        for (; k < dn1; k++)
520
0
          dp[k] = 0;
521
0
        if (da)
522
0
          dp[dn1] = y + fz_mul255(dp[dn1], t);
523
0
        if (hp)
524
0
          hp[0] = y + fz_mul255(hp[0], t);
525
0
        if (gp)
526
0
          gp[0] = y + fz_mul255(gp[0], t);
527
0
      }
528
0
    }
529
0
    dp += dn1 + da;
530
0
    if (hp)
531
0
      hp++;
532
0
    if (gp)
533
0
      gp++;
534
0
    u += fa;
535
0
    v += fb;
536
0
  }
537
0
  while (--w);
538
0
}
539
540
static fz_forceinline void
541
template_affine_N_lerp_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
542
0
{
543
0
  int k;
544
545
0
  do
546
0
  {
547
0
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
548
0
    {
549
0
      affint ui = u >> PREC;
550
0
      affint vi = v >> PREC;
551
0
      int uf = u & MASK;
552
0
      int vf = v & MASK;
553
0
      const byte *a = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi);
554
0
      const byte *b = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi);
555
0
      const byte *c = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi+1);
556
0
      const byte *d = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi+1);
557
0
      int y = sa ? bilerp(a[sn1], b[sn1], c[sn1], d[sn1], uf, vf) : 255;
558
0
      if (y != 0)
559
0
      {
560
0
        int t = 255 - y;
561
0
        for (k = 0; k < sn1; k++)
562
0
          if (fz_overprint_component(eop, k))
563
0
          {
564
0
            int x = bilerp(a[k], b[k], c[k], d[k], uf, vf);
565
0
            dp[k] = x + fz_mul255(dp[k], t);
566
0
          }
567
0
        for (; k < dn1; k++)
568
0
          if (fz_overprint_component(eop, k))
569
0
            dp[k] = 0;
570
0
        if (da)
571
0
          dp[dn1] = y + fz_mul255(dp[dn1], t);
572
0
        if (hp)
573
0
          hp[0] = y + fz_mul255(hp[0], t);
574
0
        if (gp)
575
0
          gp[0] = y + fz_mul255(gp[0], t);
576
0
      }
577
0
    }
578
0
    dp += dn1 + da;
579
0
    if (hp)
580
0
      hp++;
581
0
    if (gp)
582
0
      gp++;
583
0
    u += fa;
584
0
    v += fb;
585
0
  }
586
0
  while (--w);
587
0
}
588
589
static fz_forceinline void
590
template_affine_solid_g2rgb_lerp(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
591
0
{
592
0
  do
593
0
  {
594
0
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
595
0
    {
596
0
      affint ui = u >> PREC;
597
0
      affint vi = v >> PREC;
598
0
      int uf = u & MASK;
599
0
      int vf = v & MASK;
600
0
      const byte *a = sample_nearest(sp, sw, sh, ss, 1+sa, ui, vi);
601
0
      const byte *b = sample_nearest(sp, sw, sh, ss, 1+sa, ui+1, vi);
602
0
      const byte *c = sample_nearest(sp, sw, sh, ss, 1+sa, ui, vi+1);
603
0
      const byte *d = sample_nearest(sp, sw, sh, ss, 1+sa, ui+1, vi+1);
604
0
      int y = (sa ? bilerp(a[1], b[1], c[1], d[1], uf, vf) : 255);
605
0
      if (y != 0)
606
0
      {
607
0
        int t = 255 - y;
608
0
        int x = bilerp(a[0], b[0], c[0], d[0], uf, vf);
609
0
        dp[0] = x + fz_mul255(dp[0], t);
610
0
        dp[1] = x + fz_mul255(dp[1], t);
611
0
        dp[2] = x + fz_mul255(dp[2], t);
612
0
        if (da)
613
0
          dp[3] = y + fz_mul255(dp[3], t);
614
0
        if (hp)
615
0
          hp[0] = y + fz_mul255(hp[0], t);
616
0
        if (gp)
617
0
          gp[0] = y + fz_mul255(gp[0], t);
618
0
      }
619
0
    }
620
0
    dp += 3 + da;
621
0
    if (hp)
622
0
      hp++;
623
0
    if (gp)
624
0
      gp++;
625
0
    u += fa;
626
0
    v += fb;
627
0
  }
628
0
  while (--w);
629
0
}
630
631
static fz_forceinline void
632
template_affine_N_near_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
633
0
{
634
0
  int k;
635
0
  affint ui = u >> PREC;
636
0
  if (ui < 0 || ui >= sw)
637
0
    return;
638
0
  sp += ui*(sn1+sa);
639
0
  do
640
0
  {
641
0
    affint vi = v >> PREC;
642
0
    if (vi >= 0 && vi < sh)
643
0
    {
644
0
      const byte *sample = sp + (vi * ss);
645
0
      int a = (sa ? sample[sn1] : 255);
646
      /* If a is 0, then sample[k] = 0 for all k, as premultiplied */
647
0
      if (a != 0)
648
0
      {
649
0
        int t = 255 - a;
650
0
        if (t == 0)
651
0
        {
652
0
          if (dn1+da == 4 && dn1+sa == 4)
653
0
          {
654
0
            *(int32_t *)dp = *(int32_t *)sample;
655
0
          }
656
0
          else
657
0
          {
658
0
            dp[0] = sample[0];
659
0
            if (sn1 > 1)
660
0
              dp[1] = sample[1];
661
0
            if (sn1 > 2)
662
0
              dp[2] = sample[2];
663
0
            for (k = 3; k < sn1; k++)
664
0
              dp[k] = sample[k];
665
0
            for (k = sn1; k < dn1; k++)
666
0
              dp[k] = 0;
667
0
            if (da)
668
0
              dp[dn1] = a;
669
0
          }
670
0
          if (hp)
671
0
            hp[0] = a;
672
0
          if (gp)
673
0
            gp[0] = a;
674
0
        }
675
0
        else
676
0
        {
677
0
          for (k = 0; k < sn1; k++)
678
0
            dp[k] = sample[k] + fz_mul255(dp[k], t);
679
0
          for (; k < dn1; k++)
680
0
            dp[k] = 0;
681
0
          if (da)
682
0
            dp[dn1] = a + fz_mul255(dp[dn1], t);
683
0
          if (hp)
684
0
            hp[0] = a + fz_mul255(hp[0], t);
685
0
          if (gp)
686
0
            gp[0] = a + fz_mul255(gp[0], t);
687
0
        }
688
0
      }
689
0
    }
690
0
    dp += dn1+da;
691
0
    if (hp)
692
0
      hp++;
693
0
    if (gp)
694
0
      gp++;
695
0
    v += fb;
696
0
  }
697
0
  while (--w);
698
0
}
699
700
static fz_forceinline void
701
template_affine_N_near_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
702
2.46k
{
703
2.46k
  int k;
704
2.46k
  affint vi = v >> PREC;
705
2.46k
  if (vi < 0 || vi >= sh)
706
0
    return;
707
2.46k
  sp += vi * ss;
708
2.46k
  do
709
6.56M
  {
710
6.56M
    affint ui = u >> PREC;
711
6.56M
    if (ui >= 0 && ui < sw)
712
6.56M
    {
713
6.56M
      const byte *sample = sp + (ui * (sn1+sa));
714
6.56M
      int a = sa ? sample[sn1] : 255;
715
      /* If a is 0, then sample[k] = 0 for all k, as premultiplied */
716
6.56M
      if (a != 0)
717
6.56M
      {
718
6.56M
        int t = 255 - a;
719
6.56M
        if (t == 0)
720
6.56M
        {
721
6.56M
          if (dn1+da == 4 && sn1+sa == 4)
722
0
          {
723
0
            *(int32_t *)dp = *(int32_t *)sample;
724
0
          }
725
6.56M
          else
726
6.56M
          {
727
6.56M
            dp[0] = sample[0];
728
6.56M
            if (sn1 > 1)
729
6.56M
              dp[1] = sample[1];
730
6.56M
            if (sn1 > 2)
731
6.56M
              dp[2] = sample[2];
732
6.56M
            for (k = 3; k < sn1; k++)
733
0
              dp[k] = sample[k];
734
6.56M
            for (k = sn1; k < dn1; k++)
735
0
              dp[k] = 0;
736
6.56M
            if (da)
737
0
              dp[dn1] = a;
738
6.56M
          }
739
6.56M
          if (hp)
740
0
            hp[0] = a;
741
6.56M
          if (gp)
742
0
            gp[0] = a;
743
6.56M
        }
744
0
        else
745
0
        {
746
0
          for (k = 0; k < sn1; k++)
747
0
            dp[k] = sample[k] + fz_mul255(dp[k], t);
748
0
          for (; k < dn1; k++)
749
0
            dp[k] = 0;
750
0
          if (da)
751
0
            dp[dn1] = a + fz_mul255(dp[dn1], t);
752
0
          if (hp)
753
0
            hp[0] = a + fz_mul255(hp[0], t);
754
0
          if (gp)
755
0
            gp[0] = a + fz_mul255(gp[0], t);
756
0
        }
757
6.56M
      }
758
6.56M
    }
759
6.56M
    dp += dn1+da;
760
6.56M
    if (hp)
761
0
      hp++;
762
6.56M
    if (gp)
763
0
      gp++;
764
6.56M
    u += fa;
765
6.56M
  }
766
6.56M
  while (--w);
767
2.46k
}
768
769
static fz_forceinline void
770
template_affine_N_near(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
771
0
{
772
0
  int k;
773
774
0
  do
775
0
  {
776
0
    affint ui = u >> PREC;
777
0
    affint vi = v >> PREC;
778
0
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
779
0
    {
780
0
      const byte *sample = sp + (vi * ss) + (ui * (sn1+sa));
781
0
      int a = sa ? sample[sn1] : 255;
782
      /* If a is 0, then sample[k] = 0 for all k, as premultiplied */
783
0
      if (a != 0)
784
0
      {
785
0
        int t = 255 - a;
786
0
        if (t == 0)
787
0
        {
788
0
          if (dn1+da == 4 && sn1+sa == 4)
789
0
          {
790
0
            *(int32_t *)dp = *(int32_t *)sample;
791
0
          }
792
0
          else
793
0
          {
794
0
            dp[0] = sample[0];
795
0
            if (sn1 > 1)
796
0
              dp[1] = sample[1];
797
0
            if (sn1 > 2)
798
0
              dp[2] = sample[2];
799
0
            for (k = 3; k < sn1; k++)
800
0
              dp[k] = sample[k];
801
0
            for (; k < dn1; k++)
802
0
              dp[k] = 0;
803
0
            if (da)
804
0
              dp[dn1] = a;
805
0
          }
806
0
          if (hp)
807
0
            hp[0] = a;
808
0
          if (gp)
809
0
            gp[0] = a;
810
0
        }
811
0
        else
812
0
        {
813
0
          for (k = 0; k < sn1; k++)
814
0
            dp[k] = sample[k] + fz_mul255(dp[k], t);
815
0
          for (; k < dn1; k++)
816
0
            dp[k] = 0;
817
0
          if (da)
818
0
            dp[dn1] = a + fz_mul255(dp[dn1], t);
819
0
          if (hp)
820
0
            hp[0] = a + fz_mul255(hp[0], t);
821
0
          if (gp)
822
0
            gp[0] = a + fz_mul255(gp[0], t);
823
0
        }
824
0
      }
825
0
    }
826
0
    dp += dn1+da;
827
0
    if (hp)
828
0
      hp++;
829
0
    if (gp)
830
0
      gp++;
831
0
    u += fa;
832
0
    v += fb;
833
0
  }
834
0
  while (--w);
835
0
}
836
837
static fz_forceinline void
838
template_affine_N_near_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
839
0
{
840
0
  int k;
841
842
0
  do
843
0
  {
844
0
    affint ui = u >> PREC;
845
0
    affint vi = v >> PREC;
846
0
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
847
0
    {
848
0
      const byte *sample = sp + (vi * ss) + (ui * (sn1+sa));
849
0
      int a = sa ? sample[sn1] : 255;
850
      /* If a is 0, then sample[k] = 0 for all k, as premultiplied */
851
0
      if (a != 0)
852
0
      {
853
0
        int t = 255 - a;
854
0
        if (t == 0)
855
0
        {
856
0
          if (fz_overprint_component(eop, 0))
857
0
            dp[0] = sample[0];
858
0
          if (sn1 > 1)
859
0
            if (fz_overprint_component(eop, 1))
860
0
              dp[1] = sample[1];
861
0
          if (sn1 > 2)
862
0
            if (fz_overprint_component(eop, 2))
863
0
              dp[2] = sample[2];
864
0
          for (k = 3; k < sn1; k++)
865
0
            if (fz_overprint_component(eop, k))
866
0
              dp[k] = sample[k];
867
0
          for (; k < dn1; k++)
868
0
            if (fz_overprint_component(eop, k))
869
0
              dp[k] = 0;
870
0
          if (da)
871
0
            dp[dn1] = a;
872
0
          if (hp)
873
0
            hp[0] = a;
874
0
          if (gp)
875
0
            gp[0] = a;
876
0
        }
877
0
        else
878
0
        {
879
0
          for (k = 0; k < sn1; k++)
880
0
            if (fz_overprint_component(eop, k))
881
0
              dp[k] = sample[k] + fz_mul255(dp[k], t);
882
0
          for (; k < dn1; k++)
883
0
            if (fz_overprint_component(eop, k))
884
0
              dp[k] = 0;
885
0
          if (da)
886
0
            dp[dn1] = a + fz_mul255(dp[dn1], t);
887
0
          if (hp)
888
0
            hp[0] = a + fz_mul255(hp[0], t);
889
0
          if (gp)
890
0
            gp[0] = a + fz_mul255(gp[0], t);
891
0
        }
892
0
      }
893
0
    }
894
0
    dp += dn1+da;
895
0
    if (hp)
896
0
      hp++;
897
0
    if (gp)
898
0
      gp++;
899
0
    u += fa;
900
0
    v += fb;
901
0
  }
902
0
  while (--w);
903
0
}
904
905
static fz_forceinline void
906
template_affine_solid_g2rgb_near_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
907
0
{
908
0
  affint ui = u >> PREC;
909
0
  if (ui < 0 || ui >= sw)
910
0
    return;
911
0
  sp += ui * (1+sa);
912
0
  do
913
0
  {
914
0
    affint vi = v >> PREC;
915
0
    if (vi >= 0 && vi < sh)
916
0
    {
917
0
      const byte *sample = sp + (vi * ss);
918
0
      int a = (sa ? sample[1] : 255);
919
0
      if (a != 0)
920
0
      {
921
0
        int x = sample[0];
922
0
        int t = 255 - a;
923
0
        if (t == 0)
924
0
        {
925
0
          dp[0] = x;
926
0
          dp[1] = x;
927
0
          dp[2] = x;
928
0
          if (da)
929
0
            dp[3] = a;
930
0
          if (hp)
931
0
            hp[0] = a;
932
0
          if (gp)
933
0
            gp[0] = a;
934
0
        }
935
0
        else
936
0
        {
937
0
          dp[0] = x + fz_mul255(dp[0], t);
938
0
          dp[1] = x + fz_mul255(dp[1], t);
939
0
          dp[2] = x + fz_mul255(dp[2], t);
940
0
          if (da)
941
0
            dp[3] = a + fz_mul255(dp[3], t);
942
0
          if (hp)
943
0
            hp[0] = a + fz_mul255(hp[0], t);
944
0
          if (gp)
945
0
            gp[0] = a + fz_mul255(gp[0], t);
946
0
        }
947
0
      }
948
0
    }
949
0
    dp += 3 + da;
950
0
    if (hp)
951
0
      hp++;
952
0
    if (gp)
953
0
      gp++;
954
0
    v += fb;
955
0
  }
956
0
  while (--w);
957
0
}
958
959
static fz_forceinline void
960
template_affine_solid_g2rgb_near_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
961
0
{
962
0
  affint vi = v >> PREC;
963
0
  if (vi < 0 || vi >= sh)
964
0
    return;
965
0
  sp += vi * ss;
966
0
  do
967
0
  {
968
0
    affint ui = u >> PREC;
969
0
    if (ui >= 0 && ui < sw)
970
0
    {
971
0
      const byte *sample = sp + (ui * (1+sa));
972
0
      int a = (sa ? sample[1] : 255);
973
0
      if (a != 0)
974
0
      {
975
0
        int x = sample[0];
976
0
        int t = 255 - a;
977
0
        if (t == 0)
978
0
        {
979
0
          dp[0] = x;
980
0
          dp[1] = x;
981
0
          dp[2] = x;
982
0
          if (da)
983
0
            dp[3] = a;
984
0
          if (hp)
985
0
            hp[0] = a;
986
0
          if (gp)
987
0
            gp[0] = a;
988
0
        }
989
0
        else
990
0
        {
991
0
          dp[0] = x + fz_mul255(dp[0], t);
992
0
          dp[1] = x + fz_mul255(dp[1], t);
993
0
          dp[2] = x + fz_mul255(dp[2], t);
994
0
          if (da)
995
0
            dp[3] = a + fz_mul255(dp[3], t);
996
0
          if (hp)
997
0
            hp[0] = a + fz_mul255(hp[0], t);
998
0
          if (gp)
999
0
            gp[0] = a + fz_mul255(gp[0], t);
1000
0
        }
1001
0
      }
1002
0
    }
1003
0
    dp += 3 + da;
1004
0
    if (hp)
1005
0
      hp++;
1006
0
    if (gp)
1007
0
      gp++;
1008
0
    u += fa;
1009
0
  }
1010
0
  while (--w);
1011
0
}
1012
1013
static fz_forceinline void
1014
template_affine_solid_g2rgb_near(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
1015
0
{
1016
0
  do
1017
0
  {
1018
0
    affint ui = u >> PREC;
1019
0
    affint vi = v >> PREC;
1020
0
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
1021
0
    {
1022
0
      const byte *sample = sp + (vi * ss) + (ui * (1+sa));
1023
0
      int a = sa ? sample[1] : 255;
1024
0
      if (a != 0)
1025
0
      {
1026
0
        int x = sample[0];
1027
0
        int t = 255 - a;
1028
0
        if (t == 0)
1029
0
        {
1030
0
          dp[0] = x;
1031
0
          dp[1] = x;
1032
0
          dp[2] = x;
1033
0
          if (da)
1034
0
            dp[3] = a;
1035
0
          if (hp)
1036
0
            hp[0] = a;
1037
0
          if (gp)
1038
0
            gp[0] = a;
1039
0
        }
1040
0
        else
1041
0
        {
1042
0
          dp[0] = x + fz_mul255(dp[0], t);
1043
0
          dp[1] = x + fz_mul255(dp[1], t);
1044
0
          dp[2] = x + fz_mul255(dp[2], t);
1045
0
          if (da)
1046
0
            dp[3] = a + fz_mul255(dp[3], t);
1047
0
          if (hp)
1048
0
            hp[0] = a + fz_mul255(hp[0], t);
1049
0
          if (gp)
1050
0
            gp[0] = a + fz_mul255(gp[0], t);
1051
0
        }
1052
0
      }
1053
0
    }
1054
0
    dp += 3 + da;
1055
0
    if (hp)
1056
0
      hp++;
1057
0
    if (gp)
1058
0
      gp++;
1059
0
    u += fa;
1060
0
    v += fb;
1061
0
  }
1062
0
  while (--w);
1063
0
}
1064
1065
/* Blend non-premultiplied color in source image mask over destination */
1066
1067
static fz_forceinline void
1068
template_affine_color_N_lerp(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
1069
0
{
1070
0
  int sa = color[dn1];
1071
0
  int k;
1072
1073
0
  do
1074
0
  {
1075
0
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
1076
0
    {
1077
0
      affint ui = u >> PREC;
1078
0
      affint vi = v >> PREC;
1079
0
      int uf = u & MASK;
1080
0
      int vf = v & MASK;
1081
0
      const byte *a = sample_nearest(sp, sw, sh, ss, 1, ui, vi);
1082
0
      const byte *b = sample_nearest(sp, sw, sh, ss, 1, ui+1, vi);
1083
0
      const byte *c = sample_nearest(sp, sw, sh, ss, 1, ui, vi+1);
1084
0
      const byte *d = sample_nearest(sp, sw, sh, ss, 1, ui+1, vi+1);
1085
0
      int ma = bilerp(a[0], b[0], c[0], d[0], uf, vf);
1086
0
      int masa = FZ_COMBINE(FZ_EXPAND(ma), sa);
1087
0
      if (masa != 0)
1088
0
      {
1089
0
        for (k = 0; k < dn1; k++)
1090
0
          dp[k] = FZ_BLEND(color[k], dp[k], masa);
1091
0
        if (da)
1092
0
          dp[dn1] = FZ_BLEND(255, dp[dn1], masa);
1093
0
        if (hp)
1094
0
          hp[0] = FZ_BLEND(255, hp[0], ma);
1095
0
        if (gp)
1096
0
          gp[0] = FZ_BLEND(255, gp[0], masa);
1097
0
      }
1098
0
    }
1099
0
    dp += dn1 + da;
1100
0
    if (hp)
1101
0
      hp++;
1102
0
    if (gp)
1103
0
      gp++;
1104
0
    u += fa;
1105
0
    v += fb;
1106
0
  }
1107
0
  while (--w);
1108
0
}
1109
1110
static fz_forceinline void
1111
template_affine_color_N_lerp_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1112
0
{
1113
0
  int sa = color[dn1];
1114
0
  int k;
1115
1116
0
  do
1117
0
  {
1118
0
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
1119
0
    {
1120
0
      affint ui = u >> PREC;
1121
0
      affint vi = v >> PREC;
1122
0
      int uf = u & MASK;
1123
0
      int vf = v & MASK;
1124
0
      const byte *a = sample_nearest(sp, sw, sh, ss, 1, ui, vi);
1125
0
      const byte *b = sample_nearest(sp, sw, sh, ss, 1, ui+1, vi);
1126
0
      const byte *c = sample_nearest(sp, sw, sh, ss, 1, ui, vi+1);
1127
0
      const byte *d = sample_nearest(sp, sw, sh, ss, 1, ui+1, vi+1);
1128
0
      int ma = bilerp(a[0], b[0], c[0], d[0], uf, vf);
1129
0
      int masa = FZ_COMBINE(FZ_EXPAND(ma), sa);
1130
0
      if (masa != 0)
1131
0
      {
1132
0
        for (k = 0; k < dn1; k++)
1133
0
          if (fz_overprint_component(eop, k))
1134
0
            dp[k] = FZ_BLEND(color[k], dp[k], masa);
1135
0
        if (da)
1136
0
          dp[dn1] = FZ_BLEND(255, dp[dn1], masa);
1137
0
        if (hp)
1138
0
          hp[0] = FZ_BLEND(255, hp[0], ma);
1139
0
        if (gp)
1140
0
          gp[0] = FZ_BLEND(255, gp[0], masa);
1141
0
      }
1142
0
    }
1143
0
    dp += dn1 + da;
1144
0
    if (hp)
1145
0
      hp++;
1146
0
    if (gp)
1147
0
      gp++;
1148
0
    u += fa;
1149
0
    v += fb;
1150
0
  }
1151
0
  while (--w);
1152
0
}
1153
1154
static fz_forceinline void
1155
template_affine_color_N_near(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp)
1156
0
{
1157
0
  int sa = color[dn1];
1158
0
  int k;
1159
1160
0
  do
1161
0
  {
1162
0
    affint ui = u >> PREC;
1163
0
    affint vi = v >> PREC;
1164
0
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
1165
0
    {
1166
0
      int ma = sp[vi * ss + ui];
1167
0
      int masa = FZ_COMBINE(FZ_EXPAND(ma), sa);
1168
0
      if (masa)
1169
0
      {
1170
0
        for (k = 0; k < dn1; k++)
1171
0
          dp[k] = FZ_BLEND(color[k], dp[k], masa);
1172
0
        if (da)
1173
0
          dp[dn1] = FZ_BLEND(255, dp[dn1], masa);
1174
0
        if (hp)
1175
0
          hp[0] = FZ_BLEND(255, hp[0], ma);
1176
0
        if (gp)
1177
0
          gp[0] = FZ_BLEND(255, gp[0], masa);
1178
0
      }
1179
0
    }
1180
0
    dp += dn1+da;
1181
0
    if (hp)
1182
0
      hp++;
1183
0
    if (gp)
1184
0
      gp++;
1185
0
    u += fa;
1186
0
    v += fb;
1187
0
  }
1188
0
  while (--w);
1189
0
}
1190
1191
static fz_forceinline void
1192
template_affine_color_N_near_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1193
0
{
1194
0
  int sa = color[dn1];
1195
0
  int k;
1196
1197
0
  do
1198
0
  {
1199
0
    affint ui = u >> PREC;
1200
0
    affint vi = v >> PREC;
1201
0
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
1202
0
    {
1203
0
      int ma = sp[vi * ss + ui];
1204
0
      int masa = FZ_COMBINE(FZ_EXPAND(ma), sa);
1205
0
      if (masa)
1206
0
      {
1207
0
        for (k = 0; k < dn1; k++)
1208
0
          if (fz_overprint_component(eop, k))
1209
0
            dp[k] = FZ_BLEND(color[k], dp[k], masa);
1210
0
        if (da)
1211
0
          dp[dn1] = FZ_BLEND(255, dp[dn1], masa);
1212
0
        if (hp)
1213
0
          hp[0] = FZ_BLEND(255, hp[0], ma);
1214
0
        if (gp)
1215
0
          gp[0] = FZ_BLEND(255, gp[0], masa);
1216
0
      }
1217
0
    }
1218
0
    dp += dn1+da;
1219
0
    if (hp)
1220
0
      hp++;
1221
0
    if (gp)
1222
0
      gp++;
1223
0
    u += fa;
1224
0
    v += fb;
1225
0
  }
1226
0
  while (--w);
1227
0
}
1228
1229
static void
1230
paint_affine_lerp_da_sa_0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1231
0
{
1232
0
  TRACK_FN();
1233
0
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, hp, gp);
1234
0
}
1235
1236
static void
1237
paint_affine_lerp_da_sa_alpha_0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1238
0
{
1239
0
  TRACK_FN();
1240
0
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, alpha, hp, gp);
1241
0
}
1242
1243
static void
1244
paint_affine_lerp_da_0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1245
0
{
1246
0
  TRACK_FN();
1247
0
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, 0, hp, gp);
1248
0
}
1249
1250
static void
1251
paint_affine_lerp_da_alpha_0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1252
0
{
1253
0
  TRACK_FN();
1254
0
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, 0, alpha, hp, gp);
1255
0
}
1256
1257
static void
1258
paint_affine_lerp_da_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1259
0
{
1260
0
  TRACK_FN();
1261
0
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1262
0
}
1263
1264
static void
1265
paint_affine_lerp_da_alpha_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1266
0
{
1267
0
  TRACK_FN();
1268
0
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
1269
0
}
1270
1271
static void
1272
paint_affine_lerp_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1273
0
{
1274
0
  TRACK_FN();
1275
0
  template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1276
0
}
1277
1278
static void
1279
paint_affine_lerp_alpha_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1280
0
{
1281
0
  TRACK_FN();
1282
0
  template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
1283
0
}
1284
1285
#if FZ_PLOTTERS_G
1286
static void
1287
paint_affine_lerp_da_sa_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1288
0
{
1289
0
  TRACK_FN();
1290
0
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, hp, gp);
1291
0
}
1292
1293
static void
1294
paint_affine_lerp_da_sa_alpha_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1295
0
{
1296
0
  TRACK_FN();
1297
0
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
1298
0
}
1299
1300
static void
1301
paint_affine_lerp_sa_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1302
0
{
1303
0
  TRACK_FN();
1304
0
  template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, hp, gp);
1305
0
}
1306
1307
static void
1308
paint_affine_lerp_sa_alpha_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1309
0
{
1310
0
  TRACK_FN();
1311
0
  template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
1312
0
}
1313
#endif /* FZ_PLOTTERS_G */
1314
1315
#if FZ_PLOTTERS_RGB
1316
static void
1317
paint_affine_lerp_da_sa_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1318
0
{
1319
0
  TRACK_FN();
1320
0
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
1321
0
}
1322
1323
static void
1324
paint_affine_lerp_da_sa_alpha_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1325
0
{
1326
0
  TRACK_FN();
1327
0
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
1328
0
}
1329
1330
static void
1331
paint_affine_lerp_da_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1332
0
{
1333
0
  TRACK_FN();
1334
0
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
1335
0
}
1336
1337
static void
1338
paint_affine_lerp_da_alpha_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1339
0
{
1340
0
  TRACK_FN();
1341
0
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
1342
0
}
1343
1344
static void
1345
paint_affine_lerp_sa_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1346
0
{
1347
0
  TRACK_FN();
1348
0
  template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
1349
0
}
1350
1351
static void
1352
paint_affine_lerp_sa_alpha_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1353
0
{
1354
0
  TRACK_FN();
1355
0
  template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
1356
0
}
1357
1358
static void
1359
paint_affine_lerp_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1360
0
{
1361
0
  TRACK_FN();
1362
0
  template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
1363
0
}
1364
1365
static void
1366
paint_affine_lerp_alpha_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1367
0
{
1368
0
  TRACK_FN();
1369
0
  template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
1370
0
}
1371
#endif /* FZ_PLOTTERS_RGB */
1372
1373
#if FZ_PLOTTERS_CMYK
1374
static void
1375
paint_affine_lerp_da_sa_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1376
0
{
1377
0
  TRACK_FN();
1378
0
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, hp, gp);
1379
0
}
1380
1381
static void
1382
paint_affine_lerp_da_sa_alpha_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1383
0
{
1384
0
  TRACK_FN();
1385
0
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
1386
0
}
1387
1388
static void
1389
paint_affine_lerp_da_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1390
0
{
1391
0
  TRACK_FN();
1392
0
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, hp, gp);
1393
0
}
1394
1395
static void
1396
paint_affine_lerp_da_alpha_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1397
0
{
1398
0
  TRACK_FN();
1399
0
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
1400
0
}
1401
1402
static void
1403
paint_affine_lerp_sa_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1404
0
{
1405
0
  TRACK_FN();
1406
0
  template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, hp, gp);
1407
0
}
1408
1409
static void
1410
paint_affine_lerp_sa_alpha_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1411
0
{
1412
0
  TRACK_FN();
1413
0
  template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
1414
0
}
1415
1416
static void
1417
paint_affine_lerp_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1418
0
{
1419
0
  TRACK_FN();
1420
0
  template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, hp, gp);
1421
0
}
1422
1423
static void
1424
paint_affine_lerp_alpha_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1425
0
{
1426
0
  TRACK_FN();
1427
0
  template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
1428
0
}
1429
#endif /* FZ_PLOTTERS_CMYK */
1430
1431
#if FZ_PLOTTERS_N
1432
static void
1433
paint_affine_lerp_da_sa_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1434
0
{
1435
0
  TRACK_FN();
1436
0
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, hp, gp);
1437
0
}
1438
1439
static void
1440
paint_affine_lerp_da_sa_alpha_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1441
0
{
1442
0
  TRACK_FN();
1443
0
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
1444
0
}
1445
1446
static void
1447
paint_affine_lerp_da_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1448
0
{
1449
0
  TRACK_FN();
1450
0
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, hp, gp);
1451
0
}
1452
1453
static void
1454
paint_affine_lerp_da_alpha_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1455
0
{
1456
0
  TRACK_FN();
1457
0
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
1458
0
}
1459
1460
static void
1461
paint_affine_lerp_sa_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1462
0
{
1463
0
  TRACK_FN();
1464
0
  template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, hp, gp);
1465
0
}
1466
1467
static void
1468
paint_affine_lerp_sa_alpha_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1469
0
{
1470
0
  TRACK_FN();
1471
0
  template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
1472
0
}
1473
1474
static void
1475
paint_affine_lerp_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1476
0
{
1477
0
  TRACK_FN();
1478
0
  template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, hp, gp);
1479
0
}
1480
1481
static void
1482
paint_affine_lerp_alpha_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1483
0
{
1484
0
  TRACK_FN();
1485
0
  template_affine_alpha_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
1486
0
}
1487
#endif /* FZ_PLOTTERS_N */
1488
1489
#if FZ_ENABLE_SPOT_RENDERING
1490
static void
1491
paint_affine_lerp_N_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1492
0
{
1493
0
  TRACK_FN();
1494
0
  template_affine_N_lerp_op(dp, da, sp, sw, sh, ss, sa, u, v, fa, fb, w, dn, sn, hp, gp, eop);
1495
0
}
1496
1497
static void
1498
paint_affine_lerp_alpha_N_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1499
0
{
1500
0
  TRACK_FN();
1501
0
  template_affine_alpha_N_lerp_op(dp, da, sp, sw, sh, ss, sa, u, v, fa, fb, w, dn, sn, alpha, hp, gp, eop);
1502
0
}
1503
#endif /* FZ_ENABLE_SPOT_RENDERING */
1504
1505
static paintfn_t *
1506
fz_paint_affine_lerp(int da, int sa, affint fa, affint fb, int n, int alpha, const fz_overprint * FZ_RESTRICT eop)
1507
0
{
1508
0
#if FZ_ENABLE_SPOT_RENDERING
1509
0
  if (fz_overprint_required(eop))
1510
0
  {
1511
0
    if (alpha == 255)
1512
0
      return paint_affine_lerp_N_op;
1513
0
    else if (alpha > 0)
1514
0
      return paint_affine_lerp_alpha_N_op;
1515
0
    else
1516
0
      return NULL;
1517
0
  }
1518
0
#endif /* FZ_ENABLE_SPOT_RENDERING */
1519
1520
0
  switch(n)
1521
0
  {
1522
0
  case 0:
1523
0
    if (da)
1524
0
    {
1525
0
      if (sa)
1526
0
      {
1527
0
        if (alpha == 255)
1528
0
          return paint_affine_lerp_da_sa_0;
1529
0
        else if (alpha > 0)
1530
0
          return paint_affine_lerp_da_sa_alpha_0;
1531
0
      }
1532
0
      else
1533
0
      {
1534
0
        if (alpha == 255)
1535
0
          return paint_affine_lerp_da_0;
1536
0
        else if (alpha > 0)
1537
0
          return paint_affine_lerp_da_alpha_0;
1538
0
      }
1539
0
    }
1540
0
    break;
1541
1542
0
  case 1:
1543
0
    if (sa)
1544
0
    {
1545
0
#if FZ_PLOTTERS_G
1546
0
      if (da)
1547
0
      {
1548
0
        if (alpha == 255)
1549
0
          return paint_affine_lerp_da_sa_1;
1550
0
        else if (alpha > 0)
1551
0
          return paint_affine_lerp_da_sa_alpha_1;
1552
0
      }
1553
0
      else
1554
0
      {
1555
0
        if (alpha == 255)
1556
0
          return paint_affine_lerp_sa_1;
1557
0
        else if (alpha > 0)
1558
0
          return paint_affine_lerp_sa_alpha_1;
1559
0
      }
1560
#else
1561
      goto fallback;
1562
#endif /* FZ_PLOTTERS_H */
1563
0
    }
1564
0
    else
1565
0
    {
1566
0
      if (da)
1567
0
      {
1568
0
        if (alpha == 255)
1569
0
          return paint_affine_lerp_da_1;
1570
0
        else if (alpha > 0)
1571
0
          return paint_affine_lerp_da_alpha_1;
1572
0
      }
1573
0
      else
1574
0
      {
1575
0
        if (alpha == 255)
1576
0
          return paint_affine_lerp_1;
1577
0
        else if (alpha > 0)
1578
0
          return paint_affine_lerp_alpha_1;
1579
0
      }
1580
0
    }
1581
0
    break;
1582
1583
0
#if FZ_PLOTTERS_RGB
1584
0
  case 3:
1585
0
    if (da)
1586
0
    {
1587
0
      if (sa)
1588
0
      {
1589
0
        if (alpha == 255)
1590
0
          return paint_affine_lerp_da_sa_3;
1591
0
        else if (alpha > 0)
1592
0
          return paint_affine_lerp_da_sa_alpha_3;
1593
0
      }
1594
0
      else
1595
0
      {
1596
0
        if (alpha == 255)
1597
0
          return paint_affine_lerp_da_3;
1598
0
        else if (alpha > 0)
1599
0
          return paint_affine_lerp_da_alpha_3;
1600
0
      }
1601
0
    }
1602
0
    else
1603
0
    {
1604
0
      if (sa)
1605
0
      {
1606
0
        if (alpha == 255)
1607
0
          return paint_affine_lerp_sa_3;
1608
0
        else if (alpha > 0)
1609
0
          return paint_affine_lerp_sa_alpha_3;
1610
0
      }
1611
0
      else
1612
0
      {
1613
0
        if (alpha == 255)
1614
0
          return paint_affine_lerp_3;
1615
0
        else if (alpha > 0)
1616
0
          return paint_affine_lerp_alpha_3;
1617
0
      }
1618
0
    }
1619
0
    break;
1620
0
#endif /* FZ_PLOTTERS_RGB */
1621
1622
0
#if FZ_PLOTTERS_CMYK
1623
0
  case 4:
1624
0
    if (da)
1625
0
    {
1626
0
      if (sa)
1627
0
      {
1628
0
        if (alpha == 255)
1629
0
          return paint_affine_lerp_da_sa_4;
1630
0
        else if (alpha > 0)
1631
0
          return paint_affine_lerp_da_sa_alpha_4;
1632
0
      }
1633
0
      else
1634
0
      {
1635
0
        if (alpha == 255)
1636
0
          return paint_affine_lerp_da_4;
1637
0
        else if (alpha > 0)
1638
0
          return paint_affine_lerp_da_alpha_4;
1639
0
      }
1640
0
    }
1641
0
    else
1642
0
    {
1643
0
      if (sa)
1644
0
      {
1645
0
        if (alpha == 255)
1646
0
          return paint_affine_lerp_sa_4;
1647
0
        else if (alpha > 0)
1648
0
          return paint_affine_lerp_sa_alpha_4;
1649
0
      }
1650
0
      else
1651
0
      {
1652
0
        if (alpha == 255)
1653
0
          return paint_affine_lerp_4;
1654
0
        else if (alpha > 0)
1655
0
          return paint_affine_lerp_alpha_4;
1656
0
      }
1657
0
    }
1658
0
    break;
1659
0
#endif /* FZ_PLOTTERS_CMYK */
1660
1661
#if !FZ_PLOTTERS_G
1662
fallback:
1663
#endif /* FZ_PLOTTERS_G */
1664
0
  default:
1665
0
#if FZ_PLOTTERS_N
1666
0
    if (da)
1667
0
    {
1668
0
      if (sa)
1669
0
      {
1670
0
        if (alpha == 255)
1671
0
          return paint_affine_lerp_da_sa_N;
1672
0
        else if (alpha > 0)
1673
0
          return paint_affine_lerp_da_sa_alpha_N;
1674
0
      }
1675
0
      else
1676
0
      {
1677
0
        if (alpha == 255)
1678
0
          return paint_affine_lerp_da_N;
1679
0
        else if (alpha > 0)
1680
0
          return paint_affine_lerp_da_alpha_N;
1681
0
      }
1682
0
    }
1683
0
    else
1684
0
    {
1685
0
      if (sa)
1686
0
      {
1687
0
        if (alpha == 255)
1688
0
          return paint_affine_lerp_sa_N;
1689
0
        else if (alpha > 0)
1690
0
          return paint_affine_lerp_sa_alpha_N;
1691
0
      }
1692
0
      else
1693
0
      {
1694
0
        if (alpha == 255)
1695
0
          return paint_affine_lerp_N;
1696
0
        else if (alpha > 0)
1697
0
          return paint_affine_lerp_alpha_N;
1698
0
      }
1699
0
    }
1700
0
#endif /* FZ_PLOTTERS_N */
1701
0
    break;
1702
0
  }
1703
0
  return NULL;
1704
0
}
1705
1706
#if FZ_ENABLE_SPOT_RENDERING
1707
static paintfn_t *
1708
fz_paint_affine_lerp_spots(int da, int sa, affint fa, affint fb, int dn, int sn, int alpha, const fz_overprint * FZ_RESTRICT eop)
1709
0
{
1710
0
  if (fz_overprint_required(eop))
1711
0
  {
1712
0
    if (alpha == 255)
1713
0
      return paint_affine_lerp_N_op;
1714
0
    else if (alpha > 0)
1715
0
      return paint_affine_lerp_alpha_N_op;
1716
0
  }
1717
0
  else if (da)
1718
0
  {
1719
0
    if (sa)
1720
0
    {
1721
0
      if (alpha == 255)
1722
0
        return paint_affine_lerp_da_sa_N;
1723
0
      else if (alpha > 0)
1724
0
        return paint_affine_lerp_da_sa_alpha_N;
1725
0
    }
1726
0
    else
1727
0
    {
1728
0
      if (alpha == 255)
1729
0
        return paint_affine_lerp_da_N;
1730
0
      else if (alpha > 0)
1731
0
        return paint_affine_lerp_da_alpha_N;
1732
0
    }
1733
0
  }
1734
0
  else
1735
0
  {
1736
0
    if (sa)
1737
0
    {
1738
0
      if (alpha == 255)
1739
0
        return paint_affine_lerp_sa_N;
1740
0
      else if (alpha > 0)
1741
0
        return paint_affine_lerp_sa_alpha_N;
1742
0
    }
1743
0
    else
1744
0
    {
1745
0
      if (alpha == 255)
1746
0
        return paint_affine_lerp_N;
1747
0
      else if (alpha > 0)
1748
0
        return paint_affine_lerp_alpha_N;
1749
0
    }
1750
0
  }
1751
0
  return NULL;
1752
0
}
1753
#endif /* FZ_ENABLE_SPOT_RENDERING */
1754
1755
#if FZ_PLOTTERS_RGB
1756
static void
1757
paint_affine_lerp_da_sa_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1758
0
{
1759
0
  TRACK_FN();
1760
0
  template_affine_solid_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp, gp);
1761
0
}
1762
1763
static void
1764
paint_affine_lerp_da_sa_g2rgb_alpha(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1765
0
{
1766
0
  TRACK_FN();
1767
0
  template_affine_alpha_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp, gp);
1768
0
}
1769
1770
static void
1771
paint_affine_lerp_da_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1772
0
{
1773
0
  TRACK_FN();
1774
0
  template_affine_solid_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
1775
0
}
1776
1777
static void
1778
paint_affine_lerp_da_g2rgb_alpha(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1779
0
{
1780
0
  TRACK_FN();
1781
0
  template_affine_alpha_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
1782
0
}
1783
1784
static void
1785
paint_affine_lerp_sa_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1786
0
{
1787
0
  TRACK_FN();
1788
0
  template_affine_solid_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp, gp);
1789
0
}
1790
1791
static void
1792
paint_affine_lerp_sa_g2rgb_alpha(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1793
0
{
1794
0
  TRACK_FN();
1795
0
  template_affine_alpha_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp, gp);
1796
0
}
1797
1798
static void
1799
paint_affine_lerp_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1800
0
{
1801
0
  TRACK_FN();
1802
0
  template_affine_solid_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
1803
0
}
1804
1805
static void
1806
paint_affine_lerp_g2rgb_alpha(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1807
0
{
1808
0
  TRACK_FN();
1809
0
  template_affine_alpha_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
1810
0
}
1811
1812
static paintfn_t *
1813
fz_paint_affine_g2rgb_lerp(int da, int sa, affint fa, affint fb, int n, int alpha)
1814
0
{
1815
0
  if (da)
1816
0
  {
1817
0
    if (sa)
1818
0
    {
1819
0
      if (alpha == 255)
1820
0
        return paint_affine_lerp_da_sa_g2rgb;
1821
0
      else if (alpha > 0)
1822
0
        return paint_affine_lerp_da_sa_g2rgb_alpha;
1823
0
    }
1824
0
    else
1825
0
    {
1826
0
      if (alpha == 255)
1827
0
        return paint_affine_lerp_da_g2rgb;
1828
0
      else if (alpha > 0)
1829
0
        return paint_affine_lerp_da_g2rgb_alpha;
1830
0
    }
1831
0
  }
1832
0
  else
1833
0
  {
1834
0
    if (sa)
1835
0
    {
1836
0
      if (alpha == 255)
1837
0
        return paint_affine_lerp_sa_g2rgb;
1838
0
      else if (alpha > 0)
1839
0
        return paint_affine_lerp_sa_g2rgb_alpha;
1840
0
    }
1841
0
    else
1842
0
    {
1843
0
      if (alpha == 255)
1844
0
        return paint_affine_lerp_g2rgb;
1845
0
      else if (alpha > 0)
1846
0
        return paint_affine_lerp_g2rgb_alpha;
1847
0
    }
1848
0
  }
1849
0
  return NULL;
1850
0
}
1851
#endif /* FZ_PLOTTERS_RGB */
1852
1853
static void
1854
paint_affine_near_da_sa_0_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1855
0
{
1856
0
  TRACK_FN();
1857
0
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, hp, gp);
1858
0
}
1859
1860
static void
1861
paint_affine_near_da_sa_alpha_0_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1862
0
{
1863
0
  TRACK_FN();
1864
0
  template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, alpha, hp, gp);
1865
0
}
1866
1867
static void
1868
paint_affine_near_da_0_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1869
0
{
1870
0
  TRACK_FN();
1871
0
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, 0, hp, gp);
1872
0
}
1873
1874
static void
1875
paint_affine_near_da_alpha_0_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1876
0
{
1877
0
  TRACK_FN();
1878
0
  template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, 0, alpha, hp, gp);
1879
0
}
1880
1881
static void
1882
paint_affine_near_da_sa_0_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1883
0
{
1884
0
  TRACK_FN();
1885
0
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, hp, gp);
1886
0
}
1887
1888
static void
1889
paint_affine_near_da_sa_alpha_0_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1890
0
{
1891
0
  TRACK_FN();
1892
0
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, alpha, hp, gp);
1893
0
}
1894
1895
static void
1896
paint_affine_near_da_0_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1897
0
{
1898
0
  TRACK_FN();
1899
0
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, 0, hp, gp);
1900
0
}
1901
1902
static void
1903
paint_affine_near_da_alpha_0_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1904
0
{
1905
0
  TRACK_FN();
1906
0
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, 0, alpha, hp, gp);
1907
0
}
1908
1909
static void
1910
paint_affine_near_da_sa_0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1911
0
{
1912
0
  TRACK_FN();
1913
0
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, hp, gp);
1914
0
}
1915
1916
static void
1917
paint_affine_near_da_sa_alpha_0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1918
0
{
1919
0
  TRACK_FN();
1920
0
  template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, alpha, hp, gp);
1921
0
}
1922
1923
static void
1924
paint_affine_near_da_0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1925
0
{
1926
0
  TRACK_FN();
1927
0
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, 0, hp, gp);
1928
0
}
1929
1930
static void
1931
paint_affine_near_da_alpha_0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1932
0
{
1933
0
  TRACK_FN();
1934
0
  template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 0, 0, alpha, hp, gp);
1935
0
}
1936
1937
static void
1938
paint_affine_near_1_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int snn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1939
0
{
1940
0
  TRACK_FN();
1941
0
  template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1942
0
}
1943
1944
static void
1945
paint_affine_near_1_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1946
0
{
1947
0
  TRACK_FN();
1948
0
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1949
0
}
1950
1951
static void
1952
paint_affine_near_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1953
0
{
1954
0
  TRACK_FN();
1955
0
  template_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1956
0
}
1957
1958
static void
1959
paint_affine_near_alpha_1_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1960
0
{
1961
0
  TRACK_FN();
1962
0
  template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
1963
0
}
1964
1965
static void
1966
paint_affine_near_alpha_1_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1967
0
{
1968
0
  TRACK_FN();
1969
0
  template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
1970
0
}
1971
1972
static void
1973
paint_affine_near_alpha_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1974
0
{
1975
0
  TRACK_FN();
1976
0
  template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
1977
0
}
1978
1979
static void
1980
paint_affine_near_da_1_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1981
0
{
1982
0
  TRACK_FN();
1983
0
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1984
0
}
1985
1986
static void
1987
paint_affine_near_da_alpha_1_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1988
0
{
1989
0
  TRACK_FN();
1990
0
  template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
1991
0
}
1992
1993
static void
1994
paint_affine_near_da_1_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
1995
0
{
1996
0
  TRACK_FN();
1997
0
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1998
0
}
1999
2000
static void
2001
paint_affine_near_da_alpha_1_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2002
0
{
2003
0
  TRACK_FN();
2004
0
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
2005
0
}
2006
2007
static void
2008
paint_affine_near_da_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2009
0
{
2010
0
  TRACK_FN();
2011
0
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
2012
0
}
2013
2014
static void
2015
paint_affine_near_da_alpha_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2016
0
{
2017
0
  TRACK_FN();
2018
0
  template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
2019
0
}
2020
2021
#if FZ_PLOTTERS_G
2022
static void
2023
paint_affine_near_da_sa_1_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2024
0
{
2025
0
  TRACK_FN();
2026
0
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, hp, gp);
2027
0
}
2028
2029
static void
2030
paint_affine_near_da_sa_alpha_1_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2031
0
{
2032
0
  TRACK_FN();
2033
0
  template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
2034
0
}
2035
2036
static void
2037
paint_affine_near_sa_1_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2038
0
{
2039
0
  TRACK_FN();
2040
0
  template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, hp, gp);
2041
0
}
2042
2043
static void
2044
paint_affine_near_sa_alpha_1_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2045
0
{
2046
0
  TRACK_FN();
2047
0
  template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
2048
0
}
2049
2050
static void
2051
paint_affine_near_da_sa_1_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2052
0
{
2053
0
  TRACK_FN();
2054
0
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, hp, gp);
2055
0
}
2056
2057
static void
2058
paint_affine_near_da_sa_alpha_1_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2059
0
{
2060
0
  TRACK_FN();
2061
0
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
2062
0
}
2063
2064
static void
2065
paint_affine_near_sa_alpha_1_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2066
0
{
2067
0
  TRACK_FN();
2068
0
  template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
2069
0
}
2070
2071
static void
2072
paint_affine_near_da_sa_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2073
0
{
2074
0
  TRACK_FN();
2075
0
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, hp, gp);
2076
0
}
2077
2078
static void
2079
paint_affine_near_sa_1_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2080
0
{
2081
0
  TRACK_FN();
2082
0
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, hp, gp);
2083
0
}
2084
2085
static void
2086
paint_affine_near_da_sa_alpha_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2087
0
{
2088
0
  TRACK_FN();
2089
0
  template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
2090
0
}
2091
2092
static void
2093
paint_affine_near_sa_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2094
0
{
2095
0
  TRACK_FN();
2096
0
  template_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, hp, gp);
2097
0
}
2098
2099
static void
2100
paint_affine_near_sa_alpha_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2101
0
{
2102
0
  TRACK_FN();
2103
0
  template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 1, 1, alpha, hp, gp);
2104
0
}
2105
#endif /* FZ_PLOTTERS_G */
2106
2107
#if FZ_PLOTTERS_RGB
2108
static void
2109
paint_affine_near_da_sa_3_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2110
0
{
2111
0
  TRACK_FN();
2112
0
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
2113
0
}
2114
2115
static void
2116
paint_affine_near_da_sa_alpha_3_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2117
0
{
2118
0
  TRACK_FN();
2119
0
  template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2120
0
}
2121
2122
static void
2123
paint_affine_near_da_3_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2124
0
{
2125
0
  TRACK_FN();
2126
0
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2127
0
}
2128
2129
static void
2130
paint_affine_near_da_alpha_3_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2131
0
{
2132
0
  TRACK_FN();
2133
0
  template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2134
0
}
2135
2136
static void
2137
paint_affine_near_sa_3_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2138
0
{
2139
0
  TRACK_FN();
2140
0
  template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
2141
0
}
2142
2143
static void
2144
paint_affine_near_sa_alpha_3_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2145
0
{
2146
0
  TRACK_FN();
2147
0
  template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2148
0
}
2149
2150
static void
2151
paint_affine_near_3_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2152
0
{
2153
0
  TRACK_FN();
2154
0
  template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2155
0
}
2156
2157
static void
2158
paint_affine_near_alpha_3_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2159
0
{
2160
0
  TRACK_FN();
2161
0
  template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2162
0
}
2163
2164
static void
2165
paint_affine_near_da_sa_3_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2166
0
{
2167
0
  TRACK_FN();
2168
0
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
2169
0
}
2170
2171
static void
2172
paint_affine_near_da_sa_alpha_3_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2173
0
{
2174
0
  TRACK_FN();
2175
0
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2176
0
}
2177
2178
static void
2179
paint_affine_near_da_3_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2180
0
{
2181
0
  TRACK_FN();
2182
0
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2183
0
}
2184
2185
static void
2186
paint_affine_near_da_alpha_3_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2187
0
{
2188
0
  TRACK_FN();
2189
0
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2190
0
}
2191
2192
static void
2193
paint_affine_near_sa_alpha_3_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2194
0
{
2195
0
  TRACK_FN();
2196
0
  template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2197
0
}
2198
2199
static void
2200
paint_affine_near_da_sa_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2201
0
{
2202
0
  TRACK_FN();
2203
0
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
2204
0
}
2205
2206
static void
2207
paint_affine_near_alpha_3_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2208
0
{
2209
0
  TRACK_FN();
2210
0
  template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2211
0
}
2212
2213
static void
2214
paint_affine_near_3_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2215
2.46k
{
2216
2.46k
  TRACK_FN();
2217
2.46k
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2218
2.46k
}
2219
2220
static void
2221
paint_affine_near_sa_3_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2222
0
{
2223
0
  TRACK_FN();
2224
0
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
2225
0
}
2226
2227
static void
2228
paint_affine_near_da_sa_alpha_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2229
0
{
2230
0
  TRACK_FN();
2231
0
  template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2232
0
}
2233
2234
static void
2235
paint_affine_near_da_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2236
0
{
2237
0
  TRACK_FN();
2238
0
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2239
0
}
2240
2241
static void
2242
paint_affine_near_sa_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2243
0
{
2244
0
  TRACK_FN();
2245
0
  template_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
2246
0
}
2247
2248
static void
2249
paint_affine_near_da_alpha_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2250
0
{
2251
0
  TRACK_FN();
2252
0
  template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2253
0
}
2254
2255
static void
2256
paint_affine_near_sa_alpha_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2257
0
{
2258
0
  TRACK_FN();
2259
0
  template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2260
0
}
2261
2262
static void
2263
paint_affine_near_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2264
0
{
2265
0
  TRACK_FN();
2266
0
  template_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2267
0
}
2268
2269
static void
2270
paint_affine_near_alpha_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2271
0
{
2272
0
  TRACK_FN();
2273
0
  template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2274
0
}
2275
#endif /* FZ_PLOTTERS_RGB */
2276
2277
#if FZ_PLOTTERS_CMYK
2278
static void
2279
paint_affine_near_da_sa_4_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2280
0
{
2281
0
  TRACK_FN();
2282
0
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, hp, gp);
2283
0
}
2284
2285
static void
2286
paint_affine_near_da_sa_alpha_4_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2287
0
{
2288
0
  TRACK_FN();
2289
0
  template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2290
0
}
2291
2292
static void
2293
paint_affine_near_da_4_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2294
0
{
2295
0
  TRACK_FN();
2296
0
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, hp, gp);
2297
0
}
2298
2299
static void
2300
paint_affine_near_da_alpha_4_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2301
0
{
2302
0
  TRACK_FN();
2303
0
  template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2304
0
}
2305
2306
static void
2307
paint_affine_near_sa_4_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2308
0
{
2309
0
  TRACK_FN();
2310
0
  template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, hp, gp);
2311
0
}
2312
2313
static void
2314
paint_affine_near_sa_alpha_4_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2315
0
{
2316
0
  TRACK_FN();
2317
0
  template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2318
0
}
2319
2320
static void
2321
paint_affine_near_4_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2322
0
{
2323
0
  TRACK_FN();
2324
0
  template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, hp, gp);
2325
0
}
2326
2327
static void
2328
paint_affine_near_alpha_4_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2329
0
{
2330
0
  TRACK_FN();
2331
0
  template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2332
0
}
2333
2334
static void
2335
paint_affine_near_da_sa_4_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2336
0
{
2337
0
  TRACK_FN();
2338
0
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, hp, gp);
2339
0
}
2340
2341
static void
2342
paint_affine_near_da_sa_alpha_4_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2343
0
{
2344
0
  TRACK_FN();
2345
0
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2346
0
}
2347
2348
static void
2349
paint_affine_near_da_4_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2350
0
{
2351
0
  TRACK_FN();
2352
0
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, hp, gp);
2353
0
}
2354
2355
static void
2356
paint_affine_near_da_alpha_4_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2357
0
{
2358
0
  TRACK_FN();
2359
0
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2360
0
}
2361
2362
static void
2363
paint_affine_near_sa_4_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2364
0
{
2365
0
  TRACK_FN();
2366
0
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, hp, gp);
2367
0
}
2368
2369
static void
2370
paint_affine_near_sa_alpha_4_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2371
0
{
2372
0
  TRACK_FN();
2373
0
  template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2374
0
}
2375
2376
static void
2377
paint_affine_near_4_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2378
0
{
2379
0
  TRACK_FN();
2380
0
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, hp, gp);
2381
0
}
2382
2383
static void
2384
paint_affine_near_alpha_4_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2385
0
{
2386
0
  TRACK_FN();
2387
0
  template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2388
0
}
2389
2390
static void
2391
paint_affine_near_da_sa_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2392
0
{
2393
0
  TRACK_FN();
2394
0
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, hp, gp);
2395
0
}
2396
2397
static void
2398
paint_affine_near_da_sa_alpha_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2399
0
{
2400
0
  TRACK_FN();
2401
0
  template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2402
0
}
2403
2404
static void
2405
paint_affine_near_da_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2406
0
{
2407
0
  TRACK_FN();
2408
0
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, hp, gp);
2409
0
}
2410
2411
static void
2412
paint_affine_near_da_alpha_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2413
0
{
2414
0
  TRACK_FN();
2415
0
  template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2416
0
}
2417
2418
static void
2419
paint_affine_near_sa_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2420
0
{
2421
0
  TRACK_FN();
2422
0
  template_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, hp, gp);
2423
0
}
2424
2425
static void
2426
paint_affine_near_sa_alpha_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2427
0
{
2428
0
  TRACK_FN();
2429
0
  template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2430
0
}
2431
2432
static void
2433
paint_affine_near_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2434
0
{
2435
0
  TRACK_FN();
2436
0
  template_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, hp, gp);
2437
0
}
2438
2439
static void
2440
paint_affine_near_alpha_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2441
0
{
2442
0
  TRACK_FN();
2443
0
  template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, alpha, hp, gp);
2444
0
}
2445
#endif /* FZ_PLOTTERS_CMYK */
2446
2447
#if FZ_PLOTTERS_N
2448
static void
2449
paint_affine_near_da_sa_N_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2450
0
{
2451
0
  TRACK_FN();
2452
0
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, hp, gp);
2453
0
}
2454
2455
static void
2456
paint_affine_near_da_sa_alpha_N_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2457
0
{
2458
0
  TRACK_FN();
2459
0
  template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2460
0
}
2461
2462
static void
2463
paint_affine_near_da_N_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2464
0
{
2465
0
  TRACK_FN();
2466
0
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, hp, gp);
2467
0
}
2468
2469
static void
2470
paint_affine_near_da_alpha_N_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2471
0
{
2472
0
  TRACK_FN();
2473
0
  template_affine_alpha_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2474
0
}
2475
2476
static void
2477
paint_affine_near_sa_N_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2478
0
{
2479
0
  TRACK_FN();
2480
0
  template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, hp, gp);
2481
0
}
2482
2483
static void
2484
paint_affine_near_sa_alpha_N_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2485
0
{
2486
0
  TRACK_FN();
2487
0
  template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2488
0
}
2489
2490
static void
2491
paint_affine_near_N_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2492
0
{
2493
0
  TRACK_FN();
2494
0
  template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, hp, gp);
2495
0
}
2496
2497
static void
2498
paint_affine_near_alpha_N_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2499
0
{
2500
0
  TRACK_FN();
2501
0
  template_affine_alpha_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2502
0
}
2503
2504
static void
2505
paint_affine_near_da_sa_N_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2506
0
{
2507
0
  TRACK_FN();
2508
0
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, hp, gp);
2509
0
}
2510
2511
static void
2512
paint_affine_near_da_sa_alpha_N_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2513
0
{
2514
0
  TRACK_FN();
2515
0
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2516
0
}
2517
2518
static void
2519
paint_affine_near_da_N_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2520
0
{
2521
0
  TRACK_FN();
2522
0
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, hp, gp);
2523
0
}
2524
2525
static void
2526
paint_affine_near_da_alpha_N_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2527
0
{
2528
0
  TRACK_FN();
2529
0
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2530
0
}
2531
2532
static void
2533
paint_affine_near_sa_N_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2534
0
{
2535
0
  TRACK_FN();
2536
0
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, hp, gp);
2537
0
}
2538
2539
static void
2540
paint_affine_near_sa_alpha_N_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2541
0
{
2542
0
  TRACK_FN();
2543
0
  template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2544
0
}
2545
2546
static void
2547
paint_affine_near_N_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2548
0
{
2549
0
  TRACK_FN();
2550
0
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, hp, gp);
2551
0
}
2552
2553
static void
2554
paint_affine_near_alpha_N_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2555
0
{
2556
0
  TRACK_FN();
2557
0
  template_affine_alpha_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2558
0
}
2559
2560
static void
2561
paint_affine_near_da_sa_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2562
0
{
2563
0
  TRACK_FN();
2564
0
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, hp, gp);
2565
0
}
2566
2567
static void
2568
paint_affine_near_da_sa_alpha_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2569
0
{
2570
0
  TRACK_FN();
2571
0
  template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2572
0
}
2573
2574
static void
2575
paint_affine_near_da_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2576
0
{
2577
0
  TRACK_FN();
2578
0
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, hp, gp);
2579
0
}
2580
2581
static void
2582
paint_affine_near_da_alpha_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2583
0
{
2584
0
  TRACK_FN();
2585
0
  template_affine_alpha_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2586
0
}
2587
2588
static void
2589
paint_affine_near_sa_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2590
0
{
2591
0
  TRACK_FN();
2592
0
  template_affine_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, hp, gp);
2593
0
}
2594
2595
static void
2596
paint_affine_near_sa_alpha_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2597
0
{
2598
0
  TRACK_FN();
2599
0
  template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2600
0
}
2601
2602
static void
2603
paint_affine_near_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2604
0
{
2605
0
  TRACK_FN();
2606
0
  template_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, hp, gp);
2607
0
}
2608
2609
static void
2610
paint_affine_near_alpha_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2611
0
{
2612
0
  TRACK_FN();
2613
0
  template_affine_alpha_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, dn, sn, alpha, hp, gp);
2614
0
}
2615
#endif /* FZ_PLOTTERS_N */
2616
2617
#if FZ_ENABLE_SPOT_RENDERING
2618
static void
2619
paint_affine_near_N_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2620
0
{
2621
0
  TRACK_FN();
2622
0
  template_affine_N_near_op(dp, da, sp, sw, sh, ss, sa, u, v, fa, fb, w, dn, sn, hp, gp, eop);
2623
0
}
2624
2625
static void
2626
paint_affine_near_alpha_N_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
2627
0
{
2628
0
  TRACK_FN();
2629
0
  template_affine_alpha_N_near_op(dp, da, sp, sw, sh, ss, sa, u, v, fa, fb, w, dn, sn, alpha, hp, gp, eop);
2630
0
}
2631
#endif /* FZ_ENABLE_SPOT_RENDERING */
2632
2633
static paintfn_t *
2634
fz_paint_affine_near(int da, int sa, affint fa, affint fb, int n, int alpha, const fz_overprint * FZ_RESTRICT eop)
2635
2
{
2636
2
#if FZ_ENABLE_SPOT_RENDERING
2637
2
  if (fz_overprint_required(eop))
2638
0
  {
2639
0
    if (alpha == 255)
2640
0
      return paint_affine_near_N_op;
2641
0
    else if (alpha > 0)
2642
0
      return paint_affine_near_alpha_N_op;
2643
0
    else
2644
0
      return NULL;
2645
0
  }
2646
2
#endif /* FZ_ENABLE_SPOT_RENDERING */
2647
2
  switch(n)
2648
2
  {
2649
0
  case 0:
2650
0
    if (da)
2651
0
    {
2652
0
      if (sa)
2653
0
      {
2654
0
        if (alpha == 255)
2655
0
        {
2656
0
          if (fa == 0)
2657
0
            return paint_affine_near_da_sa_0_fa0;
2658
0
          else if (fb == 0)
2659
0
            return paint_affine_near_da_sa_0_fb0;
2660
0
          else
2661
0
            return paint_affine_near_da_sa_0;
2662
0
        }
2663
0
        else if (alpha > 0)
2664
0
        {
2665
0
          if (fa == 0)
2666
0
            return paint_affine_near_da_sa_alpha_0_fa0;
2667
0
          else if (fb == 0)
2668
0
            return paint_affine_near_da_sa_alpha_0_fb0;
2669
0
          else
2670
0
            return paint_affine_near_da_sa_alpha_0;
2671
0
        }
2672
0
      }
2673
0
      else
2674
0
      {
2675
0
        if (alpha == 255)
2676
0
        {
2677
0
          if (fa == 0)
2678
0
            return paint_affine_near_da_0_fa0;
2679
0
          else if (fb == 0)
2680
0
            return paint_affine_near_da_0_fb0;
2681
0
          else
2682
0
            return paint_affine_near_da_0;
2683
0
        }
2684
0
        else if (alpha > 0)
2685
0
        {
2686
0
          if (fa == 0)
2687
0
            return paint_affine_near_da_alpha_0_fa0;
2688
0
          else if (fb == 0)
2689
0
            return paint_affine_near_da_alpha_0_fb0;
2690
0
          else
2691
0
            return paint_affine_near_da_alpha_0;
2692
0
        }
2693
0
      }
2694
0
    }
2695
0
    break;
2696
2697
0
  case 1:
2698
0
    if (sa)
2699
0
    {
2700
0
#if FZ_PLOTTERS_G
2701
0
      if (da)
2702
0
      {
2703
0
        if (alpha == 255)
2704
0
        {
2705
0
          if (fa == 0)
2706
0
            return paint_affine_near_da_sa_1_fa0;
2707
0
          else if (fb == 0)
2708
0
            return paint_affine_near_da_sa_1_fb0;
2709
0
          else
2710
0
            return paint_affine_near_da_sa_1;
2711
0
        }
2712
0
        else if (alpha > 0)
2713
0
        {
2714
0
          if (fa == 0)
2715
0
            return paint_affine_near_da_sa_alpha_1_fa0;
2716
0
          else if (fb == 0)
2717
0
            return paint_affine_near_da_sa_alpha_1_fb0;
2718
0
          else
2719
0
            return paint_affine_near_da_sa_alpha_1;
2720
0
        }
2721
0
      }
2722
0
      else
2723
0
      {
2724
0
        if (alpha == 255)
2725
0
        {
2726
0
          if (fa == 0)
2727
0
            return paint_affine_near_sa_1_fa0;
2728
0
          else if (fb == 0)
2729
0
            return paint_affine_near_sa_1_fb0;
2730
0
          else
2731
0
            return paint_affine_near_sa_1;
2732
0
        }
2733
0
        else if (alpha > 0)
2734
0
        {
2735
0
          if (fa == 0)
2736
0
            return paint_affine_near_sa_alpha_1_fa0;
2737
0
          else if (fb == 0)
2738
0
            return paint_affine_near_sa_alpha_1_fb0;
2739
0
          else
2740
0
            return paint_affine_near_sa_alpha_1;
2741
0
        }
2742
0
      }
2743
#else
2744
      goto fallback;
2745
#endif /* FZ_PLOTTERS_G */
2746
0
    }
2747
0
    else
2748
0
    {
2749
0
      if (da)
2750
0
      {
2751
0
        if (alpha == 255)
2752
0
        {
2753
0
          if (fa == 0)
2754
0
            return paint_affine_near_da_1_fa0;
2755
0
          else if (fb == 0)
2756
0
            return paint_affine_near_da_1_fb0;
2757
0
          else
2758
0
            return paint_affine_near_da_1;
2759
0
        }
2760
0
        else if (alpha > 0)
2761
0
        {
2762
0
          if (fa == 0)
2763
0
            return paint_affine_near_da_alpha_1_fa0;
2764
0
          else if (fb == 0)
2765
0
            return paint_affine_near_da_alpha_1_fb0;
2766
0
          else
2767
0
            return paint_affine_near_da_alpha_1;
2768
0
        }
2769
0
      }
2770
0
      else
2771
0
      {
2772
0
        if (alpha == 255)
2773
0
        {
2774
0
          if (fa == 0)
2775
0
            return paint_affine_near_1_fa0;
2776
0
          else if (fb == 0)
2777
0
            return paint_affine_near_1_fb0;
2778
0
          else
2779
0
            return paint_affine_near_1;
2780
0
        }
2781
0
        else if (alpha > 0)
2782
0
        {
2783
0
          if (fa == 0)
2784
0
            return paint_affine_near_alpha_1_fa0;
2785
0
          else if (fb == 0)
2786
0
            return paint_affine_near_alpha_1_fb0;
2787
0
          else
2788
0
            return paint_affine_near_alpha_1;
2789
0
        }
2790
0
      }
2791
0
    }
2792
0
    break;
2793
2794
0
#if FZ_PLOTTERS_RGB
2795
2
  case 3:
2796
2
    if (da)
2797
0
    {
2798
0
      if (sa)
2799
0
      {
2800
0
        if (alpha == 255)
2801
0
        {
2802
0
          if (fa == 0)
2803
0
            return paint_affine_near_da_sa_3_fa0;
2804
0
          else if (fb == 0)
2805
0
            return paint_affine_near_da_sa_3_fb0;
2806
0
          else
2807
0
            return paint_affine_near_da_sa_3;
2808
0
        }
2809
0
        else if (alpha > 0)
2810
0
        {
2811
0
          if (fa == 0)
2812
0
            return paint_affine_near_da_sa_alpha_3_fa0;
2813
0
          else if (fb == 0)
2814
0
            return paint_affine_near_da_sa_alpha_3_fb0;
2815
0
          else
2816
0
            return paint_affine_near_da_sa_alpha_3;
2817
0
        }
2818
0
      }
2819
0
      else
2820
0
      {
2821
0
        if (alpha == 255)
2822
0
        {
2823
0
          if (fa == 0)
2824
0
            return paint_affine_near_da_3_fa0;
2825
0
          else if (fb == 0)
2826
0
            return paint_affine_near_da_3_fb0;
2827
0
          else
2828
0
            return paint_affine_near_da_3;
2829
0
        }
2830
0
        else if (alpha > 0)
2831
0
        {
2832
0
          if (fa == 0)
2833
0
            return paint_affine_near_da_alpha_3_fa0;
2834
0
          else if (fb == 0)
2835
0
            return paint_affine_near_da_alpha_3_fb0;
2836
0
          else
2837
0
            return paint_affine_near_da_alpha_3;
2838
0
        }
2839
0
      }
2840
0
    }
2841
2
    else
2842
2
    {
2843
2
      if (sa)
2844
0
      {
2845
0
        if (alpha == 255)
2846
0
        {
2847
0
          if (fa == 0)
2848
0
            return paint_affine_near_sa_3_fa0;
2849
0
          else if (fb == 0)
2850
0
            return paint_affine_near_sa_3_fb0;
2851
0
          else
2852
0
            return paint_affine_near_sa_3;
2853
0
        }
2854
0
        else if (alpha > 0)
2855
0
        {
2856
0
          if (fa == 0)
2857
0
            return paint_affine_near_sa_alpha_3_fa0;
2858
0
          else if (fb == 0)
2859
0
            return paint_affine_near_sa_alpha_3_fb0;
2860
0
          else
2861
0
            return paint_affine_near_sa_alpha_3;
2862
0
        }
2863
0
      }
2864
2
      else
2865
2
      {
2866
2
        if (alpha == 255)
2867
2
        {
2868
2
          if (fa == 0)
2869
0
            return paint_affine_near_3_fa0;
2870
2
          else if (fb == 0)
2871
2
            return paint_affine_near_3_fb0;
2872
0
          else
2873
0
            return paint_affine_near_3;
2874
2
        }
2875
0
        else if (alpha > 0)
2876
0
        {
2877
0
          if (fa == 0)
2878
0
            return paint_affine_near_alpha_3_fa0;
2879
0
          else if (fb == 0)
2880
0
            return paint_affine_near_alpha_3_fb0;
2881
0
          else
2882
0
            return paint_affine_near_alpha_3;
2883
0
        }
2884
2
      }
2885
2
    }
2886
0
    break;
2887
0
#endif /* FZ_PLOTTERS_RGB */
2888
2889
0
#if FZ_PLOTTERS_CMYK
2890
0
  case 4:
2891
0
    if (da)
2892
0
    {
2893
0
      if (sa)
2894
0
      {
2895
0
        if (alpha == 255)
2896
0
        {
2897
0
          if (fa == 0)
2898
0
            return paint_affine_near_da_sa_4_fa0;
2899
0
          else if (fb == 0)
2900
0
            return paint_affine_near_da_sa_4_fb0;
2901
0
          else
2902
0
            return paint_affine_near_da_sa_4;
2903
0
        }
2904
0
        else if (alpha > 0)
2905
0
        {
2906
0
          if (fa == 0)
2907
0
            return paint_affine_near_da_sa_alpha_4_fa0;
2908
0
          else if (fb == 0)
2909
0
            return paint_affine_near_da_sa_alpha_4_fb0;
2910
0
          else
2911
0
            return paint_affine_near_da_sa_alpha_4;
2912
0
        }
2913
0
      }
2914
0
      else
2915
0
      {
2916
0
        if (alpha == 255)
2917
0
        {
2918
0
          if (fa == 0)
2919
0
            return paint_affine_near_da_4_fa0;
2920
0
          else if (fb == 0)
2921
0
            return paint_affine_near_da_4_fb0;
2922
0
          else
2923
0
            return paint_affine_near_da_4;
2924
0
        }
2925
0
        else if (alpha > 0)
2926
0
        {
2927
0
          if (fa == 0)
2928
0
            return paint_affine_near_da_alpha_4_fa0;
2929
0
          else if (fb == 0)
2930
0
            return paint_affine_near_da_alpha_4_fb0;
2931
0
          else
2932
0
            return paint_affine_near_da_alpha_4;
2933
0
        }
2934
0
      }
2935
0
    }
2936
0
    else
2937
0
    {
2938
0
      if (sa)
2939
0
      {
2940
0
        if (alpha == 255)
2941
0
        {
2942
0
          if (fa == 0)
2943
0
            return paint_affine_near_sa_4_fa0;
2944
0
          else if (fb == 0)
2945
0
            return paint_affine_near_sa_4_fb0;
2946
0
          else
2947
0
            return paint_affine_near_sa_4;
2948
0
        }
2949
0
        else if (alpha > 0)
2950
0
        {
2951
0
          if (fa == 0)
2952
0
            return paint_affine_near_sa_alpha_4_fa0;
2953
0
          else if (fb == 0)
2954
0
            return paint_affine_near_sa_alpha_4_fb0;
2955
0
          else
2956
0
            return paint_affine_near_sa_alpha_4;
2957
0
        }
2958
0
      }
2959
0
      else
2960
0
      {
2961
0
        if (alpha == 255)
2962
0
        {
2963
0
          if (fa == 0)
2964
0
            return paint_affine_near_4_fa0;
2965
0
          else if (fb == 0)
2966
0
            return paint_affine_near_4_fb0;
2967
0
          else
2968
0
            return paint_affine_near_4;
2969
0
        }
2970
0
        else if (alpha > 0)
2971
0
        {
2972
0
          if (fa == 0)
2973
0
            return paint_affine_near_alpha_4_fa0;
2974
0
          else if (fb == 0)
2975
0
            return paint_affine_near_alpha_4_fb0;
2976
0
          else
2977
0
            return paint_affine_near_alpha_4;
2978
0
        }
2979
0
      }
2980
0
    }
2981
0
    break;
2982
0
#endif /* FZ_PLOTTERS_CMYK */
2983
2984
#if !FZ_PLOTTERS_G
2985
fallback:
2986
#endif /* FZ_PLOTTERS_G */
2987
0
  default:
2988
0
#if FZ_PLOTTERS_N
2989
0
    if (da)
2990
0
    {
2991
0
      if (sa)
2992
0
      {
2993
0
        if (alpha == 255)
2994
0
        {
2995
0
          if (fa == 0)
2996
0
            return paint_affine_near_da_sa_N_fa0;
2997
0
          else if (fb == 0)
2998
0
            return paint_affine_near_da_sa_N_fb0;
2999
0
          else
3000
0
            return paint_affine_near_da_sa_N;
3001
0
        }
3002
0
        else if (alpha > 0)
3003
0
        {
3004
0
          if (fa == 0)
3005
0
            return paint_affine_near_da_sa_alpha_N_fa0;
3006
0
          else if (fb == 0)
3007
0
            return paint_affine_near_da_sa_alpha_N_fb0;
3008
0
          else
3009
0
            return paint_affine_near_da_sa_alpha_N;
3010
0
        }
3011
0
      }
3012
0
      else
3013
0
      {
3014
0
        if (alpha == 255)
3015
0
        {
3016
0
          if (fa == 0)
3017
0
            return paint_affine_near_da_N_fa0;
3018
0
          else if (fb == 0)
3019
0
            return paint_affine_near_da_N_fb0;
3020
0
          else
3021
0
            return paint_affine_near_da_N;
3022
0
        }
3023
0
        else if (alpha > 0)
3024
0
        {
3025
0
          if (fa == 0)
3026
0
            return paint_affine_near_da_alpha_N_fa0;
3027
0
          else if (fb == 0)
3028
0
            return paint_affine_near_da_alpha_N_fb0;
3029
0
          else
3030
0
            return paint_affine_near_da_alpha_N;
3031
0
        }
3032
0
      }
3033
0
    }
3034
0
    else
3035
0
    {
3036
0
      if (sa)
3037
0
      {
3038
0
        if (alpha == 255)
3039
0
        {
3040
0
          if (fa == 0)
3041
0
            return paint_affine_near_sa_N_fa0;
3042
0
          else if (fb == 0)
3043
0
            return paint_affine_near_sa_N_fb0;
3044
0
          else
3045
0
            return paint_affine_near_sa_N;
3046
0
        }
3047
0
        else if (alpha > 0)
3048
0
        {
3049
0
          if (fa == 0)
3050
0
            return paint_affine_near_sa_alpha_N_fa0;
3051
0
          else if (fb == 0)
3052
0
            return paint_affine_near_sa_alpha_N_fb0;
3053
0
          else
3054
0
            return paint_affine_near_sa_alpha_N;
3055
0
        }
3056
0
      }
3057
0
      else
3058
0
      {
3059
0
        if (alpha == 255)
3060
0
        {
3061
0
          if (fa == 0)
3062
0
            return paint_affine_near_N_fa0;
3063
0
          else if (fb == 0)
3064
0
            return paint_affine_near_N_fb0;
3065
0
          else
3066
0
            return paint_affine_near_N;
3067
0
        }
3068
0
        else if (alpha > 0)
3069
0
        {
3070
0
          if (fa == 0)
3071
0
            return paint_affine_near_alpha_N_fa0;
3072
0
          else if (fb == 0)
3073
0
            return paint_affine_near_alpha_N_fb0;
3074
0
          else
3075
0
            return paint_affine_near_alpha_N;
3076
0
        }
3077
0
      }
3078
0
    }
3079
0
#endif /* FZ_PLOTTERS_N */
3080
0
    break;
3081
2
  }
3082
0
  return NULL;
3083
2
}
3084
3085
#if FZ_ENABLE_SPOT_RENDERING
3086
static paintfn_t *
3087
fz_paint_affine_near_spots(int da, int sa, affint fa, affint fb, int dn, int sn, int alpha, const fz_overprint * FZ_RESTRICT eop)
3088
0
{
3089
0
  if (fz_overprint_required(eop))
3090
0
  {
3091
0
    if (alpha == 255)
3092
0
      return paint_affine_near_N_op;
3093
0
    else if (alpha > 0)
3094
0
      return paint_affine_near_alpha_N_op;
3095
0
  }
3096
0
  else if (da)
3097
0
  {
3098
0
    if (sa)
3099
0
    {
3100
0
      if (alpha == 255)
3101
0
      {
3102
0
        if (fa == 0)
3103
0
          return paint_affine_near_da_sa_N_fa0;
3104
0
        else if (fb == 0)
3105
0
          return paint_affine_near_da_sa_N_fb0;
3106
0
        else
3107
0
          return paint_affine_near_da_sa_N;
3108
0
      }
3109
0
      else if (alpha > 0)
3110
0
      {
3111
0
        if (fa == 0)
3112
0
          return paint_affine_near_da_sa_alpha_N_fa0;
3113
0
        else if (fb == 0)
3114
0
          return paint_affine_near_da_sa_alpha_N_fb0;
3115
0
        else
3116
0
          return paint_affine_near_da_sa_alpha_N;
3117
0
      }
3118
0
    }
3119
0
    else
3120
0
    {
3121
0
      if (alpha == 255)
3122
0
      {
3123
0
        if (fa == 0)
3124
0
          return paint_affine_near_da_N_fa0;
3125
0
        else if (fb == 0)
3126
0
          return paint_affine_near_da_N_fb0;
3127
0
        else
3128
0
          return paint_affine_near_da_N;
3129
0
      }
3130
0
      else if (alpha > 0)
3131
0
      {
3132
0
        if (fa == 0)
3133
0
          return paint_affine_near_da_alpha_N_fa0;
3134
0
        else if (fb == 0)
3135
0
          return paint_affine_near_da_alpha_N_fb0;
3136
0
        else
3137
0
          return paint_affine_near_da_alpha_N;
3138
0
      }
3139
0
    }
3140
0
  }
3141
0
  else
3142
0
  {
3143
0
    if (sa)
3144
0
    {
3145
0
      if (alpha == 255)
3146
0
      {
3147
0
        if (fa == 0)
3148
0
          return paint_affine_near_sa_N_fa0;
3149
0
        else if (fb == 0)
3150
0
          return paint_affine_near_sa_N_fb0;
3151
0
        else
3152
0
          return paint_affine_near_sa_N;
3153
0
      }
3154
0
      else if (alpha > 0)
3155
0
      {
3156
0
        if (fa == 0)
3157
0
          return paint_affine_near_sa_alpha_N_fa0;
3158
0
        else if (fb == 0)
3159
0
          return paint_affine_near_sa_alpha_N_fb0;
3160
0
        else
3161
0
          return paint_affine_near_sa_alpha_N;
3162
0
      }
3163
0
    }
3164
0
    else
3165
0
    {
3166
0
      if (alpha == 255)
3167
0
      {
3168
0
        if (fa == 0)
3169
0
          return paint_affine_near_N_fa0;
3170
0
        else if (fb == 0)
3171
0
          return paint_affine_near_N_fb0;
3172
0
        else
3173
0
          return paint_affine_near_N;
3174
0
      }
3175
0
      else if (alpha > 0)
3176
0
      {
3177
0
        if (fa == 0)
3178
0
          return paint_affine_near_alpha_N_fa0;
3179
0
        else if (fb == 0)
3180
0
          return paint_affine_near_alpha_N_fb0;
3181
0
        else
3182
0
          return paint_affine_near_alpha_N;
3183
0
      }
3184
0
    }
3185
0
  }
3186
0
  return NULL;
3187
0
}
3188
#endif /* FZ_ENABLE_SPOT_RENDERING */
3189
3190
#if FZ_PLOTTERS_RGB
3191
static void
3192
paint_affine_near_da_sa_g2rgb_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3193
0
{
3194
0
  TRACK_FN();
3195
0
  template_affine_solid_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp, gp);
3196
0
}
3197
3198
static void
3199
paint_affine_near_da_sa_alpha_g2rgb_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3200
0
{
3201
0
  TRACK_FN();
3202
0
  template_affine_alpha_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp, gp);
3203
0
}
3204
3205
static void
3206
paint_affine_near_da_g2rgb_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3207
0
{
3208
0
  TRACK_FN();
3209
0
  template_affine_solid_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3210
0
}
3211
3212
static void
3213
paint_affine_near_da_alpha_g2rgb_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3214
0
{
3215
0
  TRACK_FN();
3216
0
  template_affine_alpha_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
3217
0
}
3218
3219
static void
3220
paint_affine_near_sa_g2rgb_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3221
0
{
3222
0
  TRACK_FN();
3223
0
  template_affine_solid_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp, gp);
3224
0
}
3225
3226
static void
3227
paint_affine_near_sa_alpha_g2rgb_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3228
0
{
3229
0
  TRACK_FN();
3230
0
  template_affine_alpha_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp, gp);
3231
0
}
3232
3233
static void
3234
paint_affine_near_g2rgb_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3235
0
{
3236
0
  TRACK_FN();
3237
0
  template_affine_solid_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3238
0
}
3239
3240
static void
3241
paint_affine_near_alpha_g2rgb_fa0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3242
0
{
3243
0
  TRACK_FN();
3244
0
  template_affine_alpha_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
3245
0
}
3246
3247
static void
3248
paint_affine_near_da_sa_g2rgb_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3249
0
{
3250
0
  TRACK_FN();
3251
0
  template_affine_solid_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp, gp);
3252
0
}
3253
3254
static void
3255
paint_affine_near_da_sa_alpha_g2rgb_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3256
0
{
3257
0
  TRACK_FN();
3258
0
  template_affine_alpha_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp, gp);
3259
0
}
3260
3261
static void
3262
paint_affine_near_da_g2rgb_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3263
0
{
3264
0
  TRACK_FN();
3265
0
  template_affine_solid_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3266
0
}
3267
3268
static void
3269
paint_affine_near_da_alpha_g2rgb_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3270
0
{
3271
0
  TRACK_FN();
3272
0
  template_affine_alpha_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
3273
0
}
3274
3275
static void
3276
paint_affine_near_sa_g2rgb_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3277
0
{
3278
0
  TRACK_FN();
3279
0
  template_affine_solid_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp, gp);
3280
0
}
3281
3282
static void
3283
paint_affine_near_sa_alpha_g2rgb_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3284
0
{
3285
0
  TRACK_FN();
3286
0
  template_affine_alpha_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp, gp);
3287
0
}
3288
3289
static void
3290
paint_affine_near_g2rgb_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3291
0
{
3292
0
  TRACK_FN();
3293
0
  template_affine_solid_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3294
0
}
3295
3296
static void
3297
paint_affine_near_alpha_g2rgb_fb0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3298
0
{
3299
0
  TRACK_FN();
3300
0
  template_affine_alpha_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
3301
0
}
3302
3303
static void
3304
paint_affine_near_da_sa_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3305
0
{
3306
0
  TRACK_FN();
3307
0
  template_affine_solid_g2rgb_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp, gp);
3308
0
}
3309
3310
static void
3311
paint_affine_near_da_sa_alpha_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3312
0
{
3313
0
  TRACK_FN();
3314
0
  template_affine_alpha_g2rgb_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp, gp);
3315
0
}
3316
3317
static void
3318
paint_affine_near_da_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3319
0
{
3320
0
  TRACK_FN();
3321
0
  template_affine_solid_g2rgb_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3322
0
}
3323
3324
static void
3325
paint_affine_near_da_alpha_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3326
0
{
3327
0
  TRACK_FN();
3328
0
  template_affine_alpha_g2rgb_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
3329
0
}
3330
3331
static void
3332
paint_affine_near_sa_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3333
0
{
3334
0
  TRACK_FN();
3335
0
  template_affine_solid_g2rgb_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp, gp);
3336
0
}
3337
3338
static void
3339
paint_affine_near_sa_alpha_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3340
0
{
3341
0
  TRACK_FN();
3342
0
  template_affine_alpha_g2rgb_near(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, alpha, hp, gp);
3343
0
}
3344
3345
static void
3346
paint_affine_near_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3347
0
{
3348
0
  TRACK_FN();
3349
0
  template_affine_solid_g2rgb_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3350
0
}
3351
3352
static void
3353
paint_affine_near_alpha_g2rgb(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn1, int sn1, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3354
0
{
3355
0
  TRACK_FN();
3356
0
  template_affine_alpha_g2rgb_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
3357
0
}
3358
3359
static paintfn_t *
3360
fz_paint_affine_g2rgb_near(int da, int sa, affint fa, affint fb, int n, int alpha)
3361
0
{
3362
0
  if (da)
3363
0
  {
3364
0
    if (sa)
3365
0
    {
3366
0
      if (fa == 0)
3367
0
      {
3368
0
        if (alpha == 255)
3369
0
          return paint_affine_near_da_sa_g2rgb_fa0;
3370
0
        else if (alpha > 0)
3371
0
          return paint_affine_near_da_sa_alpha_g2rgb_fa0;
3372
0
      }
3373
0
      else if (fb == 0)
3374
0
      {
3375
0
        if (alpha == 255)
3376
0
          return paint_affine_near_da_sa_g2rgb_fb0;
3377
0
        else if (alpha > 0)
3378
0
          return paint_affine_near_da_sa_alpha_g2rgb_fb0;
3379
0
      }
3380
0
      else
3381
0
      {
3382
0
        if (alpha == 255)
3383
0
          return paint_affine_near_da_sa_g2rgb;
3384
0
        else if (alpha > 0)
3385
0
          return paint_affine_near_da_sa_alpha_g2rgb;
3386
0
      }
3387
0
    }
3388
0
    else
3389
0
    {
3390
0
      if (fa == 0)
3391
0
      {
3392
0
        if (alpha == 255)
3393
0
          return paint_affine_near_da_g2rgb_fa0;
3394
0
        else if (alpha > 0)
3395
0
          return paint_affine_near_da_alpha_g2rgb_fa0;
3396
0
      }
3397
0
      else if (fb == 0)
3398
0
      {
3399
0
        if (alpha == 255)
3400
0
          return paint_affine_near_da_g2rgb_fb0;
3401
0
        else if (alpha > 0)
3402
0
          return paint_affine_near_da_alpha_g2rgb_fb0;
3403
0
      }
3404
0
      else
3405
0
      {
3406
0
        if (alpha == 255)
3407
0
          return paint_affine_near_da_g2rgb;
3408
0
        else if (alpha > 0)
3409
0
          return paint_affine_near_da_alpha_g2rgb;
3410
0
      }
3411
0
    }
3412
0
  }
3413
0
  else
3414
0
  {
3415
0
    if (sa)
3416
0
    {
3417
0
      if (fa == 0)
3418
0
      {
3419
0
        if (alpha == 255)
3420
0
          return paint_affine_near_sa_g2rgb_fa0;
3421
0
        else if (alpha > 0)
3422
0
          return paint_affine_near_sa_alpha_g2rgb_fa0;
3423
0
      }
3424
0
      else if (fb == 0)
3425
0
      {
3426
0
        if (alpha == 255)
3427
0
          return paint_affine_near_sa_g2rgb_fb0;
3428
0
        else if (alpha > 0)
3429
0
          return paint_affine_near_sa_alpha_g2rgb_fb0;
3430
0
      }
3431
0
      else
3432
0
      {
3433
0
        if (alpha == 255)
3434
0
          return paint_affine_near_sa_g2rgb;
3435
0
        else if (alpha > 0)
3436
0
          return paint_affine_near_sa_alpha_g2rgb;
3437
0
      }
3438
0
    }
3439
0
    else
3440
0
    {
3441
0
      if (fa == 0)
3442
0
      {
3443
0
        if (alpha == 255)
3444
0
          return paint_affine_near_g2rgb_fa0;
3445
0
        else if (alpha > 0)
3446
0
          return paint_affine_near_alpha_g2rgb_fa0;
3447
0
      }
3448
0
      else if (fb == 0)
3449
0
      {
3450
0
        if (alpha == 255)
3451
0
          return paint_affine_near_g2rgb_fb0;
3452
0
        else if (alpha > 0)
3453
0
          return paint_affine_near_alpha_g2rgb_fb0;
3454
0
      }
3455
0
      else
3456
0
      {
3457
0
        if (alpha == 255)
3458
0
          return paint_affine_near_g2rgb;
3459
0
        else if (alpha > 0)
3460
0
          return paint_affine_near_alpha_g2rgb;
3461
0
      }
3462
0
    }
3463
0
  }
3464
0
  return NULL;
3465
0
}
3466
#endif /* FZ_PLOTTERS_RGB */
3467
3468
static void
3469
paint_affine_color_lerp_da_0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3470
0
{
3471
0
  TRACK_FN();
3472
0
  template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 0, 0, color, hp, gp);
3473
0
}
3474
3475
#if FZ_PLOTTERS_G
3476
static void
3477
paint_affine_color_lerp_da_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3478
0
{
3479
0
  TRACK_FN();
3480
0
  template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 1, 1, color, hp, gp);
3481
0
}
3482
3483
static void
3484
paint_affine_color_lerp_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3485
0
{
3486
0
  TRACK_FN();
3487
0
  template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 1, 1, color, hp, gp);
3488
0
}
3489
#endif /* FZ_PLOTTERS_G */
3490
3491
#if FZ_PLOTTERS_RGB
3492
static void
3493
paint_affine_color_lerp_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3494
0
{
3495
0
  TRACK_FN();
3496
0
  template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 3, 3, color, hp, gp);
3497
0
}
3498
3499
static void
3500
paint_affine_color_lerp_da_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3501
0
{
3502
0
  TRACK_FN();
3503
0
  template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 3, 3, color, hp, gp);
3504
0
}
3505
#endif /* FZ_PLOTTERS_RGB */
3506
3507
#if FZ_PLOTTERS_CMYK
3508
static void
3509
paint_affine_color_lerp_da_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3510
0
{
3511
0
  TRACK_FN();
3512
0
  template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 4, 4, color, hp, gp);
3513
0
}
3514
3515
static void
3516
paint_affine_color_lerp_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3517
0
{
3518
0
  TRACK_FN();
3519
0
  template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 4, 4, color, hp, gp);
3520
0
}
3521
#endif /* FZ_PLOTTERS_G */
3522
3523
#if FZ_PLOTTERS_N
3524
static void
3525
paint_affine_color_lerp_da_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3526
0
{
3527
0
  TRACK_FN();
3528
0
  template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp);
3529
0
}
3530
3531
static void
3532
paint_affine_color_lerp_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3533
0
{
3534
0
  TRACK_FN();
3535
0
  template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp);
3536
0
}
3537
#endif /* FZ_PLOTTERS_N */
3538
3539
#if FZ_ENABLE_SPOT_RENDERING
3540
static void
3541
paint_affine_color_lerp_N_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3542
0
{
3543
0
  TRACK_FN();
3544
0
  template_affine_color_N_lerp_op(dp, da, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp, eop);
3545
0
}
3546
#endif /* FZ_ENABLE_SPOT_RENDERING */
3547
3548
static paintfn_t *
3549
fz_paint_affine_color_lerp(int da, int sa, affint fa, affint fb, int n, int alpha, const fz_overprint * FZ_RESTRICT eop)
3550
0
{
3551
0
#if FZ_ENABLE_SPOT_RENDERING
3552
0
  if (fz_overprint_required(eop))
3553
0
    return paint_affine_color_lerp_N_op;
3554
0
#endif /* FZ_ENABLE_SPOT_RENDERING */
3555
0
  switch (n)
3556
0
  {
3557
0
  case 0: return da ? paint_affine_color_lerp_da_0 : NULL;
3558
0
#if FZ_PLOTTERS_G
3559
0
  case 1: return da ? paint_affine_color_lerp_da_1 : paint_affine_color_lerp_1;
3560
0
#endif /* FZ_PLOTTERS_G */
3561
0
#if FZ_PLOTTERS_RGB
3562
0
  case 3: return da ? paint_affine_color_lerp_da_3 : paint_affine_color_lerp_3;
3563
0
#endif /* FZ_PLOTTERS_RGB */
3564
0
#if FZ_PLOTTERS_CMYK
3565
0
  case 4: return da ? paint_affine_color_lerp_da_4 : paint_affine_color_lerp_4;
3566
0
#endif /* FZ_PLOTTERS_CMYK */
3567
0
#if FZ_PLOTTERS_N
3568
0
  default: return da ? paint_affine_color_lerp_da_N : paint_affine_color_lerp_N;
3569
0
#endif /* FZ_PLOTTERS_N */
3570
0
  }
3571
0
}
3572
3573
#if FZ_ENABLE_SPOT_RENDERING
3574
static paintfn_t *
3575
fz_paint_affine_color_lerp_spots(int da, int sa, affint fa, affint fb, int dn, int sn, int alpha, const fz_overprint * FZ_RESTRICT eop)
3576
0
{
3577
0
  if (fz_overprint_required(eop))
3578
0
    return paint_affine_color_lerp_N_op;
3579
0
  return da ? paint_affine_color_lerp_da_N : paint_affine_color_lerp_N;
3580
0
}
3581
#endif /* FZ_ENABLE_SPOT_RENDERING */
3582
3583
static void
3584
paint_affine_color_near_da_0(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3585
0
{
3586
0
  TRACK_FN();
3587
0
  template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 0, 0, color, hp, gp);
3588
0
}
3589
3590
#if FZ_PLOTTERS_G
3591
static void
3592
paint_affine_color_near_da_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3593
0
{
3594
0
  TRACK_FN();
3595
0
  template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 1, 1, color, hp, gp);
3596
0
}
3597
3598
static void
3599
paint_affine_color_near_1(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3600
0
{
3601
0
  TRACK_FN();
3602
0
  template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 1, 1, color, hp, gp);
3603
0
}
3604
#endif /* FZ_PLOTTERS_G */
3605
3606
#if FZ_PLOTTERS_RGB
3607
static void
3608
paint_affine_color_near_da_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3609
0
{
3610
0
  TRACK_FN();
3611
0
  template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 3, 3, color, hp, gp);
3612
0
}
3613
3614
static void
3615
paint_affine_color_near_3(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3616
0
{
3617
0
  TRACK_FN();
3618
0
  template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 3, 3, color, hp, gp);
3619
0
}
3620
#endif /* FZ_PLOTTERS_RGB */
3621
3622
#if FZ_PLOTTERS_CMYK
3623
static void
3624
paint_affine_color_near_da_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3625
0
{
3626
0
  TRACK_FN();
3627
0
  template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 4, 4, color, hp, gp);
3628
0
}
3629
3630
static void
3631
paint_affine_color_near_4(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3632
0
{
3633
0
  TRACK_FN();
3634
0
  template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 4, 4, color, hp, gp);
3635
0
}
3636
#endif /* FZ_PLOTTERS_CMYK */
3637
3638
#if FZ_PLOTTERS_N
3639
static void
3640
paint_affine_color_near_da_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3641
0
{
3642
0
  TRACK_FN();
3643
0
  template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp);
3644
0
}
3645
3646
static void
3647
paint_affine_color_near_N(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3648
0
{
3649
0
  TRACK_FN();
3650
0
  template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp);
3651
0
}
3652
#endif /* FZ_PLOTTERS_N */
3653
3654
#if FZ_ENABLE_SPOT_RENDERING
3655
static void
3656
paint_affine_color_near_da_N_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3657
0
{
3658
0
  TRACK_FN();
3659
0
  template_affine_color_N_near_op(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp, eop);
3660
0
}
3661
3662
static void
3663
paint_affine_color_near_N_op(byte * FZ_RESTRICT dp, int da, const byte * FZ_RESTRICT sp, affint sw, affint sh, ptrdiff_t ss, int sa, affint u, affint v, affint fa, affint fb, int w, int dn, int sn, int alpha, const byte * FZ_RESTRICT color, byte * FZ_RESTRICT hp, byte * FZ_RESTRICT gp, const fz_overprint * FZ_RESTRICT eop)
3664
0
{
3665
0
  TRACK_FN();
3666
0
  template_affine_color_N_near_op(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp, eop);
3667
0
}
3668
#endif /* FZ_ENABLE_SPOT_RENDERING */
3669
3670
static paintfn_t *
3671
fz_paint_affine_color_near(int da, int sa, affint fa, affint fb, int n, int alpha, const fz_overprint * FZ_RESTRICT eop)
3672
0
{
3673
0
#if FZ_ENABLE_SPOT_RENDERING
3674
0
  if (fz_overprint_required(eop))
3675
0
    return da ? paint_affine_color_near_da_N_op : paint_affine_color_near_N_op;
3676
0
#endif /* FZ_ENABLE_SPOT_RENDERING */
3677
0
  switch (n)
3678
0
  {
3679
0
  case 0: return da ? paint_affine_color_near_da_0 : NULL;
3680
0
#if FZ_PLOTTERS_G
3681
0
  case 1: return da ? paint_affine_color_near_da_1 : paint_affine_color_near_1;
3682
0
#endif /* FZ_PLOTTERS_G */
3683
0
#if FZ_PLOTTERS_RGB
3684
0
  case 3: return da ? paint_affine_color_near_da_3 : paint_affine_color_near_3;
3685
0
#endif /* FZ_PLOTTERS_RGB */
3686
0
#if FZ_PLOTTERS_CMYK
3687
0
  case 4: return da ? paint_affine_color_near_da_4 : paint_affine_color_near_4;
3688
0
#endif /* FZ_PLOTTERS_CMYK */
3689
0
#if FZ_PLOTTERS_N
3690
0
  default: return da ? paint_affine_color_near_da_N : paint_affine_color_near_N;
3691
#else
3692
  default: return NULL;
3693
#endif /* FZ_PLOTTERS_N */
3694
0
  }
3695
0
}
3696
3697
#if FZ_ENABLE_SPOT_RENDERING
3698
static paintfn_t *
3699
fz_paint_affine_color_near_spots(int da, int sa, affint fa, affint fb, int dn, int sn, int alpha, const fz_overprint * FZ_RESTRICT eop)
3700
0
{
3701
0
  if (fz_overprint_required(eop))
3702
0
    return da ? paint_affine_color_near_da_N_op : paint_affine_color_near_N_op;
3703
0
  return da ? paint_affine_color_near_da_N : paint_affine_color_near_N;
3704
0
}
3705
#endif /* FZ_ENABLE_SPOT_RENDERING */
3706
3707
/* RJW: The following code was originally written to be sensitive to
3708
 * FLT_EPSILON. Given the way the 'minimum representable difference'
3709
 * between 2 floats changes size as we scale, we now pick a larger
3710
 * value to ensure idempotency even with rounding problems. The
3711
 * value we pick is still far smaller than would ever show up with
3712
 * antialiasing.
3713
 */
3714
40
#define MY_EPSILON 0.001f
3715
3716
/* We have 2 possible ways of gridfitting images. The first way, considered
3717
 * 'safe' in all cases, is to expand an image out to fill a box that entirely
3718
 * covers all the pixels touched by the current image. This is our 'standard'
3719
 * mechanism.
3720
 *
3721
 * The alternative, used when we know images are tiled across a page, is to
3722
 * round the edge of each image to the closest integer pixel boundary. This
3723
 * would not be safe in the general case, but gives less distortion across
3724
 * neighbouring images when tiling is used.
3725
 */
3726
fz_matrix
3727
fz_gridfit_matrix(int as_tiled, fz_matrix m)
3728
10
{
3729
10
  if (fabsf(m.b) < FLT_EPSILON && fabsf(m.c) < FLT_EPSILON)
3730
10
  {
3731
10
    if (as_tiled)
3732
0
    {
3733
0
      float f;
3734
      /* Nearest boundary for left */
3735
0
      f = (float)(int)(m.e + 0.5f);
3736
0
      m.a += m.e - f; /* Adjust width for change */
3737
0
      m.e = f;
3738
      /* Nearest boundary for right (width really) */
3739
0
      m.a = (float)(int)(m.a + 0.5f);
3740
0
    }
3741
10
    else if (m.a > 0)
3742
10
    {
3743
10
      float f;
3744
      /* Adjust left hand side onto pixel boundary */
3745
10
      f = (float)(int)(m.e);
3746
10
      if (f - m.e > MY_EPSILON)
3747
0
        f -= 1.0f; /* Ensure it moves left */
3748
10
      m.a += m.e - f; /* width gets wider as f <= m.e */
3749
10
      m.e = f;
3750
      /* Adjust right hand side onto pixel boundary */
3751
10
      f = (float)(int)(m.a);
3752
10
      if (m.a - f > MY_EPSILON)
3753
1
        f += 1.0f; /* Ensure it moves right */
3754
10
      m.a = f;
3755
10
    }
3756
0
    else if (m.a < 0)
3757
0
    {
3758
0
      float f;
3759
      /* Adjust right hand side onto pixel boundary */
3760
0
      f = (float)(int)(m.e);
3761
0
      if (m.e - f > MY_EPSILON)
3762
0
        f += 1.0f; /* Ensure it moves right */
3763
0
      m.a += m.e - f; /* width gets wider (more -ve) */
3764
0
      m.e = f;
3765
      /* Adjust left hand side onto pixel boundary */
3766
0
      f = (float)(int)(m.a);
3767
0
      if (f - m.a > MY_EPSILON)
3768
0
        f -= 1.0f; /* Ensure it moves left */
3769
0
      m.a = f;
3770
0
    }
3771
10
    if (as_tiled)
3772
0
    {
3773
0
      float f;
3774
      /* Nearest boundary for top */
3775
0
      f = (float)(int)(m.f + 0.5f);
3776
0
      m.d += m.f - f; /* Adjust width for change */
3777
0
      m.f = f;
3778
      /* Nearest boundary for bottom (height really) */
3779
0
      m.d = (float)(int)(m.d + 0.5f);
3780
0
    }
3781
10
    else if (m.d > 0)
3782
10
    {
3783
10
      float f;
3784
      /* Adjust top onto pixel boundary */
3785
10
      f = (float)(int)(m.f);
3786
10
      if (f - m.f > MY_EPSILON)
3787
0
        f -= 1.0f; /* Ensure it moves upwards */
3788
10
      m.d += m.f - f; /* width gets wider as f <= m.f */
3789
10
      m.f = f;
3790
      /* Adjust bottom onto pixel boundary */
3791
10
      f = (float)(int)(m.d);
3792
10
      if (m.d - f > MY_EPSILON)
3793
1
        f += 1.0f; /* Ensure it moves down */
3794
10
      m.d = f;
3795
10
    }
3796
0
    else if (m.d < 0)
3797
0
    {
3798
0
      float f;
3799
      /* Adjust bottom onto pixel boundary */
3800
0
      f = (float)(int)(m.f);
3801
0
      if (m.f - f > MY_EPSILON)
3802
0
        f += 1.0f; /* Ensure it moves down */
3803
0
      m.d += m.f - f; /* width gets wider (more -ve) */
3804
0
      m.f = f;
3805
      /* Adjust top onto pixel boundary */
3806
0
      f = (float)(int)(m.d);
3807
0
      if (f - m.d > MY_EPSILON)
3808
0
        f -= 1.0f; /* Ensure it moves up */
3809
0
      m.d = f;
3810
0
    }
3811
10
  }
3812
0
  else if (fabsf(m.a) < FLT_EPSILON && fabsf(m.d) < FLT_EPSILON)
3813
0
  {
3814
0
    if (as_tiled)
3815
0
    {
3816
0
      float f;
3817
      /* Nearest boundary for left */
3818
0
      f = (float)(int)(m.e + 0.5f);
3819
0
      m.b += m.e - f; /* Adjust width for change */
3820
0
      m.e = f;
3821
      /* Nearest boundary for right (width really) */
3822
0
      m.b = (float)(int)(m.b + 0.5f);
3823
0
    }
3824
0
    else if (m.b > 0)
3825
0
    {
3826
0
      float f;
3827
      /* Adjust left hand side onto pixel boundary */
3828
0
      f = (float)(int)(m.f);
3829
0
      if (f - m.f > MY_EPSILON)
3830
0
        f -= 1.0f; /* Ensure it moves left */
3831
0
      m.b += m.f - f; /* width gets wider as f <= m.f */
3832
0
      m.f = f;
3833
      /* Adjust right hand side onto pixel boundary */
3834
0
      f = (float)(int)(m.b);
3835
0
      if (m.b - f > MY_EPSILON)
3836
0
        f += 1.0f; /* Ensure it moves right */
3837
0
      m.b = f;
3838
0
    }
3839
0
    else if (m.b < 0)
3840
0
    {
3841
0
      float f;
3842
      /* Adjust right hand side onto pixel boundary */
3843
0
      f = (float)(int)(m.f);
3844
0
      if (m.f - f > MY_EPSILON)
3845
0
        f += 1.0f; /* Ensure it moves right */
3846
0
      m.b += m.f - f; /* width gets wider (more -ve) */
3847
0
      m.f = f;
3848
      /* Adjust left hand side onto pixel boundary */
3849
0
      f = (float)(int)(m.b);
3850
0
      if (f - m.b > MY_EPSILON)
3851
0
        f -= 1.0f; /* Ensure it moves left */
3852
0
      m.b = f;
3853
0
    }
3854
0
    if (as_tiled)
3855
0
    {
3856
0
      float f;
3857
      /* Nearest boundary for left */
3858
0
      f = (float)(int)(m.f + 0.5f);
3859
0
      m.c += m.f - f; /* Adjust width for change */
3860
0
      m.f = f;
3861
      /* Nearest boundary for right (width really) */
3862
0
      m.c = (float)(int)(m.c + 0.5f);
3863
0
    }
3864
0
    else if (m.c > 0)
3865
0
    {
3866
0
      float f;
3867
      /* Adjust top onto pixel boundary */
3868
0
      f = (float)(int)(m.e);
3869
0
      if (f - m.e > MY_EPSILON)
3870
0
        f -= 1.0f; /* Ensure it moves upwards */
3871
0
      m.c += m.e - f; /* width gets wider as f <= m.e */
3872
0
      m.e = f;
3873
      /* Adjust bottom onto pixel boundary */
3874
0
      f = (float)(int)(m.c);
3875
0
      if (m.c - f > MY_EPSILON)
3876
0
        f += 1.0f; /* Ensure it moves down */
3877
0
      m.c = f;
3878
0
    }
3879
0
    else if (m.c < 0)
3880
0
    {
3881
0
      float f;
3882
      /* Adjust bottom onto pixel boundary */
3883
0
      f = (float)(int)(m.e);
3884
0
      if (m.e - f > MY_EPSILON)
3885
0
        f += 1.0f; /* Ensure it moves down */
3886
0
      m.c += m.e - f; /* width gets wider (more -ve) */
3887
0
      m.e = f;
3888
      /* Adjust top onto pixel boundary */
3889
0
      f = (float)(int)(m.c);
3890
0
      if (f - m.c > MY_EPSILON)
3891
0
        f -= 1.0f; /* Ensure it moves up */
3892
0
      m.c = f;
3893
0
    }
3894
0
  }
3895
10
  return m;
3896
10
}
3897
3898
/* Draw an image with an affine transform on destination */
3899
3900
static void
3901
fz_paint_image_imp(fz_context *ctx,
3902
  fz_pixmap *dst,
3903
  const fz_irect *scissor,
3904
  fz_pixmap *shape,
3905
  fz_pixmap *group_alpha,
3906
  fz_pixmap *img,
3907
  fz_matrix ctm,
3908
  const byte *color,
3909
  int alpha,
3910
  int lerp_allowed,
3911
  const fz_overprint *eop)
3912
2
{
3913
2
  byte *dp, *sp, *hp, *gp;
3914
2
  affint u, v, fa, fb, fc, fd;
3915
2
  int x, y, w, h;
3916
2
  affint sw, sh, sa, sn, hs, da, dn, gs;
3917
2
  ptrdiff_t ss;
3918
2
  fz_irect bbox;
3919
2
  int dolerp;
3920
2
  paintfn_t *paintfn;
3921
2
  int is_rectilinear;
3922
3923
2
  if (alpha == 0)
3924
0
    return;
3925
3926
  /* turn on interpolation for upscaled and non-rectilinear transforms */
3927
2
  dolerp = 0;
3928
2
  is_rectilinear = fz_is_rectilinear(ctm);
3929
2
  if (!is_rectilinear)
3930
0
    dolerp = lerp_allowed;
3931
2
  if (sqrtf(ctm.a * ctm.a + ctm.b * ctm.b) > img->w)
3932
0
    dolerp = lerp_allowed;
3933
2
  if (sqrtf(ctm.c * ctm.c + ctm.d * ctm.d) > img->h)
3934
0
    dolerp = lerp_allowed;
3935
3936
  /* except when we shouldn't, at large magnifications */
3937
2
  if (!(img->flags & FZ_PIXMAP_FLAG_INTERPOLATE))
3938
0
  {
3939
0
    if (sqrtf(ctm.a * ctm.a + ctm.b * ctm.b) > img->w * 2)
3940
0
      dolerp = 0;
3941
0
    if (sqrtf(ctm.c * ctm.c + ctm.d * ctm.d) > img->h * 2)
3942
0
      dolerp = 0;
3943
0
  }
3944
3945
2
  bbox = fz_irect_from_rect(fz_transform_rect(fz_unit_rect, ctm));
3946
2
  bbox = fz_intersect_irect(bbox, *scissor);
3947
3948
2
  x = bbox.x0;
3949
2
  if (shape && shape->x > x)
3950
0
    x = shape->x;
3951
2
  if (group_alpha && group_alpha->x > x)
3952
0
    x = group_alpha->x;
3953
2
  y = bbox.y0;
3954
2
  if (shape && shape->y > y)
3955
0
    y = shape->y;
3956
2
  if (group_alpha && group_alpha->y > y)
3957
0
    y = group_alpha->y;
3958
2
  w = bbox.x1;
3959
2
  if (shape && shape->x + shape->w < w)
3960
0
    w = shape->x + shape->w;
3961
2
  if (group_alpha && group_alpha->x + group_alpha->w < w)
3962
0
    w = group_alpha->x + group_alpha->w;
3963
2
  if (w <= x)
3964
0
    return;
3965
2
  w -= x;
3966
2
  h = bbox.y1;
3967
2
  if (shape && shape->y + shape->h < h)
3968
0
    h = shape->y + shape->h;
3969
2
  if (group_alpha && group_alpha->y + group_alpha->h < h)
3970
0
    h = group_alpha->y + group_alpha->h;
3971
2
  if (h <= y)
3972
0
    return;
3973
2
  h -= y;
3974
3975
  /* map from screen space (x,y) to image space (u,v) */
3976
2
  ctm = fz_pre_scale(ctm, 1.0f / img->w, 1.0f / img->h);
3977
2
  ctm = fz_invert_matrix(ctm);
3978
3979
2
  fa = (affint)(ctm.a *= ONE);
3980
2
  fb = (affint)(ctm.b *= ONE);
3981
2
  fc = (affint)(ctm.c *= ONE);
3982
2
  fd = (affint)(ctm.d *= ONE);
3983
2
  ctm.e *= ONE;
3984
2
  ctm.f *= ONE;
3985
3986
  /* Calculate initial texture positions. Do a half step to start. */
3987
  /* Bug 693021: Keep calculation in float for as long as possible to
3988
   * avoid overflow. */
3989
2
  u = (int)((ctm.a * x) + (ctm.c * y) + ctm.e + ((ctm.a + ctm.c) * .5f));
3990
2
  v = (int)((ctm.b * x) + (ctm.d * y) + ctm.f + ((ctm.b + ctm.d) * .5f));
3991
3992
2
  dp = dst->samples + (y - dst->y) * (size_t)dst->stride + (x - dst->x) * (size_t)dst->n;
3993
2
  da = dst->alpha;
3994
2
  dn = dst->n - da;
3995
2
  sp = img->samples;
3996
2
  sw = img->w;
3997
2
  sh = img->h;
3998
2
  ss = img->stride;
3999
2
  sa = img->alpha;
4000
2
  sn = img->n - sa;
4001
2
  if (shape)
4002
0
  {
4003
0
    hs = shape->stride;
4004
0
    hp = shape->samples + (y - shape->y) * (size_t)shape->stride + x - shape->x;
4005
0
  }
4006
2
  else
4007
2
  {
4008
2
    hs = 0;
4009
2
    hp = NULL;
4010
2
  }
4011
2
  if (group_alpha)
4012
0
  {
4013
0
    gs = group_alpha->stride;
4014
0
    gp = group_alpha->samples + (y - group_alpha->y) * (size_t)group_alpha->stride + x - group_alpha->x;
4015
0
  }
4016
2
  else
4017
2
  {
4018
2
    gs = 0;
4019
2
    gp = NULL;
4020
2
  }
4021
4022
  /* image size overflows fixed point math */
4023
2
  if (sw >= LIMIT || sh >= LIMIT)
4024
0
  {
4025
    /* Note this may cause compile warning because fz_warn() is marked as
4026
    being like printf(), but actually it treats %ld as matching int64_t. */
4027
0
    fz_warn(ctx, "image too large for fixed point math: %ld x %ld", (int64_t)sw, (int64_t)sh);
4028
0
    return;
4029
0
  }
4030
4031
  /* TODO: if (fb == 0 && fa == 1) call fz_paint_span */
4032
4033
  /* Sometimes we can get an alpha only input to be
4034
   * plotted. In this case treat it as a greyscale
4035
   * input. */
4036
2
  if (img->n == sa && color)
4037
0
  {
4038
0
    sa = 0;
4039
0
    sn = 1;
4040
0
  }
4041
4042
2
#if FZ_PLOTTERS_RGB
4043
2
  if (dn == 3 && dst->s == 0 && img->n == 1 + sa && !color && !fz_overprint_required(eop))
4044
0
  {
4045
0
    if (dolerp)
4046
0
      paintfn = fz_paint_affine_g2rgb_lerp(da, sa, fa, fb, dn, alpha);
4047
0
    else
4048
0
      paintfn = fz_paint_affine_g2rgb_near(da, sa, fa, fb, dn, alpha);
4049
0
  }
4050
2
  else
4051
2
#endif /* FZ_PLOTTERS_RGB */
4052
2
#if FZ_ENABLE_SPOT_RENDERING
4053
2
  if (sn != dn)
4054
0
  {
4055
0
    if (dolerp)
4056
0
    {
4057
0
      if (color)
4058
0
        paintfn = fz_paint_affine_color_lerp_spots(da, sa, fa, fb, dn, sn, alpha, eop);
4059
0
      else
4060
0
        paintfn = fz_paint_affine_lerp_spots(da, sa, fa, fb, dn, sn, alpha, eop);
4061
0
    }
4062
0
    else
4063
0
    {
4064
0
      if (color)
4065
0
        paintfn = fz_paint_affine_color_near_spots(da, sa, fa, fb, dn, sn, alpha, eop);
4066
0
      else
4067
0
        paintfn = fz_paint_affine_near_spots(da, sa, fa, fb, dn, sn, alpha, eop);
4068
0
    }
4069
0
  }
4070
2
  else
4071
2
#endif /* FZ_ENABLE_SPOT_RENDERING */
4072
2
  {
4073
2
    assert((!color && sn == dn) || (color && sn + sa == 1));
4074
2
    if (dolerp)
4075
0
    {
4076
0
      if (color)
4077
0
        paintfn = fz_paint_affine_color_lerp(da, sa, fa, fb, dn, alpha, eop);
4078
0
      else
4079
0
        paintfn = fz_paint_affine_lerp(da, sa, fa, fb, dn, alpha, eop);
4080
0
    }
4081
2
    else
4082
2
    {
4083
2
      if (color)
4084
0
        paintfn = fz_paint_affine_color_near(da, sa, fa, fb, dn, alpha, eop);
4085
2
      else
4086
2
        paintfn = fz_paint_affine_near(da, sa, fa, fb, dn, alpha, eop);
4087
2
    }
4088
2
  }
4089
4090
2
  assert(paintfn);
4091
2
  if (paintfn == NULL)
4092
0
    return;
4093
4094
2
  if (dolerp)
4095
0
  {
4096
0
    u -= HALF;
4097
0
    v -= HALF;
4098
0
    sw = (sw<<PREC) + HALF;
4099
0
    sh = (sh<<PREC) + HALF;
4100
0
  }
4101
4102
2.46k
  while (h--)
4103
2.46k
  {
4104
2.46k
    paintfn(dp, da, sp, sw, sh, ss, sa, u, v, fa, fb, w, dn, sn, alpha, color, hp, gp, eop);
4105
2.46k
    dp += dst->stride;
4106
2.46k
    hp += hs;
4107
2.46k
    gp += gs;
4108
2.46k
    u += fc;
4109
2.46k
    v += fd;
4110
2.46k
  }
4111
2
}
4112
4113
void
4114
fz_paint_image_with_color(fz_context *ctx, fz_pixmap * FZ_RESTRICT dst, const fz_irect * FZ_RESTRICT scissor, fz_pixmap * FZ_RESTRICT shape, fz_pixmap * FZ_RESTRICT group_alpha, fz_pixmap * FZ_RESTRICT img, fz_matrix ctm, const byte * FZ_RESTRICT color, int lerp_allowed, const fz_overprint * FZ_RESTRICT eop)
4115
0
{
4116
0
  assert(img->n == 1);
4117
0
  fz_paint_image_imp(ctx, dst, scissor, shape, group_alpha, img, ctm, color, 255, lerp_allowed, eop);
4118
0
}
4119
4120
void
4121
fz_paint_image(fz_context *ctx, fz_pixmap * FZ_RESTRICT dst, const fz_irect * FZ_RESTRICT scissor, fz_pixmap * FZ_RESTRICT shape, fz_pixmap * FZ_RESTRICT group_alpha, fz_pixmap * FZ_RESTRICT img, fz_matrix ctm, int alpha, int lerp_allowed, const fz_overprint * FZ_RESTRICT eop)
4122
2
{
4123
  fz_paint_image_imp(ctx, dst, scissor, shape, group_alpha, img, ctm, NULL, alpha, lerp_allowed, eop);
4124
2
}