Coverage Report

Created: 2024-05-20 06:23

/src/mupdf/source/fitz/draw-affine.c
Line
Count
Source (jump to first uncovered line)
1
// Copyright (C) 2004-2021 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
15.0G
#define PREC 14
34
185M
#define ONE (((affint)1)<<PREC)
35
32.7M
#define MASK (ONE-1)
36
231M
#define HALF (((affint)1)<<(PREC-1))
37
125k
#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
72.4M
{
45
72.4M
  return a + (((b - a) * f) >> PREC);
46
72.4M
}
47
48
static fz_forceinline int bilerp(int a, int b, int c, int d, int uf, int vf)
49
24.1M
{
50
24.1M
  return lerp(lerp(a, b, uf), lerp(c, d, uf), vf);
51
24.1M
}
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
65.4M
{
55
65.4M
  if (u < 0) u = 0;
56
65.4M
  if (v < 0) v = 0;
57
65.4M
  if (u >= (w>>PREC)) u = (w>>PREC) - 1;
58
65.4M
  if (v >= (h>>PREC)) v = (h>>PREC) - 1;
59
65.4M
  return s + v * str + u * n;
60
65.4M
}
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
342
{
67
342
  int k;
68
69
342
  do
70
58.4k
  {
71
58.4k
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
72
58.4k
    {
73
58.4k
      affint ui = u >> PREC;
74
58.4k
      affint vi = v >> PREC;
75
58.4k
      int uf = u & MASK;
76
58.4k
      int vf = v & MASK;
77
58.4k
      const byte *a = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi);
78
58.4k
      const byte *b = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi);
79
58.4k
      const byte *c = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi+1);
80
58.4k
      const byte *d = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi+1);
81
58.4k
      int x = sa ? bilerp(a[sn1], b[sn1], c[sn1], d[sn1], uf, vf) : 255;
82
58.4k
      int xa = sa ? fz_mul255(x, alpha) : alpha;
83
58.4k
      if (xa != 0)
84
58.4k
      {
85
58.4k
        int t = 255 - xa;
86
233k
        for (k = 0; k < sn1; k++)
87
175k
        {
88
175k
          int x = bilerp(a[k], b[k], c[k], d[k], uf, vf);
89
175k
          dp[k] = fz_mul255(x, alpha) + fz_mul255(dp[k], t);
90
175k
        }
91
58.4k
        for (; k < dn1; k++)
92
0
          dp[k] = 0;
93
58.4k
        if (da)
94
58.4k
          dp[dn1] = xa + fz_mul255(dp[dn1], t);
95
58.4k
        if (hp)
96
0
          hp[0] = x + fz_mul255(hp[0], 255 - x);
97
58.4k
        if (gp)
98
0
          gp[0] = xa + fz_mul255(gp[0], t);
99
58.4k
      }
100
58.4k
    }
101
58.4k
    dp += dn1+da;
102
58.4k
    if (hp)
103
0
      hp++;
104
58.4k
    if (gp)
105
0
      gp++;
106
58.4k
    u += fa;
107
58.4k
    v += fb;
108
58.4k
  }
109
58.4k
  while (--w);
110
342
}
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 x = bilerp(a[k], b[k], c[k], d[k], uf, vf);
139
0
            dp[k] = fz_mul255(x, 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
65
{
168
65
  do
169
275
  {
170
275
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
171
140
    {
172
140
      affint ui = u >> PREC;
173
140
      affint vi = v >> PREC;
174
140
      int uf = u & MASK;
175
140
      int vf = v & MASK;
176
140
      const byte *a = sample_nearest(sp, sw, sh, ss, 1+sa, ui, vi);
177
140
      const byte *b = sample_nearest(sp, sw, sh, ss, 1+sa, ui+1, vi);
178
140
      const byte *c = sample_nearest(sp, sw, sh, ss, 1+sa, ui, vi+1);
179
140
      const byte *d = sample_nearest(sp, sw, sh, ss, 1+sa, ui+1, vi+1);
180
140
      int y = sa ? bilerp(a[1], b[1], c[1], d[1], uf, vf) : 255;
181
140
      int ya = (sa ? fz_mul255(y, alpha) : alpha);
182
140
      if (ya != 0)
183
140
      {
184
140
        int x = bilerp(a[0], b[0], c[0], d[0], uf, vf);
185
140
        int t = 255 - ya;
186
140
        x = fz_mul255(x, alpha);
187
140
        dp[0] = x + fz_mul255(dp[0], t);
188
140
        dp[1] = x + fz_mul255(dp[1], t);
189
140
        dp[2] = x + fz_mul255(dp[2], t);
190
140
        if (da)
191
140
          dp[3] = ya + fz_mul255(dp[3], t);
192
140
        if (hp)
193
0
          hp[0] = y + fz_mul255(hp[0], 255 - y);
194
140
        if (gp)
195
0
          gp[0] = ya + fz_mul255(gp[0], t);
196
140
      }
197
140
    }
198
275
    dp += 3+da;
199
275
    if (hp)
200
0
      hp++;
201
275
    if (gp)
202
0
      gp++;
203
275
    u += fa;
204
275
    v += fb;
205
275
  }
206
275
  while (--w);
207
65
}
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
9.56k
{
254
9.56k
  int k;
255
9.56k
  affint vi = v >> PREC;
256
9.56k
  if (vi < 0 || vi >= sh)
257
1
    return;
258
9.56k
  sp += vi * ss;
259
9.56k
  do
260
5.81M
  {
261
5.81M
    affint ui = u >> PREC;
262
5.81M
    if (ui >= 0 && ui < sw)
263
5.81M
    {
264
5.81M
      const byte *sample = sp + (ui * (sn1+sa));
265
5.81M
      int a = sa ? sample[sn1] : 255;
266
5.81M
      int aa = (sa ? fz_mul255(a, alpha) : alpha);
267
5.81M
      if (aa != 0)
268
5.81M
      {
269
5.81M
        int t = 255 - aa;
270
23.2M
        for (k = 0; k < sn1; k++)
271
17.4M
          dp[k] = fz_mul255(sample[k], alpha) + fz_mul255(dp[k], t);
272
5.81M
        for (; k < dn1; k++)
273
0
          dp[k] = 0;
274
5.81M
        if (da)
275
5.81M
          dp[dn1] = aa + fz_mul255(dp[dn1], t);
276
5.81M
        if (hp)
277
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
278
5.81M
        if (gp)
279
0
          gp[0] = aa + fz_mul255(gp[0], t);
280
5.81M
      }
281
5.81M
    }
282
5.81M
    dp += dn1+da;
283
5.81M
    if (hp)
284
0
      hp++;
285
5.81M
    if (gp)
286
0
      gp++;
287
5.81M
    u += fa;
288
5.81M
  }
289
5.81M
  while (--w);
290
9.56k
}
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
15
{
377
15
  affint ui = u >> PREC;
378
15
  if (ui < 0 || ui >= sw)
379
0
    return;
380
15
  sp += ui * (1+sa);
381
15
  do
382
3.90k
  {
383
3.90k
    affint vi = v >> PREC;
384
3.90k
    if (vi >= 0 && vi < sh)
385
40
    {
386
40
      const byte *sample = sp + (vi * ss);
387
40
      int x = fz_mul255(sample[0], alpha);
388
40
      int a = sa ? sample[1] : 255;
389
40
      int aa = (sa ? fz_mul255(a, alpha) : alpha);
390
40
      if (aa != 0)
391
40
      {
392
40
        int t = 255 - aa;
393
40
        dp[0] = x + fz_mul255(dp[0], t);
394
40
        dp[1] = x + fz_mul255(dp[1], t);
395
40
        dp[2] = x + fz_mul255(dp[2], t);
396
40
        if (da)
397
40
          dp[3] = aa + fz_mul255(dp[3], t);
398
40
        if (hp)
399
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
400
40
        if (gp)
401
0
          gp[0] = aa + fz_mul255(gp[0], t);
402
40
      }
403
40
    }
404
3.90k
    dp += 3 + da;
405
3.90k
    if (hp)
406
0
      hp++;
407
3.90k
    if (gp)
408
0
      gp++;
409
3.90k
    v += fb;
410
3.90k
  }
411
3.90k
  while (--w);
412
15
}
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
1
{
417
1
  affint vi = v >> PREC;
418
1
  if (vi < 0 || vi >= sh)
419
0
    return;
420
1
  sp += vi * ss;
421
1
  do
422
1
  {
423
1
    affint ui = u >> PREC;
424
1
    if (ui >= 0 && ui < sw)
425
1
    {
426
1
      const byte *sample = sp + (ui * (1+sa));
427
1
      int x = fz_mul255(sample[0], alpha);
428
1
      int a = sa ? sample[1] : 255;
429
1
      int aa = (sa ? fz_mul255(a, alpha) : alpha);
430
1
      if (aa != 0)
431
1
      {
432
1
        int t = 255 - aa;
433
1
        dp[0] = x + fz_mul255(dp[0], t);
434
1
        dp[1] = x + fz_mul255(dp[1], t);
435
1
        dp[2] = x + fz_mul255(dp[2], t);
436
1
        if (da)
437
1
          dp[3] = aa + fz_mul255(dp[3], t);
438
1
        if (hp)
439
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
440
1
        if (gp)
441
0
          gp[0] = aa + fz_mul255(gp[0], t);
442
1
      }
443
1
    }
444
1
    dp += 3 + da;
445
1
    if (hp)
446
0
      hp++;
447
1
    if (gp)
448
0
      gp++;
449
1
    u += fa;
450
1
  }
451
1
  while (--w);
452
1
}
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
139
{
457
139
  do
458
84.9k
  {
459
84.9k
    affint ui = u >> PREC;
460
84.9k
    affint vi = v >> PREC;
461
84.9k
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
462
5.82k
    {
463
5.82k
      const byte *sample = sp + (vi * ss) + (ui * (1+sa));
464
5.82k
      int x = fz_mul255(sample[0], alpha);
465
5.82k
      int a = sa ? sample[1] : 255;
466
5.82k
      int aa = (sa ? fz_mul255(a, alpha): alpha);
467
5.82k
      if (aa != 0)
468
5.82k
      {
469
5.82k
        int t = 255 - aa;
470
5.82k
        dp[0] = x + fz_mul255(dp[0], t);
471
5.82k
        dp[1] = x + fz_mul255(dp[1], t);
472
5.82k
        dp[2] = x + fz_mul255(dp[2], t);
473
5.82k
        if (da)
474
5.82k
          dp[3] = aa + fz_mul255(dp[3], t);
475
5.82k
        if (hp)
476
0
          hp[0] = a + fz_mul255(hp[0], 255 - a);
477
5.82k
        if (gp)
478
0
          gp[0] = aa + fz_mul255(gp[0], t);
479
5.82k
      }
480
5.82k
    }
481
84.9k
    dp += 3 + da;
482
84.9k
    if (hp)
483
0
      hp++;
484
84.9k
    if (gp)
485
0
      gp++;
486
84.9k
    u += fa;
487
84.9k
    v += fb;
488
84.9k
  }
489
84.9k
  while (--w);
490
139
}
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
344k
{
496
344k
  int k;
497
498
344k
  do
499
151M
  {
500
151M
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
501
9.15M
    {
502
9.15M
      affint ui = u >> PREC;
503
9.15M
      affint vi = v >> PREC;
504
9.15M
      int uf = u & MASK;
505
9.15M
      int vf = v & MASK;
506
9.15M
      const byte *a = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi);
507
9.15M
      const byte *b = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi);
508
9.15M
      const byte *c = sample_nearest(sp, sw, sh, ss, sn1+sa, ui, vi+1);
509
9.15M
      const byte *d = sample_nearest(sp, sw, sh, ss, sn1+sa, ui+1, vi+1);
510
9.15M
      int y = sa ? bilerp(a[sn1], b[sn1], c[sn1], d[sn1], uf, vf) : 255;
511
9.15M
      if (y != 0)
512
6.56M
      {
513
6.56M
        int t = 255 - y;
514
17.9M
        for (k = 0; k < sn1; k++)
515
11.3M
        {
516
11.3M
          int x = bilerp(a[k], b[k], c[k], d[k], uf, vf);
517
11.3M
          dp[k] = x + fz_mul255(dp[k], t);
518
11.3M
        }
519
6.56M
        for (; k < dn1; k++)
520
0
          dp[k] = 0;
521
6.56M
        if (da)
522
5.05M
          dp[dn1] = y + fz_mul255(dp[dn1], t);
523
6.56M
        if (hp)
524
0
          hp[0] = y + fz_mul255(hp[0], t);
525
6.56M
        if (gp)
526
1.87M
          gp[0] = y + fz_mul255(gp[0], t);
527
6.56M
      }
528
9.15M
    }
529
151M
    dp += dn1 + da;
530
151M
    if (hp)
531
0
      hp++;
532
151M
    if (gp)
533
43.5M
      gp++;
534
151M
    u += fa;
535
151M
    v += fb;
536
151M
  }
