Rev 1891 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1891 | Rev 3931 | ||
---|---|---|---|
Line 100... | Line 100... | ||
100 | 100 | ||
Line 101... | Line 101... | ||
101 | #endif |
101 | #endif |
102 | 102 | ||
- | 103 | static const box_type_t PREFIX (_empty_box_) = { 0, 0, 0, 0 }; |
|
- | 104 | static const region_data_type_t PREFIX (_empty_data_) = { 0, 0 }; |
|
- | 105 | #if defined (__llvm__) && !defined (__clang__) |
|
103 | static const box_type_t PREFIX (_empty_box_) = { 0, 0, 0, 0 }; |
106 | static const volatile region_data_type_t PREFIX (_broken_data_) = { 0, 0 }; |
- | 107 | #else |
|
Line 104... | Line 108... | ||
104 | static const region_data_type_t PREFIX (_empty_data_) = { 0, 0 }; |
108 | static const region_data_type_t PREFIX (_broken_data_) = { 0, 0 }; |
105 | static const region_data_type_t PREFIX (_broken_data_) = { 0, 0 }; |
109 | #endif |
106 | 110 | ||
107 | static box_type_t *pixman_region_empty_box = |
111 | static box_type_t *pixman_region_empty_box = |
Line 196... | Line 200... | ||
196 | return 0; |
200 | return 0; |
Line 197... | Line 201... | ||
197 | 201 | ||
198 | return size + sizeof(region_data_type_t); |
202 | return size + sizeof(region_data_type_t); |
Line 199... | Line 203... | ||
199 | } |
203 | } |
200 | 204 | ||
201 | static void * |
205 | static region_data_type_t * |
202 | alloc_data (size_t n) |
206 | alloc_data (size_t n) |
Line 203... | Line 207... | ||
203 | { |
207 | { |
Line 736... | Line 740... | ||
736 | box_type_t * r1, |
740 | box_type_t * r1, |
737 | box_type_t * r1_end, |
741 | box_type_t * r1_end, |
738 | box_type_t * r2, |
742 | box_type_t * r2, |
739 | box_type_t * r2_end, |
743 | box_type_t * r2_end, |
740 | int y1, |
744 | int y1, |
741 | int y2, |
745 | int y2); |
742 | int * overlap); |
- | |
Line 743... | Line 746... | ||
743 | 746 | ||
744 | static pixman_bool_t |
747 | static pixman_bool_t |
745 | pixman_op (region_type_t * new_reg, /* Place to store result */ |
748 | pixman_op (region_type_t * new_reg, /* Place to store result */ |
746 | region_type_t * reg1, /* First region in operation */ |
749 | region_type_t * reg1, /* First region in operation */ |
747 | region_type_t * reg2, /* 2d region in operation */ |
750 | region_type_t * reg2, /* 2d region in operation */ |
748 | overlap_proc_ptr overlap_func, /* Function to call for over- |
751 | overlap_proc_ptr overlap_func, /* Function to call for over- |
749 | * lapping bands */ |
752 | * lapping bands */ |
750 | int append_non1, /* Append non-overlapping bands |
753 | int append_non1, /* Append non-overlapping bands |
751 | * in region 1 ? |
754 | * in region 1 ? |
752 | */ |
755 | */ |
753 | int append_non2, /* Append non-overlapping bands |
756 | int append_non2 /* Append non-overlapping bands |
754 | * in region 2 ? |
757 | * in region 2 ? |
755 | */ |
758 | */ |
756 | int * overlap) |
759 | ) |
757 | { |
760 | { |
758 | box_type_t *r1; /* Pointer into first region */ |
761 | box_type_t *r1; /* Pointer into first region */ |
759 | box_type_t *r2; /* Pointer into 2d region */ |
762 | box_type_t *r2; /* Pointer into 2d region */ |
760 | box_type_t *r1_end; /* End of 1st region */ |
763 | box_type_t *r1_end; /* End of 1st region */ |
Line 822... | Line 825... | ||
822 | 825 | ||
823 | if (new_size > new_reg->data->size) |
826 | if (new_size > new_reg->data->size) |
824 | { |
827 | { |
825 | if (!pixman_rect_alloc (new_reg, new_size)) |
828 | if (!pixman_rect_alloc (new_reg, new_size)) |
826 | { |
- | |
827 | if (old_data) |
829 | { |
828 | free (old_data); |
830 | free (old_data); |
829 | return FALSE; |
831 | return FALSE; |
830 | } |
832 | } |
Line 930... | Line 932... | ||
930 | cur_band = new_reg->data->numRects; |
932 | cur_band = new_reg->data->numRects; |
Line 931... | Line 933... | ||
931 | 933 | ||
932 | if (!(*overlap_func)(new_reg, |
934 | if (!(*overlap_func)(new_reg, |
933 | r1, r1_band_end, |
935 | r1, r1_band_end, |
934 | r2, r2_band_end, |
936 | r2, r2_band_end, |
935 | ytop, ybot, |
- | |
936 | overlap)) |
937 | ytop, ybot)) |
937 | { |
938 | { |
938 | goto bail; |
939 | goto bail; |
Line 939... | Line 940... | ||
939 | } |
940 | } |
Line 999... | Line 1000... | ||
999 | 1000 | ||
1000 | /* Append rest of boxes */ |
1001 | /* Append rest of boxes */ |
1001 | APPEND_REGIONS (new_reg, r2_band_end, r2_end); |
1002 | APPEND_REGIONS (new_reg, r2_band_end, r2_end); |
Line 1002... | Line -... | ||
1002 | } |
- | |
1003 | 1003 | } |
|
Line 1004... | Line 1004... | ||
1004 | if (old_data) |
1004 | |
1005 | free (old_data); |
1005 | free (old_data); |
1006 | 1006 | ||
Line 1021... | Line 1021... | ||
1021 | } |
1021 | } |
Line 1022... | Line 1022... | ||
1022 | 1022 | ||
Line 1023... | Line 1023... | ||
1023 | return TRUE; |
1023 | return TRUE; |
1024 | - | ||
1025 | bail: |
1024 | |
Line 1026... | Line 1025... | ||
1026 | if (old_data) |
1025 | bail: |
1027 | free (old_data); |
1026 | free (old_data); |
Line 1110... | Line 1109... | ||
1110 | box_type_t * r1, |
1109 | box_type_t * r1, |
1111 | box_type_t * r1_end, |
1110 | box_type_t * r1_end, |
1112 | box_type_t * r2, |
1111 | box_type_t * r2, |
1113 | box_type_t * r2_end, |
1112 | box_type_t * r2_end, |
1114 | int y1, |
1113 | int y1, |
1115 | int y2, |
1114 | int y2) |
1116 | int * overlap) |
- | |
1117 | { |
1115 | { |
1118 | int x1; |
1116 | int x1; |
1119 | int x2; |
1117 | int x2; |
1120 | box_type_t * next_rect; |
1118 | box_type_t * next_rect; |
Line 1207... | Line 1205... | ||
1207 | return PREFIX (_copy) (new_reg, reg1); |
1205 | return PREFIX (_copy) (new_reg, reg1); |
1208 | } |
1206 | } |
1209 | else |
1207 | else |
1210 | { |
1208 | { |
1211 | /* General purpose intersection */ |
1209 | /* General purpose intersection */ |
1212 | int overlap; /* result ignored */ |
- | |
Line 1213... | Line 1210... | ||
1213 | 1210 | ||
1214 | if (!pixman_op (new_reg, reg1, reg2, pixman_region_intersect_o, FALSE, FALSE, |
- | |
1215 | &overlap)) |
- | |
1216 | { |
1211 | if (!pixman_op (new_reg, reg1, reg2, pixman_region_intersect_o, FALSE, FALSE)) |
1217 | return FALSE; |
- | |
Line 1218... | Line 1212... | ||
1218 | } |
1212 | return FALSE; |
1219 | 1213 | ||
Line 1220... | Line 1214... | ||
1220 | pixman_set_extents (new_reg); |
1214 | pixman_set_extents (new_reg); |
Line 1228... | Line 1222... | ||
1228 | do \ |
1222 | do \ |
1229 | { \ |
1223 | { \ |
1230 | if (r->x1 <= x2) \ |
1224 | if (r->x1 <= x2) \ |
1231 | { \ |
1225 | { \ |
1232 | /* Merge with current rectangle */ \ |
1226 | /* Merge with current rectangle */ \ |
1233 | if (r->x1 < x2) \ |
- | |
1234 | *overlap = TRUE; \ |
- | |
1235 | \ |
- | |
1236 | if (x2 < r->x2) \ |
1227 | if (x2 < r->x2) \ |
1237 | x2 = r->x2; \ |
1228 | x2 = r->x2; \ |
1238 | } \ |
1229 | } \ |
1239 | else \ |
1230 | else \ |
1240 | { \ |
1231 | { \ |
Line 1270... | Line 1261... | ||
1270 | box_type_t * r1, |
1261 | box_type_t * r1, |
1271 | box_type_t * r1_end, |
1262 | box_type_t * r1_end, |
1272 | box_type_t * r2, |
1263 | box_type_t * r2, |
1273 | box_type_t * r2_end, |
1264 | box_type_t * r2_end, |
1274 | int y1, |
1265 | int y1, |
1275 | int y2, |
1266 | int y2) |
1276 | int * overlap) |
- | |
1277 | { |
1267 | { |
1278 | box_type_t *next_rect; |
1268 | box_type_t *next_rect; |
1279 | int x1; /* left and right side of current union */ |
1269 | int x1; /* left and right side of current union */ |
1280 | int x2; |
1270 | int x2; |
Line 1380... | Line 1370... | ||
1380 | PIXMAN_EXPORT pixman_bool_t |
1370 | PIXMAN_EXPORT pixman_bool_t |
1381 | PREFIX (_union) (region_type_t *new_reg, |
1371 | PREFIX (_union) (region_type_t *new_reg, |
1382 | region_type_t *reg1, |
1372 | region_type_t *reg1, |
1383 | region_type_t *reg2) |
1373 | region_type_t *reg2) |
1384 | { |
1374 | { |
1385 | int overlap; /* result ignored */ |
- | |
1386 | - | ||
1387 | /* Return TRUE if some overlap |
1375 | /* Return TRUE if some overlap |
1388 | * between reg1, reg2 |
1376 | * between reg1, reg2 |
1389 | */ |
1377 | */ |
1390 | GOOD (reg1); |
1378 | GOOD (reg1); |
1391 | GOOD (reg2); |
1379 | GOOD (reg2); |
Line 1447... | Line 1435... | ||
1447 | return PREFIX (_copy) (new_reg, reg2); |
1435 | return PREFIX (_copy) (new_reg, reg2); |
Line 1448... | Line 1436... | ||
1448 | 1436 | ||
1449 | return TRUE; |
1437 | return TRUE; |
Line 1450... | Line 1438... | ||
1450 | } |
1438 | } |
1451 | 1439 | ||
Line 1452... | Line 1440... | ||
1452 | if (!pixman_op (new_reg, reg1, reg2, pixman_region_union_o, TRUE, TRUE, &overlap)) |
1440 | if (!pixman_op (new_reg, reg1, reg2, pixman_region_union_o, TRUE, TRUE)) |
1453 | return FALSE; |
1441 | return FALSE; |
1454 | 1442 | ||
Line 1514... | Line 1502... | ||
1514 | do |
1502 | do |
1515 | { |
1503 | { |
1516 | r++; |
1504 | r++; |
1517 | i++; |
1505 | i++; |
1518 | } |
1506 | } |
1519 | - | ||
1520 | while (i != numRects && (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1))) |
1507 | while (i != numRects && (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1))); |
1521 | ; |
- | |
Line 1522... | Line 1508... | ||
1522 | 1508 | ||
1523 | r = &(rects[j]); |
1509 | r = &(rects[j]); |
1524 | do |
1510 | do |
1525 | { |
1511 | { |
Line 1577... | Line 1563... | ||
1577 | * |
1563 | * |
1578 | *----------------------------------------------------------------------- |
1564 | *----------------------------------------------------------------------- |
1579 | */ |
1565 | */ |
Line 1580... | Line 1566... | ||
1580 | 1566 | ||
1581 | static pixman_bool_t |
1567 | static pixman_bool_t |
1582 | validate (region_type_t * badreg, |
- | |
1583 | int * overlap) |
1568 | validate (region_type_t * badreg) |
1584 | { |
1569 | { |
1585 | /* Descriptor for regions under construction in Step 2. */ |
1570 | /* Descriptor for regions under construction in Step 2. */ |
1586 | typedef struct |
1571 | typedef struct |
1587 | { |
1572 | { |
Line 1603... | Line 1588... | ||
1603 | box_type_t *box; /* Current box in rects */ |
1588 | box_type_t *box; /* Current box in rects */ |
1604 | box_type_t *ri_box; /* Last box in ri[j].reg */ |
1589 | box_type_t *ri_box; /* Last box in ri[j].reg */ |
1605 | region_type_t *hreg; /* ri[j_half].reg */ |
1590 | region_type_t *hreg; /* ri[j_half].reg */ |
1606 | pixman_bool_t ret = TRUE; |
1591 | pixman_bool_t ret = TRUE; |
Line 1607... | Line -... | ||
1607 | - | ||
1608 | *overlap = FALSE; |
1592 | |
1609 | if (!badreg->data) |
1593 | if (!badreg->data) |
1610 | { |
1594 | { |
1611 | GOOD (badreg); |
1595 | GOOD (badreg); |
1612 | return TRUE; |
1596 | return TRUE; |
Line 1677... | Line 1661... | ||
1677 | { |
1661 | { |
1678 | /* box is in same band as ri_box. Merge or append it */ |
1662 | /* box is in same band as ri_box. Merge or append it */ |
1679 | if (box->x1 <= ri_box->x2) |
1663 | if (box->x1 <= ri_box->x2) |
1680 | { |
1664 | { |
1681 | /* Merge it with ri_box */ |
1665 | /* Merge it with ri_box */ |
1682 | if (box->x1 < ri_box->x2) |
- | |
1683 | *overlap = TRUE; |
- | |
1684 | - | ||
1685 | if (box->x2 > ri_box->x2) |
1666 | if (box->x2 > ri_box->x2) |
1686 | ri_box->x2 = box->x2; |
1667 | ri_box->x2 = box->x2; |
1687 | } |
1668 | } |
1688 | else |
1669 | else |
1689 | { |
1670 | { |
Line 1783... | Line 1764... | ||
1783 | for (j = num_ri & 1; j < (half + (num_ri & 1)); j++) |
1764 | for (j = num_ri & 1; j < (half + (num_ri & 1)); j++) |
1784 | { |
1765 | { |
1785 | reg = &ri[j].reg; |
1766 | reg = &ri[j].reg; |
1786 | hreg = &ri[j + half].reg; |
1767 | hreg = &ri[j + half].reg; |
Line 1787... | Line 1768... | ||
1787 | 1768 | ||
1788 | if (!pixman_op (reg, reg, hreg, pixman_region_union_o, TRUE, TRUE, overlap)) |
1769 | if (!pixman_op (reg, reg, hreg, pixman_region_union_o, TRUE, TRUE)) |
Line 1789... | Line 1770... | ||
1789 | ret = FALSE; |
1770 | ret = FALSE; |
1790 | 1771 | ||
Line 1851... | Line 1832... | ||
1851 | box_type_t * r1, |
1832 | box_type_t * r1, |
1852 | box_type_t * r1_end, |
1833 | box_type_t * r1_end, |
1853 | box_type_t * r2, |
1834 | box_type_t * r2, |
1854 | box_type_t * r2_end, |
1835 | box_type_t * r2_end, |
1855 | int y1, |
1836 | int y1, |
1856 | int y2, |
1837 | int y2) |
1857 | int * overlap) |
- | |
1858 | { |
1838 | { |
1859 | box_type_t * next_rect; |
1839 | box_type_t * next_rect; |
1860 | int x1; |
1840 | int x1; |
Line 1861... | Line 1841... | ||
1861 | 1841 | ||
Line 1876... | Line 1856... | ||
1876 | r2++; |
1856 | r2++; |
1877 | } |
1857 | } |
1878 | else if (r2->x1 <= x1) |
1858 | else if (r2->x1 <= x1) |
1879 | { |
1859 | { |
1880 | /* |
1860 | /* |
1881 | * Subtrahend preceeds minuend: nuke left edge of minuend. |
1861 | * Subtrahend precedes minuend: nuke left edge of minuend. |
1882 | */ |
1862 | */ |
1883 | x1 = r2->x2; |
1863 | x1 = r2->x2; |
1884 | if (x1 >= r1->x2) |
1864 | if (x1 >= r1->x2) |
1885 | { |
1865 | { |
1886 | /* |
1866 | /* |
Line 1976... | Line 1956... | ||
1976 | PIXMAN_EXPORT pixman_bool_t |
1956 | PIXMAN_EXPORT pixman_bool_t |
1977 | PREFIX (_subtract) (region_type_t *reg_d, |
1957 | PREFIX (_subtract) (region_type_t *reg_d, |
1978 | region_type_t *reg_m, |
1958 | region_type_t *reg_m, |
1979 | region_type_t *reg_s) |
1959 | region_type_t *reg_s) |
1980 | { |
1960 | { |
1981 | int overlap; /* result ignored */ |
- | |
1982 | - | ||
1983 | GOOD (reg_m); |
1961 | GOOD (reg_m); |
1984 | GOOD (reg_s); |
1962 | GOOD (reg_s); |
1985 | GOOD (reg_d); |
1963 | GOOD (reg_d); |
Line 1986... | Line 1964... | ||
1986 | 1964 | ||
Line 2002... | Line 1980... | ||
2002 | 1980 | ||
2003 | return TRUE; |
1981 | return TRUE; |
Line 2004... | Line 1982... | ||
2004 | } |
1982 | } |
2005 | 1983 | ||
2006 | /* Add those rectangles in region 1 that aren't in region 2, |
1984 | /* Add those rectangles in region 1 that aren't in region 2, |
2007 | do yucky substraction for overlaps, and |
1985 | do yucky subtraction for overlaps, and |
2008 | just throw away rectangles in region 2 that aren't in region 1 */ |
1986 | just throw away rectangles in region 2 that aren't in region 1 */ |
Line 2009... | Line 1987... | ||
2009 | if (!pixman_op (reg_d, reg_m, reg_s, pixman_region_subtract_o, TRUE, FALSE, &overlap)) |
1987 | if (!pixman_op (reg_d, reg_m, reg_s, pixman_region_subtract_o, TRUE, FALSE)) |
2010 | return FALSE; |
1988 | return FALSE; |
2011 | 1989 | ||
Line 2038... | Line 2016... | ||
2038 | * Side Effects: |
2016 | * Side Effects: |
2039 | * new_reg is overwritten. |
2017 | * new_reg is overwritten. |
2040 | * |
2018 | * |
2041 | *----------------------------------------------------------------------- |
2019 | *----------------------------------------------------------------------- |
2042 | */ |
2020 | */ |
2043 | pixman_bool_t |
2021 | PIXMAN_EXPORT pixman_bool_t |
2044 | PIXMAN_EXPORT PREFIX (_inverse) (region_type_t *new_reg, /* Destination region */ |
2022 | PREFIX (_inverse) (region_type_t *new_reg, /* Destination region */ |
2045 | region_type_t *reg1, /* Region to invert */ |
2023 | region_type_t *reg1, /* Region to invert */ |
2046 | box_type_t * inv_rect) /* Bounding box for inversion */ |
2024 | box_type_t * inv_rect) /* Bounding box for inversion */ |
2047 | { |
2025 | { |
2048 | region_type_t inv_reg; /* Quick and dirty region made from the |
2026 | region_type_t inv_reg; /* Quick and dirty region made from the |
2049 | * bounding box */ |
2027 | * bounding box */ |
2050 | int overlap; /* result ignored */ |
- | |
2051 | - | ||
2052 | GOOD (reg1); |
2028 | GOOD (reg1); |
2053 | GOOD (new_reg); |
2029 | GOOD (new_reg); |
Line 2054... | Line 2030... | ||
2054 | 2030 | ||
2055 | /* check for trivial rejects */ |
2031 | /* check for trivial rejects */ |
Line 2064... | Line 2040... | ||
2064 | 2040 | ||
2065 | return TRUE; |
2041 | return TRUE; |
Line 2066... | Line 2042... | ||
2066 | } |
2042 | } |
2067 | 2043 | ||
2068 | /* Add those rectangles in region 1 that aren't in region 2, |
2044 | /* Add those rectangles in region 1 that aren't in region 2, |
2069 | * do yucky substraction for overlaps, and |
2045 | * do yucky subtraction for overlaps, and |
2070 | * just throw away rectangles in region 2 that aren't in region 1 |
2046 | * just throw away rectangles in region 2 that aren't in region 1 |
2071 | */ |
2047 | */ |
2072 | inv_reg.extents = *inv_rect; |
2048 | inv_reg.extents = *inv_rect; |
2073 | inv_reg.data = (region_data_type_t *)NULL; |
2049 | inv_reg.data = (region_data_type_t *)NULL; |
Line 2074... | Line 2050... | ||
2074 | if (!pixman_op (new_reg, &inv_reg, reg1, pixman_region_subtract_o, TRUE, FALSE, &overlap)) |
2050 | if (!pixman_op (new_reg, &inv_reg, reg1, pixman_region_subtract_o, TRUE, FALSE)) |
2075 | return FALSE; |
2051 | return FALSE; |
2076 | 2052 | ||
Line 2084... | Line 2060... | ||
2084 | pixman_set_extents (new_reg); |
2060 | pixman_set_extents (new_reg); |
2085 | GOOD (new_reg); |
2061 | GOOD (new_reg); |
2086 | return TRUE; |
2062 | return TRUE; |
2087 | } |
2063 | } |
Line -... | Line 2064... | ||
- | 2064 | ||
- | 2065 | /* In time O(log n), locate the first box whose y2 is greater than y. |
|
- | 2066 | * Return @end if no such box exists. |
|
- | 2067 | */ |
|
- | 2068 | static box_type_t * |
|
- | 2069 | find_box_for_y (box_type_t *begin, box_type_t *end, int y) |
|
- | 2070 | { |
|
- | 2071 | box_type_t *mid; |
|
- | 2072 | ||
- | 2073 | if (end == begin) |
|
- | 2074 | return end; |
|
- | 2075 | ||
- | 2076 | if (end - begin == 1) |
|
- | 2077 | { |
|
- | 2078 | if (begin->y2 > y) |
|
- | 2079 | return begin; |
|
- | 2080 | else |
|
- | 2081 | return end; |
|
- | 2082 | } |
|
- | 2083 | ||
- | 2084 | mid = begin + (end - begin) / 2; |
|
- | 2085 | if (mid->y2 > y) |
|
- | 2086 | { |
|
- | 2087 | /* If no box is found in [begin, mid], the function |
|
- | 2088 | * will return @mid, which is then known to be the |
|
- | 2089 | * correct answer. |
|
- | 2090 | */ |
|
- | 2091 | return find_box_for_y (begin, mid, y); |
|
- | 2092 | } |
|
- | 2093 | else |
|
- | 2094 | { |
|
- | 2095 | return find_box_for_y (mid, end, y); |
|
- | 2096 | } |
|
- | 2097 | } |
|
2088 | 2098 | ||
2089 | /* |
2099 | /* |
2090 | * rect_in(region, rect) |
2100 | * rect_in(region, rect) |
2091 | * This routine takes a pointer to a region and a pointer to a box |
2101 | * This routine takes a pointer to a region and a pointer to a box |
2092 | * and determines if the box is outside/inside/partly inside the region. |
2102 | * and determines if the box is outside/inside/partly inside the region. |
Line 2100... | Line 2110... | ||
2100 | * box has been partially covered (part_in == part_out == TRUE -- because of |
2110 | * box has been partially covered (part_in == part_out == TRUE -- because of |
2101 | * the banding, the first time this is true we know the box is only |
2111 | * the banding, the first time this is true we know the box is only |
2102 | * partially in the region) or is outside the region (we reached a band |
2112 | * partially in the region) or is outside the region (we reached a band |
2103 | * that doesn't overlap the box at all and part_in is false) |
2113 | * that doesn't overlap the box at all and part_in is false) |
2104 | */ |
2114 | */ |
2105 | - | ||
2106 | pixman_region_overlap_t |
2115 | PIXMAN_EXPORT pixman_region_overlap_t |
2107 | PIXMAN_EXPORT PREFIX (_contains_rectangle) (region_type_t * region, |
2116 | PREFIX (_contains_rectangle) (region_type_t * region, |
2108 | box_type_t * prect) |
2117 | box_type_t * prect) |
2109 | { |
2118 | { |
2110 | box_type_t * pbox; |
2119 | box_type_t * pbox; |
2111 | box_type_t * pbox_end; |
2120 | box_type_t * pbox_end; |
2112 | int part_in, part_out; |
2121 | int part_in, part_out; |
Line 2140... | Line 2149... | ||
2140 | /* can stop when both part_out and part_in are TRUE, or we reach prect->y2 */ |
2149 | /* can stop when both part_out and part_in are TRUE, or we reach prect->y2 */ |
2141 | for (pbox = PIXREGION_BOXPTR (region), pbox_end = pbox + numRects; |
2150 | for (pbox = PIXREGION_BOXPTR (region), pbox_end = pbox + numRects; |
2142 | pbox != pbox_end; |
2151 | pbox != pbox_end; |
2143 | pbox++) |
2152 | pbox++) |
2144 | { |
2153 | { |
2145 | - | ||
- | 2154 | /* getting up to speed or skipping remainder of band */ |
|
2146 | if (pbox->y2 <= y) |
2155 | if (pbox->y2 <= y) |
- | 2156 | { |
|
2147 | continue; /* getting up to speed or skipping remainder of band */ |
2157 | if ((pbox = find_box_for_y (pbox, pbox_end, y)) == pbox_end) |
- | 2158 | break; |
|
- | 2159 | } |
|
Line 2148... | Line 2160... | ||
2148 | 2160 | ||
2149 | if (pbox->y1 > y) |
2161 | if (pbox->y1 > y) |
2150 | { |
2162 | { |
2151 | part_out = TRUE; /* missed part of rectangle above */ |
2163 | part_out = TRUE; /* missed part of rectangle above */ |
Line 2317... | Line 2329... | ||
2317 | FREE_DATA (region); |
2329 | FREE_DATA (region); |
Line 2318... | Line 2330... | ||
2318 | 2330 | ||
2319 | region->data = NULL; |
2331 | region->data = NULL; |
Line -... | Line 2332... | ||
- | 2332 | } |
|
- | 2333 | ||
- | 2334 | PIXMAN_EXPORT void |
|
- | 2335 | PREFIX (_clear) (region_type_t *region) |
|
- | 2336 | { |
|
- | 2337 | GOOD (region); |
|
- | 2338 | FREE_DATA (region); |
|
- | 2339 | ||
- | 2340 | region->extents = *pixman_region_empty_box; |
|
- | 2341 | region->data = pixman_region_empty_data; |
|
2320 | } |
2342 | } |
2321 | 2343 | ||
2322 | /* box is "return" value */ |
2344 | /* box is "return" value */ |
2323 | PIXMAN_EXPORT int |
2345 | PIXMAN_EXPORT int |
2324 | PREFIX (_contains_point) (region_type_t * region, |
2346 | PREFIX (_contains_point) (region_type_t * region, |
Line 2340... | Line 2362... | ||
2340 | *box = region->extents; |
2362 | *box = region->extents; |
Line 2341... | Line 2363... | ||
2341 | 2363 | ||
2342 | return(TRUE); |
2364 | return(TRUE); |
Line 2343... | Line 2365... | ||
2343 | } |
2365 | } |
2344 | 2366 | ||
2345 | for (pbox = PIXREGION_BOXPTR (region), pbox_end = pbox + numRects; |
- | |
2346 | pbox != pbox_end; |
- | |
2347 | pbox++) |
- | |
2348 | { |
- | |
Line -... | Line 2367... | ||
- | 2367 | pbox = PIXREGION_BOXPTR (region); |
|
- | 2368 | pbox_end = pbox + numRects; |
|
- | 2369 | ||
- | 2370 | pbox = find_box_for_y (pbox, pbox_end, y); |
|
2349 | if (y >= pbox->y2) |
2371 | |
2350 | continue; /* not there yet */ |
2372 | for (;pbox != pbox_end; pbox++) |
Line 2351... | Line 2373... | ||
2351 | 2373 | { |
|
2352 | if ((y < pbox->y1) || (x < pbox->x1)) |
2374 | if ((y < pbox->y1) || (x < pbox->x1)) |
Line 2526... | Line 2548... | ||
2526 | } |
2548 | } |
Line 2527... | Line 2549... | ||
2527 | 2549 | ||
2528 | /* Validate */ |
2550 | /* Validate */ |
Line 2529... | Line 2551... | ||
2529 | region->extents.x1 = region->extents.x2 = 0; |
2551 | region->extents.x1 = region->extents.x2 = 0; |
2530 | 2552 | ||
Line 2531... | Line 2553... | ||
2531 | return validate (region, &i); |
2553 | return validate (region); |
Line 2532... | Line 2554... | ||
2532 | } |
2554 | } |
Line 2543... | Line 2565... | ||
2543 | if ((rx1 < rx2) && (ry1 < ry2) && |
2565 | if ((rx1 < rx2) && (ry1 < ry2) && |
2544 | (!(reg->data->numRects && |
2566 | (!(reg->data->numRects && |
2545 | ((r-1)->y1 == ry1) && ((r-1)->y2 == ry2) && |
2567 | ((r-1)->y1 == ry1) && ((r-1)->y2 == ry2) && |
2546 | ((r-1)->x1 <= rx1) && ((r-1)->x2 >= rx2)))) |
2568 | ((r-1)->x1 <= rx1) && ((r-1)->x2 >= rx2)))) |
2547 | { |
2569 | { |
2548 | if (!reg->data || |
- | |
2549 | reg->data->numRects == reg->data->size) |
2570 | if (reg->data->numRects == reg->data->size) |
2550 | { |
2571 | { |
2551 | if (!pixman_rect_alloc (reg, 1)) |
2572 | if (!pixman_rect_alloc (reg, 1)) |
2552 | return NULL; |
2573 | return NULL; |
2553 | *first_rect = PIXREGION_BOXPTR(reg); |
2574 | *first_rect = PIXREGION_BOXPTR(reg); |
2554 | r = *first_rect + reg->data->numRects; |
2575 | r = *first_rect + reg->data->numRects; |
Line 2588... | Line 2609... | ||
2588 | pixman_bool_t in_box, same; |
2609 | pixman_bool_t in_box, same; |
2589 | int width, height, stride; |
2610 | int width, height, stride; |
Line 2590... | Line 2611... | ||
2590 | 2611 | ||
Line -... | Line 2612... | ||
- | 2612 | PREFIX(_init) (region); |
|
- | 2613 | ||
2591 | PREFIX(_init) (region); |
2614 | critical_if_fail (region->data); |
2592 | 2615 | ||
Line 2593... | Line 2616... | ||
2593 | return_if_fail (image->type == BITS); |
2616 | return_if_fail (image->type == BITS); |
2594 | return_if_fail (image->bits.format == PIXMAN_a1); |
2617 | return_if_fail (image->bits.format == PIXMAN_a1); |