Lines Matching +full:- +full:o

2  * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
28 * ----------------------------
30 * 2006-Jan-27
32 * Copyright 1996-2002, 2006 by
55 * o We don't promise that this software works. However, we will be
58 * o You can use this software for whatever you want, in parts or
59 * full form, without having to pay us. (`royalty-free' usage)
61 * o You may not pretend that you wrote this software. If you use
88 * --------------
109 * The FreeType Project is copyright (C) 1996-2000 by David Turner,
114 * --------------
124 * -----------------
126 * This license grants a worldwide, royalty-free, perpetual and
134 * o Redistribution of source code must retain this license file
141 * o Redistribution in binary form must provide a disclaimer that
153 * --------------
173 * -----------
177 * o freetype@nongnu.org
184 * o freetype-devel@nongnu.org
264 …n {SwCoord(((unsigned long) pt.x) << (PIXEL_BITS - 6)), SwCoord(((unsigned long) pt.y) << (PIXEL_B… in UPSCALE()
298 if (pt.x < 0) pt.x = -pt.x; in HYPOT()
299 if (pt.y < 0) pt.y = -pt.y; in HYPOT()
314 auto coverage = static_cast<int>(area >> (PIXEL_BITS * 2 + 1 - 8)); //range 0 - 255 in _horizLine()
316 if (coverage < 0) coverage = -coverage; in _horizLine()
318 if (rw.outline->fillRule == FillRule::EvenOdd) { in _horizLine()
320 if (coverage > 255) coverage = 511 - coverage; in _horizLine()
322 //normal non-zero winding rule in _horizLine()
330 TVGERR("SW_ENGINE", "X-coordinate overflow!"); in _horizLine()
334 TVGERR("SW_ENGINE", "Y-coordinate overflow!"); in _horizLine()
343 if (rle->size > 0) { in _horizLine()
344 auto span = rle->spans + rle->size - 1; in _horizLine()
345 if ((span->coverage == coverage) && (span->y == y) && (span->x + span->len == x)) { in _horizLine()
348 if (x + aCount >= rw.cellMax.x) xOver -= (x + aCount - rw.cellMax.x); in _horizLine()
349 if (x < rw.cellMin.x) xOver -= (rw.cellMin.x - x); in _horizLine()
351 //span->len += (aCount + xOver) - 1; in _horizLine()
352 span->len += (aCount + xOver); in _horizLine()
358 if (rle->size >= rle->alloc) { in _horizLine()
359 auto newSize = (rle->size > 0) ? (rle->size * 2) : 256; in _horizLine()
360 if (rle->alloc < newSize) { in _horizLine()
361 rle->alloc = newSize; in _horizLine()
362 rle->spans = static_cast<SwSpan*>(realloc(rle->spans, rle->alloc * sizeof(SwSpan))); in _horizLine()
368 if (x + aCount >= rw.cellMax.x) xOver -= (x + aCount - rw.cellMax.x); in _horizLine()
370 xOver -= (rw.cellMin.x - x); in _horizLine()
378 auto span = rle->spans + rle->size; in _horizLine()
379 span->x = x; in _horizLine()
380 span->y = y; in _horizLine()
381 span->len = (aCount + xOver); in _horizLine()
382 span->coverage = coverage; in _horizLine()
383 rle->size++; in _horizLine()
397 … if (cell->x > x && cover != 0) _horizLine(rw, x, y, cover * (ONE_PIXEL * 2), cell->x - x); in _sweep()
398 cover += cell->cover; in _sweep()
399 auto area = cover * (ONE_PIXEL * 2) - cell->area; in _sweep()
400 if (area != 0 && cell->x >= 0) _horizLine(rw, cell->x, y, area, 1); in _sweep()
401 x = cell->x + 1; in _sweep()
402 cell = cell->next; in _sweep()
405 if (cover != 0) _horizLine(rw, x, y, cover * (ONE_PIXEL * 2), rw.cellXCnt - x); in _sweep()
419 if (!cell || cell->x > x) break; in _findCell()
420 if (cell->x == x) return cell; in _findCell()
421 pcell = &cell->next; in _findCell()
427 cell->x = x; in _findCell()
428 cell->area = 0; in _findCell()
429 cell->cover = 0; in _findCell()
430 cell->next = *pcell; in _findCell()
441 cell->area += rw.area; in _recordCell()
442 cell->cover += rw.cover; in _recordCell()
453 /* . the new vertical position must be within min_ey..max_ey-1. */ in _setCell()
457 /* actually set to the (min_ex-1) horizontal position. */ in _setCell()
460 min_ex - 1 horizontal position. */ in _setCell()
461 pos.x -= rw.cellMin.x; in _setCell()
462 pos.y -= rw.cellMin.y; in _setCell()
486 rw.cellPos = pos - rw.cellMin; in _startCell()
509 (sizeof(long) * CHAR_BIT - PIXEL_BITS)) in _lineTo()
525 auto diff = line[0] - line[1]; in _lineTo()
536 auto f1 = line[1] - SUBPIXELS(e1); in _lineTo()
551 rw.cover += (f2.y - f1.y); in _lineTo()
552 rw.area += (f2.y - f1.y) * f1.x * 2; in _lineTo()
561 rw.cover += (f2.y - f1.y); in _lineTo()
562 rw.area += (f2.y - f1.y) * f1.x * 2; in _lineTo()
564 --e1.y; in _lineTo()
570 Area prod = diff.x * f1.y - diff.y * f1.x; in _lineTo()
585 if (prod <= 0 && prod - px > 0) { in _lineTo()
586 f2 = {0, SW_UDIV(-prod, -dx_r)}; in _lineTo()
587 prod -= py; in _lineTo()
588 rw.cover += (f2.y - f1.y); in _lineTo()
589 rw.area += (f2.y - f1.y) * (f1.x + f2.x); in _lineTo()
591 --e1.x; in _lineTo()
593 } else if (prod - px <= 0 && prod - px + py > 0) { in _lineTo()
594 prod -= px; in _lineTo()
595 f2 = {SW_UDIV(-prod, dy_r), ONE_PIXEL}; in _lineTo()
596 rw.cover += (f2.y - f1.y); in _lineTo()
597 rw.area += (f2.y - f1.y) * (f1.x + f2.x); in _lineTo()
601 } else if (prod - px + py <= 0 && prod + py >= 0) { in _lineTo()
604 rw.cover += (f2.y - f1.y); in _lineTo()
605 rw.area += (f2.y - f1.y) * (f1.x + f2.x); in _lineTo()
610 f2 = {SW_UDIV(prod, -dy_r), 0}; in _lineTo()
612 rw.cover += (f2.y - f1.y); in _lineTo()
613 rw.area += (f2.y - f1.y) * (f1.x + f2.x); in _lineTo()
615 --e1.y; in _lineTo()
623 f2 = {line[0].x - SUBPIXELS(e2.x), line[0].y - SUBPIXELS(e2.y)}; in _lineTo()
624 rw.cover += (f2.y - f1.y); in _lineTo()
625 rw.area += (f2.y - f1.y) * (f1.x + f2.x); in _lineTo()
628 if (line-- == rw.lineStack) return; in _lineTo()
641 //Short-cut the arc that crosses the current band in _cubicTo()
657 …/* http://www.cis.southalabama.edu/~hain/general/Publications/Bezier/Camera-ready%20CISST02%202.pd… in _cubicTo()
660 //diff is the P0 - P3 chord vector in _cubicTo()
661 auto diff = arc[3] - arc[0]; in _cubicTo()
670 auto diff1 = arc[1] - arc[0]; in _cubicTo()
671 auto s = diff.y * diff1.x - diff.x * diff1.y; in _cubicTo()
672 if (s < 0) s = -s; in _cubicTo()
675 //s is L * the perpendicular distance from P2 to the line P0 - P3 in _cubicTo()
676 auto diff2 = arc[2] - arc[0]; in _cubicTo()
677 s = diff.y * diff2.x - diff.x * diff2.y; in _cubicTo()
678 if (s < 0) s = -s; in _cubicTo()
682 from the chord that the angles P0-P1-P3 or P0-P2-P3 become in _cubicTo()
684 if (diff1.x * (diff1.x - diff.x) + diff1.y * (diff1.y - diff.y) > 0 || in _cubicTo()
685 diff2.x * (diff2.x - diff.x) + diff2.y * (diff2.y - diff.y) > 0) in _cubicTo()
699 arc -= 3; in _cubicTo()
709 for (auto cntr = outline->cntrs.begin(); cntr < outline->cntrs.end(); ++cntr) { in _decomposeOutline()
711 auto limit = outline->pts.data + last; in _decomposeOutline()
712 auto start = UPSCALE(outline->pts[first]); in _decomposeOutline()
713 auto pt = outline->pts.data + first; in _decomposeOutline()
714 auto types = outline->types.data + first; in _decomposeOutline()
717 _moveTo(rw, UPSCALE(outline->pts[first])); in _decomposeOutline()
729 if (pt <= limit) _cubicTo(rw, UPSCALE(pt[-2]), UPSCALE(pt[-1]), UPSCALE(pt[0])); in _decomposeOutline()
730 else if (pt - 1 == limit) _cubicTo(rw, UPSCALE(pt[-2]), UPSCALE(pt[-1]), start); in _decomposeOutline()
748 return -1; //lack of cell memory in _genRle()
755 auto spans = target->spans; in _intersectSpansRegion()
756 auto end = target->spans + target->size; in _intersectSpansRegion()
757 auto clipSpans = clip->spans; in _intersectSpansRegion()
758 auto clipEnd = clip->spans + clip->size; in _intersectSpansRegion()
761 //align y-coordinates. in _intersectSpansRegion()
762 if (clipSpans->y > spans->y) { in _intersectSpansRegion()
766 if (spans->y > clipSpans->y) { in _intersectSpansRegion()
771 //Try clipping with all clip spans which have a same y-coordinate. in _intersectSpansRegion()
773 while(temp < clipEnd && outSpansCnt > 0 && temp->y == clipSpans->y) { in _intersectSpansRegion()
774 auto sx1 = spans->x; in _intersectSpansRegion()
775 auto sx2 = sx1 + spans->len; in _intersectSpansRegion()
776 auto cx1 = temp->x; in _intersectSpansRegion()
777 auto cx2 = cx1 + temp->len; in _intersectSpansRegion()
787 auto len = (sx2 < cx2 ? sx2 : cx2) - x; in _intersectSpansRegion()
789 out->x = x; in _intersectSpansRegion()
790 out->y = temp->y; in _intersectSpansRegion()
791 out->len = len; in _intersectSpansRegion()
792 out->coverage = (uint8_t)(((spans->coverage * temp->coverage) + 0xff) >> 8); in _intersectSpansRegion()
794 --outSpansCnt; in _intersectSpansRegion()
807 auto spans = targetRle->spans; in _intersectSpansRect()
808 auto end = targetRle->spans + targetRle->size; in _intersectSpansRect()
809 auto minx = static_cast<int16_t>(bbox->min.x); in _intersectSpansRect()
810 auto miny = static_cast<int16_t>(bbox->min.y); in _intersectSpansRect()
811 auto maxx = minx + static_cast<int16_t>(bbox->max.x - bbox->min.x) - 1; in _intersectSpansRect()
812 auto maxy = miny + static_cast<int16_t>(bbox->max.y - bbox->min.y) - 1; in _intersectSpansRect()
815 if (spans->y > maxy) { in _intersectSpansRect()
819 if (spans->y < miny || spans->x > maxx || spans->x + spans->len <= minx) { in _intersectSpansRect()
823 if (spans->x < minx) { in _intersectSpansRect()
824 …out->len = (spans->len - (minx - spans->x)) < (maxx - minx + 1) ? (spans->len - (minx - spans->x))… in _intersectSpansRect()
825 out->x = minx; in _intersectSpansRect()
828 out->x = spans->x; in _intersectSpansRect()
829 out->len = spans->len < (maxx - spans->x + 1) ? spans->len : (maxx - spans->x + 1); in _intersectSpansRect()
831 if (out->len > 0) { in _intersectSpansRect()
832 out->y = spans->y; in _intersectSpansRect()
833 out->coverage = spans->coverage; in _intersectSpansRect()
835 --outSpansCnt; in _intersectSpansRect()
845 free(rle->spans); in _replaceClipSpan()
846 rle->spans = clippedSpans; in _replaceClipSpan()
847 rle->size = rle->alloc = size; in _replaceClipSpan()
876 rw.cellXCnt = rw.cellMax.x - rw.cellMin.x; in rleRender()
877 rw.cellYCnt = rw.cellMax.y - rw.cellMin.y; in rleRender()
891 auto bandCnt = static_cast<int>((rw.cellMax.y - rw.cellMin.y) / rw.bandSize); in rleRender()
893 else if (bandCnt >= BAND_SIZE) bandCnt = (BAND_SIZE - 1); in rleRender()
902 if (n == bandCnt -1 || max > yMax) max = yMax; in rleRender()
910 rw.yCnt = band->max - band->min; in rleRender()
915 if (cellMod > 0) cellStart += sizeof(Cell) - cellMod; in rleRender()
922 rw.maxCells = cellsMax - rw.cells; in rleRender()
930 rw.cellMin.y = band->min; in rleRender()
931 rw.cellMax.y = band->max; in rleRender()
932 rw.cellYCnt = band->max - band->min; in rleRender()
937 --band; in rleRender()
945 auto bottom = band->min; in rleRender()
946 auto top = band->max; in rleRender()
947 auto middle = bottom + ((top - bottom) >> 1); in rleRender()
953 if (bottom - top >= rw.bandSize) ++rw.bandShoot; in rleRender()
976 auto width = static_cast<uint16_t>(bbox->max.x - bbox->min.x); in rleRender()
977 auto height = static_cast<uint16_t>(bbox->max.y - bbox->min.y); in rleRender()
980 rle->spans = static_cast<SwSpan*>(malloc(sizeof(SwSpan) * height)); in rleRender()
981 rle->size = height; in rleRender()
982 rle->alloc = height; in rleRender()
984 auto span = rle->spans; in rleRender()
986 span->x = bbox->min.x; in rleRender()
987 span->y = bbox->min.y + i; in rleRender()
988 span->len = width; in rleRender()
989 span->coverage = 255; in rleRender()
999 rle->size = 0; in rleReset()
1006 if (rle->spans) free(rle->spans); in rleFree()
1013 if (rle->size == 0 || clip->size == 0) return; in rleClip()
1014 auto spanCnt = rle->size > clip->size ? rle->size : clip->size; in rleClip()
1018 _replaceClipSpan(rle, spans, spansEnd - spans); in rleClip()
1026 if (rle->size == 0) return; in rleClip()
1027 auto spans = static_cast<SwSpan*>(malloc(sizeof(SwSpan) * (rle->size))); in rleClip()
1028 auto spansEnd = _intersectSpansRect(clip, rle, spans, rle->size); in rleClip()
1030 _replaceClipSpan(rle, spans, spansEnd - spans); in rleClip()