537
151M
  while (--w);
538
344k
}
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
15.7k
{
592
15.7k
  do
593
7.91M
  {
594
7.91M
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
595
1.00M
    {
596
1.00M
      affint ui = u >> PREC;
597
1.00M
      affint vi = v >> PREC;
598
1.00M
      int uf = u & MASK;
599
1.00M
      int vf = v & MASK;
600
1.00M
      const byte *a = sample_nearest(sp, sw, sh, ss, 1+sa, ui, vi);
601
1.00M
      const byte *b = sample_nearest(sp, sw, sh, ss, 1+sa, ui+1, vi);
602
1.00M
      const byte *c = sample_nearest(sp, sw, sh, ss, 1+sa, ui, vi+1);
603
1.00M
      const byte *d = sample_nearest(sp, sw, sh, ss, 1+sa, ui+1, vi+1);
604
1.00M
      int y = (sa ? bilerp(a[1], b[1], c[1], d[1], uf, vf) : 255);
605
1.00M
      if (y != 0)
606
1.00M
      {
607
1.00M
        int t = 255 - y;
608
1.00M
        int x = bilerp(a[0], b[0], c[0], d[0], uf, vf);
609
1.00M
        dp[0] = x + fz_mul255(dp[0], t);
610
1.00M
        dp[1] = x + fz_mul255(dp[1], t);
611
1.00M
        dp[2] = x + fz_mul255(dp[2], t);
612
1.00M
        if (da)
613
147
          dp[3] = y + fz_mul255(dp[3], t);
614
1.00M
        if (hp)
615
0
          hp[0] = y + fz_mul255(hp[0], t);
616
1.00M
        if (gp)
617
0
          gp[0] = y + fz_mul255(gp[0], t);
618
1.00M
      }
619
1.00M
    }
620
7.91M
    dp += 3 + da;
621
7.91M
    if (hp)
622
0
      hp++;
623
7.91M
    if (gp)
624
0
      gp++;
625
7.91M
    u += fa;
626
7.91M
    v += fb;
627
7.91M
  }
628
7.91M
  while (--w);
629
15.7k
}
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
301k
{
634
301k
  int k;
635
301k
  affint ui = u >> PREC;
636
301k
  if (ui < 0 || ui >= sw)
637
183k
    return;
638
117k
  sp += ui*(sn1+sa);
639
117k
  do
640
57.3M
  {
641
57.3M
    affint vi = v >> PREC;
642
57.3M
    if (vi >= 0 && vi < sh)
643
28.2M
    {
644
28.2M
      const byte *sample = sp + (vi * ss);
645
28.2M
      int a = (sa ? sample[sn1] : 255);
646
      /* If a is 0, then sample[k] = 0 for all k, as premultiplied */
647
28.2M
      if (a != 0)
648
23.9M
      {
649
23.9M
        int t = 255 - a;
650
23.9M
        if (t == 0)
651
23.9M
        {
652
23.9M
          if (dn1+da == 4 && dn1+sa == 4)
653
0
          {
654
0
            *(int32_t *)dp = *(int32_t *)sample;
655
0
          }
656
23.9M
          else
657
23.9M
          {
658
23.9M
            dp[0] = sample[0];
659
23.9M
            if (sn1 > 1)
660
9.74M
              dp[1] = sample[1];
661
23.9M
            if (sn1 > 2)
662
9.74M
              dp[2] = sample[2];
663
23.9M
            for (k = 3; k < sn1; k++)
664
0
              dp[k] = sample[k];
665
23.9M
            for (k = sn1; k < dn1; k++)
666
0
              dp[k] = 0;
667
23.9M
            if (da)
668
14.8M
              dp[dn1] = a;
669
23.9M
          }
670
23.9M
          if (hp)
671
0
            hp[0] = a;
672
23.9M
          if (gp)
673
3.60M
            gp[0] = a;
674
23.9M
        }
675
5.41k
        else
676
5.41k
        {
677
5.41k
          for (k = 0; k < sn1; k++)
678
0
            dp[k] = sample[k] + fz_mul255(dp[k], t);
679
5.41k
          for (; k < dn1; k++)
680
0
            dp[k] = 0;
681
5.41k
          if (da)
682
5.41k
            dp[dn1] = a + fz_mul255(dp[dn1], t);
683
5.41k
          if (hp)
684
0
            hp[0] = a + fz_mul255(hp[0], t);
685
5.41k
          if (gp)
686
2.42k
            gp[0] = a + fz_mul255(gp[0], t);
687
5.41k
        }
688
23.9M
      }
689
28.2M
    }
690
57.3M
    dp += dn1+da;
691
57.3M
    if (hp)
692
0
      hp++;
693
57.3M
    if (gp)
694
11.8M
      gp++;
695
57.3M
    v += fb;
696
57.3M
  }
697
57.3M
  while (--w);
698
117k
}
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.74M
{
703
2.74M
  int k;
704
2.74M
  affint vi = v >> PREC;
705
2.74M
  if (vi < 0 || vi >= sh)
706
5.50k
    return;
707
2.74M
  sp += vi * ss;
708
2.74M
  do
709
449M
  {
710
449M
    affint ui = u >> PREC;
711
449M
    if (ui >= 0 && ui < sw)
712
441M
    {
713
441M
      const byte *sample = sp + (ui * (sn1+sa));
714
441M
      int a = sa ? sample[sn1] : 255;
715
      /* If a is 0, then sample[k] = 0 for all k, as premultiplied */
716
441M
      if (a != 0)
717
413M
      {
718
413M
        int t = 255 - a;
719
413M
        if (t == 0)
720
412M
        {
721
412M
          if (dn1+da == 4 && sn1+sa == 4)
722
2.04M
          {
723
2.04M
            *(int32_t *)dp = *(int32_t *)sample;
724
2.04M
          }
725
410M
          else
726
410M
          {
727
410M
            dp[0] = sample[0];
728
410M
            if (sn1 > 1)
729
380M
              dp[1] = sample[1];
730
410M
            if (sn1 > 2)
731
380M
              dp[2] = sample[2];
732
410M
            for (k = 3; k < sn1; k++)
733
35.8k
              dp[k] = sample[k];
734
410M
            for (k = sn1; k < dn1; k++)
735
0
              dp[k] = 0;
736
410M
            if (da)
737
52.4M
              dp[dn1] = a;
738
410M
          }
739
412M
          if (hp)
740
0
            hp[0] = a;
741
412M
          if (gp)
742
22.7M
            gp[0] = a;
743
412M
        }
744
1.23M
        else
745
1.23M
        {
746
1.50M
          for (k = 0; k < sn1; k++)
747
268k
            dp[k] = sample[k] + fz_mul255(dp[k], t);
748
1.23M
          for (; k < dn1; k++)
749
0
            dp[k] = 0;
750
1.23M
          if (da)
751
1.15M
            dp[dn1] = a + fz_mul255(dp[dn1], t);
752
1.23M
          if (hp)
753
0
            hp[0] = a + fz_mul255(hp[0], t);
754
1.23M
          if (gp)
755
19.2k
            gp[0] = a + fz_mul255(gp[0], t);
756
1.23M
        }
757
413M
      }
758
441M
    }
759
449M
    dp += dn1+da;
760
449M
    if (hp)
761
0
      hp++;
762
449M
    if (gp)
763
35.0M
      gp++;
764
449M
    u += fa;
765
449M
  }
766
449M
  while (--w);
767
2.74M
}
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
1.47M
{
772
1.47M
  int k;
773
774
1.47M
  do
775
936M
  {
776
936M
    affint ui = u >> PREC;
777
936M
    affint vi = v >> PREC;
778
936M
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
779
58.3M
    {
780
58.3M
      const byte *sample = sp + (vi * ss) + (ui * (sn1+sa));
781
58.3M
      int a = sa ? sample[sn1] : 255;
782
      /* If a is 0, then sample[k] = 0 for all k, as premultiplied */
783
58.3M
      if (a != 0)
784
54.0M
      {
785
54.0M
        int t = 255 - a;
786
54.0M
        if (t == 0)
787
54.0M
        {
788
54.0M
          if (dn1+da == 4 && sn1+sa == 4)
789
0
          {
790
0
            *(int32_t *)dp = *(int32_t *)sample;
791
0
          }
792
54.0M
          else
793
54.0M
          {
794
54.0M
            dp[0] = sample[0];
795
54.0M
            if (sn1 > 1)
796
25.2M
              dp[1] = sample[1];
797
54.0M
            if (sn1 > 2)
798
25.2M
              dp[2] = sample[2];
799
54.0M
            for (k = 3; k < sn1; k++)
800
0
              dp[k] = sample[k];
801
54.0M
            for (; k < dn1; k++)
802
0
              dp[k] = 0;
803
54.0M
            if (da)
804
30.9M
              dp[dn1] = a;
805
54.0M
          }
806
54.0M
          if (hp)
807
0
            hp[0] = a;
808
54.0M
          if (gp)
809
2.17M
            gp[0] = a;
810
54.0M
        }
811
4.40k
        else
812
4.40k
        {
813
4.40k
          for (k = 0; k < sn1; k++)
814
0
            dp[k] = sample[k] + fz_mul255(dp[k], t);
815
4.40k
          for (; k < dn1; k++)
816
0
            dp[k] = 0;
817
4.40k
          if (da)
818
4.40k
            dp[dn1] = a + fz_mul255(dp[dn1], t);
819
4.40k
          if (hp)
820
0
            hp[0] = a + fz_mul255(hp[0], t);
821
4.40k
          if (gp)
822
2.95k
            gp[0] = a + fz_mul255(gp[0], t);
823
4.40k
        }
824
54.0M
      }
825
58.3M
    }
826
936M
    dp += dn1+da;
827
936M
    if (hp)
828
0
      hp++;
829
936M
    if (gp)
830
170M
      gp++;
831
936M
    u += fa;
832
936M
    v += fb;
833
936M
  }
834
936M
  while (--w);
835
1.47M
}
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
66.7k
{
908
66.7k
  affint ui = u >> PREC;
909
66.7k
  if (ui < 0 || ui >= sw)
910
32.9k
    return;
911
33.7k
  sp += ui * (1+sa);
912
33.7k
  do
913
9.88M
  {
914
9.88M
    affint vi = v >> PREC;
915
9.88M
    if (vi >= 0 && vi < sh)
916
8.44M
    {
917
8.44M
      const byte *sample = sp + (vi * ss);
918
8.44M
      int a = (sa ? sample[1] : 255);
919
8.44M
      if (a != 0)
920
8.44M
      {
921
8.44M
        int x = sample[0];
922
8.44M
        int t = 255 - a;
923
8.44M
        if (t == 0)
924
8.44M
        {
925
8.44M
          dp[0] = x;
926
8.44M
          dp[1] = x;
927
8.44M
          dp[2] = x;
928
8.44M
          if (da)
929
0
            dp[3] = a;
930
8.44M
          if (hp)
931
0
            hp[0] = a;
932
8.44M
          if (gp)
933
0
            gp[0] = a;
934
8.44M
        }
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
8.44M
      }
948
8.44M
    }
949
9.88M
    dp += 3 + da;
950
9.88M
    if (hp)
951
0
      hp++;
952
9.88M
    if (gp)
953
0
      gp++;
954
9.88M
    v += fb;
955
9.88M
  }
956
9.88M
  while (--w);
957
33.7k
}
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
10.3M
{
962
10.3M
  affint vi = v >> PREC;
963
10.3M
  if (vi < 0 || vi >= sh)
964
35
    return;
965
10.3M
  sp += vi * ss;
966
10.3M
  do
967
11.0G
  {
968
11.0G
    affint ui = u >> PREC;
969
11.0G
    if (ui >= 0 && ui < sw)
970
11.0G
    {
971
11.0G
      const byte *sample = sp + (ui * (1+sa));
972
11.0G
      int a = (sa ? sample[1] : 255);
973
11.0G
      if (a != 0)
974
11.0G
      {
975
11.0G
        int x = sample[0];
976
11.0G
        int t = 255 - a;
977
11.0G
        if (t == 0)
978
11.0G
        {
979
11.0G
          dp[0] = x;
980
11.0G
          dp[1] = x;
981
11.0G
          dp[2] = x;
982
11.0G
          if (da)
983
102k
            dp[3] = a;
984
11.0G
          if (hp)
985
0
            hp[0] = a;
986
11.0G
          if (gp)
987
0
            gp[0] = a;
988
11.0G
        }
989
34.5k
        else
990
34.5k
        {
991
34.5k
          dp[0] = x + fz_mul255(dp[0], t);
992
34.5k
          dp[1] = x + fz_mul255(dp[1], t);
993
34.5k
          dp[2] = x + fz_mul255(dp[2], t);
994
34.5k
          if (da)
995
0
            dp[3] = a + fz_mul255(dp[3], t);
996
34.5k
          if (hp)
997
0
            hp[0] = a + fz_mul255(hp[0], t);
998
34.5k
          if (gp)
999
0
            gp[0] = a + fz_mul255(gp[0], t);
1000
34.5k
        }
1001
11.0G
      }
1002
11.0G
    }
1003
11.0G
    dp += 3 + da;
1004
11.0G
    if (hp)
1005
0
      hp++;
1006
11.0G
    if (gp)
1007
0
      gp++;
1008
11.0G
    u += fa;
1009
11.0G
  }
1010
11.0G
  while (--w);
1011
10.3M
}
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
78.1k
{
1016
78.1k
  do
1017
23.2M
  {
1018
23.2M
    affint ui = u >> PREC;
1019
23.2M
    affint vi = v >> PREC;
1020
23.2M
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
1021
941k
    {
1022
941k
      const byte *sample = sp + (vi * ss) + (ui * (1+sa));
1023
941k
      int a = sa ? sample[1] : 255;
1024
941k
      if (a != 0)
1025
941k
      {
1026
941k
        int x = sample[0];
1027
941k
        int t = 255 - a;
1028
941k
        if (t == 0)
1029
941k
        {
1030
941k
          dp[0] = x;
1031
941k
          dp[1] = x;
1032
941k
          dp[2] = x;
1033
941k
          if (da)
1034
576k
            dp[3] = a;
1035
941k
          if (hp)
1036
0
            hp[0] = a;
1037
941k
          if (gp)
1038
0
            gp[0] = a;
1039
941k
        }
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
941k
      }
1053
941k
    }
1054
23.2M
    dp += 3 + da;
1055
23.2M
    if (hp)
1056
0
      hp++;
1057
23.2M
    if (gp)
1058
0
      gp++;
1059
23.2M
    u += fa;
1060
23.2M
    v += fb;
1061
23.2M
  }
1062
23.2M
  while (--w);
1063
78.1k
}
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
105k
{
1070
105k
  int sa = color[dn1];
1071
105k
  int k;
1072
1073
105k
  do
1074
46.4M
  {
1075
46.4M
    if (u + HALF >= 0 && u + ONE < sw && v + HALF >= 0 && v + ONE < sh)
1076
6.13M
    {
1077
6.13M
      affint ui = u >> PREC;
1078
6.13M
      affint vi = v >> PREC;
1079
6.13M
      int uf = u & MASK;
1080
6.13M
      int vf = v & MASK;
1081
6.13M
      const byte *a = sample_nearest(sp, sw, sh, ss, 1, ui, vi);
1082
6.13M
      const byte *b = sample_nearest(sp, sw, sh, ss, 1, ui+1, vi);
1083
6.13M
      const byte *c = sample_nearest(sp, sw, sh, ss, 1, ui, vi+1);
1084
6.13M
      const byte *d = sample_nearest(sp, sw, sh, ss, 1, ui+1, vi+1);
1085
6.13M
      int ma = bilerp(a[0], b[0], c[0], d[0], uf, vf);
1086
6.13M
      int masa = FZ_COMBINE(FZ_EXPAND(ma), sa);
1087
6.13M
      if (masa != 0)
1088
4.47M
      {
1089
17.6M
        for (k = 0; k < dn1; k++)
1090
13.1M
          dp[k] = FZ_BLEND(color[k], dp[k], masa);
1091
4.47M
        if (da)
1092
847k
          dp[dn1] = FZ_BLEND(255, dp[dn1], masa);
1093
4.47M
        if (hp)
1094
0
          hp[0] = FZ_BLEND(255, hp[0], ma);
1095
4.47M
        if (gp)
1096
569k
          gp[0] = FZ_BLEND(255, gp[0], masa);
1097
4.47M
      }
1098
6.13M
    }
1099
46.4M
    dp += dn1 + da;
1100
46.4M
    if (hp)
1101
0
      hp++;
1102
46.4M
    if (gp)
1103
19.9M
      gp++;
1104
46.4M
    u += fa;
1105
46.4M
    v += fb;
1106
46.4M
  }
1107
46.4M
  while (--w);
1108
105k
}
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
1.16M
{
1157
1.16M
  int sa = color[dn1];
1158
1.16M
  int k;
1159
1160
1.16M
  do
1161
425M
  {
1162
425M
    affint ui = u >> PREC;
1163
425M
    affint vi = v >> PREC;
1164
425M
    if (ui >= 0 && ui < sw && vi >= 0 && vi < sh)
1165
248M
    {
1166
248M
      int ma = sp[vi * ss + ui];
1167
248M
      int masa = FZ_COMBINE(FZ_EXPAND(ma), sa);
1168
248M
      if (masa)
1169
69.3M
      {
1170
105M
        for (k = 0; k < dn1; k++)
1171
36.2M
          dp[k] = FZ_BLEND(color[k], dp[k], masa);
1172
69.3M
        if (da)
1173
58.3M
          dp[dn1] = FZ_BLEND(255, dp[dn1], masa);
1174
69.3M
        if (hp)
1175
0
          hp[0] = FZ_BLEND(255, hp[0], ma);
1176
69.3M
        if (gp)
1177
2.19M
          gp[0] = FZ_BLEND(255, gp[0], masa);
1178
69.3M
      }
1179
248M
    }
1180
425M
    dp += dn1+da;
1181
425M
    if (hp)
1182
0
      hp++;
1183
425M
    if (gp)
1184
103M
      gp++;
1185
425M
    u += fa;
1186
425M
    v += fb;
1187
425M
  }
1188
425M
  while (--w);
1189
1.16M
}
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
87.5k
{
1232
87.5k
  TRACK_FN();
1233
87.5k
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, hp, gp);
1234
87.5k
}
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
159k
{
1274
159k
  TRACK_FN();
1275
159k
  template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1276
159k
}
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
2.14k
{
1319
2.14k
  TRACK_FN();
1320
2.14k
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
1321
2.14k
}
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
75.7k
{
1333
75.7k
  TRACK_FN();
1334
75.7k
  template_affine_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
1335
75.7k
}
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
342
{
1340
342
  TRACK_FN();
1341
342
  template_affine_alpha_N_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
1342
342
}
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
19.5k
{
1361
19.5k
  TRACK_FN();
1362
19.5k
  template_affine_N_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
1363
19.5k
}
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
2.17k
{
1508
2.17k
#if FZ_ENABLE_SPOT_RENDERING
1509
2.17k
  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
2.17k
#endif /* FZ_ENABLE_SPOT_RENDERING */
1519
1520
2.17k
  switch(n)
1521
2.17k
  {
1522
860
  case 0:
1523
860
    if (da)
1524
860
    {
1525
860
      if (sa)
1526
860
      {
1527
860
        if (alpha == 255)
1528
860
          return paint_affine_lerp_da_sa_0;
1529
0
        else if (alpha > 0)
1530
0
          return paint_affine_lerp_da_sa_alpha_0;
1531
860
      }
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
860
    }
1540
0
    break;
1541
1542
251
  case 1:
1543
251
    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
251
    else
1565
251
    {
1566
251
      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
251
      else
1574
251
      {
1575
251
        if (alpha == 255)
1576
251
          return paint_affine_lerp_1;
1577
0
        else if (alpha > 0)
1578
0
          return paint_affine_lerp_alpha_1;
1579
251
      }
1580
251
    }
1581
0
    break;
1582
1583
0
#if FZ_PLOTTERS_RGB
1584
1.06k
  case 3:
1585
1.06k
    if (da)
1586
646
    {
1587
646
      if (sa)
1588
8
      {
1589
8
        if (alpha == 255)
1590
8
          return paint_affine_lerp_da_sa_3;
1591
0
        else if (alpha > 0)
1592
0
          return paint_affine_lerp_da_sa_alpha_3;
1593
8
      }
1594
638
      else
1595
638
      {
1596
638
        if (alpha == 255)
1597
636
          return paint_affine_lerp_da_3;
1598
2
        else if (alpha > 0)
1599
2
          return paint_affine_lerp_da_alpha_3;
1600
638
      }
1601
646
    }
1602
421
    else
1603
421
    {
1604
421
      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
421
      else
1612
421
      {
1613
421
        if (alpha == 255)
1614
421
          return paint_affine_lerp_3;
1615
0
        else if (alpha > 0)
1616
0
          return paint_affine_lerp_alpha_3;
1617
421
      }
1618
421
    }
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
2.17k
  }
1703
0
  return NULL;
1704
2.17k
}
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
429
{
1773
429
  TRACK_FN();
1774
429
  template_affine_solid_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
1775
429
}
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
65
{
1780
65
  TRACK_FN();
1781
65
  template_affine_alpha_g2rgb_lerp(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
1782
65
}
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
15.2k
{
1801
15.2k
  TRACK_FN();
1802
15.2k
  template_affine_solid_g2rgb_lerp(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
1803
15.2k
}
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
118
{
1815
118
  if (da)
1816
33
  {
1817
33
    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
33
    else
1825
33
    {
1826
33
      if (alpha == 255)
1827
27
        return paint_affine_lerp_da_g2rgb;
1828
6
      else if (alpha > 0)
1829
6
        return paint_affine_lerp_da_g2rgb_alpha;
1830
33
    }
1831
33
  }
1832
85
  else
1833
85
  {
1834
85
    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
85
    else
1842
85
    {
1843
85
      if (alpha == 255)
1844
85
        return paint_affine_lerp_g2rgb;
1845
0
      else if (alpha > 0)
1846
0
        return paint_affine_lerp_g2rgb_alpha;
1847
85
    }
1848
85
  }
1849
0
  return NULL;
1850
118
}
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
83.0k
{
1856
83.0k
  TRACK_FN();
1857
83.0k
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, hp, gp);
1858
83.0k
}
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
385k
{
1884
385k
  TRACK_FN();
1885
385k
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, hp, gp);
1886
385k
}
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
48
{
1891
48
  TRACK_FN();
1892
48
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, alpha, hp, gp);
1893
48
}
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
771k
{
1912
771k
  TRACK_FN();
1913
771k
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 0, 0, hp, gp);
1914
771k
}
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
151k
{
1940
151k
  TRACK_FN();
1941
151k
  template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1942
151k
}
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
65.9k
{
1947
65.9k
  TRACK_FN();
1948
65.9k
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1949
65.9k
}
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
114k
{
1954
114k
  TRACK_FN();
1955
114k
  template_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1956
114k
}
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
4.70k
{
1996
4.70k
  TRACK_FN();
1997
4.70k
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 1, 1, hp, gp);
1998
4.70k
}
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
42.2k
{
2125
42.2k
  TRACK_FN();
2126
42.2k
  template_affine_N_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2127
42.2k
}
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
24.6k
{
2153
24.6k
  TRACK_FN();
2154
24.6k
  template_affine_N_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2155
24.6k
}
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
4.64k
{
2167
4.64k
  TRACK_FN();
2168
4.64k
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
2169
4.64k
}
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
417k
{
2181
417k
  TRACK_FN();
2182
417k
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2183
417k
}
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
9.52k
{
2188
9.52k
  TRACK_FN();
2189
9.52k
  template_affine_alpha_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, alpha, hp, gp);
