Branch Coverage

image.c
Criterion Covered Total %
branch 259 418 61.9


line true false branch
122 0 2959 if ( (cl=mymalloc(sizeof(i_color))) == NULL) im_fatal(aIMCTX, 2,"malloc() error\n");
150 0 0 if (cl == NULL)
151 0 0 if ( (cl=mymalloc(sizeof(i_color))) == NULL)
177 0 0 for(i=0;i
228 0 166 if ( (cl=mymalloc(sizeof(i_fcolor))) == NULL) im_fatal(aIMCTX, 2,"malloc() error\n");
262 178 1314 if (im->i_f_destroy)
264 1476 16 if (im->idata != NULL) { myfree(im->idata); }
437 9 62 switch (model) {
440 2 7 if (channel) *channel = (int)model - 1;
500 0 0 if (x2
501 0 0 if (y2
504 0 0 for(x=x1;x
507 0 0 for(y=y1;y
510 0 0 if ( trans != NULL)
513 0 0 for(ch=0;chchannels;ch++) if (trans->channel[ch]!=pv.channel[ch]) tt++;
0 0 for(ch=0;chchannels;ch++) if (trans->channel[ch]!=pv.channel[ch]) tt++;
514 0 0 if (tt) i_ppix(im,ttx,tty,&pv);
544 0 220 if (!im)
549 214 6 if (src->type == i_direct_type) {
550 170 44 if (src->bits == i_8_bits) {
554 17945 170 for (y = 0; y < y1; ++y) {
564 4554 44 for (y = 0; y < y1; ++y) {
575 575 6 for (y = 0; y < y1; ++y) {
576 575 0 i_gpal(src, 0, x1, y, vals);
577 575 0 i_ppal(im, 0, x1, y, vals);
599 26377 3075 if ((x >= 2.0) || (x <= -2.0)) return (0.0);
0 26377 if ((x >= 2.0) || (x <= -2.0)) return (0.0);
600 3075 23302 else if (x == 0.0) return (1.0);
633 27 27 if (Axis == XAXIS) {
635 1 26 if (hsize < 1) {
647 1 26 if (vsize < 1) {
657 0 54 if (!new_img) {
663 13 41 LanczosWidthFactor = (Value >= 1) ? 1 : (i_img_dim) (1.4/Value);
669 4733 54 for (j=0; j
674 14726 4733 for (l = 0; l
681 14726 4733 for(l=0; l
687 14726 4733 for(l=0; l
692 2447 2286 if (Axis == XAXIS) {
694 246275 2447 for (i=0; i
695 740545 246275 for (k=0; kchannels; k++) PictureValue[k] = 0.0;
696 832670 246275 for (l=0; l
700 29431 803239 Mx = (Mx >= im->xsize) ? im->xsize-1 : Mx;
705 3440 829230 if (has_alpha) {
708 10320 3440 for (k=0; k < color_chans; k++) {
716 2487690 829230 for (k=0; kchannels; k++) {
723 1720 244555 if (has_alpha) {
725 2 1718 int alpha = minmax(0, 255, fa+0.5);
1409 309 int alpha = minmax(0, 255, fa+0.5);
726 1599 121 if (alpha) {
727 4797 1599 for (k = 0; k < color_chans; ++k) {
729 4797 0 val.channel[k]=minmax(0,255,psave);
735 484 121 for (k = 0; k < im->channels; ++k)
740 733665 244555 for(k=0;kchannels;k++) {
742 30805 702860 val.channel[k]=minmax(0,255,psave);
750 336567 2286 for (i=0; i
751 1011301 336567 for (k=0; kchannels; k++) PictureValue[k] = 0.0;
752 812810 336567 for (l=0; l < lMax; l++) {
756 12818 799992 Mx = (Mx >= im->ysize) ? im->ysize-1 : Mx;
760 3200 809610 if (has_alpha) {
763 9600 3200 for (k=0; k < color_chans; k++) {
771 2428830 809610 for (k=0; kchannels; k++) {
777 1600 334967 if (has_alpha) {
779 0 1600 int alpha = minmax(0, 255, fa+0.5);
1302 298 int alpha = minmax(0, 255, fa+0.5);
780 1520 80 if (alpha) {
781 4560 1520 for (k = 0; k < color_chans; ++k) {
783 4560 0 val.channel[k]=minmax(0,255,psave);
788 320 80 for (k = 0; k < im->channels; ++k)
793 1004901 334967 for(k=0;kchannels;k++) {
795 41445 963456 val.channel[k]=minmax(0,255,psave);
834 1 17 if (nxsize < 1) {
839 1 17 if (nysize < 1) {
843 18 0 im_assert(scx != 0 && scy != 0);
0 18 im_assert(scx != 0 && scy != 0);
847 121890 1038 for(ny=0;ny
1038 18 for(ny=0;ny
874 351 18 if (src->type == i_direct_type) {
875 286 65 if (src->bits == 8) {
878 21 44 else if (src->bits == i_16_bits) {
881 44 0 else if (src->bits == i_double_bits) {
893 18 0 i_img *targ = i_img_pal_new(xsize, ysize, src->channels, i_maxcolors(src));
894 1071 0 for (i = 0; i < i_colorcount(src); ++i) {
1053 18 for (i = 0; i < i_colorcount(src); ++i) {
895 1053 0 i_getcolors(src, i, &col, 1);
896 1053 0 i_addcolors(targ, &col, 1);
920 39 18 if (src->bits == 8) {
923 4 14 else if (src->bits == i_16_bits) {
926 14 0 else if (src->bits == i_double_bits) {
969 0 0 for(ny=0;ny
0 0 for(ny=0;ny
1019 2851287 89498 for(y=0;y
89498 339 for(y=0;y
1023 8372247 2851287 for(ch=0;ch
1062 0 0 for(y=0;y
0 0 for(y=0;y
1066 0 0 for(ch=0;ch
1083 0 29 if (what == NULL)
1095 3100 29 for(y = 0; y < yb; y++) {
1096 340000 3100 for(x = 0; x < xb; x++) {
1100 1020000 340000 for(ch = 0; ch < chb; ch++) {
1102 0 1020000 if (fabs(sdiff) > epsilon) {
1138 0 0 for(y=0;y
0 0 for(y=0;y
1141 0 0 for(ch=0;chchannels;ch++) {
1149 0 0 for(y=0;y
0 0 for(y=0;y
1152 0 0 for(ch=0;chchannels;ch++) {
1186 8 1 if (im->channels >= 3) {
1199 526 8 for(y = 0; y < ysize; ) {
1201 45235 525 for(x = 0; x < samp_cnt; ) {
1204 1 45234 if (colorcnt > maxc) {
1228 1 3 if (n < 2) return;
1232 3 5 if (l > 0) {
1238 3 2 if (--ir == 0) {
1245 5 2 while (j <= ir) {
1246 2 3 if (j < ir && ra[j] < ra[j+1]) j++;
2 0 if (j < ir && ra[j] < ra[j+1]) j++;
1247 2 3 if (rra < ra[j]) {
1281 4 1 if (im->channels >= 3) {
1290 226 4 for(y = 0; y < ysize; ) {
1292 11251 225 for(x = 0; x < samp_cnt; ) {
1295 1 11250 if (colorcnt > maxc) {
1330 63 21 for (ch = 0; ch < im->channels; ++ch)
1345 20 0 if (i_gpix(im, x, y, &temp) == 0) {
1346 60 20 for (ch = 0; ch < im->channels; ++ch)
1363 0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
1364 0 0 if (r > im->xsize)
1366 0 0 if (r > l) {
1371 0 0 for (i = 0; i < r-l; ++i) {
1372 0 0 for (ch = 0; ch < im->channels; ++ch)
1398 0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
1399 0 0 if (r > im->xsize)
1401 0 0 if (r > l) {
1407 0 0 for (i = 0; i < r-l; ++i) {
1408 0 0 for (ch = 0; ch < im->channels; ++ch)
1435 0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
0 0 if (y >= 0 && y < im->ysize && l < im->xsize && l >= 0) {
1436 0 0 if (r > im->xsize)
1438 0 0 if (r > l) {
1443 0 0 for (i = 0; i < ret; ++i) {
1475 1 0 return i_addcolors(*(i_img **)im->ext_data, colors, count);
1484 1 0 return i_getcolors(*(i_img **)im->ext_data, i, color, count);
1493 0 0 return i_setcolors(*(i_img **)im->ext_data, i, color, count);
1502 5 0 return i_colorcount(*(i_img **)im->ext_data);
1511 0 0 return i_maxcolors(*(i_img **)im->ext_data);
1520 0 0 return i_findcolor(*(i_img **)im->ext_data, color, entry);
1540 1 0 if (bits < 1 || bits > 32) {
0 1 if (bits < 1 || bits > 32) {
1545 1 0 if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
1 0 if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
1 0 if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
1 0 if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) {
1550 0 1 if (bits == 32)
1555 0 1 if (r > im->xsize)
1560 1 0 if (chans) {
1562 2 1 for (ch = 0; ch < chan_count; ++ch) {
1563 2 0 if (chans[ch] < 0 || chans[ch] >= im->channels) {
0 2 if (chans[ch] < 0 || chans[ch] >= im->channels) {
1568 4 1 for (i = 0; i < w; ++i) {
1571 8 4 for (ch = 0; ch < chan_count; ++ch) {
1578 0 0 if (chan_count <= 0 || chan_count > im->channels) {
0 0 if (chan_count <= 0 || chan_count > im->channels) {
1582 0 0 for (i = 0; i < w; ++i) {
1585 0 0 for (ch = 0; ch < chan_count; ++ch) {
1602 52 4155 if (length < magic->magic_size)
1604 663 3492 if (magic->mask) {
1610 2976 7 for (i = 0; i < magic->magic_size; ++i) {
1611 2188 788 int mask = *maskp == 'x' ? 0xFF : *maskp == ' ' ? 0 : *maskp;
0 2188 int mask = *maskp == 'x' ? 0xFF : *maskp == ' ' ? 0 : *maskp;
1614 656 2320 if ((*bufp++ & mask) != (*magicp++ & mask))
1743 0 194 if (rc == -1) return NULL;
1756 11 193 while (p) {
1757 1 10 if (test_magic(head, rc, &p->m)) {
1764 4145 48 for(i=0; i
1767 145 4000 if (test_magic(head, rc, entry))
1775 51 7 for(i=0; i
1778 23 28 if (test_magic(head, rc, entry))
1818 20 140 if (im->type == i_palette_type
1819 20 0 && i_colorcount(im) == 2) {
17 3 && i_colorcount(im) == 2) {
1821 17 0 if (!i_getcolors(im, 0, colors, 2))
0 17 if (!i_getcolors(im, 0, colors, 2))
1823 11 6 if (im->channels == 3) {
1824 2 9 if (colors[0].rgb.r == 255 &&
2 0 if (colors[0].rgb.r == 255 &&
1825 2 0 colors[0].rgb.g == 255 &&
1826 2 0 colors[0].rgb.b == 255 &&
1827 2 0 colors[1].rgb.r == 0 &&
1828 2 0 colors[1].rgb.g == 0 &&
1833 8 1 else if (colors[0].rgb.r == 0 &&
8 0 else if (colors[0].rgb.r == 0 &&
1834 8 0 colors[0].rgb.g == 0 &&
1835 8 0 colors[0].rgb.b == 0 &&
1836 8 0 colors[1].rgb.r == 255 &&
1837 8 0 colors[1].rgb.g == 255 &&
1843 6 0 else if (im->channels == 1) {
1844 3 3 if (colors[0].channel[0] == 255 &&
3 0 if (colors[0].channel[0] == 255 &&
1849 3 0 else if (colors[0].channel[0] == 0 &&
3 0 else if (colors[0].channel[0] == 0 &&
1878 44 3 if (!result) {