| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -128,6 +128,7 @@ point_in_path_impl(const void* const points_, const size_t s0, | |||
| 128 | 128 | npy_bool* const inside_flag) | |
| 129 | 129 | { | |
| 130 | 130 | int *yflag0; | |
| 131 | + int *subpath_flag; | ||
| 131 | 132 | int yflag1; | |
| 132 | 133 | double vtx0, vty0, vtx1, vty1; | |
| 133 | 134 | double tx, ty; | |
@@ -138,6 +139,7 @@ point_in_path_impl(const void* const points_, const size_t s0, | |||
| 138 | 139 | const char *const points = (const char * const)points_; | |
| 139 | 140 | ||
| 140 | 141 | yflag0 = (int *)malloc(n * sizeof(int)); | |
| 142 | + subpath_flag = (int *)malloc(n * sizeof(int)); | ||
| 141 | 143 | ||
| 142 | 144 | path.rewind(0); | |
| 143 | 145 | ||
@@ -151,6 +153,10 @@ point_in_path_impl(const void* const points_, const size_t s0, | |||
| 151 | 153 | if (code != agg::path_cmd_move_to) | |
| 152 | 154 | { | |
| 153 | 155 | code = path.vertex(&x, &y); | |
| 156 | + if (code == agg::path_cmd_stop || | ||
| 157 | + (code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) { | ||
| 158 | + continue; | ||
| 159 | + } | ||
| 154 | 160 | } | |
| 155 | 161 | ||
| 156 | 162 | sx = vtx0 = vtx1 = x; | |
@@ -162,7 +168,7 @@ point_in_path_impl(const void* const points_, const size_t s0, | |||
| 162 | 168 | // get test bit for above/below X axis | |
| 163 | 169 | yflag0[i] = (vty0 >= ty); | |
| 164 | 170 | ||
| 165 | - inside_flag[i] = 0; | ||
| 171 | + subpath_flag[i] = 0; | ||
| 166 | 172 | } | |
| 167 | 173 | ||
| 168 | 174 | do | |
@@ -208,7 +214,7 @@ point_in_path_impl(const void* const points_, const size_t s0, | |||
| 208 | 214 | // tests. | |
| 209 | 215 | if (((vty1 - ty) * (vtx0 - vtx1) >= | |
| 210 | 216 | (vtx1 - tx) * (vty0 - vty1)) == yflag1) { | |
| 211 | - inside_flag[i] ^= 1; | ||
| 217 | + subpath_flag[i] ^= 1; | ||
| 212 | 218 | } | |
| 213 | 219 | } | |
| 214 | 220 | ||
@@ -235,10 +241,10 @@ point_in_path_impl(const void* const points_, const size_t s0, | |||
| 235 | 241 | if (yflag0[i] != yflag1) { | |
| 236 | 242 | if (((vty1 - ty) * (vtx0 - vtx1) >= | |
| 237 | 243 | (vtx1 - tx) * (vty0 - vty1)) == yflag1) { | |
| 238 | - inside_flag[i] ^= 1; | ||
| 244 | + subpath_flag[i] ^= 1; | ||
| 239 | 245 | } | |
| 240 | 246 | } | |
| 241 | - | ||
| 247 | + inside_flag[i] |= subpath_flag[i]; | ||
| 242 | 248 | if (inside_flag[i] == 0) { | |
| 243 | 249 | all_done = 0; | |
| 244 | 250 | } | |
@@ -253,6 +259,7 @@ point_in_path_impl(const void* const points_, const size_t s0, | |||
| 253 | 259 | exit: | |
| 254 | 260 | ||
| 255 | 261 | free(yflag0); | |
| 262 | + free(subpath_flag); | ||
| 256 | 263 | } | |
| 257 | 264 | ||
| 258 | 265 | inline void | |
| Back | FazBrowse Home | New Git URL |
0 commit comments