2190
9.52k
}
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
862k
{
2216
862k
  TRACK_FN();
2217
862k
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2218
862k
}
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
1.00M
{
2223
1.00M
  TRACK_FN();
2224
1.00M
  template_affine_N_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, 3, 3, hp, gp);
2225
1.00M
}
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
359k
{
2237
359k
  TRACK_FN();
2238
359k
  template_affine_N_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2239
359k
}
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
230k
{
2265
230k
  TRACK_FN();
2266
230k
  template_affine_N_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, 3, 3, hp, gp);
2267
230k
}
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
609
{
2351
609
  TRACK_FN();
2352
609
  template_affine_N_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, 4, 4, hp, gp);
2353
609
}
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
19.5k
{
2636
19.5k
#if FZ_ENABLE_SPOT_RENDERING
2637
19.5k
  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
19.5k
#endif /* FZ_ENABLE_SPOT_RENDERING */
2647
19.5k
  switch(n)
2648
19.5k
  {
2649
8.15k
  case 0:
2650
8.15k
    if (da)
2651
8.15k
    {
2652
8.15k
      if (sa)
2653
8.15k
      {
2654
8.15k
        if (alpha == 255)
2655
8.15k
        {
2656
8.15k
          if (fa == 0)
2657
519
            return paint_affine_near_da_sa_0_fa0;
2658
7.63k
          else if (fb == 0)
2659
6.66k
            return paint_affine_near_da_sa_0_fb0;
2660
967
          else
2661
967
            return paint_affine_near_da_sa_0;
2662
8.15k
        }
2663
2
        else if (alpha > 0)
2664
2
        {
2665
2
          if (fa == 0)
2666
0
            return paint_affine_near_da_sa_alpha_0_fa0;
2667
2
          else if (fb == 0)
2668
2
            return paint_affine_near_da_sa_alpha_0_fb0;
2669
0
          else
2670
0
            return paint_affine_near_da_sa_alpha_0;
2671
2
        }
2672
8.15k
      }
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
8.15k
    }
2695
0
    break;
2696
2697
1.13k
  case 1:
2698
1.13k
    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
1.13k
    else
2748
1.13k
    {
2749
1.13k
      if (da)
2750
68
      {
2751
68
        if (alpha == 255)
2752
68
        {
2753
68
          if (fa == 0)
2754
0
            return paint_affine_near_da_1_fa0;
2755
68
          else if (fb == 0)
2756
68
            return paint_affine_near_da_1_fb0;
2757
0
          else
2758
0
            return paint_affine_near_da_1;
2759
68
        }
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
68
      }
2770
1.07k
      else
2771
1.07k
      {
2772
1.07k
        if (alpha == 255)
2773
1.07k
        {
2774
1.07k
          if (fa == 0)
2775
252
            return paint_affine_near_1_fa0;
2776
818
          else if (fb == 0)
2777
628
            return paint_affine_near_1_fb0;
2778
190
          else
2779
190
            return paint_affine_near_1;
2780
1.07k
        }
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
1.07k
      }
2791
1.13k
    }
2792
0
    break;
2793
2794
0
#if FZ_PLOTTERS_RGB
2795
10.2k
  case 3:
2796
10.2k
    if (da)
2797
7.91k
    {
2798
7.91k
      if (sa)
2799
19
      {
2800
19
        if (alpha == 255)
2801
19
        {
2802
19
          if (fa == 0)
2803
0
            return paint_affine_near_da_sa_3_fa0;
2804
19
          else if (fb == 0)
2805
19
            return paint_affine_near_da_sa_3_fb0;
2806
0
          else
2807
0
            return paint_affine_near_da_sa_3;
2808
19
        }
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
19
      }
2819
7.89k
      else
2820
7.89k
      {
2821
7.89k
        if (alpha == 255)
2822
7.88k
        {
2823
7.88k
          if (fa == 0)
2824
342
            return paint_affine_near_da_3_fa0;
2825
7.54k
          else if (fb == 0)
2826
6.80k
            return paint_affine_near_da_3_fb0;
2827
741
          else
2828
741
            return paint_affine_near_da_3;
2829
7.88k
        }
2830
14
        else if (alpha > 0)
2831
14
        {
2832
14
          if (fa == 0)
2833
0
            return paint_affine_near_da_alpha_3_fa0;
2834
14
          else if (fb == 0)
2835
14
            return paint_affine_near_da_alpha_3_fb0;
2836
0
          else
2837
0
            return paint_affine_near_da_alpha_3;
2838
14
        }
2839
7.89k
      }
2840
7.91k
    }
2841
2.28k
    else
2842
2.28k
    {
2843
2.28k
      if (sa)
2844
388
      {
2845
388
        if (alpha == 255)
2846
388
        {
2847
388
          if (fa == 0)
2848
0
            return paint_affine_near_sa_3_fa0;
2849
388
          else if (fb == 0)
2850
388
            return paint_affine_near_sa_3_fb0;
2851
0
          else
2852
0
            return paint_affine_near_sa_3;
2853
388
        }
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
388
      }
2864
1.90k
      else
2865
1.90k
      {
2866
1.90k
        if (alpha == 255)
2867
1.90k
        {
2868
1.90k
          if (fa == 0)
2869
124
            return paint_affine_near_3_fa0;
2870
1.77k
          else if (fb == 0)
2871
1.42k
            return paint_affine_near_3_fb0;
2872
351
          else
2873
351
            return paint_affine_near_3;
2874
1.90k
        }
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
1.90k
      }
2885
2.28k
    }
2886
0
    break;
2887
0
#endif /* FZ_PLOTTERS_RGB */
2888
2889
0
#if FZ_PLOTTERS_CMYK
2890
12
  case 4:
2891
12
    if (da)
2892
12
    {
2893
12
      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
12
      else
2915
12
      {
2916
12
        if (alpha == 255)
2917
12
        {
2918
12
          if (fa == 0)
2919
0
            return paint_affine_near_da_4_fa0;
2920
12
          else if (fb == 0)
2921
12
            return paint_affine_near_da_4_fb0;
2922
0
          else
2923
0
            return paint_affine_near_da_4;
2924
12
        }
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
12
      }
2935
12
    }
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
19.5k
  }
3082
0
  return NULL;
3083
19.5k
}
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
4.74k
{
3208
4.74k
  TRACK_FN();
3209
4.74k
  template_affine_solid_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3210
4.74k
}
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
15
{
3215
15
  TRACK_FN();
3216
15
  template_affine_alpha_g2rgb_near_fa0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
3217
15
}
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
61.9k
{
3236
61.9k
  TRACK_FN();
3237
61.9k
  template_affine_solid_g2rgb_near_fa0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3238
61.9k
}
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
531
{
3264
531
  TRACK_FN();
3265
531
  template_affine_solid_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3266
531
}
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
1
{
3271
1
  TRACK_FN();
3272
1
  template_affine_alpha_g2rgb_near_fb0(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
3273
1
}
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
1.43k
{
3278
1.43k
  TRACK_FN();
3279
1.43k
  template_affine_solid_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 1, u, v, fa, fb, w, hp, gp);
3280
1.43k
}
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
10.3M
{
3292
10.3M
  TRACK_FN();
3293
10.3M
  template_affine_solid_g2rgb_near_fb0(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3294
10.3M
}
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
16.1k
{
3320
16.1k
  TRACK_FN();
3321
16.1k
  template_affine_solid_g2rgb_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3322
16.1k
}
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
139
{
3327
139
  TRACK_FN();
3328
139
  template_affine_alpha_g2rgb_near(dp, 1, sp, sw, sh, ss, 0, u, v, fa, fb, w, alpha, hp, gp);
3329
139
}
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
61.9k
{
3348
61.9k
  TRACK_FN();
3349
61.9k
  template_affine_solid_g2rgb_near(dp, 0, sp, sw, sh, ss, 0, u, v, fa, fb, w, hp, gp);
3350
61.9k
}
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
1.63k
{
3362
1.63k
  if (da)
3363
102
  {
3364
102
    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
102
    else
3389
102
    {
3390
102
      if (fa == 0)
3391
7
      {
3392
7
        if (alpha == 255)
3393
6
          return paint_affine_near_da_g2rgb_fa0;
3394
1
        else if (alpha > 0)
3395
1
          return paint_affine_near_da_alpha_g2rgb_fa0;
3396
7
      }
3397
95
      else if (fb == 0)
3398
72
      {
3399
72
        if (alpha == 255)
3400
71
          return paint_affine_near_da_g2rgb_fb0;
3401
1
        else if (alpha > 0)
3402
1
          return paint_affine_near_da_alpha_g2rgb_fb0;
3403
72
      }
3404
23
      else
3405
23
      {
3406
23
        if (alpha == 255)
3407
22
          return paint_affine_near_da_g2rgb;
3408
1
        else if (alpha > 0)
3409
1
          return paint_affine_near_da_alpha_g2rgb;
3410
23
      }
3411
102
    }
3412
102
  }
3413
1.53k
  else
3414
1.53k
  {
3415
1.53k
    if (sa)
3416
14
    {
3417
14
      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
14
      else if (fb == 0)
3425
14
      {
3426
14
        if (alpha == 255)
3427
14
          return paint_affine_near_sa_g2rgb_fb0;
3428
0
        else if (alpha > 0)
3429
0
          return paint_affine_near_sa_alpha_g2rgb_fb0;
3430
14
      }
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
14
    }
3439
1.51k
    else
3440
1.51k
    {
3441
1.51k
      if (fa == 0)
3442
193
      {
3443
193
        if (alpha == 255)
3444
193
          return paint_affine_near_g2rgb_fa0;
3445
0
        else if (alpha > 0)
3446
0
          return paint_affine_near_alpha_g2rgb_fa0;
3447
193
      }
3448
1.32k
      else if (fb == 0)
3449
1.22k
      {
3450
1.22k
        if (alpha == 255)
3451
1.22k
          return paint_affine_near_g2rgb_fb0;
3452
0
        else if (alpha > 0)
3453
0
          return paint_affine_near_alpha_g2rgb_fb0;
3454
1.22k
      }
3455
98
      else
3456
98
      {
3457
98
        if (alpha == 255)
3458
98
          return paint_affine_near_g2rgb;
3459
0
        else if (alpha > 0)
3460
0
          return paint_affine_near_alpha_g2rgb;
3461
98
      }
3462
1.51k
    }
3463
1.53k
  }
3464
0
  return NULL;
3465
1.63k
}
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
14.0k
{
3486
14.0k
  TRACK_FN();
3487
14.0k
  template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 1, 1, color, hp, gp);
3488
14.0k
}
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
60.2k
{
3527
60.2k
  TRACK_FN();
3528
60.2k
  template_affine_color_N_lerp(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp);
3529
60.2k
}
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
31.0k
{
3534
31.0k
  TRACK_FN();
3535
31.0k
  template_affine_color_N_lerp(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp);
3536
31.0k
}
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
157
{
3551
157
#if FZ_ENABLE_SPOT_RENDERING
3552
157
  if (fz_overprint_required(eop))
3553
0
    return paint_affine_color_lerp_N_op;
3554
157
#endif /* FZ_ENABLE_SPOT_RENDERING */
3555
157
  switch (n)
3556
157
  {
3557
0
  case 0: return da ? paint_affine_color_lerp_da_0 : NULL;
3558
0
#if FZ_PLOTTERS_G
3559
157
  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
157
#endif /* FZ_PLOTTERS_N */
3570
157
  }
3571
0
  return NULL;
3572
157
}
3573
3574
#if FZ_ENABLE_SPOT_RENDERING
3575
static paintfn_t *
3576
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)
3577
799
{
3578
799
  if (fz_overprint_required(eop))
3579
0
    return paint_affine_color_lerp_N_op;
3580
799
  return da ? paint_affine_color_lerp_da_N : paint_affine_color_lerp_N;
3581
799
}
3582
#endif /* FZ_ENABLE_SPOT_RENDERING */
3583
3584
static void
3585
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)
3586
0
{
3587
0
  TRACK_FN();
3588
0
  template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 0, 0, color, hp, gp);
3589
0
}
3590
3591
#if FZ_PLOTTERS_G
3592
static void
3593
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)
3594
0
{
3595
0
  TRACK_FN();
3596
0
  template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 1, 1, color, hp, gp);
3597
0
}
3598
3599
static void
3600
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)
3601
79.0k
{
3602
79.0k
  TRACK_FN();
3603
79.0k
  template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 1, 1, color, hp, gp);
3604
79.0k
}
3605
#endif /* FZ_PLOTTERS_G */
3606
3607
#if FZ_PLOTTERS_RGB
3608
static void
3609
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)
3610
0
{
3611
0
  TRACK_FN();
3612
0
  template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 3, 3, color, hp, gp);
3613
0
}
3614
3615
static void
3616
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)
3617
0
{
3618
0
  TRACK_FN();
3619
0
  template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 3, 3, color, hp, gp);
3620
0
}
3621
#endif /* FZ_PLOTTERS_RGB */
3622
3623
#if FZ_PLOTTERS_CMYK
3624
static void
3625
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)
3626
0
{
3627
0
  TRACK_FN();
3628
0
  template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, 4, 4, color, hp, gp);
3629
0
}
3630
3631
static void
3632
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)
3633
0
{
3634
0
  TRACK_FN();
3635
0
  template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, 4, 4, color, hp, gp);
3636
0
}
3637
#endif /* FZ_PLOTTERS_CMYK */
3638
3639
#if FZ_PLOTTERS_N
3640
static void
3641
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)
3642
696k
{
3643
696k
  TRACK_FN();
3644
696k
  template_affine_color_N_near(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp);
3645
696k
}
3646
3647
static void
3648
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)
3649
390k
{
3650
390k
  TRACK_FN();
3651
390k
  template_affine_color_N_near(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp);
3652
390k
}
3653
#endif /* FZ_PLOTTERS_N */
3654
3655
#if FZ_ENABLE_SPOT_RENDERING
3656
static void
3657
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)
3658
0
{
3659
0
  TRACK_FN();
3660
0
  template_affine_color_N_near_op(dp, 1, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp, eop);
3661
0
}
3662
3663
static void
3664
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)
3665
0
{
3666
0
  TRACK_FN();
3667
0
  template_affine_color_N_near_op(dp, 0, sp, sw, sh, ss, u, v, fa, fb, w, dn, sn, color, hp, gp, eop);
3668
0
}
3669
#endif /* FZ_ENABLE_SPOT_RENDERING */
3670
3671
static paintfn_t *
3672
fz_paint_affine_color_near(int da, int sa, affint fa, affint fb, int n, int alpha, const fz_overprint * FZ_RESTRICT eop)
3673
1.31k
{
3674
1.31k
#if FZ_ENABLE_SPOT_RENDERING
3675
1.31k
  if (fz_overprint_required(eop))
3676
0
    return da ? paint_affine_color_near_da_N_op : paint_affine_color_near_N_op;
3677
1.31k
#endif /* FZ_ENABLE_SPOT_RENDERING */
3678
1.31k
  switch (n)
3679
1.31k
  {
3680
0
  case 0: return da ? paint_affine_color_near_da_0 : NULL;
3681
0
#if FZ_PLOTTERS_G
3682
1.31k
  case 1: return da ? paint_affine_color_near_da_1 : paint_affine_color_near_1;
3683
0
#endif /* FZ_PLOTTERS_G */
3684
0
#if FZ_PLOTTERS_RGB
3685
0
  case 3: return da ? paint_affine_color_near_da_3 : paint_affine_color_near_3;
3686
0
#endif /* FZ_PLOTTERS_RGB */
3687
0
#if FZ_PLOTTERS_CMYK
3688
0
  case 4: return da ? paint_affine_color_near_da_4 : paint_affine_color_near_4;
3689
0
#endif /* FZ_PLOTTERS_CMYK */
3690
0
#if FZ_PLOTTERS_N
3691
0
  default: return da ? paint_affine_color_near_da_N : paint_affine_color_near_N;
3692
#else
3693
  default: return NULL;
3694
#endif /* FZ_PLOTTERS_N */
3695
1.31k
  }
3696
1.31k
}
3697
3698
#if FZ_ENABLE_SPOT_RENDERING
3699
static paintfn_t *
3700
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)
3701
16.2k
{
3702
16.2k
  if (fz_overprint_required(eop))
3703
0
    return da ? paint_affine_color_near_da_N_op : paint_affine_color_near_N_op;
3704
16.2k
  return da ? paint_affine_color_near_da_N : paint_affine_color_near_N;
3705
16.2k
}
3706
#endif /* FZ_ENABLE_SPOT_RENDERING */
3707
3708
/* RJW: The following code was originally written to be sensitive to
3709
 * FLT_EPSILON. Given the way the 'minimum representable difference'
3710
 * between 2 floats changes size as we scale, we now pick a larger
3711
 * value to ensure idempotency even with rounding problems. The
3712
 * value we pick is still far smaller than would ever show up with
3713
 * antialiasing.
3714
 */
3715
265k
#define MY_EPSILON 0.001f
3716
3717
/* We have 2 possible ways of gridfitting images. The first way, considered
3718
 * 'safe' in all cases, is to expand an image out to fill a box that entirely
3719
 * covers all the pixels touched by the current image. This is our 'standard'
3720
 * mechanism.
3721
 *
3722
 * The alternative, used when we know images are tiled across a page, is to
3723
 * round the edge of each image to the closest integer pixel boundary. This
3724
 * would not be safe in the general case, but gives less distortion across
3725
 * neighbouring images when tiling is used.
3726
 */
3727
fz_matrix
3728
fz_gridfit_matrix(int as_tiled, fz_matrix m)
3729
83.4k
{
3730
83.4k
  if (fabsf(m.b) < FLT_EPSILON && fabsf(m.c) < FLT_EPSILON)
3731
54.3k
  {
3732
54.3k
    if (as_tiled)
3733
0
    {
3734
0
      float f;
3735
      /* Nearest boundary for left */
3736
0
      f = (float)(int)(m.e + 0.5f);
3737
0
      m.a += m.e - f; /* Adjust width for change */
3738
0
      m.e = f;
3739
      /* Nearest boundary for right (width really) */
3740
0
      m.a = (float)(int)(m.a + 0.5f);
3741
0
    }
3742
54.3k
    else if (m.a > 0)
3743
48.5k
    {
3744
48.5k
      float f;
3745
      /* Adjust left hand side onto pixel boundary */
3746
48.5k
      f = (float)(int)(m.e);
3747
48.5k
      if (f - m.e > MY_EPSILON)
3748
442
        f -= 1.0f; /* Ensure it moves left */
3749
48.5k
      m.a += m.e - f; /* width gets wider as f <= m.e */
3750
48.5k
      m.e = f;
3751
      /* Adjust right hand side onto pixel boundary */
3752
48.5k
      f = (float)(int)(m.a);
3753
48.5k
      if (m.a - f > MY_EPSILON)
3754
25.0k
        f += 1.0f; /* Ensure it moves right */
3755
48.5k
      m.a = f;
3756
48.5k
    }
3757
5.78k
    else if (m.a < 0)
3758
3.01k
    {
3759
3.01k
      float f;
3760
      /* Adjust right hand side onto pixel boundary */
3761
3.01k
      f = (float)(int)(m.e);
3762
3.01k
      if (m.e - f > MY_EPSILON)
3763
1.22k
        f += 1.0f; /* Ensure it moves right */
3764
3.01k
      m.a += m.e - f; /* width gets wider (more -ve) */
3765
3.01k
      m.e = f;
3766
      /* Adjust left hand side onto pixel boundary */
3767
3.01k
      f = (float)(int)(m.a);
3768
3.01k
      if (f - m.a > MY_EPSILON)
3769
1.78k
        f -= 1.0f; /* Ensure it moves left */
3770
3.01k
      m.a = f;
3771
3.01k
    }
3772
54.3k
    if (as_tiled)
3773
0
    {
3774
0
      float f;
3775
      /* Nearest boundary for top */
3776
0
      f = (float)(int)(m.f + 0.5f);
3777
0
      m.d += m.f - f; /* Adjust width for change */
3778
0
      m.f = f;
3779
      /* Nearest boundary for bottom (height really) */
3780
0
      m.d = (float)(int)(m.d + 0.5f);
3781
0
    }
3782
54.3k
    else if (m.d > 0)
3783
45.9k
    {
3784
45.9k
      float f;
3785
      /* Adjust top onto pixel boundary */
3786
45.9k
      f = (float)(int)(m.f);
3787
45.9k
      if (f - m.f > MY_EPSILON)
3788
2.20k
        f -= 1.0f; /* Ensure it moves upwards */
3789
45.9k
      m.d += m.f - f; /* width gets wider as f <= m.f */
3790
45.9k
      m.f = f;
3791
      /* Adjust bottom onto pixel boundary */
3792
45.9k
      f = (float)(int)(m.d);
3793
45.9k
      if (m.d - f > MY_EPSILON)
3794
22.6k
        f += 1.0f; /* Ensure it moves down */
3795
45.9k
      m.d = f;
3796
45.9k
    }
3797
8.40k
    else if (m.d < 0)
3798
3.10k
    {
3799
3.10k
      float f;
3800
      /* Adjust bottom onto pixel boundary */
3801
3.10k
      f = (float)(int)(m.f);
3802
3.10k
      if (m.f - f > MY_EPSILON)
3803
1.21k
        f += 1.0f; /* Ensure it moves down */
3804
3.10k
      m.d += m.f - f; /* width gets wider (more -ve) */
3805
3.10k
      m.f = f;
3806
      /* Adjust top onto pixel boundary */
3807
3.10k
      f = (float)(int)(m.d);
3808
3.10k
      if (f - m.d > MY_EPSILON)
3809
1.73k
        f -= 1.0f; /* Ensure it moves up */
3810
3.10k
      m.d = f;
3811
3.10k
    }
3812
54.3k
  }
3813
29.1k
  else if (fabsf(m.a) < FLT_EPSILON && fabsf(m.d) < FLT_EPSILON)
3814
16.4k
  {
3815
16.4k
    if (as_tiled)
3816
0
    {
3817
0
      float f;
3818
      /* Nearest boundary for left */
3819
0
      f = (float)(int)(m.e + 0.5f);
3820
0
      m.b += m.e - f; /* Adjust width for change */
3821
0
      m.e = f;
3822
      /* Nearest boundary for right (width really) */
3823
0
      m.b = (float)(int)(m.b + 0.5f);
3824
0
    }
3825
16.4k
    else if (m.b > 0)
3826
281
    {
3827
281
      float f;
3828
      /* Adjust left hand side onto pixel boundary */
3829
281
      f = (float)(int)(m.f);
3830
281
      if (f - m.f > MY_EPSILON)
3831
4
        f -= 1.0f; /* Ensure it moves left */
3832
281
      m.b += m.f - f; /* width gets wider as f <= m.f */
3833
281
      m.f = f;
3834
      /* Adjust right hand side onto pixel boundary */
3835
281
      f = (float)(int)(m.b);
3836
281
      if (m.b - f > MY_EPSILON)
3837
190
        f += 1.0f; /* Ensure it moves right */
3838
281
      m.b = f;
3839
281
    }
3840
16.1k
    else if (m.b < 0)
3841
15.7k
    {
3842
15.7k
      float f;
3843
      /* Adjust right hand side onto pixel boundary */
3844
15.7k
      f = (float)(int)(m.f);
3845
15.7k
      if (m.f - f > MY_EPSILON)
3846
7.70k
        f += 1.0f; /* Ensure it moves right */
3847
15.7k
      m.b += m.f - f; /* width gets wider (more -ve) */
3848
15.7k
      m.f = f;
3849
      /* Adjust left hand side onto pixel boundary */
3850
15.7k
      f = (float)(int)(m.b);
3851
15.7k
      if (f - m.b > MY_EPSILON)
3852
8.11k
        f -= 1.0f; /* Ensure it moves left */
3853
15.7k
      m.b = f;
3854
15.7k
    }
3855
16.4k
    if (as_tiled)
3856
0
    {
3857
0
      float f;
3858
      /* Nearest boundary for left */
3859
0
      f = (float)(int)(m.f + 0.5f);
3860
0
      m.c += m.f - f; /* Adjust width for change */
3861
0
      m.f = f;
3862
      /* Nearest boundary for right (width really) */
3863
0
      m.c = (float)(int)(m.c + 0.5f);
3864
0
    }
3865
16.4k
    else if (m.c > 0)
3866
14.5k
    {
3867
14.5k
      float f;
3868
      /* Adjust top onto pixel boundary */
3869
14.5k
      f = (float)(int)(m.e);
3870
14.5k
      if (f - m.e > MY_EPSILON)
3871
9
        f -= 1.0f; /* Ensure it moves upwards */
3872
14.5k
      m.c += m.e - f; /* width gets wider as f <= m.e */
3873
14.5k
      m.e = f;
3874
      /* Adjust bottom onto pixel boundary */
3875
14.5k
      f = (float)(int)(m.c);
3876
14.5k
      if (m.c - f > MY_EPSILON)
3877
7.36k
        f += 1.0f; /* Ensure it moves down */
3878
14.5k
      m.c = f;
3879
14.5k
    }
3880
1.88k
    else if (m.c < 0)
3881
1.31k
    {
3882
1.31k
      float f;
3883
      /* Adjust bottom onto pixel boundary */
3884
1.31k
      f = (float)(int)(m.e);
3885
1.31k
      if (m.e - f > MY_EPSILON)
3886
597
        f += 1.0f; /* Ensure it moves down */
3887
1.31k
      m.c += m.e - f; /* width gets wider (more -ve) */
3888
1.31k
      m.e = f;
3889
      /* Adjust top onto pixel boundary */
3890
1.31k
      f = (float)(int)(m.c);
3891
1.31k
      if (f - m.c > MY_EPSILON)
3892
605
        f -= 1.0f; /* Ensure it moves up */
3893
1.31k
      m.c = f;
3894
1.31k
    }
3895
16.4k
  }
3896
83.4k
  return m;
3897
83.4k
}
3898
3899
/* Draw an image with an affine transform on destination */
3900
3901
static void
3902
fz_paint_image_imp(fz_context *ctx,
3903
  fz_pixmap *dst,
3904
  const fz_irect *scissor,
3905
  fz_pixmap *shape,
3906
  fz_pixmap *group_alpha,
3907
  fz_pixmap *img,
3908
  fz_matrix ctm,
3909
  const byte *color,
3910
  int alpha,
3911
  int lerp_allowed,
3912
  const fz_overprint *eop)
3913
50.0k
{
3914
50.0k
  byte *dp, *sp, *hp, *gp;
3915
50.0k
  affint u, v, fa, fb, fc, fd;
3916
50.0k
  int x, y, w, h;
3917
50.0k
  affint sw, sh, sa, sn, hs, da, dn, gs;
3918
50.0k
  ptrdiff_t ss;
3919
50.0k
  fz_irect bbox;
3920
50.0k
  int dolerp;
3921
50.0k
  paintfn_t *paintfn;
3922
50.0k
  int is_rectilinear;
3923
3924
50.0k
  if (alpha == 0)
3925
0
    return;
3926
3927
  /* turn on interpolation for upscaled and non-rectilinear transforms */
3928
50.0k
  dolerp = 0;
3929
50.0k
  is_rectilinear = fz_is_rectilinear(ctm);
3930
50.0k
  if (!is_rectilinear)
3931
10.2k
    dolerp = lerp_allowed;
3932
50.0k
  if (sqrtf(ctm.a * ctm.a + ctm.b * ctm.b) > img->w)
3933
11.6k
    dolerp = lerp_allowed;
3934
50.0k
  if (sqrtf(ctm.c * ctm.c + ctm.d * ctm.d) > img->h)
3935
7.55k
    dolerp = lerp_allowed;
3936
3937
  /* except when we shouldn't, at large magnifications */
3938
50.0k
  if (!(img->flags & FZ_PIXMAP_FLAG_INTERPOLATE))
3939
11.2k
  {
3940
11.2k
    if (sqrtf(ctm.a * ctm.a + ctm.b * ctm.b) > img->w * 2)
3941
7.84k
      dolerp = 0;
3942
11.2k
    if (sqrtf(ctm.c * ctm.c + ctm.d * ctm.d) > img->h * 2)
3943
4.37k
      dolerp = 0;
3944
11.2k
  }
3945
3946
50.0k
  bbox = fz_irect_from_rect(fz_transform_rect(fz_unit_rect, ctm));
3947
50.0k
  bbox = fz_intersect_irect(bbox, *scissor);
3948
3949
50.0k
  x = bbox.x0;
3950
50.0k
  if (shape && shape->x > x)
3951
0
    x = shape->x;
3952
50.0k
  if (group_alpha && group_alpha->x > x)
3953
0
    x = group_alpha->x;
3954
50.0k
  y = bbox.y0;
3955
50.0k
  if (shape && shape->y > y)
3956
0
    y = shape->y;
3957
50.0k
  if (group_alpha && group_alpha->y > y)
3958
0
    y = group_alpha->y;
3959
50.0k
  w = bbox.x1;
3960
50.0k
  if (shape && shape->x + shape->w < w)
3961
0
    w = shape->x + shape->w;
3962
50.0k
  if (group_alpha && group_alpha->x + group_alpha->w < w)
3963
0
    w = group_alpha->x + group_alpha->w;
3964
50.0k
  if (w <= x)
3965
7.26k
    return;
3966
42.7k
  w -= x;
3967
42.7k
  h = bbox.y1;
3968
42.7k
  if (shape && shape->y + shape->h < h)
3969
0
    h = shape->y + shape->h;
3970
42.7k
  if (group_alpha && group_alpha->y + group_alpha->h < h)
3971
0
    h = group_alpha->y + group_alpha->h;
3972
42.7k
  if (h <= y)
3973
760
    return;
3974
41.9k
  h -= y;
3975
3976
  /* map from screen space (x,y) to image space (u,v) */
3977
41.9k
  ctm = fz_pre_scale(ctm, 1.0f / img->w, 1.0f / img->h);
3978
41.9k
  ctm = fz_invert_matrix(ctm);
3979
3980
41.9k
  fa = (affint)(ctm.a *= ONE);
3981
41.9k
  fb = (affint)(ctm.b *= ONE);
3982
41.9k
  fc = (affint)(ctm.c *= ONE);
3983
41.9k
  fd = (affint)(ctm.d *= ONE);
3984
41.9k
  ctm.e *= ONE;
3985
41.9k
  ctm.f *= ONE;
3986
3987
  /* Calculate initial texture positions. Do a half step to start. */
3988
  /* Bug 693021: Keep calculation in float for as long as possible to
3989
   * avoid overflow. */
3990
41.9k
  u = (int)((ctm.a * x) + (ctm.c * y) + ctm.e + ((ctm.a + ctm.c) * .5f));
3991
41.9k
  v = (int)((ctm.b * x) + (ctm.d * y) + ctm.f + ((ctm.b + ctm.d) * .5f));
3992
3993
41.9k
  dp = dst->samples + (y - dst->y) * (size_t)dst->stride + (x - dst->x) * (size_t)dst->n;
3994
41.9k
  da = dst->alpha;
3995
41.9k
  dn = dst->n - da;
3996
41.9k
  sp = img->samples;
3997
41.9k
  sw = img->w;
3998
41.9k
  sh = img->h;
3999
41.9k
  ss = img->stride;
4000
41.9k
  sa = img->alpha;
4001
41.9k
  sn = img->n - sa;
4002
41.9k
  if (shape)
4003
0
  {
4004
0
    hs = shape->stride;
4005
0
    hp = shape->samples + (y - shape->y) * (size_t)shape->stride + x - shape->x;
4006
0
  }
4007
41.9k
  else
4008
41.9k
  {
4009
41.9k
    hs = 0;
4010
41.9k
    hp = NULL;
4011
41.9k
  }
4012
41.9k
  if (group_alpha)
4013
10.7k
  {
4014
10.7k
    gs = group_alpha->stride;
4015
10.7k
    gp = group_alpha->samples + (y - group_alpha->y) * (size_t)group_alpha->stride + x - group_alpha->x;
4016
10.7k
  }
4017
31.2k
  else
4018
31.2k
  {
4019
31.2k
    gs = 0;
4020
31.2k
    gp = NULL;
4021
31.2k
  }
4022
4023
  /* image size overflows fixed point math */
4024
41.9k
  if (sw >= LIMIT || sh >= LIMIT)
4025
0
  {
4026
    /* Note this may cause compile warning because fz_warn() is marked as
4027
    being like printf(), but actually it treats %ld as matching int64_t. */
4028
0
    fz_warn(ctx, "image too large for fixed point math: %ld x %ld", (int64_t)sw, (int64_t)sh);
4029
0
    return;
4030
0
  }
4031
4032
  /* TODO: if (fb == 0 && fa == 1) call fz_paint_span */
4033
4034
  /* Sometimes we can get an alpha only input to be
4035
   * plotted. In this case treat it as a greyscale
4036
   * input. */
4037
41.9k
  if (img->n == sa && color)
4038
18.5k
  {
4039
18.5k
    sa = 0;
4040
18.5k
    sn = 1;
4041
18.5k
  }
4042
4043
41.9k
#if FZ_PLOTTERS_RGB
4044
41.9k
  if (dn == 3 && dst->s == 0 && img->n == 1 + sa && !color && !fz_overprint_required(eop))
4045
1.75k
  {
4046
1.75k
    if (dolerp)
4047
118
      paintfn = fz_paint_affine_g2rgb_lerp(da, sa, fa, fb, dn, alpha);
4048
1.63k
    else
4049
1.63k
      paintfn = fz_paint_affine_g2rgb_near(da, sa, fa, fb, dn, alpha);
4050
1.75k
  }
4051
40.2k
  else
4052
40.2k
#endif /* FZ_PLOTTERS_RGB */
4053
40.2k
#if FZ_ENABLE_SPOT_RENDERING
4054
40.2k
  if (sn != dn)
4055
17.0k
  {
4056
17.0k
    if (dolerp)
4057
799
    {
4058
799
      if (color)
4059
799
        paintfn = fz_paint_affine_color_lerp_spots(da, sa, fa, fb, dn, sn, alpha, eop);
4060
0
      else
4061
0
        paintfn = fz_paint_affine_lerp_spots(da, sa, fa, fb, dn, sn, alpha, eop);
4062
799
    }
4063
16.2k
    else
4064
16.2k
    {
4065
16.2k
      if (color)
4066
16.2k
        paintfn = fz_paint_affine_color_near_spots(da, sa, fa, fb, dn, sn, alpha, eop);
4067
0
      else
4068
0
        paintfn = fz_paint_affine_near_spots(da, sa, fa, fb, dn, sn, alpha, eop);
4069
16.2k
    }
4070
17.0k
  }
4071
23.1k
  else
4072
23.1k
#endif /* FZ_ENABLE_SPOT_RENDERING */
4073
23.1k
  {
4074
23.1k
    assert((!color && sn == dn) || (color && sn + sa == 1));
4075
23.1k
    if (dolerp)
4076
2.33k
    {
4077
2.33k
      if (color)
4078
157
        paintfn = fz_paint_affine_color_lerp(da, sa, fa, fb, dn, alpha, eop);
4079
2.17k
      else
4080
2.17k
        paintfn = fz_paint_affine_lerp(da, sa, fa, fb, dn, alpha, eop);
4081
2.33k
    }
4082
20.8k
    else
4083
20.8k
    {
4084
20.8k
      if (color)
4085
1.31k
        paintfn = fz_paint_affine_color_near(da, sa, fa, fb, dn, alpha, eop);
4086
19.5k
      else
4087
19.5k
        paintfn = fz_paint_affine_near(da, sa, fa, fb, dn, alpha, eop);
4088
20.8k
    }
4089
23.1k
  }
4090
4091
41.9k
  assert(paintfn);
4092
41.9k
  if (paintfn == NULL)
4093
0
    return;
4094
4095
41.9k
  if (dolerp)
4096
3.25k
  {
4097
3.25k
    u -= HALF;
4098
3.25k
    v -= HALF;
4099
3.25k
    sw = (sw<<PREC) + HALF;
4100
3.25k
    sh = (sh<<PREC) + HALF;
4101
3.25k
  }
4102
4103
16.6M
  while (h--)
4104
16.6M
  {
4105
16.6M
    paintfn(dp, da, sp, sw, sh, ss, sa, u, v, fa, fb, w, dn, sn, alpha, color, hp, gp, eop);
4106
16.6M
    dp += dst->stride;
4107
16.6M
    hp += hs;
4108
16.6M
    gp += gs;
4109
16.6M
    u += fc;
4110
16.6M
    v += fd;
4111
16.6M
  }
4112
41.9k
}
4113
4114
void
4115
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)
4116
24.8k
{
4117
24.8k
  assert(img->n == 1);
4118
24.8k
  fz_paint_image_imp(ctx, dst, scissor, shape, group_alpha, img, ctm, color, 255, lerp_allowed, eop);
4119
24.8k
}
4120
4121
void
4122
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)
4123
25.1k
{
4124
25.1k
  fz_paint_image_imp(ctx, dst, scissor, shape, group_alpha, img, ctm, NULL, alpha, lerp_allowed, eop);
4125
25.1k
}