| 1 |
|
| /* ---------------------------------------------------------------------------- |
| 2 |
|
| * This file was automatically generated by SWIG (http://www.swig.org). |
| 3 |
|
| * Version 1.3.14u-20020903-0949 |
| 4 |
|
| * |
| 5 |
|
| * This file is not intended to be easily readable and contains a number of |
| 6 |
|
| * coding conventions designed to improve portability and efficiency. Do not make |
| 7 |
|
| * changes to this file unless you know what you are doing--modify the SWIG |
| 8 |
|
| * interface file instead. |
| 9 |
|
| * ----------------------------------------------------------------------------- */ |
| 10 |
|
| |
| 11 |
|
| /*********************************************************************** |
| 12 |
|
| * common.swg |
| 13 |
|
| * |
| 14 |
|
| * This file contains generic SWIG runtime support for pointer |
| 15 |
|
| * type checking as well as a few commonly used macros to control |
| 16 |
|
| * external linkage. |
| 17 |
|
| * |
| 18 |
|
| * Author : David Beazley (beazley@cs.uchicago.edu) |
| 19 |
|
| * |
| 20 |
|
| * Copyright (c) 1999-2000, The University of Chicago |
| 21 |
|
| * |
| 22 |
|
| * This file may be freely redistributed without license or fee provided |
| 23 |
|
| * this copyright message remains intact. |
| 24 |
|
| ************************************************************************/ |
| 25 |
|
| |
| 26 |
|
| #include <string.h> |
| 27 |
|
| |
| 28 |
|
| #if defined(_WIN32) || defined(__WIN32__) |
| 29 |
|
| # if defined(_MSC_VER) |
| 30 |
|
| # if defined(STATIC_LINKED) |
| 31 |
|
| # define SWIGEXPORT(a) a |
| 32 |
|
| # define SWIGIMPORT(a) extern a |
| 33 |
|
| # else |
| 34 |
|
| # define SWIGEXPORT(a) __declspec(dllexport) a |
| 35 |
|
| # define SWIGIMPORT(a) extern a |
| 36 |
|
| # endif |
| 37 |
|
| # else |
| 38 |
|
| # if defined(__BORLANDC__) |
| 39 |
|
| # define SWIGEXPORT(a) a _export |
| 40 |
|
| # define SWIGIMPORT(a) a _export |
| 41 |
|
| # else |
| 42 |
|
| # define SWIGEXPORT(a) a |
| 43 |
|
| # define SWIGIMPORT(a) a |
| 44 |
|
| # endif |
| 45 |
|
| # endif |
| 46 |
|
| #else |
| 47 |
|
| # define SWIGEXPORT(a) a |
| 48 |
|
| # define SWIGIMPORT(a) a |
| 49 |
|
| #endif |
| 50 |
|
| |
| 51 |
|
| #ifdef SWIG_GLOBAL |
| 52 |
|
| #define SWIGRUNTIME(a) SWIGEXPORT(a) |
| 53 |
|
| #else |
| 54 |
|
| #define SWIGRUNTIME(a) static a |
| 55 |
|
| #endif |
| 56 |
|
| |
| 57 |
|
| #ifdef __cplusplus |
| 58 |
|
| extern "C" { |
| 59 |
|
| #endif |
| 60 |
|
| |
| 61 |
|
| typedef void *(*swig_converter_func)(void *); |
| 62 |
|
| typedef struct swig_type_info *(*swig_dycast_func)(void **); |
| 63 |
|
| |
| 64 |
|
| typedef struct swig_type_info { |
| 65 |
|
| const char *name; |
| 66 |
|
| swig_converter_func converter; |
| 67 |
|
| const char *str; |
| 68 |
|
| void *clientdata; |
| 69 |
|
| swig_dycast_func dcast; |
| 70 |
|
| struct swig_type_info *next; |
| 71 |
|
| struct swig_type_info *prev; |
| 72 |
|
| } swig_type_info; |
| 73 |
|
| |
| 74 |
|
| #ifdef SWIG_NOINCLUDE |
| 75 |
|
| |
| 76 |
|
| SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *); |
| 77 |
|
| SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *); |
| 78 |
|
| SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *); |
| 79 |
|
| SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **); |
| 80 |
|
| SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *); |
| 81 |
|
| SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *); |
| 82 |
|
| |
| 83 |
|
| #else |
| 84 |
|
| |
| 85 |
|
| static swig_type_info *swig_type_list = 0; |
| 86 |
|
| |
| 87 |
|
| /* Register a type mapping with the type-checking */ |
| 88 |
|
| SWIGRUNTIME(swig_type_info *) |
| 89 |
6 |
| SWIG_TypeRegister(swig_type_info *ti) |
| 90 |
|
| { |
| 91 |
|
| swig_type_info *tc, *head, *ret, *next; |
| 92 |
|
| /* Check to see if this type has already been registered */ |
| 93 |
6 |
| tc = swig_type_list; |
| 94 |
21 |
▶ | while (tc) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (tc) { |
15 |
6 |
21 |
|
| 95 |
15 |
▶ | if (strcmp(tc->name, ti->name) == 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (strcmp(tc->name, ti->name) == 0) { |
0 |
15 |
15 |
|
| 96 |
|
| /* Already exists in the table. Just add additional types to the list */ |
| 97 |
0 |
▶ | if (tc->clientdata) ti->clientdata = tc->clientdata; |
Branch: 1 branch
| Branch | True | False | Total |
| if (tc->clientdata) ti->clientdata = tc->clientdata; |
0 |
0 |
0 |
|
| 98 |
0 |
| head = tc; |
| 99 |
0 |
| next = tc->next; |
| 100 |
0 |
| goto l1; |
| 101 |
|
| } |
| 102 |
15 |
| tc = tc->prev; |
| 103 |
|
| } |
| 104 |
6 |
| head = ti; |
| 105 |
6 |
| next = 0; |
| 106 |
|
| |
| 107 |
|
| /* Place in list */ |
| 108 |
6 |
| ti->prev = swig_type_list; |
| 109 |
6 |
| swig_type_list = ti; |
| 110 |
|
| |
| 111 |
|
| /* Build linked lists */ |
| 112 |
6 |
| l1: |
| 113 |
6 |
| ret = head; |
| 114 |
6 |
| tc = ti + 1; |
| 115 |
|
| /* Patch up the rest of the links */ |
| 116 |
12 |
▶ | while (tc->name) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (tc->name) { |
6 |
6 |
12 |
|
| 117 |
6 |
| head->next = tc; |
| 118 |
6 |
| tc->prev = head; |
| 119 |
6 |
| head = tc; |
| 120 |
6 |
| tc++; |
| 121 |
|
| } |
| 122 |
6 |
| head->next = next; |
| 123 |
6 |
| return ret; |
| 124 |
|
| } |
| 125 |
|
| |
| 126 |
|
| /* Check the typename */ |
| 127 |
|
| SWIGRUNTIME(swig_type_info *) |
| 128 |
97 |
| SWIG_TypeCheck(char *c, swig_type_info *ty) |
| 129 |
|
| { |
| 130 |
|
| swig_type_info *s; |
| 131 |
97 |
▶ | if (!ty) return 0; /* Void pointer */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (!ty) return 0; /* Void pointer */ |
0 |
97 |
97 |
|
| 132 |
97 |
| s = ty->next; /* First element always just a name */ |
| 133 |
|
| do { |
| 134 |
97 |
▶ | if (strcmp(s->name,c) == 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (strcmp(s->name,c) == 0) { |
97 |
0 |
97 |
|
| 135 |
97 |
▶ | if (s == ty->next) return s; |
Branch: 1 branch
| Branch | True | False | Total |
| if (s == ty->next) return s; |
97 |
0 |
97 |
|
| 136 |
|
| /* Move s to the top of the linked list */ |
| 137 |
0 |
| s->prev->next = s->next; |
| 138 |
0 |
▶ | if (s->next) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (s->next) { |
0 |
0 |
0 |
|
| 139 |
0 |
| s->next->prev = s->prev; |
| 140 |
|
| } |
| 141 |
|
| /* Insert s as second element in the list */ |
| 142 |
0 |
| s->next = ty->next; |
| 143 |
0 |
▶ | if (ty->next) ty->next->prev = s; |
Branch: 1 branch
| Branch | True | False | Total |
| if (ty->next) ty->next->prev = s; |
0 |
0 |
0 |
|
| 144 |
0 |
| ty->next = s; |
| 145 |
0 |
| return s; |
| 146 |
|
| } |
| 147 |
0 |
| s = s->next; |
| 148 |
0 |
▶ | } while (s && (s != ty->next)); |
Branch: 2 branches
| Branch | True | False | Total |
| } while (s && (s != ty->next)); |
0 |
0 |
0 |
| } while (s && (s != ty->next)); |
0 |
0 |
0 |
|
| 149 |
0 |
| return 0; |
| 150 |
|
| } |
| 151 |
|
| |
| 152 |
|
| /* Cast a pointer up an inheritance hierarchy */ |
| 153 |
|
| SWIGRUNTIME(void *) |
| 154 |
97 |
| SWIG_TypeCast(swig_type_info *ty, void *ptr) |
| 155 |
|
| { |
| 156 |
97 |
▶ | if ((!ty) || (!ty->converter)) return ptr; |
Branch: 2 branches
| Branch | True | False | Total |
| if ((!ty) || (!ty->converter)) return ptr; |
97 |
0 |
97 |
| if ((!ty) || (!ty->converter)) return ptr; |
97 |
0 |
97 |
|
| 157 |
0 |
| return (*ty->converter)(ptr); |
| 158 |
|
| } |
| 159 |
|
| |
| 160 |
|
| /* Dynamic pointer casting. Down an inheritance hierarchy */ |
| 161 |
|
| SWIGRUNTIME(swig_type_info *) |
| 162 |
0 |
| SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) |
| 163 |
|
| { |
| 164 |
0 |
| swig_type_info *lastty = ty; |
| 165 |
0 |
▶ | if (!ty || !ty->dcast) return ty; |
Branch: 2 branches
| Branch | True | False | Total |
| if (!ty || !ty->dcast) return ty; |
0 |
0 |
0 |
| if (!ty || !ty->dcast) return ty; |
0 |
0 |
0 |
|
| 166 |
0 |
▶ | while (ty && (ty->dcast)) { |
Branch: 2 branches
| Branch | True | False | Total |
| while (ty && (ty->dcast)) { |
0 |
0 |
0 |
| while (ty && (ty->dcast)) { |
0 |
0 |
0 |
|
| 167 |
0 |
| ty = (*ty->dcast)(ptr); |
| 168 |
0 |
▶ | if (ty) lastty = ty; |
Branch: 1 branch
| Branch | True | False | Total |
| if (ty) lastty = ty; |
0 |
0 |
0 |
|
| 169 |
|
| } |
| 170 |
0 |
| return lastty; |
| 171 |
|
| } |
| 172 |
|
| |
| 173 |
|
| /* Search for a swig_type_info structure */ |
| 174 |
|
| SWIGRUNTIME(swig_type_info *) |
| 175 |
0 |
| SWIG_TypeQuery(const char *name) { |
| 176 |
0 |
| swig_type_info *ty = swig_type_list; |
| 177 |
0 |
▶ | while (ty) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (ty) { |
0 |
0 |
0 |
|
| 178 |
0 |
▶ | if (ty->str && (strcmp(name,ty->str) == 0)) return ty; |
Branch: 2 branches
| Branch | True | False | Total |
| if (ty->str && (strcmp(name,ty->str) == 0)) return ty; |
0 |
0 |
0 |
| if (ty->str && (strcmp(name,ty->str) == 0)) return ty; |
0 |
0 |
0 |
|
| 179 |
0 |
▶ | if (ty->name && (strcmp(name,ty->name) == 0)) return ty; |
Branch: 2 branches
| Branch | True | False | Total |
| if (ty->name && (strcmp(name,ty->name) == 0)) return ty; |
0 |
0 |
0 |
| if (ty->name && (strcmp(name,ty->name) == 0)) return ty; |
0 |
0 |
0 |
|
| 180 |
0 |
| ty = ty->prev; |
| 181 |
|
| } |
| 182 |
0 |
| return 0; |
| 183 |
|
| } |
| 184 |
|
| |
| 185 |
|
| /* Set the clientdata field for a type */ |
| 186 |
|
| SWIGRUNTIME(void) |
| 187 |
0 |
| SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { |
| 188 |
|
| swig_type_info *tc, *equiv; |
| 189 |
0 |
▶ | if (ti->clientdata) return; |
Branch: 1 branch
| Branch | True | False | Total |
| if (ti->clientdata) return; |
0 |
0 |
0 |
|
| 190 |
0 |
| ti->clientdata = clientdata; |
| 191 |
0 |
| equiv = ti->next; |
| 192 |
0 |
▶ | while (equiv) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (equiv) { |
0 |
0 |
0 |
|
| 193 |
0 |
▶ | if (!equiv->converter) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!equiv->converter) { |
0 |
0 |
0 |
|
| 194 |
0 |
| tc = swig_type_list; |
| 195 |
0 |
▶ | while (tc) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (tc) { |
0 |
0 |
0 |
|
| 196 |
0 |
▶ | if ((strcmp(tc->name, equiv->name) == 0)) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((strcmp(tc->name, equiv->name) == 0)) |
0 |
0 |
0 |
|
| 197 |
0 |
| SWIG_TypeClientData(tc,clientdata); |
| 198 |
0 |
| tc = tc->prev; |
| 199 |
|
| } |
| 200 |
|
| } |
| 201 |
0 |
| equiv = equiv->next; |
| 202 |
|
| } |
| 203 |
|
| } |
| 204 |
|
| #endif |
| 205 |
|
| |
| 206 |
|
| #ifdef __cplusplus |
| 207 |
|
| } |
| 208 |
|
| |
| 209 |
|
| #endif |
| 210 |
|
| |
| 211 |
|
| /* ----------------------------------------------------------------------------- |
| 212 |
|
| * perl5.swg |
| 213 |
|
| * |
| 214 |
|
| * Perl5 runtime library |
| 215 |
|
| * $Header: /cvs/projects/SWIG/Lib/perl5/Attic/perlrun.swg,v 1.1.2.8 2002/07/05 03:50:31 beazley Exp $ |
| 216 |
|
| * ----------------------------------------------------------------------------- */ |
| 217 |
|
| |
| 218 |
|
| #define SWIGPERL |
| 219 |
|
| #define SWIGPERL5 |
| 220 |
|
| #ifdef __cplusplus |
| 221 |
|
| /* Needed on some windows machines---since MS plays funny |
| 222 |
|
| games with the header files under C++ */ |
| 223 |
|
| #include <math.h> |
| 224 |
|
| #include <stdlib.h> |
| 225 |
|
| extern "C" { |
| 226 |
|
| #endif |
| 227 |
|
| #include "EXTERN.h" |
| 228 |
|
| #include "perl.h" |
| 229 |
|
| #include "XSUB.h" |
| 230 |
|
| |
| 231 |
|
| /* Get rid of free and malloc defined by perl */ |
| 232 |
|
| #undef free |
| 233 |
|
| #undef malloc |
| 234 |
|
| |
| 235 |
|
| #ifndef pTHX_ |
| 236 |
|
| #define pTHX_ |
| 237 |
|
| #endif |
| 238 |
|
| |
| 239 |
|
| #include <string.h> |
| 240 |
|
| #ifdef __cplusplus |
| 241 |
|
| } |
| 242 |
|
| #endif |
| 243 |
|
| |
| 244 |
|
| /* Macro to call an XS function */ |
| 245 |
|
| #ifdef PERL_OBJECT |
| 246 |
|
| #define SWIG_CALLXS(_name) _name(cv,pPerl) |
| 247 |
|
| #else |
| 248 |
|
| #define SWIG_CALLXS(_name) _name(cv) |
| 249 |
|
| #endif |
| 250 |
|
| |
| 251 |
|
| |
| 252 |
|
| /* Note: SwigMagicFuncHack is a typedef used to get the C++ |
| 253 |
|
| compiler to just shut up already */ |
| 254 |
|
| |
| 255 |
|
| #ifdef PERL_OBJECT |
| 256 |
|
| #define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; |
| 257 |
|
| typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); |
| 258 |
|
| |
| 259 |
|
| #ifdef __cplusplus |
| 260 |
|
| extern "C" { |
| 261 |
|
| #endif |
| 262 |
|
| typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *); |
| 263 |
|
| #ifdef __cplusplus |
| 264 |
|
| } |
| 265 |
|
| #endif |
| 266 |
|
| |
| 267 |
|
| #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) |
| 268 |
|
| #define SWIGCLASS_STATIC |
| 269 |
|
| #else |
| 270 |
|
| #define MAGIC_PPERL |
| 271 |
|
| #define SWIGCLASS_STATIC static |
| 272 |
|
| #ifndef MULTIPLICITY |
| 273 |
|
| #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) |
| 274 |
|
| typedef int (*SwigMagicFunc)(SV *, MAGIC *); |
| 275 |
|
| |
| 276 |
|
| #ifdef __cplusplus |
| 277 |
|
| extern "C" { |
| 278 |
|
| #endif |
| 279 |
|
| typedef int (*SwigMagicFuncHack)(SV *, MAGIC *); |
| 280 |
|
| #ifdef __cplusplus |
| 281 |
|
| } |
| 282 |
|
| #endif |
| 283 |
|
| |
| 284 |
|
| |
| 285 |
|
| #else |
| 286 |
|
| #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) |
| 287 |
|
| typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); |
| 288 |
|
| #ifdef __cplusplus |
| 289 |
|
| extern "C" { |
| 290 |
|
| #endif |
| 291 |
|
| typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *); |
| 292 |
|
| #ifdef __cplusplus |
| 293 |
|
| } |
| 294 |
|
| #endif |
| 295 |
|
| |
| 296 |
|
| #endif |
| 297 |
|
| #endif |
| 298 |
|
| |
| 299 |
|
| #if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) |
| 300 |
|
| #define PerlIO_exportFILE(fh,fl) (FILE*)(fh) |
| 301 |
|
| #endif |
| 302 |
|
| |
| 303 |
|
| /* Modifications for newer Perl 5.005 releases */ |
| 304 |
|
| |
| 305 |
|
| #if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50)))) |
| 306 |
|
| #ifndef PL_sv_yes |
| 307 |
|
| #define PL_sv_yes sv_yes |
| 308 |
|
| #endif |
| 309 |
|
| #ifndef PL_sv_undef |
| 310 |
|
| #define PL_sv_undef sv_undef |
| 311 |
|
| #endif |
| 312 |
|
| #ifndef PL_na |
| 313 |
|
| #define PL_na na |
| 314 |
|
| #endif |
| 315 |
|
| #endif |
| 316 |
|
| |
| 317 |
|
| #include <stdlib.h> |
| 318 |
|
| |
| 319 |
|
| #ifdef __cplusplus |
| 320 |
|
| extern "C" { |
| 321 |
|
| #endif |
| 322 |
|
| |
| 323 |
|
| #ifdef SWIG_NOINCLUDE |
| 324 |
|
| |
| 325 |
|
| #ifndef PERL_OBJECT |
| 326 |
|
| extern int SWIG_ConvertPtr(SV *, void **, swig_type_info *, int flags); |
| 327 |
|
| extern void SWIG_MakePtr(SV *, void *, swig_type_info *, int flags); |
| 328 |
|
| #else |
| 329 |
|
| extern int _SWIG_ConvertPtr(CPerlObj *, SV *, void **, swig_type_info *,int flags); |
| 330 |
|
| extern void _SWIG_MakePtr(CPerlObj *, SV *, void *, swig_type_info *, int flags); |
| 331 |
|
| #define SWIG_ConvertPtr(a,b,c,d) _SWIG_ConvertPtr(pPerl,a,b,c,d) |
| 332 |
|
| #define SWIG_MakePtr(a,b,c,d) _SWIG_MakePtr(pPerl,a,b,c,d) |
| 333 |
|
| #endif |
| 334 |
|
| |
| 335 |
|
| #else |
| 336 |
|
| |
| 337 |
|
| /* Function for getting a pointer value */ |
| 338 |
|
| |
| 339 |
|
| #ifndef PERL_OBJECT |
| 340 |
|
| SWIGRUNTIME(int) |
| 341 |
97 |
| SWIG_ConvertPtr(SV *sv, void **ptr, swig_type_info *_t, int flags) |
| 342 |
|
| #else |
| 343 |
|
| #define SWIG_ConvertPtr(a,b,c,d) _SWIG_ConvertPtr(pPerl,a,b,c,d) |
| 344 |
|
| SWIGRUNTIME(int) |
| 345 |
|
| _SWIG_ConvertPtr(CPerlObj *pPerl, SV *sv, void **ptr, swig_type_info *_t, int flags) |
| 346 |
|
| #endif |
| 347 |
|
| { |
| 348 |
|
| char *_c; |
| 349 |
|
| swig_type_info *tc; |
| 350 |
|
| IV tmp; |
| 351 |
|
| |
| 352 |
|
| /* If magical, apply more magic */ |
| 353 |
97 |
▶ | if (SvGMAGICAL(sv)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvGMAGICAL(sv)) |
0 |
97 |
97 |
|
| 354 |
0 |
| mg_get(sv); |
| 355 |
|
| |
| 356 |
|
| /* Check to see if this is an object */ |
| 357 |
97 |
▶ | if (sv_isobject(sv)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (sv_isobject(sv)) { |
97 |
0 |
97 |
|
| 358 |
97 |
| SV *tsv = (SV*) SvRV(sv); |
| 359 |
97 |
▶ | if ((SvTYPE(tsv) == SVt_PVHV)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ((SvTYPE(tsv) == SVt_PVHV)) { |
0 |
97 |
97 |
|
| 360 |
|
| MAGIC *mg; |
| 361 |
0 |
▶ | if (SvMAGICAL(tsv)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvMAGICAL(tsv)) { |
0 |
0 |
0 |
|
| 362 |
0 |
| mg = mg_find(tsv,'P'); |
| 363 |
0 |
▶ | if (mg) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (mg) { |
0 |
0 |
0 |
|
| 364 |
0 |
| SV *rsv = mg->mg_obj; |
| 365 |
0 |
▶ | if (sv_isobject(rsv)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (sv_isobject(rsv)) { |
0 |
0 |
0 |
|
| 366 |
0 |
| tmp = SvIV((SV*)SvRV(rsv)); |
| 367 |
|
| } |
| 368 |
|
| } |
| 369 |
|
| } else { |
| 370 |
0 |
| return -1; |
| 371 |
|
| } |
| 372 |
|
| } else { |
| 373 |
97 |
| tmp = SvIV((SV*)SvRV(sv)); |
| 374 |
|
| } |
| 375 |
97 |
▶ | if (!_t) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!_t) { |
0 |
97 |
97 |
|
| 376 |
0 |
| *(ptr) = (void *) tmp; |
| 377 |
0 |
| return 0; |
| 378 |
|
| } |
| 379 |
0 |
▶ | } else if (! SvOK(sv)) { /* Check for undef */ |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (! SvOK(sv)) { /* Check for undef */ |
0 |
0 |
0 |
|
| 380 |
0 |
| *(ptr) = (void *) 0; |
| 381 |
0 |
| return 0; |
| 382 |
0 |
▶ | } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ |
0 |
0 |
0 |
|
| 383 |
0 |
| *(ptr) = (void *) 0; |
| 384 |
0 |
▶ | if (!SvROK(sv)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvROK(sv)) |
0 |
0 |
0 |
|
| 385 |
0 |
| return 0; |
| 386 |
|
| else |
| 387 |
0 |
| return -1; |
| 388 |
|
| } else { /* Don't know what it is */ |
| 389 |
0 |
| *(ptr) = (void *) 0; |
| 390 |
0 |
| return -1; |
| 391 |
|
| } |
| 392 |
97 |
▶ | if (_t) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (_t) { |
97 |
0 |
97 |
|
| 393 |
|
| /* Now see if the types match */ |
| 394 |
97 |
▶ | _c = HvNAME(SvSTASH(SvRV(sv))); |
Branch: 6 branches
| Branch | True | False | Total |
| _c = HvNAME(SvSTASH(SvRV(sv))); |
97 |
0 |
97 |
| _c = HvNAME(SvSTASH(SvRV(sv))); |
97 |
0 |
97 |
| _c = HvNAME(SvSTASH(SvRV(sv))); |
0 |
97 |
97 |
| _c = HvNAME(SvSTASH(SvRV(sv))); |
0 |
0 |
0 |
| _c = HvNAME(SvSTASH(SvRV(sv))); |
97 |
0 |
97 |
| _c = HvNAME(SvSTASH(SvRV(sv))); |
0 |
97 |
97 |
|
| 395 |
97 |
| tc = SWIG_TypeCheck(_c,_t); |
| 396 |
97 |
▶ | if (!tc) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!tc) { |
0 |
97 |
97 |
|
| 397 |
0 |
| *ptr = (void *) tmp; |
| 398 |
0 |
| return -1; |
| 399 |
|
| } |
| 400 |
97 |
| *ptr = SWIG_TypeCast(tc,(void *)tmp); |
| 401 |
97 |
| return 0; |
| 402 |
|
| } |
| 403 |
0 |
| *ptr = (void *) tmp; |
| 404 |
0 |
| return 0; |
| 405 |
|
| } |
| 406 |
|
| #ifndef PERL_OBJECT |
| 407 |
|
| SWIGRUNTIME(void) |
| 408 |
36 |
| SWIG_MakePtr(SV *sv, void *ptr, swig_type_info *t,int flags) |
| 409 |
|
| #else |
| 410 |
|
| #define SWIG_MakePtr(a,b,c,d) _SWIG_MakePtr(pPerl,a,b,c,d) |
| 411 |
|
| SWIGRUNTIME(void) |
| 412 |
|
| _SWIG_MakePtr(CPerlObj *pPerl, SV *sv, void *ptr, swig_type_info *t, int flags) |
| 413 |
|
| #endif |
| 414 |
|
| { |
| 415 |
36 |
| sv_setref_pv(sv, (char *) t->name, ptr); |
| 416 |
36 |
| } |
| 417 |
|
| |
| 418 |
|
| #endif |
| 419 |
|
| |
| 420 |
|
| typedef XS(SwigPerlWrapper); |
| 421 |
|
| typedef SwigPerlWrapper *SwigPerlWrapperPtr; |
| 422 |
|
| |
| 423 |
|
| /* Structure for command table */ |
| 424 |
|
| typedef struct { |
| 425 |
|
| const char *name; |
| 426 |
|
| SwigPerlWrapperPtr wrapper; |
| 427 |
|
| } swig_command_info; |
| 428 |
|
| |
| 429 |
|
| /* Information for constant table */ |
| 430 |
|
| |
| 431 |
|
| #define SWIG_INT 1 |
| 432 |
|
| #define SWIG_FLOAT 2 |
| 433 |
|
| #define SWIG_STRING 3 |
| 434 |
|
| #define SWIG_POINTER 4 |
| 435 |
|
| #define SWIG_BINARY 5 |
| 436 |
|
| |
| 437 |
|
| /* Constant information structure */ |
| 438 |
|
| typedef struct swig_constant_info { |
| 439 |
|
| int type; |
| 440 |
|
| const char *name; |
| 441 |
|
| long lvalue; |
| 442 |
|
| double dvalue; |
| 443 |
|
| void *pvalue; |
| 444 |
|
| swig_type_info **ptype; |
| 445 |
|
| } swig_constant_info; |
| 446 |
|
| |
| 447 |
|
| #ifdef __cplusplus |
| 448 |
|
| } |
| 449 |
|
| #endif |
| 450 |
|
| |
| 451 |
|
| /* Structure for variable table */ |
| 452 |
|
| typedef struct { |
| 453 |
|
| const char *name; |
| 454 |
|
| SwigMagicFunc set; |
| 455 |
|
| SwigMagicFunc get; |
| 456 |
|
| swig_type_info **type; |
| 457 |
|
| } swig_variable_info; |
| 458 |
|
| |
| 459 |
|
| /* Magic variable code */ |
| 460 |
|
| #ifndef PERL_OBJECT |
| 461 |
|
| #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c) |
| 462 |
|
| #ifndef MULTIPLICITY |
| 463 |
0 |
| static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int \ |
| 464 |
|
| (*get)(SV *,MAGIC *)) { |
| 465 |
|
| #else |
| 466 |
|
| static void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*,\ |
| 467 |
|
| SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) { |
| 468 |
|
| #endif |
| 469 |
|
| #else |
| 470 |
|
| #define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) |
| 471 |
|
| static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) { |
| 472 |
|
| #endif |
| 473 |
|
| MAGIC *mg; |
| 474 |
0 |
| sv_magic(sv,sv,'U',(char *) name,strlen(name)); |
| 475 |
0 |
| mg = mg_find(sv,'U'); |
| 476 |
0 |
| mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); |
| 477 |
0 |
| mg->mg_virtual->svt_get = (SwigMagicFuncHack) get; |
| 478 |
0 |
| mg->mg_virtual->svt_set = (SwigMagicFuncHack) set; |
| 479 |
0 |
| mg->mg_virtual->svt_len = 0; |
| 480 |
0 |
| mg->mg_virtual->svt_clear = 0; |
| 481 |
0 |
| mg->mg_virtual->svt_free = 0; |
| 482 |
0 |
| } |
| 483 |
|
| |
| 484 |
|
| |
| 485 |
|
| |
| 486 |
|
| |
| 487 |
|
| |
| 488 |
|
| |
| 489 |
|
| |
| 490 |
|
| /* -------- TYPES TABLE (BEGIN) -------- */ |
| 491 |
|
| |
| 492 |
|
| #define SWIGTYPE_p_FILE swig_types[0] |
| 493 |
|
| #define SWIGTYPE_p_gpc_polygon swig_types[1] |
| 494 |
|
| #define SWIGTYPE_p_gpc_vertex swig_types[2] |
| 495 |
|
| #define SWIGTYPE_p_gpc_tristrip swig_types[3] |
| 496 |
|
| #define SWIGTYPE_p_int swig_types[4] |
| 497 |
|
| #define SWIGTYPE_p_gpc_vertex_list swig_types[5] |
| 498 |
|
| static swig_type_info *swig_types[7]; |
| 499 |
|
| |
| 500 |
|
| /* -------- TYPES TABLE (END) -------- */ |
| 501 |
|
| |
| 502 |
|
| #define SWIG_init boot_Math__Geometry__GPC |
| 503 |
|
| |
| 504 |
|
| #define SWIG_name "Math::Geometry::GPC::boot_Math__Geometry__GPC" |
| 505 |
|
| #define SWIG_prefix "Math::Geometry::GPC::" |
| 506 |
|
| |
| 507 |
|
| #ifdef __cplusplus |
| 508 |
|
| extern "C" |
| 509 |
|
| #endif |
| 510 |
|
| #ifndef PERL_OBJECT |
| 511 |
|
| #ifndef MULTIPLICITY |
| 512 |
|
| SWIGEXPORT(void) SWIG_init (CV* cv); |
| 513 |
|
| #else |
| 514 |
|
| SWIGEXPORT(void) SWIG_init (pTHXo_ CV* cv); |
| 515 |
|
| #endif |
| 516 |
|
| #else |
| 517 |
|
| SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *); |
| 518 |
|
| #endif |
| 519 |
|
| |
| 520 |
|
| |
| 521 |
|
| #include "GPC.h" |
| 522 |
|
| |
| 523 |
|
| |
| 524 |
2 |
| int *int_array(int size) { |
| 525 |
4 |
| return (int *) |
| 526 |
2 |
| malloc(sizeof(int)*size); |
| 527 |
|
| } |
| 528 |
0 |
| void int_destroy(int *a) { |
| 529 |
0 |
| free(a); |
| 530 |
0 |
| } |
| 531 |
2 |
| void int_set(int *a, int i, int val) { |
| 532 |
2 |
| a[i] = val; |
| 533 |
2 |
| } |
| 534 |
2 |
| int int_get(int *a, int i) { |
| 535 |
2 |
| return a[i]; |
| 536 |
|
| } |
| 537 |
2 |
| gpc_vertex *gpc_vertex_array(int size) { |
| 538 |
4 |
| return (gpc_vertex *) |
| 539 |
2 |
| malloc(sizeof(gpc_vertex)*size); |
| 540 |
|
| } |
| 541 |
0 |
| void gpc_vertex_destroy(gpc_vertex *a) { |
| 542 |
0 |
| free(a); |
| 543 |
0 |
| } |
| 544 |
8 |
| void gpc_vertex_set(gpc_vertex *a, int i, gpc_vertex val) { |
| 545 |
8 |
| a[i] = val; |
| 546 |
8 |
| } |
| 547 |
8 |
| gpc_vertex gpc_vertex_get(gpc_vertex *a, int i) { |
| 548 |
8 |
| return a[i]; |
| 549 |
|
| } |
| 550 |
0 |
| gpc_vertex_list *gpc_vertex_list_array(int size) { |
| 551 |
0 |
| return (gpc_vertex_list *) |
| 552 |
0 |
| malloc(sizeof(gpc_vertex_list)*size); |
| 553 |
|
| } |
| 554 |
0 |
| void gpc_vertex_list_destroy(gpc_vertex_list *a) { |
| 555 |
0 |
| free(a); |
| 556 |
0 |
| } |
| 557 |
2 |
| void gpc_vertex_list_set(gpc_vertex_list *a, int i, gpc_vertex_list val) { |
| 558 |
2 |
| a[i] = val; |
| 559 |
2 |
| } |
| 560 |
3 |
| gpc_vertex_list gpc_vertex_list_get(gpc_vertex_list *a, int i) { |
| 561 |
3 |
| return a[i]; |
| 562 |
|
| } |
| 563 |
|
| |
| 564 |
|
| #ifdef PERL_OBJECT |
| 565 |
|
| #define MAGIC_CLASS _wrap_GPC_var:: |
| 566 |
|
| class _wrap_GPC_var : public CPerlObj { |
| 567 |
|
| public: |
| 568 |
|
| #else |
| 569 |
|
| #define MAGIC_CLASS |
| 570 |
|
| #endif |
| 571 |
0 |
| SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *sv, MAGIC *mg) { |
| 572 |
|
| MAGIC_PPERL |
| 573 |
0 |
| sv = sv; mg = mg; |
| 574 |
0 |
| croak("Value is read-only."); |
| 575 |
|
| return 0; |
| 576 |
|
| } |
| 577 |
|
| |
| 578 |
|
| |
| 579 |
|
| #ifdef PERL_OBJECT |
| 580 |
|
| }; |
| 581 |
|
| #endif |
| 582 |
|
| |
| 583 |
|
| #ifdef __cplusplus |
| 584 |
|
| extern "C" { |
| 585 |
|
| #endif |
| 586 |
0 |
| XS(_wrap_fopen) { |
| 587 |
|
| char *arg1 ; |
| 588 |
|
| char *arg2 ; |
| 589 |
|
| FILE *result; |
| 590 |
0 |
| int argvi = 0; |
| 591 |
0 |
| dXSARGS; |
| 592 |
|
| |
| 593 |
0 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
0 |
0 |
0 |
| if ((items < 2) || (items > 2)) { |
0 |
0 |
0 |
|
| 594 |
0 |
| croak("Usage: fopen(name,mode);"); |
| 595 |
|
| } |
| 596 |
0 |
▶ | if (!SvOK((SV*) ST(0))) arg1 = 0; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvOK((SV*) ST(0))) arg1 = 0; |
0 |
0 |
0 |
|
| 597 |
0 |
| else arg1 = (char *) SvPV(ST(0), PL_na); |
| 598 |
0 |
▶ | if (!SvOK((SV*) ST(1))) arg2 = 0; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvOK((SV*) ST(1))) arg2 = 0; |
0 |
0 |
0 |
|
| 599 |
0 |
| else arg2 = (char *) SvPV(ST(1), PL_na); |
| 600 |
0 |
| result = (FILE *)fopen(arg1,arg2); |
| 601 |
|
| |
| 602 |
0 |
| ST(argvi) = sv_newmortal(); |
| 603 |
0 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_FILE,0); |
| 604 |
0 |
| XSRETURN(argvi); |
| 605 |
|
| } |
| 606 |
|
| |
| 607 |
|
| |
| 608 |
0 |
| XS(_wrap_fclose) { |
| 609 |
|
| FILE *arg1 ; |
| 610 |
0 |
| int argvi = 0; |
| 611 |
0 |
| dXSARGS; |
| 612 |
|
| |
| 613 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 614 |
0 |
| croak("Usage: fclose(FILE *);"); |
| 615 |
|
| } |
| 616 |
|
| { |
| 617 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_FILE,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_FILE,0) < 0) { |
0 |
0 |
0 |
|
| 618 |
0 |
| croak("Type error in argument 1 of fclose. Expected %s", SWIGTYPE_p_FILE->name); |
| 619 |
|
| } |
| 620 |
|
| } |
| 621 |
0 |
| fclose(arg1); |
| 622 |
|
| |
| 623 |
|
| |
| 624 |
0 |
| XSRETURN(argvi); |
| 625 |
|
| } |
| 626 |
|
| |
| 627 |
|
| |
| 628 |
2 |
| XS(_wrap_int_array) { |
| 629 |
|
| int arg1 ; |
| 630 |
|
| int *result; |
| 631 |
2 |
| int argvi = 0; |
| 632 |
2 |
| dXSARGS; |
| 633 |
|
| |
| 634 |
2 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
2 |
0 |
2 |
| if ((items < 1) || (items > 1)) { |
0 |
2 |
2 |
|
| 635 |
0 |
| croak("Usage: int_array(size);"); |
| 636 |
|
| } |
| 637 |
2 |
| arg1 = (int) SvIV(ST(0)); |
| 638 |
2 |
| result = (int *)int_array(arg1); |
| 639 |
|
| |
| 640 |
2 |
| ST(argvi) = sv_newmortal(); |
| 641 |
2 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_int,0); |
| 642 |
2 |
| XSRETURN(argvi); |
| 643 |
|
| } |
| 644 |
|
| |
| 645 |
|
| |
| 646 |
0 |
| XS(_wrap_int_destroy) { |
| 647 |
|
| int *arg1 ; |
| 648 |
0 |
| int argvi = 0; |
| 649 |
0 |
| dXSARGS; |
| 650 |
|
| |
| 651 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 652 |
0 |
| croak("Usage: int_destroy(a);"); |
| 653 |
|
| } |
| 654 |
|
| { |
| 655 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_int,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_int,0) < 0) { |
0 |
0 |
0 |
|
| 656 |
0 |
| croak("Type error in argument 1 of int_destroy. Expected %s", SWIGTYPE_p_int->name); |
| 657 |
|
| } |
| 658 |
|
| } |
| 659 |
0 |
| int_destroy(arg1); |
| 660 |
|
| |
| 661 |
|
| |
| 662 |
0 |
| XSRETURN(argvi); |
| 663 |
|
| } |
| 664 |
|
| |
| 665 |
|
| |
| 666 |
2 |
| XS(_wrap_int_set) { |
| 667 |
|
| int *arg1 ; |
| 668 |
|
| int arg2 ; |
| 669 |
|
| int arg3 ; |
| 670 |
2 |
| int argvi = 0; |
| 671 |
2 |
| dXSARGS; |
| 672 |
|
| |
| 673 |
2 |
▶ | if ((items < 3) || (items > 3)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 3) || (items > 3)) { |
2 |
0 |
2 |
| if ((items < 3) || (items > 3)) { |
0 |
2 |
2 |
|
| 674 |
0 |
| croak("Usage: int_set(a,i,val);"); |
| 675 |
|
| } |
| 676 |
|
| { |
| 677 |
2 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_int,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_int,0) < 0) { |
0 |
2 |
2 |
|
| 678 |
0 |
| croak("Type error in argument 1 of int_set. Expected %s", SWIGTYPE_p_int->name); |
| 679 |
|
| } |
| 680 |
|
| } |
| 681 |
2 |
| arg2 = (int) SvIV(ST(1)); |
| 682 |
2 |
| arg3 = (int) SvIV(ST(2)); |
| 683 |
2 |
| int_set(arg1,arg2,arg3); |
| 684 |
|
| |
| 685 |
|
| |
| 686 |
2 |
| XSRETURN(argvi); |
| 687 |
|
| } |
| 688 |
|
| |
| 689 |
|
| |
| 690 |
2 |
| XS(_wrap_int_get) { |
| 691 |
|
| int *arg1 ; |
| 692 |
|
| int arg2 ; |
| 693 |
|
| int result; |
| 694 |
2 |
| int argvi = 0; |
| 695 |
2 |
| dXSARGS; |
| 696 |
|
| |
| 697 |
2 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
2 |
0 |
2 |
| if ((items < 2) || (items > 2)) { |
0 |
2 |
2 |
|
| 698 |
0 |
| croak("Usage: int_get(a,i);"); |
| 699 |
|
| } |
| 700 |
|
| { |
| 701 |
2 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_int,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_int,0) < 0) { |
0 |
2 |
2 |
|
| 702 |
0 |
| croak("Type error in argument 1 of int_get. Expected %s", SWIGTYPE_p_int->name); |
| 703 |
|
| } |
| 704 |
|
| } |
| 705 |
2 |
| arg2 = (int) SvIV(ST(1)); |
| 706 |
2 |
| result = (int)int_get(arg1,arg2); |
| 707 |
|
| |
| 708 |
2 |
| ST(argvi) = sv_newmortal(); |
| 709 |
2 |
| sv_setiv(ST(argvi++), (IV) result); |
| 710 |
2 |
| XSRETURN(argvi); |
| 711 |
|
| } |
| 712 |
|
| |
| 713 |
|
| |
| 714 |
2 |
| XS(_wrap_gpc_vertex_array) { |
| 715 |
|
| int arg1 ; |
| 716 |
|
| gpc_vertex *result; |
| 717 |
2 |
| int argvi = 0; |
| 718 |
2 |
| dXSARGS; |
| 719 |
|
| |
| 720 |
2 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
2 |
0 |
2 |
| if ((items < 1) || (items > 1)) { |
0 |
2 |
2 |
|
| 721 |
0 |
| croak("Usage: gpc_vertex_array(size);"); |
| 722 |
|
| } |
| 723 |
2 |
| arg1 = (int) SvIV(ST(0)); |
| 724 |
2 |
| result = (gpc_vertex *)gpc_vertex_array(arg1); |
| 725 |
|
| |
| 726 |
2 |
| ST(argvi) = sv_newmortal(); |
| 727 |
2 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_gpc_vertex,0); |
| 728 |
2 |
| XSRETURN(argvi); |
| 729 |
|
| } |
| 730 |
|
| |
| 731 |
|
| |
| 732 |
0 |
| XS(_wrap_gpc_vertex_destroy) { |
| 733 |
|
| gpc_vertex *arg1 ; |
| 734 |
0 |
| int argvi = 0; |
| 735 |
0 |
| dXSARGS; |
| 736 |
|
| |
| 737 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 738 |
0 |
| croak("Usage: gpc_vertex_destroy(a);"); |
| 739 |
|
| } |
| 740 |
|
| { |
| 741 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
0 |
0 |
0 |
|
| 742 |
0 |
| croak("Type error in argument 1 of gpc_vertex_destroy. Expected %s", SWIGTYPE_p_gpc_vertex->name); |
| 743 |
|
| } |
| 744 |
|
| } |
| 745 |
0 |
| gpc_vertex_destroy(arg1); |
| 746 |
|
| |
| 747 |
|
| |
| 748 |
0 |
| XSRETURN(argvi); |
| 749 |
|
| } |
| 750 |
|
| |
| 751 |
|
| |
| 752 |
8 |
| XS(_wrap_gpc_vertex_set) { |
| 753 |
|
| gpc_vertex *arg1 ; |
| 754 |
|
| int arg2 ; |
| 755 |
|
| gpc_vertex arg3 ; |
| 756 |
8 |
| int argvi = 0; |
| 757 |
8 |
| dXSARGS; |
| 758 |
|
| |
| 759 |
8 |
▶ | if ((items < 3) || (items > 3)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 3) || (items > 3)) { |
8 |
0 |
8 |
| if ((items < 3) || (items > 3)) { |
0 |
8 |
8 |
|
| 760 |
0 |
| croak("Usage: gpc_vertex_set(a,i,val);"); |
| 761 |
|
| } |
| 762 |
|
| { |
| 763 |
8 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
0 |
8 |
8 |
|
| 764 |
0 |
| croak("Type error in argument 1 of gpc_vertex_set. Expected %s", SWIGTYPE_p_gpc_vertex->name); |
| 765 |
|
| } |
| 766 |
|
| } |
| 767 |
8 |
| arg2 = (int) SvIV(ST(1)); |
| 768 |
|
| { |
| 769 |
|
| gpc_vertex * argp; |
| 770 |
8 |
▶ | if (SWIG_ConvertPtr(ST(2),(void **) &argp, SWIGTYPE_p_gpc_vertex,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(2),(void **) &argp, SWIGTYPE_p_gpc_vertex,0) < 0) { |
0 |
8 |
8 |
|
| 771 |
0 |
| croak("Type error in argument 3 of gpc_vertex_set. Expected %s", SWIGTYPE_p_gpc_vertex->name); |
| 772 |
|
| } |
| 773 |
8 |
| arg3 = *argp; |
| 774 |
|
| } |
| 775 |
8 |
| gpc_vertex_set(arg1,arg2,arg3); |
| 776 |
|
| |
| 777 |
|
| |
| 778 |
8 |
| XSRETURN(argvi); |
| 779 |
|
| } |
| 780 |
|
| |
| 781 |
|
| |
| 782 |
8 |
| XS(_wrap_gpc_vertex_get) { |
| 783 |
|
| gpc_vertex *arg1 ; |
| 784 |
|
| int arg2 ; |
| 785 |
|
| gpc_vertex result; |
| 786 |
8 |
| int argvi = 0; |
| 787 |
8 |
| dXSARGS; |
| 788 |
|
| |
| 789 |
8 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
8 |
0 |
8 |
| if ((items < 2) || (items > 2)) { |
0 |
8 |
8 |
|
| 790 |
0 |
| croak("Usage: gpc_vertex_get(a,i);"); |
| 791 |
|
| } |
| 792 |
|
| { |
| 793 |
8 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
0 |
8 |
8 |
|
| 794 |
0 |
| croak("Type error in argument 1 of gpc_vertex_get. Expected %s", SWIGTYPE_p_gpc_vertex->name); |
| 795 |
|
| } |
| 796 |
|
| } |
| 797 |
8 |
| arg2 = (int) SvIV(ST(1)); |
| 798 |
8 |
| result = gpc_vertex_get(arg1,arg2); |
| 799 |
|
| |
| 800 |
|
| { |
| 801 |
8 |
| gpc_vertex * resultobj = (gpc_vertex *) malloc(sizeof(gpc_vertex)); |
| 802 |
8 |
| memmove(resultobj, &result, sizeof(gpc_vertex)); |
| 803 |
8 |
| ST(argvi) = sv_newmortal(); |
| 804 |
8 |
| SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_gpc_vertex,0); |
| 805 |
|
| } |
| 806 |
8 |
| XSRETURN(argvi); |
| 807 |
|
| } |
| 808 |
|
| |
| 809 |
|
| |
| 810 |
0 |
| XS(_wrap_gpc_vertex_list_array) { |
| 811 |
|
| int arg1 ; |
| 812 |
|
| gpc_vertex_list *result; |
| 813 |
0 |
| int argvi = 0; |
| 814 |
0 |
| dXSARGS; |
| 815 |
|
| |
| 816 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 817 |
0 |
| croak("Usage: gpc_vertex_list_array(size);"); |
| 818 |
|
| } |
| 819 |
0 |
| arg1 = (int) SvIV(ST(0)); |
| 820 |
0 |
| result = (gpc_vertex_list *)gpc_vertex_list_array(arg1); |
| 821 |
|
| |
| 822 |
0 |
| ST(argvi) = sv_newmortal(); |
| 823 |
0 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_gpc_vertex_list,0); |
| 824 |
0 |
| XSRETURN(argvi); |
| 825 |
|
| } |
| 826 |
|
| |
| 827 |
|
| |
| 828 |
0 |
| XS(_wrap_gpc_vertex_list_destroy) { |
| 829 |
|
| gpc_vertex_list *arg1 ; |
| 830 |
0 |
| int argvi = 0; |
| 831 |
0 |
| dXSARGS; |
| 832 |
|
| |
| 833 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 834 |
0 |
| croak("Usage: gpc_vertex_list_destroy(a);"); |
| 835 |
|
| } |
| 836 |
|
| { |
| 837 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
0 |
0 |
|
| 838 |
0 |
| croak("Type error in argument 1 of gpc_vertex_list_destroy. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 839 |
|
| } |
| 840 |
|
| } |
| 841 |
0 |
| gpc_vertex_list_destroy(arg1); |
| 842 |
|
| |
| 843 |
|
| |
| 844 |
0 |
| XSRETURN(argvi); |
| 845 |
|
| } |
| 846 |
|
| |
| 847 |
|
| |
| 848 |
2 |
| XS(_wrap_gpc_vertex_list_set) { |
| 849 |
|
| gpc_vertex_list *arg1 ; |
| 850 |
|
| int arg2 ; |
| 851 |
|
| gpc_vertex_list arg3 ; |
| 852 |
2 |
| int argvi = 0; |
| 853 |
2 |
| dXSARGS; |
| 854 |
|
| |
| 855 |
2 |
▶ | if ((items < 3) || (items > 3)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 3) || (items > 3)) { |
2 |
0 |
2 |
| if ((items < 3) || (items > 3)) { |
0 |
2 |
2 |
|
| 856 |
0 |
| croak("Usage: gpc_vertex_list_set(a,i,val);"); |
| 857 |
|
| } |
| 858 |
|
| { |
| 859 |
2 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
2 |
2 |
|
| 860 |
0 |
| croak("Type error in argument 1 of gpc_vertex_list_set. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 861 |
|
| } |
| 862 |
|
| } |
| 863 |
2 |
| arg2 = (int) SvIV(ST(1)); |
| 864 |
|
| { |
| 865 |
|
| gpc_vertex_list * argp; |
| 866 |
2 |
▶ | if (SWIG_ConvertPtr(ST(2),(void **) &argp, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(2),(void **) &argp, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
2 |
2 |
|
| 867 |
0 |
| croak("Type error in argument 3 of gpc_vertex_list_set. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 868 |
|
| } |
| 869 |
2 |
| arg3 = *argp; |
| 870 |
|
| } |
| 871 |
2 |
| gpc_vertex_list_set(arg1,arg2,arg3); |
| 872 |
|
| |
| 873 |
|
| |
| 874 |
2 |
| XSRETURN(argvi); |
| 875 |
|
| } |
| 876 |
|
| |
| 877 |
|
| |
| 878 |
3 |
| XS(_wrap_gpc_vertex_list_get) { |
| 879 |
|
| gpc_vertex_list *arg1 ; |
| 880 |
|
| int arg2 ; |
| 881 |
|
| gpc_vertex_list result; |
| 882 |
3 |
| int argvi = 0; |
| 883 |
3 |
| dXSARGS; |
| 884 |
|
| |
| 885 |
3 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
3 |
0 |
3 |
| if ((items < 2) || (items > 2)) { |
0 |
3 |
3 |
|
| 886 |
0 |
| croak("Usage: gpc_vertex_list_get(a,i);"); |
| 887 |
|
| } |
| 888 |
|
| { |
| 889 |
3 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
3 |
3 |
|
| 890 |
0 |
| croak("Type error in argument 1 of gpc_vertex_list_get. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 891 |
|
| } |
| 892 |
|
| } |
| 893 |
3 |
| arg2 = (int) SvIV(ST(1)); |
| 894 |
3 |
| result = gpc_vertex_list_get(arg1,arg2); |
| 895 |
|
| |
| 896 |
|
| { |
| 897 |
3 |
| gpc_vertex_list * resultobj = (gpc_vertex_list *) malloc(sizeof(gpc_vertex_list)); |
| 898 |
3 |
| memmove(resultobj, &result, sizeof(gpc_vertex_list)); |
| 899 |
3 |
| ST(argvi) = sv_newmortal(); |
| 900 |
3 |
| SWIG_MakePtr(ST(argvi++), (void *) resultobj, SWIGTYPE_p_gpc_vertex_list,0); |
| 901 |
|
| } |
| 902 |
3 |
| XSRETURN(argvi); |
| 903 |
|
| } |
| 904 |
|
| |
| 905 |
|
| |
| 906 |
8 |
| XS(_wrap_gpc_vertex_x_set) { |
| 907 |
|
| gpc_vertex *arg1 ; |
| 908 |
|
| double arg2 ; |
| 909 |
8 |
| int argvi = 0; |
| 910 |
8 |
| dXSARGS; |
| 911 |
|
| |
| 912 |
8 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
8 |
0 |
8 |
| if ((items < 2) || (items > 2)) { |
0 |
8 |
8 |
|
| 913 |
0 |
| croak("Usage: gpc_vertex_x_set(self,x);"); |
| 914 |
|
| } |
| 915 |
|
| { |
| 916 |
8 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
0 |
8 |
8 |
|
| 917 |
0 |
| croak("Type error in argument 1 of gpc_vertex_x_set. Expected %s", SWIGTYPE_p_gpc_vertex->name); |
| 918 |
|
| } |
| 919 |
|
| } |
| 920 |
8 |
| arg2 = (double) SvNV(ST(1)); |
| 921 |
|
| |
| 922 |
8 |
▶ | if (arg1) (arg1)->x = arg2; |
Branch: 1 branch
| Branch | True | False | Total |
| if (arg1) (arg1)->x = arg2; |
8 |
0 |
8 |
|
| 923 |
|
| |
| 924 |
|
| |
| 925 |
8 |
| XSRETURN(argvi); |
| 926 |
|
| } |
| 927 |
|
| |
| 928 |
|
| |
| 929 |
8 |
| XS(_wrap_gpc_vertex_x_get) { |
| 930 |
|
| gpc_vertex *arg1 ; |
| 931 |
|
| double result; |
| 932 |
8 |
| int argvi = 0; |
| 933 |
8 |
| dXSARGS; |
| 934 |
|
| |
| 935 |
8 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
8 |
0 |
8 |
| if ((items < 1) || (items > 1)) { |
0 |
8 |
8 |
|
| 936 |
0 |
| croak("Usage: gpc_vertex_x_get(self);"); |
| 937 |
|
| } |
| 938 |
|
| { |
| 939 |
8 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
0 |
8 |
8 |
|
| 940 |
0 |
| croak("Type error in argument 1 of gpc_vertex_x_get. Expected %s", SWIGTYPE_p_gpc_vertex->name); |
| 941 |
|
| } |
| 942 |
|
| } |
| 943 |
8 |
| result = (double) ((arg1)->x); |
| 944 |
|
| |
| 945 |
8 |
| ST(argvi) = sv_newmortal(); |
| 946 |
8 |
| sv_setnv(ST(argvi++), (double) result); |
| 947 |
8 |
| XSRETURN(argvi); |
| 948 |
|
| } |
| 949 |
|
| |
| 950 |
|
| |
| 951 |
8 |
| XS(_wrap_gpc_vertex_y_set) { |
| 952 |
|
| gpc_vertex *arg1 ; |
| 953 |
|
| double arg2 ; |
| 954 |
8 |
| int argvi = 0; |
| 955 |
8 |
| dXSARGS; |
| 956 |
|
| |
| 957 |
8 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
8 |
0 |
8 |
| if ((items < 2) || (items > 2)) { |
0 |
8 |
8 |
|
| 958 |
0 |
| croak("Usage: gpc_vertex_y_set(self,y);"); |
| 959 |
|
| } |
| 960 |
|
| { |
| 961 |
8 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
0 |
8 |
8 |
|
| 962 |
0 |
| croak("Type error in argument 1 of gpc_vertex_y_set. Expected %s", SWIGTYPE_p_gpc_vertex->name); |
| 963 |
|
| } |
| 964 |
|
| } |
| 965 |
8 |
| arg2 = (double) SvNV(ST(1)); |
| 966 |
|
| |
| 967 |
8 |
▶ | if (arg1) (arg1)->y = arg2; |
Branch: 1 branch
| Branch | True | False | Total |
| if (arg1) (arg1)->y = arg2; |
8 |
0 |
8 |
|
| 968 |
|
| |
| 969 |
|
| |
| 970 |
8 |
| XSRETURN(argvi); |
| 971 |
|
| } |
| 972 |
|
| |
| 973 |
|
| |
| 974 |
8 |
| XS(_wrap_gpc_vertex_y_get) { |
| 975 |
|
| gpc_vertex *arg1 ; |
| 976 |
|
| double result; |
| 977 |
8 |
| int argvi = 0; |
| 978 |
8 |
| dXSARGS; |
| 979 |
|
| |
| 980 |
8 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
8 |
0 |
8 |
| if ((items < 1) || (items > 1)) { |
0 |
8 |
8 |
|
| 981 |
0 |
| croak("Usage: gpc_vertex_y_get(self);"); |
| 982 |
|
| } |
| 983 |
|
| { |
| 984 |
8 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
0 |
8 |
8 |
|
| 985 |
0 |
| croak("Type error in argument 1 of gpc_vertex_y_get. Expected %s", SWIGTYPE_p_gpc_vertex->name); |
| 986 |
|
| } |
| 987 |
|
| } |
| 988 |
8 |
| result = (double) ((arg1)->y); |
| 989 |
|
| |
| 990 |
8 |
| ST(argvi) = sv_newmortal(); |
| 991 |
8 |
| sv_setnv(ST(argvi++), (double) result); |
| 992 |
8 |
| XSRETURN(argvi); |
| 993 |
|
| } |
| 994 |
|
| |
| 995 |
|
| |
| 996 |
8 |
| XS(_wrap_new_gpc_vertex) { |
| 997 |
|
| gpc_vertex *result; |
| 998 |
8 |
| int argvi = 0; |
| 999 |
8 |
| dXSARGS; |
| 1000 |
|
| |
| 1001 |
8 |
▶ | if ((items < 0) || (items > 0)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 0) || (items > 0)) { |
8 |
0 |
8 |
| if ((items < 0) || (items > 0)) { |
0 |
8 |
8 |
|
| 1002 |
0 |
| croak("Usage: new_gpc_vertex();"); |
| 1003 |
|
| } |
| 1004 |
8 |
| result = (gpc_vertex *)(gpc_vertex *) calloc(1, sizeof(gpc_vertex)); |
| 1005 |
|
| |
| 1006 |
8 |
| ST(argvi) = sv_newmortal(); |
| 1007 |
8 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_gpc_vertex,0); |
| 1008 |
8 |
| XSRETURN(argvi); |
| 1009 |
|
| } |
| 1010 |
|
| |
| 1011 |
|
| |
| 1012 |
0 |
| XS(_wrap_delete_gpc_vertex) { |
| 1013 |
|
| gpc_vertex *arg1 ; |
| 1014 |
0 |
| int argvi = 0; |
| 1015 |
0 |
| dXSARGS; |
| 1016 |
|
| |
| 1017 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 1018 |
0 |
| croak("Usage: delete_gpc_vertex(self);"); |
| 1019 |
|
| } |
| 1020 |
|
| { |
| 1021 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex,0) < 0) { |
0 |
0 |
0 |
|
| 1022 |
0 |
| croak("Type error in argument 1 of delete_gpc_vertex. Expected %s", SWIGTYPE_p_gpc_vertex->name); |
| 1023 |
|
| } |
| 1024 |
|
| } |
| 1025 |
0 |
| free((char *) arg1); |
| 1026 |
|
| |
| 1027 |
|
| |
| 1028 |
0 |
| XSRETURN(argvi); |
| 1029 |
|
| } |
| 1030 |
|
| |
| 1031 |
|
| |
| 1032 |
2 |
| XS(_wrap_gpc_vertex_list_num_vertices_set) { |
| 1033 |
|
| gpc_vertex_list *arg1 ; |
| 1034 |
|
| int arg2 ; |
| 1035 |
2 |
| int argvi = 0; |
| 1036 |
2 |
| dXSARGS; |
| 1037 |
|
| |
| 1038 |
2 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
2 |
0 |
2 |
| if ((items < 2) || (items > 2)) { |
0 |
2 |
2 |
|
| 1039 |
0 |
| croak("Usage: gpc_vertex_list_num_vertices_set(self,num_vertices);"); |
| 1040 |
|
| } |
| 1041 |
|
| { |
| 1042 |
2 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
2 |
2 |
|
| 1043 |
0 |
| croak("Type error in argument 1 of gpc_vertex_list_num_vertices_set. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 1044 |
|
| } |
| 1045 |
|
| } |
| 1046 |
2 |
| arg2 = (int) SvIV(ST(1)); |
| 1047 |
2 |
▶ | if (arg1) (arg1)->num_vertices = arg2; |
Branch: 1 branch
| Branch | True | False | Total |
| if (arg1) (arg1)->num_vertices = arg2; |
2 |
0 |
2 |
|
| 1048 |
|
| |
| 1049 |
|
| |
| 1050 |
2 |
| XSRETURN(argvi); |
| 1051 |
|
| } |
| 1052 |
|
| |
| 1053 |
|
| |
| 1054 |
3 |
| XS(_wrap_gpc_vertex_list_num_vertices_get) { |
| 1055 |
|
| gpc_vertex_list *arg1 ; |
| 1056 |
|
| int result; |
| 1057 |
3 |
| int argvi = 0; |
| 1058 |
3 |
| dXSARGS; |
| 1059 |
|
| |
| 1060 |
3 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
3 |
0 |
3 |
| if ((items < 1) || (items > 1)) { |
0 |
3 |
3 |
|
| 1061 |
0 |
| croak("Usage: gpc_vertex_list_num_vertices_get(self);"); |
| 1062 |
|
| } |
| 1063 |
|
| { |
| 1064 |
3 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
3 |
3 |
|
| 1065 |
0 |
| croak("Type error in argument 1 of gpc_vertex_list_num_vertices_get. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 1066 |
|
| } |
| 1067 |
|
| } |
| 1068 |
3 |
| result = (int) ((arg1)->num_vertices); |
| 1069 |
|
| |
| 1070 |
3 |
| ST(argvi) = sv_newmortal(); |
| 1071 |
3 |
| sv_setiv(ST(argvi++), (IV) result); |
| 1072 |
3 |
| XSRETURN(argvi); |
| 1073 |
|
| } |
| 1074 |
|
| |
| 1075 |
|
| |
| 1076 |
2 |
| XS(_wrap_gpc_vertex_list_vertex_set) { |
| 1077 |
|
| gpc_vertex_list *arg1 ; |
| 1078 |
|
| gpc_vertex *arg2 ; |
| 1079 |
2 |
| int argvi = 0; |
| 1080 |
2 |
| dXSARGS; |
| 1081 |
|
| |
| 1082 |
2 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
2 |
0 |
2 |
| if ((items < 2) || (items > 2)) { |
0 |
2 |
2 |
|
| 1083 |
0 |
| croak("Usage: gpc_vertex_list_vertex_set(self,vertex);"); |
| 1084 |
|
| } |
| 1085 |
|
| { |
| 1086 |
2 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
2 |
2 |
|
| 1087 |
0 |
| croak("Type error in argument 1 of gpc_vertex_list_vertex_set. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 1088 |
|
| } |
| 1089 |
|
| } |
| 1090 |
|
| { |
| 1091 |
2 |
▶ | if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_vertex,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_vertex,0) < 0) { |
0 |
2 |
2 |
|
| 1092 |
0 |
| croak("Type error in argument 2 of gpc_vertex_list_vertex_set. Expected %s", SWIGTYPE_p_gpc_vertex->name); |
| 1093 |
|
| } |
| 1094 |
|
| } |
| 1095 |
2 |
▶ | if (arg1) (arg1)->vertex = arg2; |
Branch: 1 branch
| Branch | True | False | Total |
| if (arg1) (arg1)->vertex = arg2; |
2 |
0 |
2 |
|
| 1096 |
|
| |
| 1097 |
|
| |
| 1098 |
2 |
| XSRETURN(argvi); |
| 1099 |
|
| } |
| 1100 |
|
| |
| 1101 |
|
| |
| 1102 |
1 |
| XS(_wrap_gpc_vertex_list_vertex_get) { |
| 1103 |
|
| gpc_vertex_list *arg1 ; |
| 1104 |
|
| gpc_vertex *result; |
| 1105 |
1 |
| int argvi = 0; |
| 1106 |
1 |
| dXSARGS; |
| 1107 |
|
| |
| 1108 |
1 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
1 |
0 |
1 |
| if ((items < 1) || (items > 1)) { |
0 |
1 |
1 |
|
| 1109 |
0 |
| croak("Usage: gpc_vertex_list_vertex_get(self);"); |
| 1110 |
|
| } |
| 1111 |
|
| { |
| 1112 |
1 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
1 |
1 |
|
| 1113 |
0 |
| croak("Type error in argument 1 of gpc_vertex_list_vertex_get. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 1114 |
|
| } |
| 1115 |
|
| } |
| 1116 |
1 |
| result = (gpc_vertex *) ((arg1)->vertex); |
| 1117 |
|
| |
| 1118 |
1 |
| ST(argvi) = sv_newmortal(); |
| 1119 |
1 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_gpc_vertex,0); |
| 1120 |
1 |
| XSRETURN(argvi); |
| 1121 |
|
| } |
| 1122 |
|
| |
| 1123 |
|
| |
| 1124 |
4 |
| XS(_wrap_new_gpc_vertex_list) { |
| 1125 |
|
| gpc_vertex_list *result; |
| 1126 |
4 |
| int argvi = 0; |
| 1127 |
4 |
| dXSARGS; |
| 1128 |
|
| |
| 1129 |
4 |
▶ | if ((items < 0) || (items > 0)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 0) || (items > 0)) { |
4 |
0 |
4 |
| if ((items < 0) || (items > 0)) { |
0 |
4 |
4 |
|
| 1130 |
0 |
| croak("Usage: new_gpc_vertex_list();"); |
| 1131 |
|
| } |
| 1132 |
4 |
| result = (gpc_vertex_list *)(gpc_vertex_list *) calloc(1, sizeof(gpc_vertex_list)); |
| 1133 |
|
| |
| 1134 |
4 |
| ST(argvi) = sv_newmortal(); |
| 1135 |
4 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_gpc_vertex_list,0); |
| 1136 |
4 |
| XSRETURN(argvi); |
| 1137 |
|
| } |
| 1138 |
|
| |
| 1139 |
|
| |
| 1140 |
0 |
| XS(_wrap_delete_gpc_vertex_list) { |
| 1141 |
|
| gpc_vertex_list *arg1 ; |
| 1142 |
0 |
| int argvi = 0; |
| 1143 |
0 |
| dXSARGS; |
| 1144 |
|
| |
| 1145 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 1146 |
0 |
| croak("Usage: delete_gpc_vertex_list(self);"); |
| 1147 |
|
| } |
| 1148 |
|
| { |
| 1149 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
0 |
0 |
|
| 1150 |
0 |
| croak("Type error in argument 1 of delete_gpc_vertex_list. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 1151 |
|
| } |
| 1152 |
|
| } |
| 1153 |
0 |
| free((char *) arg1); |
| 1154 |
|
| |
| 1155 |
|
| |
| 1156 |
0 |
| XSRETURN(argvi); |
| 1157 |
|
| } |
| 1158 |
|
| |
| 1159 |
|
| |
| 1160 |
2 |
| XS(_wrap_gpc_polygon_num_contours_set) { |
| 1161 |
|
| gpc_polygon *arg1 ; |
| 1162 |
|
| int arg2 ; |
| 1163 |
2 |
| int argvi = 0; |
| 1164 |
2 |
| dXSARGS; |
| 1165 |
|
| |
| 1166 |
2 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
2 |
0 |
2 |
| if ((items < 2) || (items > 2)) { |
0 |
2 |
2 |
|
| 1167 |
0 |
| croak("Usage: gpc_polygon_num_contours_set(self,num_contours);"); |
| 1168 |
|
| } |
| 1169 |
|
| { |
| 1170 |
2 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
2 |
2 |
|
| 1171 |
0 |
| croak("Type error in argument 1 of gpc_polygon_num_contours_set. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1172 |
|
| } |
| 1173 |
|
| } |
| 1174 |
2 |
| arg2 = (int) SvIV(ST(1)); |
| 1175 |
2 |
▶ | if (arg1) (arg1)->num_contours = arg2; |
Branch: 1 branch
| Branch | True | False | Total |
| if (arg1) (arg1)->num_contours = arg2; |
2 |
0 |
2 |
|
| 1176 |
|
| |
| 1177 |
|
| |
| 1178 |
2 |
| XSRETURN(argvi); |
| 1179 |
|
| } |
| 1180 |
|
| |
| 1181 |
|
| |
| 1182 |
2 |
| XS(_wrap_gpc_polygon_num_contours_get) { |
| 1183 |
|
| gpc_polygon *arg1 ; |
| 1184 |
|
| int result; |
| 1185 |
2 |
| int argvi = 0; |
| 1186 |
2 |
| dXSARGS; |
| 1187 |
|
| |
| 1188 |
2 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
2 |
0 |
2 |
| if ((items < 1) || (items > 1)) { |
0 |
2 |
2 |
|
| 1189 |
0 |
| croak("Usage: gpc_polygon_num_contours_get(self);"); |
| 1190 |
|
| } |
| 1191 |
|
| { |
| 1192 |
2 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
2 |
2 |
|
| 1193 |
0 |
| croak("Type error in argument 1 of gpc_polygon_num_contours_get. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1194 |
|
| } |
| 1195 |
|
| } |
| 1196 |
2 |
| result = (int) ((arg1)->num_contours); |
| 1197 |
|
| |
| 1198 |
2 |
| ST(argvi) = sv_newmortal(); |
| 1199 |
2 |
| sv_setiv(ST(argvi++), (IV) result); |
| 1200 |
2 |
| XSRETURN(argvi); |
| 1201 |
|
| } |
| 1202 |
|
| |
| 1203 |
|
| |
| 1204 |
2 |
| XS(_wrap_gpc_polygon_hole_set) { |
| 1205 |
|
| gpc_polygon *arg1 ; |
| 1206 |
|
| int *arg2 ; |
| 1207 |
2 |
| int argvi = 0; |
| 1208 |
2 |
| dXSARGS; |
| 1209 |
|
| |
| 1210 |
2 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
2 |
0 |
2 |
| if ((items < 2) || (items > 2)) { |
0 |
2 |
2 |
|
| 1211 |
0 |
| croak("Usage: gpc_polygon_hole_set(self,hole);"); |
| 1212 |
|
| } |
| 1213 |
|
| { |
| 1214 |
2 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
2 |
2 |
|
| 1215 |
0 |
| croak("Type error in argument 1 of gpc_polygon_hole_set. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1216 |
|
| } |
| 1217 |
|
| } |
| 1218 |
|
| { |
| 1219 |
2 |
▶ | if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_int,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_int,0) < 0) { |
0 |
2 |
2 |
|
| 1220 |
0 |
| croak("Type error in argument 2 of gpc_polygon_hole_set. Expected %s", SWIGTYPE_p_int->name); |
| 1221 |
|
| } |
| 1222 |
|
| } |
| 1223 |
2 |
▶ | if (arg1) (arg1)->hole = arg2; |
Branch: 1 branch
| Branch | True | False | Total |
| if (arg1) (arg1)->hole = arg2; |
2 |
0 |
2 |
|
| 1224 |
|
| |
| 1225 |
|
| |
| 1226 |
2 |
| XSRETURN(argvi); |
| 1227 |
|
| } |
| 1228 |
|
| |
| 1229 |
|
| |
| 1230 |
2 |
| XS(_wrap_gpc_polygon_hole_get) { |
| 1231 |
|
| gpc_polygon *arg1 ; |
| 1232 |
|
| int *result; |
| 1233 |
2 |
| int argvi = 0; |
| 1234 |
2 |
| dXSARGS; |
| 1235 |
|
| |
| 1236 |
2 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
2 |
0 |
2 |
| if ((items < 1) || (items > 1)) { |
0 |
2 |
2 |
|
| 1237 |
0 |
| croak("Usage: gpc_polygon_hole_get(self);"); |
| 1238 |
|
| } |
| 1239 |
|
| { |
| 1240 |
2 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
2 |
2 |
|
| 1241 |
0 |
| croak("Type error in argument 1 of gpc_polygon_hole_get. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1242 |
|
| } |
| 1243 |
|
| } |
| 1244 |
2 |
| result = (int *) ((arg1)->hole); |
| 1245 |
|
| |
| 1246 |
2 |
| ST(argvi) = sv_newmortal(); |
| 1247 |
2 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_int,0); |
| 1248 |
2 |
| XSRETURN(argvi); |
| 1249 |
|
| } |
| 1250 |
|
| |
| 1251 |
|
| |
| 1252 |
2 |
| XS(_wrap_gpc_polygon_contour_set) { |
| 1253 |
|
| gpc_polygon *arg1 ; |
| 1254 |
|
| gpc_vertex_list *arg2 ; |
| 1255 |
2 |
| int argvi = 0; |
| 1256 |
2 |
| dXSARGS; |
| 1257 |
|
| |
| 1258 |
2 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
2 |
0 |
2 |
| if ((items < 2) || (items > 2)) { |
0 |
2 |
2 |
|
| 1259 |
0 |
| croak("Usage: gpc_polygon_contour_set(self,contour);"); |
| 1260 |
|
| } |
| 1261 |
|
| { |
| 1262 |
2 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
2 |
2 |
|
| 1263 |
0 |
| croak("Type error in argument 1 of gpc_polygon_contour_set. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1264 |
|
| } |
| 1265 |
|
| } |
| 1266 |
|
| { |
| 1267 |
2 |
▶ | if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
2 |
2 |
|
| 1268 |
0 |
| croak("Type error in argument 2 of gpc_polygon_contour_set. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 1269 |
|
| } |
| 1270 |
|
| } |
| 1271 |
2 |
▶ | if (arg1) (arg1)->contour = arg2; |
Branch: 1 branch
| Branch | True | False | Total |
| if (arg1) (arg1)->contour = arg2; |
2 |
0 |
2 |
|
| 1272 |
|
| |
| 1273 |
|
| |
| 1274 |
2 |
| XSRETURN(argvi); |
| 1275 |
|
| } |
| 1276 |
|
| |
| 1277 |
|
| |
| 1278 |
3 |
| XS(_wrap_gpc_polygon_contour_get) { |
| 1279 |
|
| gpc_polygon *arg1 ; |
| 1280 |
|
| gpc_vertex_list *result; |
| 1281 |
3 |
| int argvi = 0; |
| 1282 |
3 |
| dXSARGS; |
| 1283 |
|
| |
| 1284 |
3 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
3 |
0 |
3 |
| if ((items < 1) || (items > 1)) { |
0 |
3 |
3 |
|
| 1285 |
0 |
| croak("Usage: gpc_polygon_contour_get(self);"); |
| 1286 |
|
| } |
| 1287 |
|
| { |
| 1288 |
3 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
3 |
3 |
|
| 1289 |
0 |
| croak("Type error in argument 1 of gpc_polygon_contour_get. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1290 |
|
| } |
| 1291 |
|
| } |
| 1292 |
3 |
| result = (gpc_vertex_list *) ((arg1)->contour); |
| 1293 |
|
| |
| 1294 |
3 |
| ST(argvi) = sv_newmortal(); |
| 1295 |
3 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_gpc_vertex_list,0); |
| 1296 |
3 |
| XSRETURN(argvi); |
| 1297 |
|
| } |
| 1298 |
|
| |
| 1299 |
|
| |
| 1300 |
3 |
| XS(_wrap_new_gpc_polygon) { |
| 1301 |
|
| gpc_polygon *result; |
| 1302 |
3 |
| int argvi = 0; |
| 1303 |
3 |
| dXSARGS; |
| 1304 |
|
| |
| 1305 |
3 |
▶ | if ((items < 0) || (items > 0)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 0) || (items > 0)) { |
3 |
0 |
3 |
| if ((items < 0) || (items > 0)) { |
0 |
3 |
3 |
|
| 1306 |
0 |
| croak("Usage: new_gpc_polygon();"); |
| 1307 |
|
| } |
| 1308 |
3 |
| result = (gpc_polygon *)(gpc_polygon *) calloc(1, sizeof(gpc_polygon)); |
| 1309 |
|
| |
| 1310 |
3 |
| ST(argvi) = sv_newmortal(); |
| 1311 |
3 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_gpc_polygon,0); |
| 1312 |
3 |
| XSRETURN(argvi); |
| 1313 |
|
| } |
| 1314 |
|
| |
| 1315 |
|
| |
| 1316 |
0 |
| XS(_wrap_delete_gpc_polygon) { |
| 1317 |
|
| gpc_polygon *arg1 ; |
| 1318 |
0 |
| int argvi = 0; |
| 1319 |
0 |
| dXSARGS; |
| 1320 |
|
| |
| 1321 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 1322 |
0 |
| croak("Usage: delete_gpc_polygon(self);"); |
| 1323 |
|
| } |
| 1324 |
|
| { |
| 1325 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
0 |
0 |
|
| 1326 |
0 |
| croak("Type error in argument 1 of delete_gpc_polygon. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1327 |
|
| } |
| 1328 |
|
| } |
| 1329 |
0 |
| free((char *) arg1); |
| 1330 |
|
| |
| 1331 |
|
| |
| 1332 |
0 |
| XSRETURN(argvi); |
| 1333 |
|
| } |
| 1334 |
|
| |
| 1335 |
|
| |
| 1336 |
0 |
| XS(_wrap_gpc_tristrip_num_strips_set) { |
| 1337 |
|
| gpc_tristrip *arg1 ; |
| 1338 |
|
| int arg2 ; |
| 1339 |
0 |
| int argvi = 0; |
| 1340 |
0 |
| dXSARGS; |
| 1341 |
|
| |
| 1342 |
0 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
0 |
0 |
0 |
| if ((items < 2) || (items > 2)) { |
0 |
0 |
0 |
|
| 1343 |
0 |
| croak("Usage: gpc_tristrip_num_strips_set(self,num_strips);"); |
| 1344 |
|
| } |
| 1345 |
|
| { |
| 1346 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
0 |
0 |
0 |
|
| 1347 |
0 |
| croak("Type error in argument 1 of gpc_tristrip_num_strips_set. Expected %s", SWIGTYPE_p_gpc_tristrip->name); |
| 1348 |
|
| } |
| 1349 |
|
| } |
| 1350 |
0 |
| arg2 = (int) SvIV(ST(1)); |
| 1351 |
0 |
▶ | if (arg1) (arg1)->num_strips = arg2; |
Branch: 1 branch
| Branch | True | False | Total |
| if (arg1) (arg1)->num_strips = arg2; |
0 |
0 |
0 |
|
| 1352 |
|
| |
| 1353 |
|
| |
| 1354 |
0 |
| XSRETURN(argvi); |
| 1355 |
|
| } |
| 1356 |
|
| |
| 1357 |
|
| |
| 1358 |
0 |
| XS(_wrap_gpc_tristrip_num_strips_get) { |
| 1359 |
|
| gpc_tristrip *arg1 ; |
| 1360 |
|
| int result; |
| 1361 |
0 |
| int argvi = 0; |
| 1362 |
0 |
| dXSARGS; |
| 1363 |
|
| |
| 1364 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 1365 |
0 |
| croak("Usage: gpc_tristrip_num_strips_get(self);"); |
| 1366 |
|
| } |
| 1367 |
|
| { |
| 1368 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
0 |
0 |
0 |
|
| 1369 |
0 |
| croak("Type error in argument 1 of gpc_tristrip_num_strips_get. Expected %s", SWIGTYPE_p_gpc_tristrip->name); |
| 1370 |
|
| } |
| 1371 |
|
| } |
| 1372 |
0 |
| result = (int) ((arg1)->num_strips); |
| 1373 |
|
| |
| 1374 |
0 |
| ST(argvi) = sv_newmortal(); |
| 1375 |
0 |
| sv_setiv(ST(argvi++), (IV) result); |
| 1376 |
0 |
| XSRETURN(argvi); |
| 1377 |
|
| } |
| 1378 |
|
| |
| 1379 |
|
| |
| 1380 |
0 |
| XS(_wrap_gpc_tristrip_strip_set) { |
| 1381 |
|
| gpc_tristrip *arg1 ; |
| 1382 |
|
| gpc_vertex_list *arg2 ; |
| 1383 |
0 |
| int argvi = 0; |
| 1384 |
0 |
| dXSARGS; |
| 1385 |
|
| |
| 1386 |
0 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
0 |
0 |
0 |
| if ((items < 2) || (items > 2)) { |
0 |
0 |
0 |
|
| 1387 |
0 |
| croak("Usage: gpc_tristrip_strip_set(self,strip);"); |
| 1388 |
|
| } |
| 1389 |
|
| { |
| 1390 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
0 |
0 |
0 |
|
| 1391 |
0 |
| croak("Type error in argument 1 of gpc_tristrip_strip_set. Expected %s", SWIGTYPE_p_gpc_tristrip->name); |
| 1392 |
|
| } |
| 1393 |
|
| } |
| 1394 |
|
| { |
| 1395 |
0 |
▶ | if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
0 |
0 |
|
| 1396 |
0 |
| croak("Type error in argument 2 of gpc_tristrip_strip_set. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 1397 |
|
| } |
| 1398 |
|
| } |
| 1399 |
0 |
▶ | if (arg1) (arg1)->strip = arg2; |
Branch: 1 branch
| Branch | True | False | Total |
| if (arg1) (arg1)->strip = arg2; |
0 |
0 |
0 |
|
| 1400 |
|
| |
| 1401 |
|
| |
| 1402 |
0 |
| XSRETURN(argvi); |
| 1403 |
|
| } |
| 1404 |
|
| |
| 1405 |
|
| |
| 1406 |
0 |
| XS(_wrap_gpc_tristrip_strip_get) { |
| 1407 |
|
| gpc_tristrip *arg1 ; |
| 1408 |
|
| gpc_vertex_list *result; |
| 1409 |
0 |
| int argvi = 0; |
| 1410 |
0 |
| dXSARGS; |
| 1411 |
|
| |
| 1412 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 1413 |
0 |
| croak("Usage: gpc_tristrip_strip_get(self);"); |
| 1414 |
|
| } |
| 1415 |
|
| { |
| 1416 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
0 |
0 |
0 |
|
| 1417 |
0 |
| croak("Type error in argument 1 of gpc_tristrip_strip_get. Expected %s", SWIGTYPE_p_gpc_tristrip->name); |
| 1418 |
|
| } |
| 1419 |
|
| } |
| 1420 |
0 |
| result = (gpc_vertex_list *) ((arg1)->strip); |
| 1421 |
|
| |
| 1422 |
0 |
| ST(argvi) = sv_newmortal(); |
| 1423 |
0 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_gpc_vertex_list,0); |
| 1424 |
0 |
| XSRETURN(argvi); |
| 1425 |
|
| } |
| 1426 |
|
| |
| 1427 |
|
| |
| 1428 |
0 |
| XS(_wrap_new_gpc_tristrip) { |
| 1429 |
|
| gpc_tristrip *result; |
| 1430 |
0 |
| int argvi = 0; |
| 1431 |
0 |
| dXSARGS; |
| 1432 |
|
| |
| 1433 |
0 |
▶ | if ((items < 0) || (items > 0)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 0) || (items > 0)) { |
0 |
0 |
0 |
| if ((items < 0) || (items > 0)) { |
0 |
0 |
0 |
|
| 1434 |
0 |
| croak("Usage: new_gpc_tristrip();"); |
| 1435 |
|
| } |
| 1436 |
0 |
| result = (gpc_tristrip *)(gpc_tristrip *) calloc(1, sizeof(gpc_tristrip)); |
| 1437 |
|
| |
| 1438 |
0 |
| ST(argvi) = sv_newmortal(); |
| 1439 |
0 |
| SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_gpc_tristrip,0); |
| 1440 |
0 |
| XSRETURN(argvi); |
| 1441 |
|
| } |
| 1442 |
|
| |
| 1443 |
|
| |
| 1444 |
0 |
| XS(_wrap_delete_gpc_tristrip) { |
| 1445 |
|
| gpc_tristrip *arg1 ; |
| 1446 |
0 |
| int argvi = 0; |
| 1447 |
0 |
| dXSARGS; |
| 1448 |
|
| |
| 1449 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 1450 |
0 |
| croak("Usage: delete_gpc_tristrip(self);"); |
| 1451 |
|
| } |
| 1452 |
|
| { |
| 1453 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
0 |
0 |
0 |
|
| 1454 |
0 |
| croak("Type error in argument 1 of delete_gpc_tristrip. Expected %s", SWIGTYPE_p_gpc_tristrip->name); |
| 1455 |
|
| } |
| 1456 |
|
| } |
| 1457 |
0 |
| free((char *) arg1); |
| 1458 |
|
| |
| 1459 |
|
| |
| 1460 |
0 |
| XSRETURN(argvi); |
| 1461 |
|
| } |
| 1462 |
|
| |
| 1463 |
|
| |
| 1464 |
0 |
| XS(_wrap_gpc_read_polygon) { |
| 1465 |
|
| FILE *arg1 ; |
| 1466 |
|
| int arg2 ; |
| 1467 |
|
| gpc_polygon *arg3 ; |
| 1468 |
0 |
| int argvi = 0; |
| 1469 |
0 |
| dXSARGS; |
| 1470 |
|
| |
| 1471 |
0 |
▶ | if ((items < 3) || (items > 3)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 3) || (items > 3)) { |
0 |
0 |
0 |
| if ((items < 3) || (items > 3)) { |
0 |
0 |
0 |
|
| 1472 |
0 |
| croak("Usage: gpc_read_polygon(infile_ptr,read_hole_flags,polygon);"); |
| 1473 |
|
| } |
| 1474 |
|
| { |
| 1475 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_FILE,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_FILE,0) < 0) { |
0 |
0 |
0 |
|
| 1476 |
0 |
| croak("Type error in argument 1 of gpc_read_polygon. Expected %s", SWIGTYPE_p_FILE->name); |
| 1477 |
|
| } |
| 1478 |
|
| } |
| 1479 |
0 |
| arg2 = (int) SvIV(ST(1)); |
| 1480 |
|
| { |
| 1481 |
0 |
▶ | if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
0 |
0 |
|
| 1482 |
0 |
| croak("Type error in argument 3 of gpc_read_polygon. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1483 |
|
| } |
| 1484 |
|
| } |
| 1485 |
0 |
| gpc_read_polygon(arg1,arg2,arg3); |
| 1486 |
|
| |
| 1487 |
|
| |
| 1488 |
0 |
| XSRETURN(argvi); |
| 1489 |
|
| } |
| 1490 |
|
| |
| 1491 |
|
| |
| 1492 |
0 |
| XS(_wrap_gpc_write_polygon) { |
| 1493 |
|
| FILE *arg1 ; |
| 1494 |
|
| int arg2 ; |
| 1495 |
|
| gpc_polygon *arg3 ; |
| 1496 |
0 |
| int argvi = 0; |
| 1497 |
0 |
| dXSARGS; |
| 1498 |
|
| |
| 1499 |
0 |
▶ | if ((items < 3) || (items > 3)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 3) || (items > 3)) { |
0 |
0 |
0 |
| if ((items < 3) || (items > 3)) { |
0 |
0 |
0 |
|
| 1500 |
0 |
| croak("Usage: gpc_write_polygon(outfile_ptr,write_hole_flags,polygon);"); |
| 1501 |
|
| } |
| 1502 |
|
| { |
| 1503 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_FILE,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_FILE,0) < 0) { |
0 |
0 |
0 |
|
| 1504 |
0 |
| croak("Type error in argument 1 of gpc_write_polygon. Expected %s", SWIGTYPE_p_FILE->name); |
| 1505 |
|
| } |
| 1506 |
|
| } |
| 1507 |
0 |
| arg2 = (int) SvIV(ST(1)); |
| 1508 |
|
| { |
| 1509 |
0 |
▶ | if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
0 |
0 |
|
| 1510 |
0 |
| croak("Type error in argument 3 of gpc_write_polygon. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1511 |
|
| } |
| 1512 |
|
| } |
| 1513 |
0 |
| gpc_write_polygon(arg1,arg2,arg3); |
| 1514 |
|
| |
| 1515 |
|
| |
| 1516 |
0 |
| XSRETURN(argvi); |
| 1517 |
|
| } |
| 1518 |
|
| |
| 1519 |
|
| |
| 1520 |
0 |
| XS(_wrap_gpc_add_contour) { |
| 1521 |
|
| gpc_polygon *arg1 ; |
| 1522 |
|
| gpc_vertex_list *arg2 ; |
| 1523 |
|
| int arg3 ; |
| 1524 |
0 |
| int argvi = 0; |
| 1525 |
0 |
| dXSARGS; |
| 1526 |
|
| |
| 1527 |
0 |
▶ | if ((items < 3) || (items > 3)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 3) || (items > 3)) { |
0 |
0 |
0 |
| if ((items < 3) || (items > 3)) { |
0 |
0 |
0 |
|
| 1528 |
0 |
| croak("Usage: gpc_add_contour(polygon,contour,hole);"); |
| 1529 |
|
| } |
| 1530 |
|
| { |
| 1531 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
0 |
0 |
|
| 1532 |
0 |
| croak("Type error in argument 1 of gpc_add_contour. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1533 |
|
| } |
| 1534 |
|
| } |
| 1535 |
|
| { |
| 1536 |
0 |
▶ | if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_vertex_list,0) < 0) { |
0 |
0 |
0 |
|
| 1537 |
0 |
| croak("Type error in argument 2 of gpc_add_contour. Expected %s", SWIGTYPE_p_gpc_vertex_list->name); |
| 1538 |
|
| } |
| 1539 |
|
| } |
| 1540 |
0 |
| arg3 = (int) SvIV(ST(2)); |
| 1541 |
0 |
| gpc_add_contour(arg1,arg2,arg3); |
| 1542 |
|
| |
| 1543 |
|
| |
| 1544 |
0 |
| XSRETURN(argvi); |
| 1545 |
|
| } |
| 1546 |
|
| |
| 1547 |
|
| |
| 1548 |
1 |
| XS(_wrap_gpc_polygon_clip) { |
| 1549 |
|
| int arg1 ; |
| 1550 |
|
| gpc_polygon *arg2 ; |
| 1551 |
|
| gpc_polygon *arg3 ; |
| 1552 |
|
| gpc_polygon *arg4 ; |
| 1553 |
1 |
| int argvi = 0; |
| 1554 |
1 |
| dXSARGS; |
| 1555 |
|
| |
| 1556 |
1 |
▶ | if ((items < 4) || (items > 4)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 4) || (items > 4)) { |
1 |
0 |
1 |
| if ((items < 4) || (items > 4)) { |
0 |
1 |
1 |
|
| 1557 |
0 |
| croak("Usage: gpc_polygon_clip(set_operation,subject_polygon,clip_polygon,result_polygon);"); |
| 1558 |
|
| } |
| 1559 |
1 |
| arg1 = (int) SvIV(ST(0)); |
| 1560 |
|
| { |
| 1561 |
1 |
▶ | if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
1 |
1 |
|
| 1562 |
0 |
| croak("Type error in argument 2 of gpc_polygon_clip. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1563 |
|
| } |
| 1564 |
|
| } |
| 1565 |
|
| { |
| 1566 |
1 |
▶ | if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
1 |
1 |
|
| 1567 |
0 |
| croak("Type error in argument 3 of gpc_polygon_clip. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1568 |
|
| } |
| 1569 |
|
| } |
| 1570 |
|
| { |
| 1571 |
1 |
▶ | if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
1 |
1 |
|
| 1572 |
0 |
| croak("Type error in argument 4 of gpc_polygon_clip. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1573 |
|
| } |
| 1574 |
|
| } |
| 1575 |
1 |
| gpc_polygon_clip((gpc_op )arg1,arg2,arg3,arg4); |
| 1576 |
|
| |
| 1577 |
|
| |
| 1578 |
1 |
| XSRETURN(argvi); |
| 1579 |
|
| } |
| 1580 |
|
| |
| 1581 |
|
| |
| 1582 |
0 |
| XS(_wrap_gpc_tristrip_clip) { |
| 1583 |
|
| int arg1 ; |
| 1584 |
|
| gpc_polygon *arg2 ; |
| 1585 |
|
| gpc_polygon *arg3 ; |
| 1586 |
|
| gpc_tristrip *arg4 ; |
| 1587 |
0 |
| int argvi = 0; |
| 1588 |
0 |
| dXSARGS; |
| 1589 |
|
| |
| 1590 |
0 |
▶ | if ((items < 4) || (items > 4)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 4) || (items > 4)) { |
0 |
0 |
0 |
| if ((items < 4) || (items > 4)) { |
0 |
0 |
0 |
|
| 1591 |
0 |
| croak("Usage: gpc_tristrip_clip(set_operation,subject_polygon,clip_polygon,result_tristrip);"); |
| 1592 |
|
| } |
| 1593 |
0 |
| arg1 = (int) SvIV(ST(0)); |
| 1594 |
|
| { |
| 1595 |
0 |
▶ | if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
0 |
0 |
|
| 1596 |
0 |
| croak("Type error in argument 2 of gpc_tristrip_clip. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1597 |
|
| } |
| 1598 |
|
| } |
| 1599 |
|
| { |
| 1600 |
0 |
▶ | if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(2), (void **) &arg3, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
0 |
0 |
|
| 1601 |
0 |
| croak("Type error in argument 3 of gpc_tristrip_clip. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1602 |
|
| } |
| 1603 |
|
| } |
| 1604 |
|
| { |
| 1605 |
0 |
▶ | if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
0 |
0 |
0 |
|
| 1606 |
0 |
| croak("Type error in argument 4 of gpc_tristrip_clip. Expected %s", SWIGTYPE_p_gpc_tristrip->name); |
| 1607 |
|
| } |
| 1608 |
|
| } |
| 1609 |
0 |
| gpc_tristrip_clip((gpc_op )arg1,arg2,arg3,arg4); |
| 1610 |
|
| |
| 1611 |
|
| |
| 1612 |
0 |
| XSRETURN(argvi); |
| 1613 |
|
| } |
| 1614 |
|
| |
| 1615 |
|
| |
| 1616 |
0 |
| XS(_wrap_gpc_polygon_to_tristrip) { |
| 1617 |
|
| gpc_polygon *arg1 ; |
| 1618 |
|
| gpc_tristrip *arg2 ; |
| 1619 |
0 |
| int argvi = 0; |
| 1620 |
0 |
| dXSARGS; |
| 1621 |
|
| |
| 1622 |
0 |
▶ | if ((items < 2) || (items > 2)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 2) || (items > 2)) { |
0 |
0 |
0 |
| if ((items < 2) || (items > 2)) { |
0 |
0 |
0 |
|
| 1623 |
0 |
| croak("Usage: gpc_polygon_to_tristrip(polygon,tristrip);"); |
| 1624 |
|
| } |
| 1625 |
|
| { |
| 1626 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
0 |
0 |
|
| 1627 |
0 |
| croak("Type error in argument 1 of gpc_polygon_to_tristrip. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1628 |
|
| } |
| 1629 |
|
| } |
| 1630 |
|
| { |
| 1631 |
0 |
▶ | if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
0 |
0 |
0 |
|
| 1632 |
0 |
| croak("Type error in argument 2 of gpc_polygon_to_tristrip. Expected %s", SWIGTYPE_p_gpc_tristrip->name); |
| 1633 |
|
| } |
| 1634 |
|
| } |
| 1635 |
0 |
| gpc_polygon_to_tristrip(arg1,arg2); |
| 1636 |
|
| |
| 1637 |
|
| |
| 1638 |
0 |
| XSRETURN(argvi); |
| 1639 |
|
| } |
| 1640 |
|
| |
| 1641 |
|
| |
| 1642 |
0 |
| XS(_wrap_gpc_free_polygon) { |
| 1643 |
|
| gpc_polygon *arg1 ; |
| 1644 |
0 |
| int argvi = 0; |
| 1645 |
0 |
| dXSARGS; |
| 1646 |
|
| |
| 1647 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 1648 |
0 |
| croak("Usage: gpc_free_polygon(polygon);"); |
| 1649 |
|
| } |
| 1650 |
|
| { |
| 1651 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_polygon,0) < 0) { |
0 |
0 |
0 |
|
| 1652 |
0 |
| croak("Type error in argument 1 of gpc_free_polygon. Expected %s", SWIGTYPE_p_gpc_polygon->name); |
| 1653 |
|
| } |
| 1654 |
|
| } |
| 1655 |
0 |
| gpc_free_polygon(arg1); |
| 1656 |
|
| |
| 1657 |
|
| |
| 1658 |
0 |
| XSRETURN(argvi); |
| 1659 |
|
| } |
| 1660 |
|
| |
| 1661 |
|
| |
| 1662 |
0 |
| XS(_wrap_gpc_free_tristrip) { |
| 1663 |
|
| gpc_tristrip *arg1 ; |
| 1664 |
0 |
| int argvi = 0; |
| 1665 |
0 |
| dXSARGS; |
| 1666 |
|
| |
| 1667 |
0 |
▶ | if ((items < 1) || (items > 1)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
| if ((items < 1) || (items > 1)) { |
0 |
0 |
0 |
|
| 1668 |
0 |
| croak("Usage: gpc_free_tristrip(tristrip);"); |
| 1669 |
|
| } |
| 1670 |
|
| { |
| 1671 |
0 |
▶ | if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_gpc_tristrip,0) < 0) { |
0 |
0 |
0 |
|
| 1672 |
0 |
| croak("Type error in argument 1 of gpc_free_tristrip. Expected %s", SWIGTYPE_p_gpc_tristrip->name); |
| 1673 |
|
| } |
| 1674 |
|
| } |
| 1675 |
0 |
| gpc_free_tristrip(arg1); |
| 1676 |
|
| |
| 1677 |
|
| |
| 1678 |
0 |
| XSRETURN(argvi); |
| 1679 |
|
| } |
| 1680 |
|
| |
| 1681 |
|
| |
| 1682 |
|
| |
| 1683 |
|
| /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ |
| 1684 |
|
| |
| 1685 |
|
| static swig_type_info _swigt__p_FILE[] = {{"_p_FILE", 0, "FILE *", 0},{"_p_FILE"},{0}}; |
| 1686 |
|
| static swig_type_info _swigt__p_gpc_polygon[] = {{"_p_gpc_polygon", 0, "gpc_polygon *", 0},{"_p_gpc_polygon"},{0}}; |
| 1687 |
|
| static swig_type_info _swigt__p_gpc_vertex[] = {{"_p_gpc_vertex", 0, "gpc_vertex *", 0},{"_p_gpc_vertex"},{0}}; |
| 1688 |
|
| static swig_type_info _swigt__p_gpc_tristrip[] = {{"_p_gpc_tristrip", 0, "gpc_tristrip *", 0},{"_p_gpc_tristrip"},{0}}; |
| 1689 |
|
| static swig_type_info _swigt__p_int[] = {{"_p_int", 0, "int *", 0},{"_p_int"},{0}}; |
| 1690 |
|
| static swig_type_info _swigt__p_gpc_vertex_list[] = {{"_p_gpc_vertex_list", 0, "gpc_vertex_list *", 0},{"_p_gpc_vertex_list"},{0}}; |
| 1691 |
|
| |
| 1692 |
|
| static swig_type_info *swig_types_initial[] = { |
| 1693 |
|
| _swigt__p_FILE, |
| 1694 |
|
| _swigt__p_gpc_polygon, |
| 1695 |
|
| _swigt__p_gpc_vertex, |
| 1696 |
|
| _swigt__p_gpc_tristrip, |
| 1697 |
|
| _swigt__p_int, |
| 1698 |
|
| _swigt__p_gpc_vertex_list, |
| 1699 |
|
| 0 |
| 1700 |
|
| }; |
| 1701 |
|
| |
| 1702 |
|
| |
| 1703 |
|
| /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ |
| 1704 |
|
| |
| 1705 |
|
| static swig_constant_info swig_constants[] = { |
| 1706 |
|
| { SWIG_STRING, (char *) SWIG_prefix "GPC_VERSION", 0, 0, (void *)"2.31", 0}, |
| 1707 |
|
| { SWIG_INT, (char *) SWIG_prefix "GPC_DIFF", (long) GPC_DIFF, 0, 0, 0}, |
| 1708 |
|
| { SWIG_INT, (char *) SWIG_prefix "GPC_INT", (long) GPC_INT, 0, 0, 0}, |
| 1709 |
|
| { SWIG_INT, (char *) SWIG_prefix "GPC_XOR", (long) GPC_XOR, 0, 0, 0}, |
| 1710 |
|
| { SWIG_INT, (char *) SWIG_prefix "GPC_UNION", (long) GPC_UNION, 0, 0, 0}, |
| 1711 |
|
| {0} |
| 1712 |
|
| }; |
| 1713 |
|
| #ifdef __cplusplus |
| 1714 |
|
| } |
| 1715 |
|
| #endif |
| 1716 |
|
| static swig_variable_info swig_variables[] = { |
| 1717 |
|
| {0} |
| 1718 |
|
| }; |
| 1719 |
|
| static swig_command_info swig_commands[] = { |
| 1720 |
|
| {"Math::Geometry::GPC::fopen", _wrap_fopen}, |
| 1721 |
|
| {"Math::Geometry::GPC::fclose", _wrap_fclose}, |
| 1722 |
|
| {"Math::Geometry::GPC::int_array", _wrap_int_array}, |
| 1723 |
|
| {"Math::Geometry::GPC::int_destroy", _wrap_int_destroy}, |
| 1724 |
|
| {"Math::Geometry::GPC::int_set", _wrap_int_set}, |
| 1725 |
|
| {"Math::Geometry::GPC::int_get", _wrap_int_get}, |
| 1726 |
|
| {"Math::Geometry::GPC::gpc_vertex_array", _wrap_gpc_vertex_array}, |
| 1727 |
|
| {"Math::Geometry::GPC::gpc_vertex_destroy", _wrap_gpc_vertex_destroy}, |
| 1728 |
|
| {"Math::Geometry::GPC::gpc_vertex_set", _wrap_gpc_vertex_set}, |
| 1729 |
|
| {"Math::Geometry::GPC::gpc_vertex_get", _wrap_gpc_vertex_get}, |
| 1730 |
|
| {"Math::Geometry::GPC::gpc_vertex_list_array", _wrap_gpc_vertex_list_array}, |
| 1731 |
|
| {"Math::Geometry::GPC::gpc_vertex_list_destroy", _wrap_gpc_vertex_list_destroy}, |
| 1732 |
|
| {"Math::Geometry::GPC::gpc_vertex_list_set", _wrap_gpc_vertex_list_set}, |
| 1733 |
|
| {"Math::Geometry::GPC::gpc_vertex_list_get", _wrap_gpc_vertex_list_get}, |
| 1734 |
|
| {"Math::Geometry::GPC::gpc_vertex_x_set", _wrap_gpc_vertex_x_set}, |
| 1735 |
|
| {"Math::Geometry::GPC::gpc_vertex_x_get", _wrap_gpc_vertex_x_get}, |
| 1736 |
|
| {"Math::Geometry::GPC::gpc_vertex_y_set", _wrap_gpc_vertex_y_set}, |
| 1737 |
|
| {"Math::Geometry::GPC::gpc_vertex_y_get", _wrap_gpc_vertex_y_get}, |
| 1738 |
|
| {"Math::Geometry::GPC::new_gpc_vertex", _wrap_new_gpc_vertex}, |
| 1739 |
|
| {"Math::Geometry::GPC::delete_gpc_vertex", _wrap_delete_gpc_vertex}, |
| 1740 |
|
| {"Math::Geometry::GPC::gpc_vertex_list_num_vertices_set", _wrap_gpc_vertex_list_num_vertices_set}, |
| 1741 |
|
| {"Math::Geometry::GPC::gpc_vertex_list_num_vertices_get", _wrap_gpc_vertex_list_num_vertices_get}, |
| 1742 |
|
| {"Math::Geometry::GPC::gpc_vertex_list_vertex_set", _wrap_gpc_vertex_list_vertex_set}, |
| 1743 |
|
| {"Math::Geometry::GPC::gpc_vertex_list_vertex_get", _wrap_gpc_vertex_list_vertex_get}, |
| 1744 |
|
| {"Math::Geometry::GPC::new_gpc_vertex_list", _wrap_new_gpc_vertex_list}, |
| 1745 |
|
| {"Math::Geometry::GPC::delete_gpc_vertex_list", _wrap_delete_gpc_vertex_list}, |
| 1746 |
|
| {"Math::Geometry::GPC::gpc_polygon_num_contours_set", _wrap_gpc_polygon_num_contours_set}, |
| 1747 |
|
| {"Math::Geometry::GPC::gpc_polygon_num_contours_get", _wrap_gpc_polygon_num_contours_get}, |
| 1748 |
|
| {"Math::Geometry::GPC::gpc_polygon_hole_set", _wrap_gpc_polygon_hole_set}, |
| 1749 |
|
| {"Math::Geometry::GPC::gpc_polygon_hole_get", _wrap_gpc_polygon_hole_get}, |
| 1750 |
|
| {"Math::Geometry::GPC::gpc_polygon_contour_set", _wrap_gpc_polygon_contour_set}, |
| 1751 |
|
| {"Math::Geometry::GPC::gpc_polygon_contour_get", _wrap_gpc_polygon_contour_get}, |
| 1752 |
|
| {"Math::Geometry::GPC::new_gpc_polygon", _wrap_new_gpc_polygon}, |
| 1753 |
|
| {"Math::Geometry::GPC::delete_gpc_polygon", _wrap_delete_gpc_polygon}, |
| 1754 |
|
| {"Math::Geometry::GPC::gpc_tristrip_num_strips_set", _wrap_gpc_tristrip_num_strips_set}, |
| 1755 |
|
| {"Math::Geometry::GPC::gpc_tristrip_num_strips_get", _wrap_gpc_tristrip_num_strips_get}, |
| 1756 |
|
| {"Math::Geometry::GPC::gpc_tristrip_strip_set", _wrap_gpc_tristrip_strip_set}, |
| 1757 |
|
| {"Math::Geometry::GPC::gpc_tristrip_strip_get", _wrap_gpc_tristrip_strip_get}, |
| 1758 |
|
| {"Math::Geometry::GPC::new_gpc_tristrip", _wrap_new_gpc_tristrip}, |
| 1759 |
|
| {"Math::Geometry::GPC::delete_gpc_tristrip", _wrap_delete_gpc_tristrip}, |
| 1760 |
|
| {"Math::Geometry::GPC::gpc_read_polygon", _wrap_gpc_read_polygon}, |
| 1761 |
|
| {"Math::Geometry::GPC::gpc_write_polygon", _wrap_gpc_write_polygon}, |
| 1762 |
|
| {"Math::Geometry::GPC::gpc_add_contour", _wrap_gpc_add_contour}, |
| 1763 |
|
| {"Math::Geometry::GPC::gpc_polygon_clip", _wrap_gpc_polygon_clip}, |
| 1764 |
|
| {"Math::Geometry::GPC::gpc_tristrip_clip", _wrap_gpc_tristrip_clip}, |
| 1765 |
|
| {"Math::Geometry::GPC::gpc_polygon_to_tristrip", _wrap_gpc_polygon_to_tristrip}, |
| 1766 |
|
| {"Math::Geometry::GPC::gpc_free_polygon", _wrap_gpc_free_polygon}, |
| 1767 |
|
| {"Math::Geometry::GPC::gpc_free_tristrip", _wrap_gpc_free_tristrip}, |
| 1768 |
|
| {0,0} |
| 1769 |
|
| }; |
| 1770 |
|
| |
| 1771 |
|
| #ifdef __cplusplus |
| 1772 |
|
| extern "C" |
| 1773 |
|
| #endif |
| 1774 |
|
| |
| 1775 |
1 |
| XS(SWIG_init) { |
| 1776 |
1 |
| dXSARGS; |
| 1777 |
|
| int i; |
| 1778 |
|
| static int _init = 0; |
| 1779 |
1 |
▶ | if (!_init) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (!_init) { |
1 |
0 |
1 |
|
| 1780 |
7 |
▶ | for (i = 0; swig_types_initial[i]; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; swig_types_initial[i]; i++) { |
6 |
1 |
7 |
|
| 1781 |
6 |
| swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); |
| 1782 |
|
| } |
| 1783 |
1 |
| _init = 1; |
| 1784 |
|
| } |
| 1785 |
|
| |
| 1786 |
|
| /* Install commands */ |
| 1787 |
49 |
▶ | for (i = 0; swig_commands[i].name; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; swig_commands[i].name; i++) { |
48 |
1 |
49 |
|
| 1788 |
48 |
| newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__); |
| 1789 |
|
| } |
| 1790 |
|
| |
| 1791 |
|
| /* Install variables */ |
| 1792 |
1 |
▶ | for (i = 0; swig_variables[i].name; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; swig_variables[i].name; i++) { |
0 |
1 |
1 |
|
| 1793 |
|
| SV *sv; |
| 1794 |
0 |
| sv = perl_get_sv((char*) swig_variables[i].name, TRUE | 0x2); |
| 1795 |
0 |
▶ | if (swig_variables[i].type) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (swig_variables[i].type) { |
0 |
0 |
0 |
|
| 1796 |
0 |
| SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); |
| 1797 |
|
| }else { |
| 1798 |
0 |
| sv_setiv(sv,(IV) 0); |
| 1799 |
|
| } |
| 1800 |
0 |
| swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); |
| 1801 |
|
| } |
| 1802 |
|
| |
| 1803 |
|
| /* Install constant */ |
| 1804 |
6 |
▶ | for (i = 0; swig_constants[i].type; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; swig_constants[i].type; i++) { |
5 |
1 |
6 |
|
| 1805 |
|
| SV *sv; |
| 1806 |
5 |
| sv = perl_get_sv((char*)swig_constants[i].name, TRUE | 0x2); |
| 1807 |
5 |
| switch(swig_constants[i].type) { |
| 1808 |
4 |
| case SWIG_INT: |
| 1809 |
4 |
| sv_setiv(sv, (IV) swig_constants[i].lvalue); |
| 1810 |
4 |
| break; |
| 1811 |
0 |
| case SWIG_FLOAT: |
| 1812 |
0 |
| sv_setnv(sv, (double) swig_constants[i].dvalue); |
| 1813 |
0 |
| break; |
| 1814 |
1 |
| case SWIG_STRING: |
| 1815 |
1 |
| sv_setpv(sv, (char *) swig_constants[i].pvalue); |
| 1816 |
1 |
| break; |
| 1817 |
0 |
| case SWIG_POINTER: |
| 1818 |
0 |
| SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); |
| 1819 |
0 |
| break; |
| 1820 |
0 |
| case SWIG_BINARY: |
| 1821 |
|
| /* obj = SWIG_NewPackedObj(swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); */ |
| 1822 |
0 |
| break; |
| 1823 |
0 |
| default: |
| 1824 |
0 |
| break; |
| 1825 |
|
| } |
| 1826 |
5 |
| SvREADONLY_on(sv); |
| 1827 |
|
| } |
| 1828 |
|
| |
| 1829 |
1 |
| ST(0) = &PL_sv_yes; |
| 1830 |
1 |
| XSRETURN(1); |
| 1831 |
|
| } |
| 1832 |
|
| |
| 1833 |
|
| /* |
| 1834 |
|
| Modified by Christopher Teh Boon Sung to remove compiler warnings. |
| 1835 |
|
| Modifications are denoted by comments starting with "CBSTEH". |
| 1836 |
|
| Updated: Mar. 2001 |
| 1837 |
|
| */ |
| 1838 |
|
| |
| 1839 |
|
| /* |
| 1840 |
|
| ########################################################################### |
| 1841 |
|
| |
| 1842 |
|
| Project: Generic Polygon Clipper |
| 1843 |
|
| |
| 1844 |
|
| A new algorithm for calculating the difference, intersection, |
| 1845 |
|
| exclusive-or or union of arbitrary polygon sets. |
| 1846 |
|
| |
| 1847 |
|
| File: GPC.c |
| 1848 |
|
| Author: Alan Murta (email: gpc@cs.man.ac.uk) |
| 1849 |
|
| Version: 2.31 |
| 1850 |
|
| Date: 4th June 1999 |
| 1851 |
|
| |
| 1852 |
|
| Copyright: (C) 1997-1999, Advanced Interfaces Group, |
| 1853 |
|
| University of Manchester. |
| 1854 |
|
| |
| 1855 |
|
| This software is free for non-commercial use. It may be copied, |
| 1856 |
|
| modified, and redistributed provided that this copyright notice |
| 1857 |
|
| is preserved on all copies. The intellectual property rights of |
| 1858 |
|
| the algorithms used reside with the University of Manchester |
| 1859 |
|
| Advanced Interfaces Group. |
| 1860 |
|
| |
| 1861 |
|
| You may not use this software, in whole or in part, in support |
| 1862 |
|
| of any commercial product without the express consent of the |
| 1863 |
|
| author. |
| 1864 |
|
| |
| 1865 |
|
| There is no warranty or other guarantee of fitness of this |
| 1866 |
|
| software for any purpose. It is provided solely "as is". |
| 1867 |
|
| |
| 1868 |
|
| ########################################################################### |
| 1869 |
|
| */ |
| 1870 |
|
| |
| 1871 |
|
| |
| 1872 |
|
| /* |
| 1873 |
|
| ########################################################################### |
| 1874 |
|
| Includes |
| 1875 |
|
| ########################################################################### |
| 1876 |
|
| */ |
| 1877 |
|
| |
| 1878 |
|
| #include "GPC.h" |
| 1879 |
|
| #include <stdlib.h> |
| 1880 |
|
| #include <float.h> |
| 1881 |
|
| #include <math.h> |
| 1882 |
|
| |
| 1883 |
|
| |
| 1884 |
|
| /* |
| 1885 |
|
| ########################################################################### |
| 1886 |
|
| Constants |
| 1887 |
|
| ########################################################################### |
| 1888 |
|
| */ |
| 1889 |
|
| |
| 1890 |
|
| #ifndef TRUE |
| 1891 |
|
| #define FALSE 0 |
| 1892 |
|
| #define TRUE 1 |
| 1893 |
|
| #endif |
| 1894 |
|
| |
| 1895 |
|
| #define LEFT 0 |
| 1896 |
|
| #define RIGHT 1 |
| 1897 |
|
| |
| 1898 |
|
| #define ABOVE 0 |
| 1899 |
|
| #define BELOW 1 |
| 1900 |
|
| |
| 1901 |
|
| #define CLIP 0 |
| 1902 |
|
| #define SUBJ 1 |
| 1903 |
|
| |
| 1904 |
|
| #define INVERT_TRISTRIPS FALSE |
| 1905 |
|
| |
| 1906 |
|
| |
| 1907 |
|
| /* |
| 1908 |
|
| ########################################################################### |
| 1909 |
|
| Macros |
| 1910 |
|
| ########################################################################### |
| 1911 |
|
| */ |
| 1912 |
|
| |
| 1913 |
|
| #define EQ(a, b) (fabs((a) - (b)) <= GPC_EPSILON) |
| 1914 |
|
| |
| 1915 |
|
| #define PREV_INDEX(i, n) ((i - 1 + n) % n) |
| 1916 |
|
| #define NEXT_INDEX(i, n) ((i + 1 ) % n) |
| 1917 |
|
| |
| 1918 |
|
| #define OPTIMAL(v, i, n) ((v[PREV_INDEX(i, n)].y != v[i].y) || \ |
| 1919 |
|
| (v[NEXT_INDEX(i, n)].y != v[i].y)) |
| 1920 |
|
| |
| 1921 |
|
| #define FWD_MIN(v, i, n) ((v[PREV_INDEX(i, n)].vertex.y >= v[i].vertex.y) \ |
| 1922 |
|
| && (v[NEXT_INDEX(i, n)].vertex.y > v[i].vertex.y)) |
| 1923 |
|
| |
| 1924 |
|
| #define NOT_FMAX(v, i, n) (v[NEXT_INDEX(i, n)].vertex.y > v[i].vertex.y) |
| 1925 |
|
| |
| 1926 |
|
| #define REV_MIN(v, i, n) ((v[PREV_INDEX(i, n)].vertex.y > v[i].vertex.y) \ |
| 1927 |
|
| && (v[NEXT_INDEX(i, n)].vertex.y >= v[i].vertex.y)) |
| 1928 |
|
| |
| 1929 |
|
| #define NOT_RMAX(v, i, n) (v[PREV_INDEX(i, n)].vertex.y > v[i].vertex.y) |
| 1930 |
|
| |
| 1931 |
|
| #define VERTEX(e,p,s,x,y) {add_vertex(&((e)->outp[(p)]->v[(s)]), x, y); \ |
| 1932 |
|
| (e)->outp[(p)]->active++;} |
| 1933 |
|
| |
| 1934 |
|
| #define P_EDGE(d,e,p,i,j) {(d)= (e); \ |
| 1935 |
|
| do {(d)= (d)->prev;} while (!(d)->outp[(p)]); \ |
| 1936 |
|
| (i)= (d)->bot.x + (d)->dx * ((j)-(d)->bot.y);} |
| 1937 |
|
| |
| 1938 |
|
| #define N_EDGE(d,e,p,i,j) {(d)= (e); \ |
| 1939 |
|
| do {(d)= (d)->next;} while (!(d)->outp[(p)]); \ |
| 1940 |
|
| (i)= (d)->bot.x + (d)->dx * ((j)-(d)->bot.y);} |
| 1941 |
|
| |
| 1942 |
|
| #define MALLOC(p, b, s) {if ((b) > 0) { \ |
| 1943 |
|
| p= malloc(b); if (!(p)) { \ |
| 1944 |
|
| fprintf(stderr, "GPC malloc failure: %s\n", s); \ |
| 1945 |
|
| exit(0);}} else p= NULL;} |
| 1946 |
|
| |
| 1947 |
|
| #define FREE(p) {if (p) {free(p); (p)= NULL;}} |
| 1948 |
|
| |
| 1949 |
|
| /* CBSTEH: like MALLOC but this avoids compiler warnings */ |
| 1950 |
|
| #define CMALLOC(p, b, s) { \ |
| 1951 |
|
| p = malloc(b); \ |
| 1952 |
|
| if (!p) \ |
| 1953 |
|
| { \ |
| 1954 |
|
| fprintf(stderr, "GPC malloc failure: %s\n", s); \ |
| 1955 |
|
| exit(0); \ |
| 1956 |
|
| } \ |
| 1957 |
|
| } |
| 1958 |
|
| |
| 1959 |
|
| /* CBSTEH: like FREE but this avoids compiler warnings */ |
| 1960 |
|
| #define CFREE(p) free(p); |
| 1961 |
|
| |
| 1962 |
|
| /* |
| 1963 |
|
| ########################################################################### |
| 1964 |
|
| Private Data Types |
| 1965 |
|
| ########################################################################### |
| 1966 |
|
| */ |
| 1967 |
|
| |
| 1968 |
|
| typedef enum /* Edge intersection classes */ |
| 1969 |
|
| { |
| 1970 |
|
| NUL, /* Empty non-intersection */ |
| 1971 |
|
| EMX, /* External maximum */ |
| 1972 |
|
| ELI, /* External left intermediate */ |
| 1973 |
|
| TED, /* Top edge */ |
| 1974 |
|
| ERI, /* External right intermediate */ |
| 1975 |
|
| RED, /* Right edge */ |
| 1976 |
|
| IMM, /* Internal maximum and minimum */ |
| 1977 |
|
| IMN, /* Internal minimum */ |
| 1978 |
|
| EMN, /* External minimum */ |
| 1979 |
|
| EMM, /* External maximum and minimum */ |
| 1980 |
|
| LED, /* Left edge */ |
| 1981 |
|
| ILI, /* Internal left intermediate */ |
| 1982 |
|
| BED, /* Bottom edge */ |
| 1983 |
|
| IRI, /* Internal right intermediate */ |
| 1984 |
|
| IMX, /* Internal maximum */ |
| 1985 |
|
| FUL /* Full non-intersection */ |
| 1986 |
|
| } vertex_type; |
| 1987 |
|
| |
| 1988 |
|
| typedef enum /* Horizontal edge states */ |
| 1989 |
|
| { |
| 1990 |
|
| NH, /* No horizontal edge */ |
| 1991 |
|
| BH, /* Bottom horizontal edge */ |
| 1992 |
|
| TH /* Top horizontal edge */ |
| 1993 |
|
| } h_state; |
| 1994 |
|
| |
| 1995 |
|
| typedef enum /* Edge bundle state */ |
| 1996 |
|
| { |
| 1997 |
|
| UNBUNDLED, /* Isolated edge not within a bundle */ |
| 1998 |
|
| BUNDLE_HEAD, /* Bundle head node */ |
| 1999 |
|
| BUNDLE_TAIL /* Passive bundle tail node */ |
| 2000 |
|
| } bundle_state; |
| 2001 |
|
| |
| 2002 |
|
| typedef struct v_shape /* Internal vertex list datatype */ |
| 2003 |
|
| { |
| 2004 |
|
| double x; /* X coordinate component */ |
| 2005 |
|
| double y; /* Y coordinate component */ |
| 2006 |
|
| struct v_shape *next; /* Pointer to next vertex in list */ |
| 2007 |
|
| } vertex_node; |
| 2008 |
|
| |
| 2009 |
|
| typedef struct p_shape /* Internal contour / tristrip type */ |
| 2010 |
|
| { |
| 2011 |
|
| int active; /* Active flag / vertex count */ |
| 2012 |
|
| int hole; /* Hole / external contour flag */ |
| 2013 |
|
| vertex_node *v[2]; /* Left and right vertex list ptrs */ |
| 2014 |
|
| struct p_shape *next; /* Pointer to next polygon contour */ |
| 2015 |
|
| struct p_shape *proxy; /* Pointer to actual structure used */ |
| 2016 |
|
| } polygon_node; |
| 2017 |
|
| |
| 2018 |
|
| typedef struct edge_shape |
| 2019 |
|
| { |
| 2020 |
|
| gpc_vertex vertex; /* Piggy-backed contour vertex data */ |
| 2021 |
|
| gpc_vertex bot; /* Edge lower (x, y) coordinate */ |
| 2022 |
|
| gpc_vertex top; /* Edge upper (x, y) coordinate */ |
| 2023 |
|
| double xb; /* Scanbeam bottom x coordinate */ |
| 2024 |
|
| double xt; /* Scanbeam top x coordinate */ |
| 2025 |
|
| double dx; /* Change in x for a unit y increase */ |
| 2026 |
|
| int type; /* Clip / subject edge flag */ |
| 2027 |
|
| int bundle[2][2]; /* Bundle edge flags */ |
| 2028 |
|
| int bside[2]; /* Bundle left / right indicators */ |
| 2029 |
|
| bundle_state bstate[2]; /* Edge bundle state */ |
| 2030 |
|
| polygon_node *outp[2]; /* Output polygon / tristrip pointer */ |
| 2031 |
|
| struct edge_shape *prev; /* Previous edge in the AET */ |
| 2032 |
|
| struct edge_shape *next; /* Next edge in the AET */ |
| 2033 |
|
| struct edge_shape *pred; /* Edge connected at the lower end */ |
| 2034 |
|
| struct edge_shape *succ; /* Edge connected at the upper end */ |
| 2035 |
|
| struct edge_shape *next_bound; /* Pointer to next bound in LMT */ |
| 2036 |
|
| } edge_node; |
| 2037 |
|
| |
| 2038 |
|
| typedef struct lmt_shape /* Local minima table */ |
| 2039 |
|
| { |
| 2040 |
|
| double y; /* Y coordinate at local minimum */ |
| 2041 |
|
| edge_node *first_bound; /* Pointer to bound list */ |
| 2042 |
|
| struct lmt_shape *next; /* Pointer to next local minimum */ |
| 2043 |
|
| } lmt_node; |
| 2044 |
|
| |
| 2045 |
|
| typedef struct sbt_t_shape /* Scanbeam tree */ |
| 2046 |
|
| { |
| 2047 |
|
| double y; /* Scanbeam node y value */ |
| 2048 |
|
| struct sbt_t_shape *less; /* Pointer to nodes with lower y */ |
| 2049 |
|
| struct sbt_t_shape *more; /* Pointer to nodes with higher y */ |
| 2050 |
|
| } sb_tree; |
| 2051 |
|
| |
| 2052 |
|
| typedef struct it_shape /* Intersection table */ |
| 2053 |
|
| { |
| 2054 |
|
| edge_node *ie[2]; /* Intersecting edge (bundle) pair */ |
| 2055 |
|
| gpc_vertex point; /* Point of intersection */ |
| 2056 |
|
| struct it_shape *next; /* The next intersection table node */ |
| 2057 |
|
| } it_node; |
| 2058 |
|
| |
| 2059 |
|
| typedef struct st_shape /* Sorted edge table */ |
| 2060 |
|
| { |
| 2061 |
|
| edge_node *edge; /* Pointer to AET edge */ |
| 2062 |
|
| double xb; /* Scanbeam bottom x coordinate */ |
| 2063 |
|
| double xt; /* Scanbeam top x coordinate */ |
| 2064 |
|
| double dx; /* Change in x for a unit y increase */ |
| 2065 |
|
| struct st_shape *prev; /* Previous edge in sorted list */ |
| 2066 |
|
| } st_node; |
| 2067 |
|
| |
| 2068 |
|
| typedef struct bbox_shape /* Contour axis-aligned bounding box */ |
| 2069 |
|
| { |
| 2070 |
|
| double xmin; /* Minimum x coordinate */ |
| 2071 |
|
| double ymin; /* Minimum y coordinate */ |
| 2072 |
|
| double xmax; /* Maximum x coordinate */ |
| 2073 |
|
| double ymax; /* Maximum y coordinate */ |
| 2074 |
|
| } bbox; |
| 2075 |
|
| |
| 2076 |
|
| |
| 2077 |
|
| /* |
| 2078 |
|
| ########################################################################### |
| 2079 |
|
| Global Data |
| 2080 |
|
| ########################################################################### |
| 2081 |
|
| */ |
| 2082 |
|
| |
| 2083 |
|
| /* Horizontal edge state transitions within scanbeam boundary */ |
| 2084 |
|
| const h_state next_h_state[3][6]= |
| 2085 |
|
| { |
| 2086 |
|
| /* ABOVE BELOW CROSS */ |
| 2087 |
|
| /* L R L R L R */ |
| 2088 |
|
| /* NH */ {BH, TH, TH, BH, NH, NH}, |
| 2089 |
|
| /* BH */ {NH, NH, NH, NH, TH, TH}, |
| 2090 |
|
| /* TH */ {NH, NH, NH, NH, BH, BH} |
| 2091 |
|
| }; |
| 2092 |
|
| |
| 2093 |
|
| |
| 2094 |
|
| /* |
| 2095 |
|
| ########################################################################### |
| 2096 |
|
| Private Functions |
| 2097 |
|
| ########################################################################### |
| 2098 |
|
| */ |
| 2099 |
|
| |
| 2100 |
4 |
| static void reset_it(it_node **it) |
| 2101 |
|
| { |
| 2102 |
|
| it_node *itn; |
| 2103 |
|
| |
| 2104 |
4 |
▶ | while (*it) |
Branch: 1 branch
| Branch | True | False | Total |
| while (*it) |
0 |
4 |
4 |
|
| 2105 |
|
| { |
| 2106 |
0 |
| itn= (*it)->next; |
| 2107 |
0 |
▶ | FREE(*it); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(*it); |
0 |
0 |
0 |
|
| 2108 |
0 |
| *it= itn; |
| 2109 |
|
| } |
| 2110 |
4 |
| } |
| 2111 |
|
| |
| 2112 |
|
| |
| 2113 |
1 |
| static void reset_lmt(lmt_node **lmt) |
| 2114 |
|
| { |
| 2115 |
|
| lmt_node *lmtn; |
| 2116 |
|
| |
| 2117 |
3 |
▶ | while (*lmt) |
Branch: 1 branch
| Branch | True | False | Total |
| while (*lmt) |
2 |
1 |
3 |
|
| 2118 |
|
| { |
| 2119 |
2 |
| lmtn= (*lmt)->next; |
| 2120 |
2 |
▶ | FREE(*lmt); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(*lmt); |
2 |
0 |
2 |
|
| 2121 |
2 |
| *lmt= lmtn; |
| 2122 |
|
| } |
| 2123 |
1 |
| } |
| 2124 |
|
| |
| 2125 |
|
| |
| 2126 |
6 |
| static void insert_bound(edge_node **b, edge_node *e) |
| 2127 |
|
| { |
| 2128 |
|
| edge_node *existing_bound; |
| 2129 |
|
| |
| 2130 |
6 |
▶ | if (!*b) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!*b) |
4 |
2 |
6 |
|
| 2131 |
|
| { |
| 2132 |
|
| /* Link node e to the tail of the list */ |
| 2133 |
4 |
| *b= e; |
| 2134 |
|
| } |
| 2135 |
|
| else |
| 2136 |
|
| { |
| 2137 |
|
| /* Do primary sort on the x field */ |
| 2138 |
2 |
▶ | if (e[0].bot.x < (*b)[0].bot.x) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e[0].bot.x < (*b)[0].bot.x) |
0 |
2 |
2 |
|
| 2139 |
|
| { |
| 2140 |
|
| /* Insert a new node mid-list */ |
| 2141 |
0 |
| existing_bound= *b; |
| 2142 |
0 |
| *b= e; |
| 2143 |
0 |
| (*b)->next_bound= existing_bound; |
| 2144 |
|
| } |
| 2145 |
|
| else |
| 2146 |
|
| { |
| 2147 |
2 |
▶ | if (e[0].bot.x == (*b)[0].bot.x) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e[0].bot.x == (*b)[0].bot.x) |
0 |
2 |
2 |
|
| 2148 |
|
| { |
| 2149 |
|
| /* Do secondary sort on the dx field */ |
| 2150 |
0 |
▶ | if (e[0].dx < (*b)[0].dx) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e[0].dx < (*b)[0].dx) |
0 |
0 |
0 |
|
| 2151 |
|
| { |
| 2152 |
|
| /* Insert a new node mid-list */ |
| 2153 |
0 |
| existing_bound= *b; |
| 2154 |
0 |
| *b= e; |
| 2155 |
0 |
| (*b)->next_bound= existing_bound; |
| 2156 |
|
| } |
| 2157 |
|
| else |
| 2158 |
|
| { |
| 2159 |
|
| /* Head further down the list */ |
| 2160 |
0 |
| insert_bound(&((*b)->next_bound), e); |
| 2161 |
|
| } |
| 2162 |
|
| } |
| 2163 |
|
| else |
| 2164 |
|
| { |
| 2165 |
|
| /* Head further down the list */ |
| 2166 |
2 |
| insert_bound(&((*b)->next_bound), e); |
| 2167 |
|
| } |
| 2168 |
|
| } |
| 2169 |
|
| } |
| 2170 |
6 |
| } |
| 2171 |
|
| |
| 2172 |
|
| |
| 2173 |
6 |
| static edge_node **bound_list(lmt_node **lmt, double y) |
| 2174 |
|
| { |
| 2175 |
|
| lmt_node *existing_node; |
| 2176 |
|
| |
| 2177 |
6 |
▶ | if (!*lmt) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!*lmt) |
2 |
4 |
6 |
|
| 2178 |
|
| { |
| 2179 |
|
| /* Add node onto the tail end of the LMT */ |
| 2180 |
2 |
▶ | CMALLOC(*lmt, sizeof(lmt_node), "LMT insertion"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(*lmt, sizeof(lmt_node), "LMT insertion"); /* CBSTEH */ |
0 |
2 |
2 |
|
| 2181 |
|
| |
| 2182 |
2 |
| (*lmt)->y= y; |
| 2183 |
2 |
| (*lmt)->first_bound= NULL; |
| 2184 |
2 |
| (*lmt)->next= NULL; |
| 2185 |
2 |
| return &((*lmt)->first_bound); |
| 2186 |
|
| } |
| 2187 |
|
| else |
| 2188 |
4 |
▶ | if (y < (*lmt)->y) |
Branch: 1 branch
| Branch | True | False | Total |
| if (y < (*lmt)->y) |
0 |
4 |
4 |
|
| 2189 |
|
| { |
| 2190 |
|
| /* Insert a new LMT node before the current node */ |
| 2191 |
0 |
| existing_node= *lmt; |
| 2192 |
0 |
▶ | CMALLOC(*lmt, sizeof(lmt_node), "LMT insertion"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(*lmt, sizeof(lmt_node), "LMT insertion"); /* CBSTEH */ |
0 |
0 |
0 |
|
| 2193 |
0 |
| (*lmt)->y= y; |
| 2194 |
0 |
| (*lmt)->first_bound= NULL; |
| 2195 |
0 |
| (*lmt)->next= existing_node; |
| 2196 |
0 |
| return &((*lmt)->first_bound); |
| 2197 |
|
| } |
| 2198 |
|
| else |
| 2199 |
4 |
▶ | if (y > (*lmt)->y) |
Branch: 1 branch
| Branch | True | False | Total |
| if (y > (*lmt)->y) |
2 |
2 |
4 |
|
| 2200 |
|
| /* Head further up the LMT */ |
| 2201 |
2 |
| return bound_list(&((*lmt)->next), y); |
| 2202 |
|
| else |
| 2203 |
|
| /* Use this existing LMT node */ |
| 2204 |
2 |
| return &((*lmt)->first_bound); |
| 2205 |
|
| } |
| 2206 |
|
| |
| 2207 |
|
| |
| 2208 |
18 |
| static void add_to_sbtree(int *entries, sb_tree **sbtree, double y) |
| 2209 |
|
| { |
| 2210 |
18 |
▶ | if (!*sbtree) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!*sbtree) |
4 |
14 |
18 |
|
| 2211 |
|
| { |
| 2212 |
|
| /* Add a new tree node here */ |
| 2213 |
4 |
▶ | CMALLOC(*sbtree, sizeof(sb_tree), "scanbeam tree insertion"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(*sbtree, sizeof(sb_tree), "scanbeam tree insertion"); /* CBSTEH */ |
0 |
4 |
4 |
|
| 2214 |
4 |
| (*sbtree)->y= y; |
| 2215 |
4 |
| (*sbtree)->less= NULL; |
| 2216 |
4 |
| (*sbtree)->more= NULL; |
| 2217 |
4 |
| (*entries)++; |
| 2218 |
|
| } |
| 2219 |
|
| else |
| 2220 |
|
| { |
| 2221 |
14 |
▶ | if ((*sbtree)->y > y) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((*sbtree)->y > y) |
2 |
12 |
14 |
|
| 2222 |
|
| { |
| 2223 |
|
| /* Head into the 'less' sub-tree */ |
| 2224 |
2 |
| add_to_sbtree(entries, &((*sbtree)->less), y); |
| 2225 |
|
| } |
| 2226 |
|
| else |
| 2227 |
|
| { |
| 2228 |
12 |
▶ | if ((*sbtree)->y < y) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((*sbtree)->y < y) |
8 |
4 |
12 |
|
| 2229 |
|
| { |
| 2230 |
|
| /* Head into the 'more' sub-tree */ |
| 2231 |
8 |
| add_to_sbtree(entries, &((*sbtree)->more), y); |
| 2232 |
|
| } |
| 2233 |
|
| } |
| 2234 |
|
| } |
| 2235 |
18 |
| } |
| 2236 |
|
| |
| 2237 |
|
| |
| 2238 |
4 |
| static void build_sbt(int *entries, double *sbt, sb_tree *sbtree) |
| 2239 |
|
| { |
| 2240 |
4 |
▶ | if (sbtree->less) |
Branch: 1 branch
| Branch | True | False | Total |
| if (sbtree->less) |
1 |
3 |
4 |
|
| 2241 |
1 |
| build_sbt(entries, sbt, sbtree->less); |
| 2242 |
4 |
| sbt[*entries]= sbtree->y; |
| 2243 |
4 |
| (*entries)++; |
| 2244 |
4 |
▶ | if (sbtree->more) |
Branch: 1 branch
| Branch | True | False | Total |
| if (sbtree->more) |
2 |
2 |
4 |
|
| 2245 |
2 |
| build_sbt(entries, sbt, sbtree->more); |
| 2246 |
4 |
| } |
| 2247 |
|
| |
| 2248 |
|
| |
| 2249 |
9 |
| static void free_sbtree(sb_tree **sbtree) |
| 2250 |
|
| { |
| 2251 |
9 |
▶ | if (*sbtree) |
Branch: 1 branch
| Branch | True | False | Total |
| if (*sbtree) |
4 |
5 |
9 |
|
| 2252 |
|
| { |
| 2253 |
4 |
| free_sbtree(&((*sbtree)->less)); |
| 2254 |
4 |
| free_sbtree(&((*sbtree)->more)); |
| 2255 |
4 |
▶ | FREE(*sbtree); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(*sbtree); |
4 |
0 |
4 |
|
| 2256 |
|
| } |
| 2257 |
9 |
| } |
| 2258 |
|
| |
| 2259 |
|
| |
| 2260 |
2 |
| static int count_optimal_vertices(gpc_vertex_list c) |
| 2261 |
|
| { |
| 2262 |
2 |
| int result= 0, i; |
| 2263 |
|
| |
| 2264 |
|
| /* Ignore non-contributing contours */ |
| 2265 |
2 |
▶ | if (c.num_vertices > 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (c.num_vertices > 0) |
2 |
0 |
2 |
|
| 2266 |
|
| { |
| 2267 |
10 |
▶ | for (i= 0; i < c.num_vertices; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i= 0; i < c.num_vertices; i++) |
8 |
2 |
10 |
|
| 2268 |
|
| /* Ignore superfluous vertices embedded in horizontal edges */ |
| 2269 |
8 |
▶ | if (OPTIMAL(c.vertex, i, c.num_vertices)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (OPTIMAL(c.vertex, i, c.num_vertices)) |
4 |
4 |
8 |
| if (OPTIMAL(c.vertex, i, c.num_vertices)) |
4 |
0 |
4 |
|
| 2270 |
8 |
| result++; |
| 2271 |
|
| } |
| 2272 |
2 |
| return result; |
| 2273 |
|
| } |
| 2274 |
|
| |
| 2275 |
|
| |
| 2276 |
2 |
| static edge_node *build_lmt(lmt_node **lmt, sb_tree **sbtree, |
| 2277 |
|
| int *sbt_entries, gpc_polygon *p, int type, |
| 2278 |
|
| gpc_op op) |
| 2279 |
|
| { |
| 2280 |
|
| int c, i, min, max, num_edges, v, num_vertices; |
| 2281 |
2 |
| int total_vertices= 0, e_index=0; |
| 2282 |
|
| edge_node *e, *edge_table; |
| 2283 |
|
| |
| 2284 |
4 |
▶ | for (c= 0; c < p->num_contours; c++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (c= 0; c < p->num_contours; c++) |
2 |
2 |
4 |
|
| 2285 |
2 |
| total_vertices+= count_optimal_vertices(p->contour[c]); |
| 2286 |
|
| |
| 2287 |
|
| /* Create the entire input polygon edge table in one go */ |
| 2288 |
2 |
▶ | MALLOC(edge_table, total_vertices * sizeof(edge_node), |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(edge_table, total_vertices * sizeof(edge_node), |
2 |
0 |
2 |
| MALLOC(edge_table, total_vertices * sizeof(edge_node), |
0 |
2 |
2 |
|
| 2289 |
|
| "edge table creation"); |
| 2290 |
|
| |
| 2291 |
4 |
▶ | for (c= 0; c < p->num_contours; c++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (c= 0; c < p->num_contours; c++) |
2 |
2 |
4 |
|
| 2292 |
|
| { |
| 2293 |
2 |
▶ | if (p->contour[c].num_vertices < 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p->contour[c].num_vertices < 0) |
0 |
2 |
2 |
|
| 2294 |
|
| { |
| 2295 |
|
| /* Ignore the non-contributing contour and repair the vertex count */ |
| 2296 |
0 |
| p->contour[c].num_vertices= -p->contour[c].num_vertices; |
| 2297 |
|
| } |
| 2298 |
|
| else |
| 2299 |
|
| { |
| 2300 |
|
| /* Perform contour optimisation */ |
| 2301 |
2 |
| num_vertices= 0; |
| 2302 |
10 |
▶ | for (i= 0; i < p->contour[c].num_vertices; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i= 0; i < p->contour[c].num_vertices; i++) |
8 |
2 |
10 |
|
| 2303 |
8 |
▶ | if (OPTIMAL(p->contour[c].vertex, i, p->contour[c].num_vertices)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (OPTIMAL(p->contour[c].vertex, i, p->contour[c].num_vertices)) |
4 |
4 |
8 |
| if (OPTIMAL(p->contour[c].vertex, i, p->contour[c].num_vertices)) |
4 |
0 |
4 |
|
| 2304 |
|
| { |
| 2305 |
8 |
| edge_table[num_vertices].vertex.x= p->contour[c].vertex[i].x; |
| 2306 |
8 |
| edge_table[num_vertices].vertex.y= p->contour[c].vertex[i].y; |
| 2307 |
|
| |
| 2308 |
|
| /* Record vertex in the scanbeam table */ |
| 2309 |
8 |
| add_to_sbtree(sbt_entries, sbtree, |
| 2310 |
8 |
| edge_table[num_vertices].vertex.y); |
| 2311 |
|
| |
| 2312 |
8 |
| num_vertices++; |
| 2313 |
|
| } |
| 2314 |
|
| |
| 2315 |
|
| /* Do the contour forward pass */ |
| 2316 |
10 |
▶ | for (min= 0; min < num_vertices; min++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (min= 0; min < num_vertices; min++) |
8 |
2 |
10 |
|
| 2317 |
|
| { |
| 2318 |
|
| /* If a forward local minimum... */ |
| 2319 |
8 |
▶ | if (FWD_MIN(edge_table, min, num_vertices)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (FWD_MIN(edge_table, min, num_vertices)) |
6 |
2 |
8 |
| if (FWD_MIN(edge_table, min, num_vertices)) |
2 |
4 |
6 |
|
| 2320 |
|
| { |
| 2321 |
|
| /* Search for the next local maximum... */ |
| 2322 |
2 |
| num_edges= 1; |
| 2323 |
2 |
| max= NEXT_INDEX(min, num_vertices); |
| 2324 |
2 |
▶ | while (NOT_FMAX(edge_table, max, num_vertices)) |
Branch: 1 branch
| Branch | True | False | Total |
| while (NOT_FMAX(edge_table, max, num_vertices)) |
0 |
2 |
2 |
|
| 2325 |
|
| { |
| 2326 |
0 |
| num_edges++; |
| 2327 |
0 |
| max= NEXT_INDEX(max, num_vertices); |
| 2328 |
|
| } |
| 2329 |
|
| |
| 2330 |
|
| /* Build the next edge list */ |
| 2331 |
2 |
| e= &edge_table[e_index]; |
| 2332 |
2 |
| e_index+= num_edges; |
| 2333 |
2 |
| v= min; |
| 2334 |
2 |
| e[0].bstate[BELOW]= UNBUNDLED; |
| 2335 |
2 |
| e[0].bundle[BELOW][CLIP]= FALSE; |
| 2336 |
2 |
| e[0].bundle[BELOW][SUBJ]= FALSE; |
| 2337 |
4 |
▶ | for (i= 0; i < num_edges; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i= 0; i < num_edges; i++) |
2 |
2 |
4 |
|
| 2338 |
|
| { |
| 2339 |
2 |
| e[i].xb= edge_table[v].vertex.x; |
| 2340 |
2 |
| e[i].bot.x= edge_table[v].vertex.x; |
| 2341 |
2 |
| e[i].bot.y= edge_table[v].vertex.y; |
| 2342 |
|
| |
| 2343 |
2 |
| v= NEXT_INDEX(v, num_vertices); |
| 2344 |
|
| |
| 2345 |
2 |
| e[i].top.x= edge_table[v].vertex.x; |
| 2346 |
2 |
| e[i].top.y= edge_table[v].vertex.y; |
| 2347 |
2 |
| e[i].dx= (edge_table[v].vertex.x - e[i].bot.x) / |
| 2348 |
2 |
| (e[i].top.y - e[i].bot.y); |
| 2349 |
2 |
| e[i].type= type; |
| 2350 |
2 |
| e[i].outp[ABOVE]= NULL; |
| 2351 |
2 |
| e[i].outp[BELOW]= NULL; |
| 2352 |
2 |
| e[i].next= NULL; |
| 2353 |
2 |
| e[i].prev= NULL; |
| 2354 |
0 |
▶ | e[i].succ= ((num_edges > 1) && (i < (num_edges - 1))) ? |
Branch: 1 branch
| Branch | True | False | Total |
| e[i].succ= ((num_edges > 1) && (i < (num_edges - 1))) ? |
0 |
0 |
0 |
|
| 2355 |
2 |
▶ | &(e[i + 1]) : NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| &(e[i + 1]) : NULL; |
0 |
2 |
2 |
|
| 2356 |
2 |
▶ | e[i].pred= ((num_edges > 1) && (i > 0)) ? &(e[i - 1]) : NULL; |
Branch: 2 branches
| Branch | True | False | Total |
| e[i].pred= ((num_edges > 1) && (i > 0)) ? &(e[i - 1]) : NULL; |
0 |
2 |
2 |
| e[i].pred= ((num_edges > 1) && (i > 0)) ? &(e[i - 1]) : NULL; |
0 |
0 |
0 |
|
| 2357 |
2 |
| e[i].next_bound= NULL; |
| 2358 |
2 |
| e[i].bside[CLIP]= (op == GPC_DIFF) ? RIGHT : LEFT; |
| 2359 |
2 |
| e[i].bside[SUBJ]= LEFT; |
| 2360 |
|
| } |
| 2361 |
2 |
| insert_bound(bound_list(lmt, edge_table[min].vertex.y), e); |
| 2362 |
|
| } |
| 2363 |
|
| } |
| 2364 |
|
| |
| 2365 |
|
| /* Do the contour reverse pass */ |
| 2366 |
10 |
▶ | for (min= 0; min < num_vertices; min++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (min= 0; min < num_vertices; min++) |
8 |
2 |
10 |
|
| 2367 |
|
| { |
| 2368 |
|
| /* If a reverse local minimum... */ |
| 2369 |
8 |
▶ | if (REV_MIN(edge_table, min, num_vertices)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (REV_MIN(edge_table, min, num_vertices)) |
2 |
6 |
8 |
| if (REV_MIN(edge_table, min, num_vertices)) |
2 |
0 |
2 |
|
| 2370 |
|
| { |
| 2371 |
|
| /* Search for the previous local maximum... */ |
| 2372 |
2 |
| num_edges= 1; |
| 2373 |
2 |
| max= PREV_INDEX(min, num_vertices); |
| 2374 |
2 |
▶ | while (NOT_RMAX(edge_table, max, num_vertices)) |
Branch: 1 branch
| Branch | True | False | Total |
| while (NOT_RMAX(edge_table, max, num_vertices)) |
0 |
2 |
2 |
|
| 2375 |
|
| { |
| 2376 |
0 |
| num_edges++; |
| 2377 |
0 |
| max= PREV_INDEX(max, num_vertices); |
| 2378 |
|
| } |
| 2379 |
|
| |
| 2380 |
|
| /* Build the previous edge list */ |
| 2381 |
2 |
| e= &edge_table[e_index]; |
| 2382 |
2 |
| e_index+= num_edges; |
| 2383 |
2 |
| v= min; |
| 2384 |
2 |
| e[0].bstate[BELOW]= UNBUNDLED; |
| 2385 |
2 |
| e[0].bundle[BELOW][CLIP]= FALSE; |
| 2386 |
2 |
| e[0].bundle[BELOW][SUBJ]= FALSE; |
| 2387 |
4 |
▶ | for (i= 0; i < num_edges; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i= 0; i < num_edges; i++) |
2 |
2 |
4 |
|
| 2388 |
|
| { |
| 2389 |
2 |
| e[i].xb= edge_table[v].vertex.x; |
| 2390 |
2 |
| e[i].bot.x= edge_table[v].vertex.x; |
| 2391 |
2 |
| e[i].bot.y= edge_table[v].vertex.y; |
| 2392 |
|
| |
| 2393 |
2 |
| v= PREV_INDEX(v, num_vertices); |
| 2394 |
|
| |
| 2395 |
2 |
| e[i].top.x= edge_table[v].vertex.x; |
| 2396 |
2 |
| e[i].top.y= edge_table[v].vertex.y; |
| 2397 |
2 |
| e[i].dx= (edge_table[v].vertex.x - e[i].bot.x) / |
| 2398 |
2 |
| (e[i].top.y - e[i].bot.y); |
| 2399 |
2 |
| e[i].type= type; |
| 2400 |
2 |
| e[i].outp[ABOVE]= NULL; |
| 2401 |
2 |
| e[i].outp[BELOW]= NULL; |
| 2402 |
2 |
| e[i].next= NULL; |
| 2403 |
2 |
| e[i].prev= NULL; |
| 2404 |
0 |
▶ | e[i].succ= ((num_edges > 1) && (i < (num_edges - 1))) ? |
Branch: 1 branch
| Branch | True | False | Total |
| e[i].succ= ((num_edges > 1) && (i < (num_edges - 1))) ? |
0 |
0 |
0 |
|
| 2405 |
2 |
▶ | &(e[i + 1]) : NULL; |
Branch: 1 branch
| Branch | True | False | Total |
| &(e[i + 1]) : NULL; |
0 |
2 |
2 |
|
| 2406 |
2 |
▶ | e[i].pred= ((num_edges > 1) && (i > 0)) ? &(e[i - 1]) : NULL; |
Branch: 2 branches
| Branch | True | False | Total |
| e[i].pred= ((num_edges > 1) && (i > 0)) ? &(e[i - 1]) : NULL; |
0 |
2 |
2 |
| e[i].pred= ((num_edges > 1) && (i > 0)) ? &(e[i - 1]) : NULL; |
0 |
0 |
0 |
|
| 2407 |
2 |
| e[i].next_bound= NULL; |
| 2408 |
2 |
| e[i].bside[CLIP]= (op == GPC_DIFF) ? RIGHT : LEFT; |
| 2409 |
2 |
| e[i].bside[SUBJ]= LEFT; |
| 2410 |
|
| } |
| 2411 |
2 |
| insert_bound(bound_list(lmt, edge_table[min].vertex.y), e); |
| 2412 |
|
| } |
| 2413 |
|
| } |
| 2414 |
|
| } |
| 2415 |
|
| } |
| 2416 |
2 |
| return edge_table; |
| 2417 |
|
| } |
| 2418 |
|
| |
| 2419 |
|
| |
| 2420 |
9 |
| static void add_edge_to_aet(edge_node **aet, edge_node *edge, edge_node *prev) |
| 2421 |
|
| { |
| 2422 |
9 |
▶ | if (!*aet) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!*aet) |
3 |
6 |
9 |
|
| 2423 |
|
| { |
| 2424 |
|
| /* Append edge onto the tail end of the AET */ |
| 2425 |
3 |
| *aet= edge; |
| 2426 |
3 |
| edge->prev= prev; |
| 2427 |
3 |
| edge->next= NULL; |
| 2428 |
|
| } |
| 2429 |
|
| else |
| 2430 |
|
| { |
| 2431 |
|
| /* Do primary sort on the xb field */ |
| 2432 |
6 |
▶ | if (edge->xb < (*aet)->xb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->xb < (*aet)->xb) |
1 |
5 |
6 |
|
| 2433 |
|
| { |
| 2434 |
|
| /* Insert edge here (before the AET edge) */ |
| 2435 |
1 |
| edge->prev= prev; |
| 2436 |
1 |
| edge->next= *aet; |
| 2437 |
1 |
| (*aet)->prev= edge; |
| 2438 |
1 |
| *aet= edge; |
| 2439 |
|
| } |
| 2440 |
|
| else |
| 2441 |
|
| { |
| 2442 |
5 |
▶ | if (edge->xb == (*aet)->xb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->xb == (*aet)->xb) |
0 |
5 |
5 |
|
| 2443 |
|
| { |
| 2444 |
|
| /* Do secondary sort on the dx field */ |
| 2445 |
0 |
▶ | if (edge->dx < (*aet)->dx) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->dx < (*aet)->dx) |
0 |
0 |
0 |
|
| 2446 |
|
| { |
| 2447 |
|
| /* Insert edge here (before the AET edge) */ |
| 2448 |
0 |
| edge->prev= prev; |
| 2449 |
0 |
| edge->next= *aet; |
| 2450 |
0 |
| (*aet)->prev= edge; |
| 2451 |
0 |
| *aet= edge; |
| 2452 |
|
| } |
| 2453 |
|
| else |
| 2454 |
|
| { |
| 2455 |
|
| /* Head further into the AET */ |
| 2456 |
0 |
| add_edge_to_aet(&((*aet)->next), edge, *aet); |
| 2457 |
|
| } |
| 2458 |
|
| } |
| 2459 |
|
| else |
| 2460 |
|
| { |
| 2461 |
|
| /* Head further into the AET */ |
| 2462 |
5 |
| add_edge_to_aet(&((*aet)->next), edge, *aet); |
| 2463 |
|
| } |
| 2464 |
|
| } |
| 2465 |
|
| } |
| 2466 |
9 |
| } |
| 2467 |
|
| |
| 2468 |
|
| |
| 2469 |
0 |
| static void add_intersection(it_node **it, edge_node *edge0, edge_node *edge1, |
| 2470 |
|
| double x, double y) |
| 2471 |
|
| { |
| 2472 |
|
| it_node *existing_node; |
| 2473 |
|
| |
| 2474 |
0 |
▶ | if (!*it) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!*it) |
0 |
0 |
0 |
|
| 2475 |
|
| { |
| 2476 |
|
| /* Append a new node to the tail of the list */ |
| 2477 |
0 |
▶ | CMALLOC(*it, sizeof(it_node), "IT insertion"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(*it, sizeof(it_node), "IT insertion"); /* CBSTEH */ |
0 |
0 |
0 |
|
| 2478 |
0 |
| (*it)->ie[0]= edge0; |
| 2479 |
0 |
| (*it)->ie[1]= edge1; |
| 2480 |
0 |
| (*it)->point.x= x; |
| 2481 |
0 |
| (*it)->point.y= y; |
| 2482 |
0 |
| (*it)->next= NULL; |
| 2483 |
|
| } |
| 2484 |
|
| else |
| 2485 |
|
| { |
| 2486 |
0 |
▶ | if ((*it)->point.y > y) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((*it)->point.y > y) |
0 |
0 |
0 |
|
| 2487 |
|
| { |
| 2488 |
|
| /* Insert a new node mid-list */ |
| 2489 |
0 |
| existing_node= *it; |
| 2490 |
0 |
▶ | CMALLOC(*it, sizeof(it_node), "IT insertion"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(*it, sizeof(it_node), "IT insertion"); /* CBSTEH */ |
0 |
0 |
0 |
|
| 2491 |
0 |
| (*it)->ie[0]= edge0; |
| 2492 |
0 |
| (*it)->ie[1]= edge1; |
| 2493 |
0 |
| (*it)->point.x= x; |
| 2494 |
0 |
| (*it)->point.y= y; |
| 2495 |
0 |
| (*it)->next= existing_node; |
| 2496 |
|
| } |
| 2497 |
|
| else |
| 2498 |
|
| /* Head further down the list */ |
| 2499 |
0 |
| add_intersection(&((*it)->next), edge0, edge1, x, y); |
| 2500 |
|
| } |
| 2501 |
0 |
| } |
| 2502 |
|
| |
| 2503 |
|
| |
| 2504 |
8 |
| static void add_st_edge(st_node **st, it_node **it, edge_node *edge, |
| 2505 |
|
| double dy) |
| 2506 |
|
| { |
| 2507 |
|
| st_node *existing_node; |
| 2508 |
|
| double den, r, x, y; |
| 2509 |
|
| |
| 2510 |
8 |
▶ | if (!*st) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!*st) |
3 |
5 |
8 |
|
| 2511 |
|
| { |
| 2512 |
|
| /* Append edge onto the tail end of the ST */ |
| 2513 |
3 |
▶ | CMALLOC(*st, sizeof(st_node), "ST insertion"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(*st, sizeof(st_node), "ST insertion"); /* CBSTEH */ |
0 |
3 |
3 |
|
| 2514 |
3 |
| (*st)->edge= edge; |
| 2515 |
3 |
| (*st)->xb= edge->xb; |
| 2516 |
3 |
| (*st)->xt= edge->xt; |
| 2517 |
3 |
| (*st)->dx= edge->dx; |
| 2518 |
3 |
| (*st)->prev= NULL; |
| 2519 |
|
| } |
| 2520 |
|
| else |
| 2521 |
|
| { |
| 2522 |
5 |
| den= ((*st)->xt - (*st)->xb) - (edge->xt - edge->xb); |
| 2523 |
|
| |
| 2524 |
|
| /* If new edge and ST edge don't cross */ |
| 2525 |
5 |
▶ | if ((edge->xt >= (*st)->xt) || (edge->dx == (*st)->dx) || |
Branch: 2 branches
| Branch | True | False | Total |
| if ((edge->xt >= (*st)->xt) || (edge->dx == (*st)->dx) || |
0 |
5 |
5 |
| if ((edge->xt >= (*st)->xt) || (edge->dx == (*st)->dx) || |
0 |
0 |
0 |
|
| 2526 |
0 |
▶ | (fabs(den) <= DBL_EPSILON)) |
Branch: 1 branch
| Branch | True | False | Total |
| (fabs(den) <= DBL_EPSILON)) |
0 |
0 |
0 |
|
| 2527 |
|
| { |
| 2528 |
|
| /* No intersection - insert edge here (before the ST edge) */ |
| 2529 |
5 |
| existing_node= *st; |
| 2530 |
5 |
▶ | CMALLOC(*st, sizeof(st_node), "ST insertion"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(*st, sizeof(st_node), "ST insertion"); /* CBSTEH */ |
0 |
5 |
5 |
|
| 2531 |
5 |
| (*st)->edge= edge; |
| 2532 |
5 |
| (*st)->xb= edge->xb; |
| 2533 |
5 |
| (*st)->xt= edge->xt; |
| 2534 |
5 |
| (*st)->dx= edge->dx; |
| 2535 |
5 |
| (*st)->prev= existing_node; |
| 2536 |
|
| } |
| 2537 |
|
| else |
| 2538 |
|
| { |
| 2539 |
|
| /* Compute intersection between new edge and ST edge */ |
| 2540 |
0 |
| r= (edge->xb - (*st)->xb) / den; |
| 2541 |
0 |
| x= (*st)->xb + r * ((*st)->xt - (*st)->xb); |
| 2542 |
0 |
| y= r * dy; |
| 2543 |
|
| |
| 2544 |
|
| /* Insert the edge pointers and the intersection point in the IT */ |
| 2545 |
0 |
| add_intersection(it, (*st)->edge, edge, x, y); |
| 2546 |
|
| |
| 2547 |
|
| /* Head further into the ST */ |
| 2548 |
0 |
| add_st_edge(&((*st)->prev), it, edge, dy); |
| 2549 |
|
| } |
| 2550 |
|
| } |
| 2551 |
8 |
| } |
| 2552 |
|
| |
| 2553 |
|
| |
| 2554 |
3 |
| static void build_intersection_table(it_node **it, edge_node *aet, double dy) |
| 2555 |
|
| { |
| 2556 |
|
| st_node *st, *stp; |
| 2557 |
|
| edge_node *edge; |
| 2558 |
|
| |
| 2559 |
|
| /* Build intersection table for the current scanbeam */ |
| 2560 |
3 |
| reset_it(it); |
| 2561 |
3 |
| st= NULL; |
| 2562 |
|
| |
| 2563 |
|
| /* Process each AET edge */ |
| 2564 |
11 |
▶ | for (edge= aet; edge; edge= edge->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (edge= aet; edge; edge= edge->next) |
8 |
3 |
11 |
|
| 2565 |
|
| { |
| 2566 |
8 |
▶ | if ((edge->bstate[ABOVE] == BUNDLE_HEAD) || |
Branch: 1 branch
| Branch | True | False | Total |
| if ((edge->bstate[ABOVE] == BUNDLE_HEAD) || |
8 |
0 |
8 |
|
| 2567 |
8 |
▶ | edge->bundle[ABOVE][CLIP] || edge->bundle[ABOVE][SUBJ]) |
Branch: 2 branches
| Branch | True | False | Total |
| edge->bundle[ABOVE][CLIP] || edge->bundle[ABOVE][SUBJ]) |
4 |
4 |
8 |
| edge->bundle[ABOVE][CLIP] || edge->bundle[ABOVE][SUBJ]) |
4 |
0 |
4 |
|
| 2568 |
8 |
| add_st_edge(&st, it, edge, dy); |
| 2569 |
|
| } |
| 2570 |
|
| |
| 2571 |
|
| /* Free the sorted edge table */ |
| 2572 |
11 |
▶ | while (st) |
Branch: 1 branch
| Branch | True | False | Total |
| while (st) |
8 |
3 |
11 |
|
| 2573 |
|
| { |
| 2574 |
8 |
| stp= st->prev; |
| 2575 |
8 |
▶ | FREE(st); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(st); |
8 |
0 |
8 |
|
| 2576 |
8 |
| st= stp; |
| 2577 |
|
| } |
| 2578 |
3 |
| } |
| 2579 |
|
| |
| 2580 |
1 |
| static int count_contours(polygon_node *polygon) |
| 2581 |
|
| { |
| 2582 |
|
| int nc, nv; |
| 2583 |
|
| vertex_node *v, *nextv; |
| 2584 |
|
| |
| 2585 |
2 |
▶ | for (nc= 0; polygon; polygon= polygon->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (nc= 0; polygon; polygon= polygon->next) |
1 |
1 |
2 |
|
| 2586 |
1 |
▶ | if (polygon->active) |
Branch: 1 branch
| Branch | True | False | Total |
| if (polygon->active) |
1 |
0 |
1 |
|
| 2587 |
|
| { |
| 2588 |
|
| /* Count the vertices in the current contour */ |
| 2589 |
1 |
| nv= 0; |
| 2590 |
9 |
▶ | for (v= polygon->proxy->v[LEFT]; v; v= v->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (v= polygon->proxy->v[LEFT]; v; v= v->next) |
8 |
1 |
9 |
|
| 2591 |
8 |
| nv++; |
| 2592 |
|
| |
| 2593 |
|
| /* Record valid vertex counts in the active field */ |
| 2594 |
1 |
▶ | if (nv > 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (nv > 2) |
1 |
0 |
1 |
|
| 2595 |
|
| { |
| 2596 |
1 |
| polygon->active= nv; |
| 2597 |
1 |
| nc++; |
| 2598 |
|
| } |
| 2599 |
|
| else |
| 2600 |
|
| { |
| 2601 |
|
| /* Invalid contour: just free the heap */ |
| 2602 |
0 |
▶ | for (v= polygon->proxy->v[LEFT]; v; v= nextv) |
Branch: 1 branch
| Branch | True | False | Total |
| for (v= polygon->proxy->v[LEFT]; v; v= nextv) |
0 |
0 |
0 |
|
| 2603 |
|
| { |
| 2604 |
0 |
| nextv= v->next; |
| 2605 |
0 |
| CFREE(v); /* CBSTEH */ |
| 2606 |
|
| } |
| 2607 |
0 |
| polygon->active= 0; |
| 2608 |
|
| } |
| 2609 |
|
| } |
| 2610 |
1 |
| return nc; |
| 2611 |
|
| } |
| 2612 |
|
| |
| 2613 |
|
| |
| 2614 |
4 |
| static void add_left(polygon_node *p, double x, double y) |
| 2615 |
|
| { |
| 2616 |
|
| vertex_node *nv; |
| 2617 |
|
| |
| 2618 |
|
| /* Create a new vertex node and set its fields */ |
| 2619 |
4 |
▶ | CMALLOC(nv, sizeof(vertex_node), "vertex node creation"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(nv, sizeof(vertex_node), "vertex node creation"); /* CBSTEH */ |
0 |
4 |
4 |
|
| 2620 |
4 |
| nv->x= x; |
| 2621 |
4 |
| nv->y= y; |
| 2622 |
|
| |
| 2623 |
|
| /* Add vertex nv to the left end of the polygon's vertex list */ |
| 2624 |
4 |
| nv->next= p->proxy->v[LEFT]; |
| 2625 |
|
| |
| 2626 |
|
| /* Update proxy->[LEFT] to point to nv */ |
| 2627 |
4 |
| p->proxy->v[LEFT]= nv; |
| 2628 |
4 |
| } |
| 2629 |
|
| |
| 2630 |
|
| |
| 2631 |
0 |
| static void merge_left(polygon_node *p, polygon_node *q, polygon_node *list) |
| 2632 |
|
| { |
| 2633 |
|
| polygon_node *target; |
| 2634 |
|
| |
| 2635 |
|
| /* Label contour as a hole */ |
| 2636 |
0 |
| q->proxy->hole= TRUE; |
| 2637 |
|
| |
| 2638 |
0 |
▶ | if (p->proxy != q->proxy) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p->proxy != q->proxy) |
0 |
0 |
0 |
|
| 2639 |
|
| { |
| 2640 |
|
| /* Assign p's vertex list to the left end of q's list */ |
| 2641 |
0 |
| p->proxy->v[RIGHT]->next= q->proxy->v[LEFT]; |
| 2642 |
0 |
| q->proxy->v[LEFT]= p->proxy->v[LEFT]; |
| 2643 |
|
| |
| 2644 |
|
| /* Redirect any p->proxy references to q->proxy */ |
| 2645 |
|
| |
| 2646 |
0 |
▶ | for (target= p->proxy; list; list= list->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (target= p->proxy; list; list= list->next) |
0 |
0 |
0 |
|
| 2647 |
|
| { |
| 2648 |
0 |
▶ | if (list->proxy == target) |
Branch: 1 branch
| Branch | True | False | Total |
| if (list->proxy == target) |
0 |
0 |
0 |
|
| 2649 |
|
| { |
| 2650 |
0 |
| list->active= FALSE; |
| 2651 |
0 |
| list->proxy= q->proxy; |
| 2652 |
|
| } |
| 2653 |
|
| } |
| 2654 |
|
| } |
| 2655 |
0 |
| } |
| 2656 |
|
| |
| 2657 |
|
| |
| 2658 |
3 |
| static void add_right(polygon_node *p, double x, double y) |
| 2659 |
|
| { |
| 2660 |
|
| vertex_node *nv; |
| 2661 |
|
| |
| 2662 |
|
| /* Create a new vertex node and set its fields */ |
| 2663 |
3 |
▶ | CMALLOC(nv, sizeof(vertex_node), "vertex node creation"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(nv, sizeof(vertex_node), "vertex node creation"); /* CBSTEH */ |
0 |
3 |
3 |
|
| 2664 |
3 |
| nv->x= x; |
| 2665 |
3 |
| nv->y= y; |
| 2666 |
3 |
| nv->next= NULL; |
| 2667 |
|
| |
| 2668 |
|
| /* Add vertex nv to the right end of the polygon's vertex list */ |
| 2669 |
3 |
| p->proxy->v[RIGHT]->next= nv; |
| 2670 |
|
| |
| 2671 |
|
| /* Update proxy->v[RIGHT] to point to nv */ |
| 2672 |
3 |
| p->proxy->v[RIGHT]= nv; |
| 2673 |
3 |
| } |
| 2674 |
|
| |
| 2675 |
|
| |
| 2676 |
1 |
| static void merge_right(polygon_node *p, polygon_node *q, polygon_node *list) |
| 2677 |
|
| { |
| 2678 |
|
| polygon_node *target; |
| 2679 |
|
| |
| 2680 |
|
| /* Label contour as external */ |
| 2681 |
1 |
| q->proxy->hole= FALSE; |
| 2682 |
|
| |
| 2683 |
1 |
▶ | if (p->proxy != q->proxy) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p->proxy != q->proxy) |
0 |
1 |
1 |
|
| 2684 |
|
| { |
| 2685 |
|
| /* Assign p's vertex list to the right end of q's list */ |
| 2686 |
0 |
| q->proxy->v[RIGHT]->next= p->proxy->v[LEFT]; |
| 2687 |
0 |
| q->proxy->v[RIGHT]= p->proxy->v[RIGHT]; |
| 2688 |
|
| |
| 2689 |
|
| /* Redirect any p->proxy references to q->proxy */ |
| 2690 |
0 |
▶ | for (target= p->proxy; list; list= list->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (target= p->proxy; list; list= list->next) |
0 |
0 |
0 |
|
| 2691 |
|
| { |
| 2692 |
0 |
▶ | if (list->proxy == target) |
Branch: 1 branch
| Branch | True | False | Total |
| if (list->proxy == target) |
0 |
0 |
0 |
|
| 2693 |
|
| { |
| 2694 |
0 |
| list->active= FALSE; |
| 2695 |
0 |
| list->proxy= q->proxy; |
| 2696 |
|
| } |
| 2697 |
|
| } |
| 2698 |
|
| } |
| 2699 |
1 |
| } |
| 2700 |
|
| |
| 2701 |
|
| |
| 2702 |
1 |
| static void add_local_min(polygon_node **p, edge_node *edge, |
| 2703 |
|
| double x, double y) |
| 2704 |
|
| { |
| 2705 |
|
| polygon_node *existing_min; |
| 2706 |
|
| vertex_node *nv; |
| 2707 |
|
| |
| 2708 |
1 |
| existing_min= *p; |
| 2709 |
|
| |
| 2710 |
1 |
▶ | CMALLOC(*p, sizeof(polygon_node), "polygon node creation"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(*p, sizeof(polygon_node), "polygon node creation"); /* CBSTEH */ |
0 |
1 |
1 |
|
| 2711 |
|
| |
| 2712 |
|
| /* Create a new vertex node and set its fields */ |
| 2713 |
1 |
▶ | CMALLOC(nv, sizeof(vertex_node), "vertex node creation"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(nv, sizeof(vertex_node), "vertex node creation"); /* CBSTEH */ |
0 |
1 |
1 |
|
| 2714 |
1 |
| nv->x= x; |
| 2715 |
1 |
| nv->y= y; |
| 2716 |
1 |
| nv->next= NULL; |
| 2717 |
|
| |
| 2718 |
|
| /* Initialise proxy to point to p itself */ |
| 2719 |
1 |
| (*p)->proxy= (*p); |
| 2720 |
1 |
| (*p)->active= TRUE; |
| 2721 |
1 |
| (*p)->next= existing_min; |
| 2722 |
|
| |
| 2723 |
|
| /* Make v[LEFT] and v[RIGHT] point to new vertex nv */ |
| 2724 |
1 |
| (*p)->v[LEFT]= nv; |
| 2725 |
1 |
| (*p)->v[RIGHT]= nv; |
| 2726 |
|
| |
| 2727 |
|
| /* Assign polygon p to the edge */ |
| 2728 |
1 |
| edge->outp[ABOVE]= *p; |
| 2729 |
1 |
| } |
| 2730 |
|
| |
| 2731 |
|
| |
| 2732 |
0 |
| static int count_tristrips(polygon_node *tn) |
| 2733 |
|
| { |
| 2734 |
|
| int total; |
| 2735 |
|
| |
| 2736 |
0 |
▶ | for (total= 0; tn; tn= tn->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (total= 0; tn; tn= tn->next) |
0 |
0 |
0 |
|
| 2737 |
0 |
▶ | if (tn->active > 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (tn->active > 2) |
0 |
0 |
0 |
|
| 2738 |
0 |
| total++; |
| 2739 |
0 |
| return total; |
| 2740 |
|
| } |
| 2741 |
|
| |
| 2742 |
|
| |
| 2743 |
0 |
| static void add_vertex(vertex_node **t, double x, double y) |
| 2744 |
|
| { |
| 2745 |
0 |
▶ | if (!(*t)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!(*t)) |
0 |
0 |
0 |
|
| 2746 |
|
| { |
| 2747 |
0 |
▶ | CMALLOC(*t, sizeof(vertex_node), "tristrip vertex creation"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(*t, sizeof(vertex_node), "tristrip vertex creation"); /* CBSTEH */ |
0 |
0 |
0 |
|
| 2748 |
0 |
| (*t)->x= x; |
| 2749 |
0 |
| (*t)->y= y; |
| 2750 |
0 |
| (*t)->next= NULL; |
| 2751 |
|
| } |
| 2752 |
|
| else |
| 2753 |
|
| /* Head further down the list */ |
| 2754 |
0 |
| add_vertex(&((*t)->next), x, y); |
| 2755 |
0 |
| } |
| 2756 |
|
| |
| 2757 |
|
| |
| 2758 |
0 |
| static void new_tristrip(polygon_node **tn, edge_node *edge, |
| 2759 |
|
| double x, double y) |
| 2760 |
|
| { |
| 2761 |
0 |
▶ | if (!(*tn)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!(*tn)) |
0 |
0 |
0 |
|
| 2762 |
|
| { |
| 2763 |
0 |
▶ | CMALLOC(*tn, sizeof(polygon_node), "tristrip node creation"); /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| CMALLOC(*tn, sizeof(polygon_node), "tristrip node creation"); /* CBSTEH */ |
0 |
0 |
0 |
|
| 2764 |
0 |
| (*tn)->next= NULL; |
| 2765 |
0 |
| (*tn)->v[LEFT]= NULL; |
| 2766 |
0 |
| (*tn)->v[RIGHT]= NULL; |
| 2767 |
0 |
| (*tn)->active= 1; |
| 2768 |
0 |
| add_vertex(&((*tn)->v[LEFT]), x, y); |
| 2769 |
0 |
| edge->outp[ABOVE]= *tn; |
| 2770 |
|
| } |
| 2771 |
|
| else |
| 2772 |
|
| /* Head further down the list */ |
| 2773 |
0 |
| new_tristrip(&((*tn)->next), edge, x, y); |
| 2774 |
0 |
| } |
| 2775 |
|
| |
| 2776 |
|
| |
| 2777 |
0 |
| static bbox *create_contour_bboxes(gpc_polygon *p) |
| 2778 |
|
| { |
| 2779 |
|
| bbox *box; |
| 2780 |
|
| int c, v; |
| 2781 |
|
| |
| 2782 |
0 |
▶ | MALLOC(box, p->num_contours * sizeof(bbox), "Bounding box creation"); |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(box, p->num_contours * sizeof(bbox), "Bounding box creation"); |
0 |
0 |
0 |
| MALLOC(box, p->num_contours * sizeof(bbox), "Bounding box creation"); |
0 |
0 |
0 |
|
| 2783 |
|
| |
| 2784 |
|
| /* Construct contour bounding boxes */ |
| 2785 |
0 |
▶ | for (c= 0; c < p->num_contours; c++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (c= 0; c < p->num_contours; c++) |
0 |
0 |
0 |
|
| 2786 |
|
| { |
| 2787 |
|
| /* Initialise bounding box extent */ |
| 2788 |
0 |
| box[c].xmin= DBL_MAX; |
| 2789 |
0 |
| box[c].ymin= DBL_MAX; |
| 2790 |
0 |
| box[c].xmax= -DBL_MAX; |
| 2791 |
0 |
| box[c].ymax= -DBL_MAX; |
| 2792 |
|
| |
| 2793 |
0 |
▶ | for (v= 0; v < p->contour[c].num_vertices; v++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (v= 0; v < p->contour[c].num_vertices; v++) |
0 |
0 |
0 |
|
| 2794 |
|
| { |
| 2795 |
|
| /* Adjust bounding box */ |
| 2796 |
0 |
▶ | if (p->contour[c].vertex[v].x < box[c].xmin) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p->contour[c].vertex[v].x < box[c].xmin) |
0 |
0 |
0 |
|
| 2797 |
0 |
| box[c].xmin= p->contour[c].vertex[v].x; |
| 2798 |
0 |
▶ | if (p->contour[c].vertex[v].y < box[c].ymin) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p->contour[c].vertex[v].y < box[c].ymin) |
0 |
0 |
0 |
|
| 2799 |
0 |
| box[c].ymin= p->contour[c].vertex[v].y; |
| 2800 |
0 |
▶ | if (p->contour[c].vertex[v].x > box[c].xmax) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p->contour[c].vertex[v].x > box[c].xmax) |
0 |
0 |
0 |
|
| 2801 |
0 |
| box[c].xmax= p->contour[c].vertex[v].x; |
| 2802 |
0 |
▶ | if (p->contour[c].vertex[v].y > box[c].ymax) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p->contour[c].vertex[v].y > box[c].ymax) |
0 |
0 |
0 |
|
| 2803 |
0 |
| box[c].ymax= p->contour[c].vertex[v].y; |
| 2804 |
|
| } |
| 2805 |
|
| } |
| 2806 |
0 |
| return box; |
| 2807 |
|
| } |
| 2808 |
|
| |
| 2809 |
|
| |
| 2810 |
0 |
| static void minimax_test(gpc_polygon *subj, gpc_polygon *clip, gpc_op op) |
| 2811 |
|
| { |
| 2812 |
|
| bbox *s_bbox, *c_bbox; |
| 2813 |
|
| int s, c, *o_table, overlap; |
| 2814 |
|
| |
| 2815 |
0 |
| s_bbox= create_contour_bboxes(subj); |
| 2816 |
0 |
| c_bbox= create_contour_bboxes(clip); |
| 2817 |
|
| |
| 2818 |
0 |
▶ | MALLOC(o_table, subj->num_contours * clip->num_contours * sizeof(int), |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(o_table, subj->num_contours * clip->num_contours * sizeof(int), |
0 |
0 |
0 |
| MALLOC(o_table, subj->num_contours * clip->num_contours * sizeof(int), |
0 |
0 |
0 |
|
| 2819 |
|
| "overlap table creation"); |
| 2820 |
|
| |
| 2821 |
|
| /* Check all subject contour bounding boxes against clip boxes */ |
| 2822 |
0 |
▶ | for (s= 0; s < subj->num_contours; s++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (s= 0; s < subj->num_contours; s++) |
0 |
0 |
0 |
|
| 2823 |
0 |
▶ | for (c= 0; c < clip->num_contours; c++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (c= 0; c < clip->num_contours; c++) |
0 |
0 |
0 |
|
| 2824 |
0 |
| o_table[c * subj->num_contours + s]= |
| 2825 |
0 |
| (!((s_bbox[s].xmax < c_bbox[c].xmin) || |
| 2826 |
0 |
▶ | (s_bbox[s].xmin > c_bbox[c].xmax))) && |
Branch: 2 branches
| Branch | True | False | Total |
| (s_bbox[s].xmin > c_bbox[c].xmax))) && |
0 |
0 |
0 |
| (s_bbox[s].xmin > c_bbox[c].xmax))) && |
0 |
0 |
0 |
|
| 2827 |
0 |
▶ | (!((s_bbox[s].ymax < c_bbox[c].ymin) || |
Branch: 1 branch
| Branch | True | False | Total |
| (!((s_bbox[s].ymax < c_bbox[c].ymin) || |
0 |
0 |
0 |
|
| 2828 |
0 |
▶ | (s_bbox[s].ymin > c_bbox[c].ymax))); |
Branch: 1 branch
| Branch | True | False | Total |
| (s_bbox[s].ymin > c_bbox[c].ymax))); |
0 |
0 |
0 |
|
| 2829 |
|
| |
| 2830 |
|
| /* For each clip contour, search for any subject contour overlaps */ |
| 2831 |
0 |
▶ | for (c= 0; c < clip->num_contours; c++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (c= 0; c < clip->num_contours; c++) |
0 |
0 |
0 |
|
| 2832 |
|
| { |
| 2833 |
0 |
| overlap= 0; |
| 2834 |
0 |
▶ | for (s= 0; (!overlap) && (s < subj->num_contours); s++) |
Branch: 2 branches
| Branch | True | False | Total |
| for (s= 0; (!overlap) && (s < subj->num_contours); s++) |
0 |
0 |
0 |
| for (s= 0; (!overlap) && (s < subj->num_contours); s++) |
0 |
0 |
0 |
|
| 2835 |
0 |
| overlap= o_table[c * subj->num_contours + s]; |
| 2836 |
|
| |
| 2837 |
0 |
▶ | if (!overlap) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!overlap) |
0 |
0 |
0 |
|
| 2838 |
|
| /* Flag non contributing status by negating vertex count */ |
| 2839 |
0 |
| clip->contour[c].num_vertices = -clip->contour[c].num_vertices; |
| 2840 |
|
| } |
| 2841 |
|
| |
| 2842 |
0 |
▶ | if (op == GPC_INT) |
Branch: 1 branch
| Branch | True | False | Total |
| if (op == GPC_INT) |
0 |
0 |
0 |
|
| 2843 |
|
| { |
| 2844 |
|
| /* For each subject contour, search for any clip contour overlaps */ |
| 2845 |
0 |
▶ | for (s= 0; s < subj->num_contours; s++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (s= 0; s < subj->num_contours; s++) |
0 |
0 |
0 |
|
| 2846 |
|
| { |
| 2847 |
0 |
| overlap= 0; |
| 2848 |
0 |
▶ | for (c= 0; (!overlap) && (c < clip->num_contours); c++) |
Branch: 2 branches
| Branch | True | False | Total |
| for (c= 0; (!overlap) && (c < clip->num_contours); c++) |
0 |
0 |
0 |
| for (c= 0; (!overlap) && (c < clip->num_contours); c++) |
0 |
0 |
0 |
|
| 2849 |
0 |
| overlap= o_table[c * subj->num_contours + s]; |
| 2850 |
|
| |
| 2851 |
0 |
▶ | if (!overlap) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!overlap) |
0 |
0 |
0 |
|
| 2852 |
|
| /* Flag non contributing status by negating vertex count */ |
| 2853 |
0 |
| subj->contour[s].num_vertices = -subj->contour[s].num_vertices; |
| 2854 |
|
| } |
| 2855 |
|
| } |
| 2856 |
|
| |
| 2857 |
0 |
| CFREE(s_bbox); /* CBSTEH */ |
| 2858 |
0 |
| CFREE(c_bbox); /* CBSTEH */ |
| 2859 |
0 |
| CFREE(o_table); /* CBSTEH */ |
| 2860 |
0 |
| } |
| 2861 |
|
| |
| 2862 |
|
| |
| 2863 |
|
| /* |
| 2864 |
|
| ########################################################################### |
| 2865 |
|
| Public Functions |
| 2866 |
|
| ########################################################################### |
| 2867 |
|
| */ |
| 2868 |
|
| |
| 2869 |
0 |
| void gpc_free_polygon(gpc_polygon *p) |
| 2870 |
|
| { |
| 2871 |
|
| int c; |
| 2872 |
|
| |
| 2873 |
0 |
▶ | for (c= 0; c < p->num_contours; c++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (c= 0; c < p->num_contours; c++) |
0 |
0 |
0 |
|
| 2874 |
0 |
▶ | FREE(p->contour[c].vertex); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(p->contour[c].vertex); |
0 |
0 |
0 |
|
| 2875 |
0 |
▶ | FREE(p->hole); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(p->hole); |
0 |
0 |
0 |
|
| 2876 |
0 |
▶ | FREE(p->contour); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(p->contour); |
0 |
0 |
0 |
|
| 2877 |
0 |
| p->num_contours= 0; |
| 2878 |
0 |
| } |
| 2879 |
|
| |
| 2880 |
|
| |
| 2881 |
0 |
| void gpc_read_polygon(FILE *fp, int read_hole_flags, gpc_polygon *p) |
| 2882 |
|
| { |
| 2883 |
|
| int c, v; |
| 2884 |
|
| |
| 2885 |
0 |
| fscanf(fp, "%d", &(p->num_contours)); |
| 2886 |
0 |
▶ | MALLOC(p->hole, p->num_contours * sizeof(int), |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(p->hole, p->num_contours * sizeof(int), |
0 |
0 |
0 |
| MALLOC(p->hole, p->num_contours * sizeof(int), |
0 |
0 |
0 |
|
| 2887 |
|
| "hole flag array creation"); |
| 2888 |
0 |
▶ | MALLOC(p->contour, p->num_contours |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(p->contour, p->num_contours |
0 |
0 |
0 |
| MALLOC(p->contour, p->num_contours |
0 |
0 |
0 |
|
| 2889 |
|
| * sizeof(gpc_vertex_list), "contour creation"); |
| 2890 |
0 |
▶ | for (c= 0; c < p->num_contours; c++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (c= 0; c < p->num_contours; c++) |
0 |
0 |
0 |
|
| 2891 |
|
| { |
| 2892 |
0 |
| fscanf(fp, "%d", &(p->contour[c].num_vertices)); |
| 2893 |
|
| |
| 2894 |
0 |
▶ | if (read_hole_flags) |
Branch: 1 branch
| Branch | True | False | Total |
| if (read_hole_flags) |
0 |
0 |
0 |
|
| 2895 |
0 |
| fscanf(fp, "%d", &(p->hole[c])); |
| 2896 |
|
| else |
| 2897 |
0 |
| p->hole[c]= FALSE; /* Assume all contours to be external */ |
| 2898 |
|
| |
| 2899 |
0 |
▶ | MALLOC(p->contour[c].vertex, p->contour[c].num_vertices |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(p->contour[c].vertex, p->contour[c].num_vertices |
0 |
0 |
0 |
| MALLOC(p->contour[c].vertex, p->contour[c].num_vertices |
0 |
0 |
0 |
|
| 2900 |
|
| * sizeof(gpc_vertex), "vertex creation"); |
| 2901 |
0 |
▶ | for (v= 0; v < p->contour[c].num_vertices; v++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (v= 0; v < p->contour[c].num_vertices; v++) |
0 |
0 |
0 |
|
| 2902 |
0 |
| fscanf(fp, "%lf %lf", &(p->contour[c].vertex[v].x), |
| 2903 |
0 |
| &(p->contour[c].vertex[v].y)); |
| 2904 |
|
| } |
| 2905 |
0 |
| } |
| 2906 |
|
| |
| 2907 |
|
| |
| 2908 |
0 |
| void gpc_write_polygon(FILE *fp, int write_hole_flags, gpc_polygon *p) |
| 2909 |
|
| { |
| 2910 |
|
| int c, v; |
| 2911 |
|
| |
| 2912 |
0 |
| fprintf(fp, "%d\n", p->num_contours); |
| 2913 |
0 |
▶ | for (c= 0; c < p->num_contours; c++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (c= 0; c < p->num_contours; c++) |
0 |
0 |
0 |
|
| 2914 |
|
| { |
| 2915 |
0 |
| fprintf(fp, "%d\n", p->contour[c].num_vertices); |
| 2916 |
|
| |
| 2917 |
0 |
▶ | if (write_hole_flags) |
Branch: 1 branch
| Branch | True | False | Total |
| if (write_hole_flags) |
0 |
0 |
0 |
|
| 2918 |
0 |
| fprintf(fp, "%d\n", p->hole[c]); |
| 2919 |
|
| |
| 2920 |
0 |
▶ | for (v= 0; v < p->contour[c].num_vertices; v++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (v= 0; v < p->contour[c].num_vertices; v++) |
0 |
0 |
0 |
|
| 2921 |
0 |
| fprintf(fp, "% .*lf % .*lf\n", |
| 2922 |
0 |
| DBL_DIG, p->contour[c].vertex[v].x, |
| 2923 |
0 |
| DBL_DIG, p->contour[c].vertex[v].y); |
| 2924 |
|
| } |
| 2925 |
0 |
| } |
| 2926 |
|
| |
| 2927 |
|
| |
| 2928 |
0 |
| void gpc_add_contour(gpc_polygon *p, gpc_vertex_list *new_contour, int hole) |
| 2929 |
|
| { |
| 2930 |
|
| int *extended_hole, c, v; |
| 2931 |
|
| gpc_vertex_list *extended_contour; |
| 2932 |
|
| |
| 2933 |
|
| /* Create an extended hole array */ |
| 2934 |
0 |
▶ | MALLOC(extended_hole, (p->num_contours + 1) |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(extended_hole, (p->num_contours + 1) |
0 |
0 |
0 |
| MALLOC(extended_hole, (p->num_contours + 1) |
0 |
0 |
0 |
|
| 2935 |
|
| * sizeof(int), "contour hole addition"); |
| 2936 |
|
| |
| 2937 |
|
| /* Create an extended contour array */ |
| 2938 |
0 |
▶ | MALLOC(extended_contour, (p->num_contours + 1) |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(extended_contour, (p->num_contours + 1) |
0 |
0 |
0 |
| MALLOC(extended_contour, (p->num_contours + 1) |
0 |
0 |
0 |
|
| 2939 |
|
| * sizeof(gpc_vertex_list), "contour addition"); |
| 2940 |
|
| |
| 2941 |
|
| /* Copy the old contour and hole data into the extended arrays */ |
| 2942 |
0 |
▶ | for (c= 0; c < p->num_contours; c++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (c= 0; c < p->num_contours; c++) |
0 |
0 |
0 |
|
| 2943 |
|
| { |
| 2944 |
0 |
| extended_hole[c]= p->hole[c]; |
| 2945 |
0 |
| extended_contour[c]= p->contour[c]; |
| 2946 |
|
| } |
| 2947 |
|
| |
| 2948 |
|
| /* Copy the new contour and hole onto the end of the extended arrays */ |
| 2949 |
0 |
| c= p->num_contours; |
| 2950 |
0 |
| extended_hole[c]= hole; |
| 2951 |
0 |
| extended_contour[c].num_vertices= new_contour->num_vertices; |
| 2952 |
0 |
▶ | MALLOC(extended_contour[c].vertex, new_contour->num_vertices |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(extended_contour[c].vertex, new_contour->num_vertices |
0 |
0 |
0 |
| MALLOC(extended_contour[c].vertex, new_contour->num_vertices |
0 |
0 |
0 |
|
| 2953 |
|
| * sizeof(gpc_vertex), "contour addition"); |
| 2954 |
0 |
▶ | for (v= 0; v < new_contour->num_vertices; v++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (v= 0; v < new_contour->num_vertices; v++) |
0 |
0 |
0 |
|
| 2955 |
0 |
| extended_contour[c].vertex[v]= new_contour->vertex[v]; |
| 2956 |
|
| |
| 2957 |
|
| /* Dispose of the old contour */ |
| 2958 |
0 |
▶ | FREE(p->contour); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(p->contour); |
0 |
0 |
0 |
|
| 2959 |
0 |
▶ | FREE(p->hole); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(p->hole); |
0 |
0 |
0 |
|
| 2960 |
|
| |
| 2961 |
|
| /* Update the polygon information */ |
| 2962 |
0 |
| p->num_contours++; |
| 2963 |
0 |
| p->hole= extended_hole; |
| 2964 |
0 |
| p->contour= extended_contour; |
| 2965 |
0 |
| } |
| 2966 |
|
| |
| 2967 |
|
| |
| 2968 |
1 |
| void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, |
| 2969 |
|
| gpc_polygon *result) |
| 2970 |
|
| { |
| 2971 |
1 |
| sb_tree *sbtree= NULL; |
| 2972 |
1 |
| it_node *it= NULL, *intersect; |
| 2973 |
|
| edge_node *edge, *prev_edge, *next_edge, *succ_edge, *e0, *e1; |
| 2974 |
1 |
| edge_node *aet= NULL, *c_heap= NULL, *s_heap= NULL; |
| 2975 |
1 |
| lmt_node *lmt= NULL, *local_min; |
| 2976 |
1 |
| polygon_node *out_poly= NULL, *p, *q, *poly, *npoly, *cf= NULL; |
| 2977 |
|
| vertex_node *vtx, *nv; |
| 2978 |
|
| h_state horiz[2]; |
| 2979 |
1 |
| int in[2], exists[2], parity[2]= {LEFT, LEFT}; |
| 2980 |
1 |
| int c, v, contributing, search, scanbeam= 0, sbt_entries= 0; |
| 2981 |
|
| int vclass, bl, br, tl, tr; |
| 2982 |
1 |
| double *sbt= NULL, xb, px, yb, yt, dy, ix, iy; |
| 2983 |
|
| |
| 2984 |
|
| /* Test for trivial NULL result cases */ |
| 2985 |
1 |
▶ | if (((subj->num_contours == 0) && (clip->num_contours == 0)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (((subj->num_contours == 0) && (clip->num_contours == 0)) |
0 |
1 |
1 |
| if (((subj->num_contours == 0) && (clip->num_contours == 0)) |
0 |
0 |
0 |
|
| 2986 |
1 |
▶ | || ((subj->num_contours == 0) && ((op == GPC_INT) || (op == GPC_DIFF))) |
Branch: 3 branches
| Branch | True | False | Total |
| || ((subj->num_contours == 0) && ((op == GPC_INT) || (op == GPC_DIFF))) |
0 |
1 |
1 |
| || ((subj->num_contours == 0) && ((op == GPC_INT) || (op == GPC_DIFF))) |
0 |
0 |
0 |
| || ((subj->num_contours == 0) && ((op == GPC_INT) || (op == GPC_DIFF))) |
0 |
0 |
0 |
|
| 2987 |
1 |
▶ | || ((clip->num_contours == 0) && (op == GPC_INT))) |
Branch: 2 branches
| Branch | True | False | Total |
| || ((clip->num_contours == 0) && (op == GPC_INT))) |
0 |
1 |
1 |
| || ((clip->num_contours == 0) && (op == GPC_INT))) |
0 |
0 |
0 |
|
| 2988 |
|
| { |
| 2989 |
0 |
| result->num_contours= 0; |
| 2990 |
0 |
| result->hole= NULL; |
| 2991 |
0 |
| result->contour= NULL; |
| 2992 |
0 |
| return; |
| 2993 |
|
| } |
| 2994 |
|
| |
| 2995 |
|
| /* Identify potentialy contributing contours */ |
| 2996 |
1 |
▶ | if (((op == GPC_INT) || (op == GPC_DIFF)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (((op == GPC_INT) || (op == GPC_DIFF)) |
1 |
0 |
1 |
| if (((op == GPC_INT) || (op == GPC_DIFF)) |
0 |
1 |
1 |
|
| 2997 |
0 |
▶ | && (subj->num_contours > 0) && (clip->num_contours > 0)) |
Branch: 2 branches
| Branch | True | False | Total |
| && (subj->num_contours > 0) && (clip->num_contours > 0)) |
0 |
0 |
0 |
| && (subj->num_contours > 0) && (clip->num_contours > 0)) |
0 |
0 |
0 |
|
| 2998 |
0 |
| minimax_test(subj, clip, op); |
| 2999 |
|
| |
| 3000 |
|
| /* Build LMT */ |
| 3001 |
1 |
▶ | if (subj->num_contours > 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (subj->num_contours > 0) |
1 |
0 |
1 |
|
| 3002 |
1 |
| s_heap= build_lmt(&lmt, &sbtree, &sbt_entries, subj, SUBJ, op); |
| 3003 |
1 |
▶ | if (clip->num_contours > 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (clip->num_contours > 0) |
1 |
0 |
1 |
|
| 3004 |
1 |
| c_heap= build_lmt(&lmt, &sbtree, &sbt_entries, clip, CLIP, op); |
| 3005 |
|
| |
| 3006 |
|
| /* Return a NULL result if no contours contribute */ |
| 3007 |
1 |
▶ | if (lmt == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (lmt == NULL) |
0 |
1 |
1 |
|
| 3008 |
|
| { |
| 3009 |
0 |
| result->num_contours= 0; |
| 3010 |
0 |
| result->hole= NULL; |
| 3011 |
0 |
| result->contour= NULL; |
| 3012 |
0 |
| reset_lmt(&lmt); |
| 3013 |
0 |
▶ | FREE(s_heap); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(s_heap); |
0 |
0 |
0 |
|
| 3014 |
0 |
▶ | FREE(c_heap); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(c_heap); |
0 |
0 |
0 |
|
| 3015 |
0 |
| return; |
| 3016 |
|
| } |
| 3017 |
|
| |
| 3018 |
|
| /* Build scanbeam table from scanbeam tree */ |
| 3019 |
1 |
▶ | MALLOC(sbt, sbt_entries * sizeof(double), "sbt creation"); |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(sbt, sbt_entries * sizeof(double), "sbt creation"); |
1 |
0 |
1 |
| MALLOC(sbt, sbt_entries * sizeof(double), "sbt creation"); |
0 |
1 |
1 |
|
| 3020 |
1 |
| build_sbt(&scanbeam, sbt, sbtree); |
| 3021 |
1 |
| scanbeam= 0; |
| 3022 |
1 |
| free_sbtree(&sbtree); |
| 3023 |
|
| |
| 3024 |
|
| /* Allow pointer re-use without causing memory leak */ |
| 3025 |
1 |
▶ | if (subj == result) |
Branch: 1 branch
| Branch | True | False | Total |
| if (subj == result) |
0 |
1 |
1 |
|
| 3026 |
0 |
| gpc_free_polygon(subj); |
| 3027 |
1 |
▶ | if (clip == result) |
Branch: 1 branch
| Branch | True | False | Total |
| if (clip == result) |
0 |
1 |
1 |
|
| 3028 |
0 |
| gpc_free_polygon(clip); |
| 3029 |
|
| |
| 3030 |
|
| /* Invert clip polygon for difference operation */ |
| 3031 |
1 |
▶ | if (op == GPC_DIFF) |
Branch: 1 branch
| Branch | True | False | Total |
| if (op == GPC_DIFF) |
0 |
1 |
1 |
|
| 3032 |
0 |
| parity[CLIP]= RIGHT; |
| 3033 |
|
| |
| 3034 |
1 |
| local_min= lmt; |
| 3035 |
|
| |
| 3036 |
|
| /* Process each scanbeam */ |
| 3037 |
5 |
▶ | while (scanbeam < sbt_entries) |
Branch: 1 branch
| Branch | True | False | Total |
| while (scanbeam < sbt_entries) |
4 |
1 |
5 |
|
| 3038 |
|
| { |
| 3039 |
|
| /* Set yb and yt to the bottom and top of the scanbeam */ |
| 3040 |
4 |
| yb= sbt[scanbeam++]; |
| 3041 |
4 |
▶ | if (scanbeam < sbt_entries) |
Branch: 1 branch
| Branch | True | False | Total |
| if (scanbeam < sbt_entries) |
3 |
1 |
4 |
|
| 3042 |
|
| { |
| 3043 |
3 |
| yt= sbt[scanbeam]; |
| 3044 |
3 |
| dy= yt - yb; |
| 3045 |
|
| } |
| 3046 |
|
| |
| 3047 |
|
| /* ### SCANBEAM BOUNDARY PROCESSING ################################ */ |
| 3048 |
|
| |
| 3049 |
|
| /* If LMT node corresponding to yb exists */ |
| 3050 |
4 |
▶ | if (local_min) |
Branch: 1 branch
| Branch | True | False | Total |
| if (local_min) |
2 |
2 |
4 |
|
| 3051 |
|
| { |
| 3052 |
2 |
▶ | if (local_min->y == yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (local_min->y == yb) |
2 |
0 |
2 |
|
| 3053 |
|
| { |
| 3054 |
|
| /* Add edges starting at this local minimum to the AET */ |
| 3055 |
6 |
▶ | for (edge= local_min->first_bound; edge; edge= edge->next_bound) |
Branch: 1 branch
| Branch | True | False | Total |
| for (edge= local_min->first_bound; edge; edge= edge->next_bound) |
4 |
2 |
6 |
|
| 3056 |
4 |
| add_edge_to_aet(&aet, edge, NULL); |
| 3057 |
|
| |
| 3058 |
2 |
| local_min= local_min->next; |
| 3059 |
|
| } |
| 3060 |
|
| } |
| 3061 |
|
| |
| 3062 |
|
| /* Set dummy previous x value */ |
| 3063 |
4 |
| px= -DBL_MAX; |
| 3064 |
|
| |
| 3065 |
|
| /* Create bundles within AET */ |
| 3066 |
4 |
| e0= aet; |
| 3067 |
|
| /* e1= aet; */ /* CBSTEH */ |
| 3068 |
|
| |
| 3069 |
|
| /* Set up bundle fields of first edge */ |
| 3070 |
4 |
| aet->bundle[ABOVE][ aet->type]= (aet->top.y != yb); |
| 3071 |
4 |
| aet->bundle[ABOVE][!aet->type]= FALSE; |
| 3072 |
4 |
| aet->bstate[ABOVE]= UNBUNDLED; |
| 3073 |
|
| |
| 3074 |
12 |
▶ | for (next_edge= aet->next; next_edge; next_edge= next_edge->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (next_edge= aet->next; next_edge; next_edge= next_edge->next) |
8 |
4 |
12 |
|
| 3075 |
|
| { |
| 3076 |
|
| /* Set up bundle fields of next edge */ |
| 3077 |
8 |
| next_edge->bundle[ABOVE][ next_edge->type]= (next_edge->top.y != yb); |
| 3078 |
8 |
| next_edge->bundle[ABOVE][!next_edge->type]= FALSE; |
| 3079 |
8 |
| next_edge->bstate[ABOVE]= UNBUNDLED; |
| 3080 |
|
| |
| 3081 |
|
| /* Bundle edges above the scanbeam boundary if they coincide */ |
| 3082 |
8 |
▶ | if (next_edge->bundle[ABOVE][next_edge->type]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (next_edge->bundle[ABOVE][next_edge->type]) |
6 |
2 |
8 |
|
| 3083 |
|
| { |
| 3084 |
6 |
▶ | if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx) |
Branch: 2 branches
| Branch | True | False | Total |
| if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx) |
0 |
6 |
6 |
| if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx) |
0 |
0 |
0 |
|
| 3085 |
0 |
▶ | && (e0->top.y != yb)) |
Branch: 1 branch
| Branch | True | False | Total |
| && (e0->top.y != yb)) |
0 |
0 |
0 |
|
| 3086 |
|
| { |
| 3087 |
0 |
| next_edge->bundle[ABOVE][ next_edge->type]^= |
| 3088 |
0 |
| e0->bundle[ABOVE][ next_edge->type]; |
| 3089 |
0 |
| next_edge->bundle[ABOVE][!next_edge->type]= |
| 3090 |
0 |
| e0->bundle[ABOVE][!next_edge->type]; |
| 3091 |
0 |
| next_edge->bstate[ABOVE]= BUNDLE_HEAD; |
| 3092 |
0 |
| e0->bundle[ABOVE][CLIP]= FALSE; |
| 3093 |
0 |
| e0->bundle[ABOVE][SUBJ]= FALSE; |
| 3094 |
0 |
| e0->bstate[ABOVE]= BUNDLE_TAIL; |
| 3095 |
|
| } |
| 3096 |
6 |
| e0= next_edge; |
| 3097 |
|
| } |
| 3098 |
|
| } |
| 3099 |
|
| |
| 3100 |
4 |
| horiz[CLIP]= NH; |
| 3101 |
4 |
| horiz[SUBJ]= NH; |
| 3102 |
|
| |
| 3103 |
|
| /* Process each edge at this scanbeam boundary */ |
| 3104 |
16 |
▶ | for (edge= aet; edge; edge= edge->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (edge= aet; edge; edge= edge->next) |
12 |
4 |
16 |
|
| 3105 |
|
| { |
| 3106 |
12 |
| exists[CLIP]= edge->bundle[ABOVE][CLIP] + |
| 3107 |
12 |
| (edge->bundle[BELOW][CLIP] << 1); |
| 3108 |
12 |
| exists[SUBJ]= edge->bundle[ABOVE][SUBJ] + |
| 3109 |
12 |
| (edge->bundle[BELOW][SUBJ] << 1); |
| 3110 |
|
| |
| 3111 |
12 |
▶ | if (exists[CLIP] || exists[SUBJ]) |
Branch: 2 branches
| Branch | True | False | Total |
| if (exists[CLIP] || exists[SUBJ]) |
6 |
6 |
12 |
| if (exists[CLIP] || exists[SUBJ]) |
6 |
0 |
6 |
|
| 3112 |
|
| { |
| 3113 |
|
| /* Set bundle side */ |
| 3114 |
12 |
| edge->bside[CLIP]= parity[CLIP]; |
| 3115 |
12 |
| edge->bside[SUBJ]= parity[SUBJ]; |
| 3116 |
|
| |
| 3117 |
|
| /* Determine contributing status and quadrant occupancies */ |
| 3118 |
12 |
| switch (op) |
| 3119 |
|
| { |
| 3120 |
0 |
| case GPC_DIFF: |
| 3121 |
|
| case GPC_INT: |
| 3122 |
0 |
▶ | contributing= (exists[CLIP] && (parity[SUBJ] || horiz[SUBJ])) |
Branch: 2 branches
| Branch | True | False | Total |
| contributing= (exists[CLIP] && (parity[SUBJ] || horiz[SUBJ])) |
0 |
0 |
0 |
| contributing= (exists[CLIP] && (parity[SUBJ] || horiz[SUBJ])) |
0 |
0 |
0 |
|
| 3123 |
0 |
▶ | || (exists[SUBJ] && (parity[CLIP] || horiz[CLIP])) |
Branch: 3 branches
| Branch | True | False | Total |
| || (exists[SUBJ] && (parity[CLIP] || horiz[CLIP])) |
0 |
0 |
0 |
| || (exists[SUBJ] && (parity[CLIP] || horiz[CLIP])) |
0 |
0 |
0 |
| || (exists[SUBJ] && (parity[CLIP] || horiz[CLIP])) |
0 |
0 |
0 |
|
| 3124 |
0 |
▶ | || (exists[CLIP] && exists[SUBJ] |
Branch: 3 branches
| Branch | True | False | Total |
| || (exists[CLIP] && exists[SUBJ] |
0 |
0 |
0 |
| || (exists[CLIP] && exists[SUBJ] |
0 |
0 |
0 |
| || (exists[CLIP] && exists[SUBJ] |
0 |
0 |
0 |
|
| 3125 |
0 |
▶ | && (parity[CLIP] == parity[SUBJ])); |
Branch: 1 branch
| Branch | True | False | Total |
| && (parity[CLIP] == parity[SUBJ])); |
0 |
0 |
0 |
|
| 3126 |
0 |
| br= (parity[CLIP]) |
| 3127 |
0 |
▶ | && (parity[SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (parity[SUBJ]); |
0 |
0 |
0 |
| && (parity[SUBJ]); |
0 |
0 |
0 |
|
| 3128 |
0 |
| bl= (parity[CLIP] ^ edge->bundle[ABOVE][CLIP]) |
| 3129 |
0 |
▶ | && (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| && (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 3130 |
0 |
| tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) |
| 3131 |
0 |
▶ | && (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
Branch: 2 branches
| Branch | True | False | Total |
| && (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
0 |
0 |
0 |
| && (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
0 |
0 |
0 |
|
| 3132 |
0 |
| tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) |
| 3133 |
0 |
▶ | && (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
0 |
0 |
0 |
| && (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
0 |
0 |
0 |
|
| 3134 |
0 |
| break; |
| 3135 |
0 |
| case GPC_XOR: |
| 3136 |
0 |
▶ | contributing= exists[CLIP] || exists[SUBJ]; |
Branch: 2 branches
| Branch | True | False | Total |
| contributing= exists[CLIP] || exists[SUBJ]; |
0 |
0 |
0 |
| contributing= exists[CLIP] || exists[SUBJ]; |
0 |
0 |
0 |
|
| 3137 |
0 |
| br= (parity[CLIP]) |
| 3138 |
0 |
| ^ (parity[SUBJ]); |
| 3139 |
0 |
| bl= (parity[CLIP] ^ edge->bundle[ABOVE][CLIP]) |
| 3140 |
0 |
| ^ (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
| 3141 |
0 |
| tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) |
| 3142 |
0 |
| ^ (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
| 3143 |
0 |
| tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) |
| 3144 |
0 |
| ^ (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
| 3145 |
0 |
| break; |
| 3146 |
12 |
| case GPC_UNION: |
| 3147 |
6 |
▶ | contributing= (exists[CLIP] && (!parity[SUBJ] || horiz[SUBJ])) |
Branch: 2 branches
| Branch | True | False | Total |
| contributing= (exists[CLIP] && (!parity[SUBJ] || horiz[SUBJ])) |
1 |
5 |
6 |
| contributing= (exists[CLIP] && (!parity[SUBJ] || horiz[SUBJ])) |
1 |
0 |
1 |
|
| 3148 |
7 |
▶ | || (exists[SUBJ] && (!parity[CLIP] || horiz[CLIP])) |
Branch: 3 branches
| Branch | True | False | Total |
| || (exists[SUBJ] && (!parity[CLIP] || horiz[CLIP])) |
6 |
1 |
7 |
| || (exists[SUBJ] && (!parity[CLIP] || horiz[CLIP])) |
2 |
4 |
6 |
| || (exists[SUBJ] && (!parity[CLIP] || horiz[CLIP])) |
1 |
1 |
2 |
|
| 3149 |
24 |
▶ | || (exists[CLIP] && exists[SUBJ] |
Branch: 3 branches
| Branch | True | False | Total |
| || (exists[CLIP] && exists[SUBJ] |
6 |
6 |
12 |
| || (exists[CLIP] && exists[SUBJ] |
1 |
1 |
2 |
| || (exists[CLIP] && exists[SUBJ] |
0 |
1 |
1 |
|
| 3150 |
0 |
▶ | && (parity[CLIP] == parity[SUBJ])); |
Branch: 1 branch
| Branch | True | False | Total |
| && (parity[CLIP] == parity[SUBJ])); |
0 |
0 |
0 |
|
| 3151 |
24 |
| br= (parity[CLIP]) |
| 3152 |
12 |
▶ | || (parity[SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (parity[SUBJ]); |
8 |
4 |
12 |
| || (parity[SUBJ]); |
2 |
6 |
8 |
|
| 3153 |
24 |
| bl= (parity[CLIP] ^ edge->bundle[ABOVE][CLIP]) |
| 3154 |
12 |
▶ | || (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
8 |
4 |
12 |
| || (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
2 |
6 |
8 |
|
| 3155 |
24 |
| tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) |
| 3156 |
12 |
▶ | || (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
Branch: 2 branches
| Branch | True | False | Total |
| || (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
9 |
3 |
12 |
| || (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
3 |
6 |
9 |
|
| 3157 |
24 |
| tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) |
| 3158 |
12 |
▶ | || (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
9 |
3 |
12 |
| || (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
3 |
6 |
9 |
|
| 3159 |
12 |
| break; |
| 3160 |
|
| } |
| 3161 |
|
| |
| 3162 |
|
| /* Update parity */ |
| 3163 |
12 |
| parity[CLIP]^= edge->bundle[ABOVE][CLIP]; |
| 3164 |
12 |
| parity[SUBJ]^= edge->bundle[ABOVE][SUBJ]; |
| 3165 |
|
| |
| 3166 |
|
| /* Update horizontal state */ |
| 3167 |
12 |
▶ | if (exists[CLIP]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (exists[CLIP]) |
6 |
6 |
12 |
|
| 3168 |
6 |
| horiz[CLIP]= |
| 3169 |
6 |
| next_h_state[horiz[CLIP]] |
| 3170 |
6 |
| [((exists[CLIP] - 1) << 1) + parity[CLIP]]; |
| 3171 |
12 |
▶ | if (exists[SUBJ]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (exists[SUBJ]) |
6 |
6 |
12 |
|
| 3172 |
6 |
| horiz[SUBJ]= |
| 3173 |
6 |
| next_h_state[horiz[SUBJ]] |
| 3174 |
6 |
| [((exists[SUBJ] - 1) << 1) + parity[SUBJ]]; |
| 3175 |
|
| |
| 3176 |
12 |
| vclass= tr + (tl << 1) + (br << 2) + (bl << 3); |
| 3177 |
|
| |
| 3178 |
12 |
▶ | if (contributing) |
Branch: 1 branch
| Branch | True | False | Total |
| if (contributing) |
10 |
2 |
12 |
|
| 3179 |
|
| { |
| 3180 |
10 |
| xb= edge->xb; |
| 3181 |
|
| |
| 3182 |
10 |
| switch (vclass) |
| 3183 |
|
| { |
| 3184 |
1 |
| case EMN: |
| 3185 |
|
| case IMN: |
| 3186 |
1 |
| add_local_min(&out_poly, edge, xb, yb); |
| 3187 |
1 |
| px= xb; |
| 3188 |
1 |
| cf= edge->outp[ABOVE]; |
| 3189 |
1 |
| break; |
| 3190 |
2 |
| case ERI: |
| 3191 |
2 |
▶ | if (xb != px) |
Branch: 1 branch
| Branch | True | False | Total |
| if (xb != px) |
2 |
0 |
2 |
|
| 3192 |
|
| { |
| 3193 |
2 |
| add_right(cf, xb, yb); |
| 3194 |
2 |
| px= xb; |
| 3195 |
|
| } |
| 3196 |
2 |
| edge->outp[ABOVE]= cf; |
| 3197 |
2 |
| cf= NULL; |
| 3198 |
2 |
| break; |
| 3199 |
2 |
| case ELI: |
| 3200 |
2 |
| add_left(edge->outp[BELOW], xb, yb); |
| 3201 |
2 |
| px= xb; |
| 3202 |
2 |
| cf= edge->outp[BELOW]; |
| 3203 |
2 |
| break; |
| 3204 |
1 |
| case EMX: |
| 3205 |
1 |
▶ | if (xb != px) |
Branch: 1 branch
| Branch | True | False | Total |
| if (xb != px) |
1 |
0 |
1 |
|
| 3206 |
|
| { |
| 3207 |
1 |
| add_left(cf, xb, yb); |
| 3208 |
1 |
| px= xb; |
| 3209 |
|
| } |
| 3210 |
1 |
| merge_right(cf, edge->outp[BELOW], out_poly); |
| 3211 |
1 |
| cf= NULL; |
| 3212 |
1 |
| break; |
| 3213 |
1 |
| case ILI: |
| 3214 |
1 |
▶ | if (xb != px) |
Branch: 1 branch
| Branch | True | False | Total |
| if (xb != px) |
1 |
0 |
1 |
|
| 3215 |
|
| { |
| 3216 |
1 |
| add_left(cf, xb, yb); |
| 3217 |
1 |
| px= xb; |
| 3218 |
|
| } |
| 3219 |
1 |
| edge->outp[ABOVE]= cf; |
| 3220 |
1 |
| cf= NULL; |
| 3221 |
1 |
| break; |
| 3222 |
1 |
| case IRI: |
| 3223 |
1 |
| add_right(edge->outp[BELOW], xb, yb); |
| 3224 |
1 |
| px= xb; |
| 3225 |
1 |
| cf= edge->outp[BELOW]; |
| 3226 |
1 |
| edge->outp[BELOW]= NULL; |
| 3227 |
1 |
| break; |
| 3228 |
0 |
| case IMX: |
| 3229 |
0 |
▶ | if (xb != px) |
Branch: 1 branch
| Branch | True | False | Total |
| if (xb != px) |
0 |
0 |
0 |
|
| 3230 |
|
| { |
| 3231 |
0 |
| add_right(cf, xb, yb); |
| 3232 |
0 |
| px= xb; |
| 3233 |
|
| } |
| 3234 |
0 |
| merge_left(cf, edge->outp[BELOW], out_poly); |
| 3235 |
0 |
| cf= NULL; |
| 3236 |
0 |
| edge->outp[BELOW]= NULL; |
| 3237 |
0 |
| break; |
| 3238 |
0 |
| case IMM: |
| 3239 |
0 |
▶ | if (xb != px) |
Branch: 1 branch
| Branch | True | False | Total |
| if (xb != px) |
0 |
0 |
0 |
|
| 3240 |
|
| { |
| 3241 |
0 |
| add_right(cf, xb, yb); |
| 3242 |
0 |
| px= xb; |
| 3243 |
|
| } |
| 3244 |
0 |
| merge_left(cf, edge->outp[BELOW], out_poly); |
| 3245 |
0 |
| edge->outp[BELOW]= NULL; |
| 3246 |
0 |
| add_local_min(&out_poly, edge, xb, yb); |
| 3247 |
0 |
| cf= edge->outp[ABOVE]; |
| 3248 |
0 |
| break; |
| 3249 |
0 |
| case EMM: |
| 3250 |
0 |
▶ | if (xb != px) |
Branch: 1 branch
| Branch | True | False | Total |
| if (xb != px) |
0 |
0 |
0 |
|
| 3251 |
|
| { |
| 3252 |
0 |
| add_left(cf, xb, yb); |
| 3253 |
0 |
| px= xb; |
| 3254 |
|
| } |
| 3255 |
0 |
| merge_right(cf, edge->outp[BELOW], out_poly); |
| 3256 |
0 |
| edge->outp[BELOW]= NULL; |
| 3257 |
0 |
| add_local_min(&out_poly, edge, xb, yb); |
| 3258 |
0 |
| cf= edge->outp[ABOVE]; |
| 3259 |
0 |
| break; |
| 3260 |
1 |
| case LED: |
| 3261 |
1 |
▶ | if (edge->bot.y == yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->bot.y == yb) |
0 |
1 |
1 |
|
| 3262 |
0 |
| add_left(edge->outp[BELOW], xb, yb); |
| 3263 |
1 |
| edge->outp[ABOVE]= edge->outp[BELOW]; |
| 3264 |
1 |
| px= xb; |
| 3265 |
1 |
| break; |
| 3266 |
1 |
| case RED: |
| 3267 |
1 |
▶ | if (edge->bot.y == yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->bot.y == yb) |
0 |
1 |
1 |
|
| 3268 |
0 |
| add_right(edge->outp[BELOW], xb, yb); |
| 3269 |
1 |
| edge->outp[ABOVE]= edge->outp[BELOW]; |
| 3270 |
1 |
| px= xb; |
| 3271 |
1 |
| break; |
| 3272 |
0 |
| default: |
| 3273 |
0 |
| break; |
| 3274 |
|
| } /* End of switch */ |
| 3275 |
|
| } /* End of contributing conditional */ |
| 3276 |
|
| } /* End of edge exists conditional */ |
| 3277 |
|
| } /* End of AET loop */ |
| 3278 |
|
| |
| 3279 |
|
| /* Delete terminating edges from the AET, otherwise compute xt */ |
| 3280 |
16 |
▶ | for (edge= aet; edge; edge= edge->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (edge= aet; edge; edge= edge->next) |
12 |
4 |
16 |
|
| 3281 |
|
| { |
| 3282 |
12 |
▶ | if (edge->top.y == yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->top.y == yb) |
4 |
8 |
12 |
|
| 3283 |
|
| { |
| 3284 |
4 |
| prev_edge= edge->prev; |
| 3285 |
4 |
| next_edge= edge->next; |
| 3286 |
4 |
▶ | if (prev_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge) |
1 |
3 |
4 |
|
| 3287 |
1 |
| prev_edge->next= next_edge; |
| 3288 |
|
| else |
| 3289 |
3 |
| aet= next_edge; |
| 3290 |
4 |
▶ | if (next_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (next_edge) |
3 |
1 |
4 |
|
| 3291 |
3 |
| next_edge->prev= prev_edge; |
| 3292 |
|
| |
| 3293 |
|
| /* Copy bundle head state to the adjacent tail edge if required */ |
| 3294 |
4 |
▶ | if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge) |
Branch: 2 branches
| Branch | True | False | Total |
| if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge) |
0 |
4 |
4 |
| if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge) |
0 |
0 |
0 |
|
| 3295 |
|
| { |
| 3296 |
0 |
▶ | if (prev_edge->bstate[BELOW] == BUNDLE_TAIL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge->bstate[BELOW] == BUNDLE_TAIL) |
0 |
0 |
0 |
|
| 3297 |
|
| { |
| 3298 |
0 |
| prev_edge->outp[BELOW]= edge->outp[BELOW]; |
| 3299 |
0 |
| prev_edge->bstate[BELOW]= UNBUNDLED; |
| 3300 |
0 |
▶ | if (prev_edge->prev) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge->prev) |
0 |
0 |
0 |
|
| 3301 |
0 |
▶ | if (prev_edge->prev->bstate[BELOW] == BUNDLE_TAIL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge->prev->bstate[BELOW] == BUNDLE_TAIL) |
0 |
0 |
0 |
|
| 3302 |
0 |
| prev_edge->bstate[BELOW]= BUNDLE_HEAD; |
| 3303 |
|
| } |
| 3304 |
|
| } |
| 3305 |
|
| } |
| 3306 |
|
| else |
| 3307 |
|
| { |
| 3308 |
8 |
▶ | if (edge->top.y == yt) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->top.y == yt) |
4 |
4 |
8 |
|
| 3309 |
4 |
| edge->xt= edge->top.x; |
| 3310 |
|
| else |
| 3311 |
4 |
| edge->xt= edge->bot.x + edge->dx * (yt - edge->bot.y); |
| 3312 |
|
| } |
| 3313 |
|
| } |
| 3314 |
|
| |
| 3315 |
4 |
▶ | if (scanbeam < sbt_entries) |
Branch: 1 branch
| Branch | True | False | Total |
| if (scanbeam < sbt_entries) |
3 |
1 |
4 |
|
| 3316 |
|
| { |
| 3317 |
|
| /* ### SCANBEAM INTERIOR PROCESSING ############################## */ |
| 3318 |
|
| |
| 3319 |
3 |
| build_intersection_table(&it, aet, dy); |
| 3320 |
|
| |
| 3321 |
|
| /* Process each node in the intersection table */ |
| 3322 |
3 |
▶ | for (intersect= it; intersect; intersect= intersect->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (intersect= it; intersect; intersect= intersect->next) |
0 |
3 |
3 |
|
| 3323 |
|
| { |
| 3324 |
0 |
| e0= intersect->ie[0]; |
| 3325 |
0 |
| e1= intersect->ie[1]; |
| 3326 |
|
| |
| 3327 |
|
| /* Only generate output for contributing intersections */ |
| 3328 |
0 |
▶ | if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ]) |
Branch: 2 branches
| Branch | True | False | Total |
| if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ]) |
0 |
0 |
0 |
| if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ]) |
0 |
0 |
0 |
|
| 3329 |
0 |
▶ | && (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ])) |
Branch: 2 branches
| Branch | True | False | Total |
| && (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ])) |
0 |
0 |
0 |
| && (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ])) |
0 |
0 |
0 |
|
| 3330 |
|
| { |
| 3331 |
0 |
| p= e0->outp[ABOVE]; |
| 3332 |
0 |
| q= e1->outp[ABOVE]; |
| 3333 |
0 |
| ix= intersect->point.x; |
| 3334 |
0 |
| iy= intersect->point.y + yb; |
| 3335 |
|
| |
| 3336 |
0 |
▶ | in[CLIP]= ( e0->bundle[ABOVE][CLIP] && !e0->bside[CLIP]) |
Branch: 1 branch
| Branch | True | False | Total |
| in[CLIP]= ( e0->bundle[ABOVE][CLIP] && !e0->bside[CLIP]) |
0 |
0 |
0 |
|
| 3337 |
0 |
▶ | || ( e1->bundle[ABOVE][CLIP] && e1->bside[CLIP]) |
Branch: 2 branches
| Branch | True | False | Total |
| || ( e1->bundle[ABOVE][CLIP] && e1->bside[CLIP]) |
0 |
0 |
0 |
| || ( e1->bundle[ABOVE][CLIP] && e1->bside[CLIP]) |
0 |
0 |
0 |
|
| 3338 |
0 |
▶ | || (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP] |
Branch: 3 branches
| Branch | True | False | Total |
| || (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP] |
0 |
0 |
0 |
| || (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP] |
0 |
0 |
0 |
| || (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP] |
0 |
0 |
0 |
|
| 3339 |
0 |
▶ | && e0->bside[CLIP] && e1->bside[CLIP]); |
Branch: 2 branches
| Branch | True | False | Total |
| && e0->bside[CLIP] && e1->bside[CLIP]); |
0 |
0 |
0 |
| && e0->bside[CLIP] && e1->bside[CLIP]); |
0 |
0 |
0 |
|
| 3340 |
0 |
▶ | in[SUBJ]= ( e0->bundle[ABOVE][SUBJ] && !e0->bside[SUBJ]) |
Branch: 1 branch
| Branch | True | False | Total |
| in[SUBJ]= ( e0->bundle[ABOVE][SUBJ] && !e0->bside[SUBJ]) |
0 |
0 |
0 |
|
| 3341 |
0 |
▶ | || ( e1->bundle[ABOVE][SUBJ] && e1->bside[SUBJ]) |
Branch: 2 branches
| Branch | True | False | Total |
| || ( e1->bundle[ABOVE][SUBJ] && e1->bside[SUBJ]) |
0 |
0 |
0 |
| || ( e1->bundle[ABOVE][SUBJ] && e1->bside[SUBJ]) |
0 |
0 |
0 |
|
| 3342 |
0 |
▶ | || (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ] |
Branch: 3 branches
| Branch | True | False | Total |
| || (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ] |
0 |
0 |
0 |
| || (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ] |
0 |
0 |
0 |
| || (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ] |
0 |
0 |
0 |
|
| 3343 |
0 |
▶ | && e0->bside[SUBJ] && e1->bside[SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && e0->bside[SUBJ] && e1->bside[SUBJ]); |
0 |
0 |
0 |
| && e0->bside[SUBJ] && e1->bside[SUBJ]); |
0 |
0 |
0 |
|
| 3344 |
|
| |
| 3345 |
|
| /* Determine quadrant occupancies */ |
| 3346 |
0 |
| switch (op) |
| 3347 |
|
| { |
| 3348 |
0 |
| case GPC_DIFF: |
| 3349 |
|
| case GPC_INT: |
| 3350 |
0 |
| tr= (in[CLIP]) |
| 3351 |
0 |
▶ | && (in[SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (in[SUBJ]); |
0 |
0 |
0 |
| && (in[SUBJ]); |
0 |
0 |
0 |
|
| 3352 |
0 |
| tl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP]) |
| 3353 |
0 |
▶ | && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 3354 |
0 |
| br= (in[CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 3355 |
0 |
▶ | && (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| && (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 3356 |
0 |
| bl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 3357 |
0 |
▶ | && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 3358 |
0 |
| break; |
| 3359 |
0 |
| case GPC_XOR: |
| 3360 |
0 |
| tr= (in[CLIP]) |
| 3361 |
0 |
| ^ (in[SUBJ]); |
| 3362 |
0 |
| tl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP]) |
| 3363 |
0 |
| ^ (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
| 3364 |
0 |
| br= (in[CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 3365 |
0 |
| ^ (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
| 3366 |
0 |
| bl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 3367 |
0 |
| ^ (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
| 3368 |
0 |
| break; |
| 3369 |
0 |
| case GPC_UNION: |
| 3370 |
0 |
| tr= (in[CLIP]) |
| 3371 |
0 |
▶ | || (in[SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (in[SUBJ]); |
0 |
0 |
0 |
| || (in[SUBJ]); |
0 |
0 |
0 |
|
| 3372 |
0 |
| tl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP]) |
| 3373 |
0 |
▶ | || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 3374 |
0 |
| br= (in[CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 3375 |
0 |
▶ | || (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| || (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 3376 |
0 |
| bl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 3377 |
0 |
▶ | || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 3378 |
0 |
| break; |
| 3379 |
|
| } |
| 3380 |
|
| |
| 3381 |
0 |
| vclass= tr + (tl << 1) + (br << 2) + (bl << 3); |
| 3382 |
|
| |
| 3383 |
0 |
| switch (vclass) |
| 3384 |
|
| { |
| 3385 |
0 |
| case EMN: |
| 3386 |
0 |
| add_local_min(&out_poly, e0, ix, iy); |
| 3387 |
0 |
| e1->outp[ABOVE]= e0->outp[ABOVE]; |
| 3388 |
0 |
| break; |
| 3389 |
0 |
| case ERI: |
| 3390 |
0 |
▶ | if (p) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) |
0 |
0 |
0 |
|
| 3391 |
|
| { |
| 3392 |
0 |
| add_right(p, ix, iy); |
| 3393 |
0 |
| e1->outp[ABOVE]= p; |
| 3394 |
0 |
| e0->outp[ABOVE]= NULL; |
| 3395 |
|
| } |
| 3396 |
0 |
| break; |
| 3397 |
0 |
| case ELI: |
| 3398 |
0 |
▶ | if (q) |
Branch: 1 branch
| Branch | True | False | Total |
| if (q) |
0 |
0 |
0 |
|
| 3399 |
|
| { |
| 3400 |
0 |
| add_left(q, ix, iy); |
| 3401 |
0 |
| e0->outp[ABOVE]= q; |
| 3402 |
0 |
| e1->outp[ABOVE]= NULL; |
| 3403 |
|
| } |
| 3404 |
0 |
| break; |
| 3405 |
0 |
| case EMX: |
| 3406 |
0 |
▶ | if (p && q) |
Branch: 2 branches
| Branch | True | False | Total |
| if (p && q) |
0 |
0 |
0 |
| if (p && q) |
0 |
0 |
0 |
|
| 3407 |
|
| { |
| 3408 |
0 |
| add_left(p, ix, iy); |
| 3409 |
0 |
| merge_right(p, q, out_poly); |
| 3410 |
0 |
| e0->outp[ABOVE]= NULL; |
| 3411 |
0 |
| e1->outp[ABOVE]= NULL; |
| 3412 |
|
| } |
| 3413 |
0 |
| break; |
| 3414 |
0 |
| case IMN: |
| 3415 |
0 |
| add_local_min(&out_poly, e0, ix, iy); |
| 3416 |
0 |
| e1->outp[ABOVE]= e0->outp[ABOVE]; |
| 3417 |
0 |
| break; |
| 3418 |
0 |
| case ILI: |
| 3419 |
0 |
▶ | if (p) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) |
0 |
0 |
0 |
|
| 3420 |
|
| { |
| 3421 |
0 |
| add_left(p, ix, iy); |
| 3422 |
0 |
| e1->outp[ABOVE]= p; |
| 3423 |
0 |
| e0->outp[ABOVE]= NULL; |
| 3424 |
|
| } |
| 3425 |
0 |
| break; |
| 3426 |
0 |
| case IRI: |
| 3427 |
0 |
▶ | if (q) |
Branch: 1 branch
| Branch | True | False | Total |
| if (q) |
0 |
0 |
0 |
|
| 3428 |
|
| { |
| 3429 |
0 |
| add_right(q, ix, iy); |
| 3430 |
0 |
| e0->outp[ABOVE]= q; |
| 3431 |
0 |
| e1->outp[ABOVE]= NULL; |
| 3432 |
|
| } |
| 3433 |
0 |
| break; |
| 3434 |
0 |
| case IMX: |
| 3435 |
0 |
▶ | if (p && q) |
Branch: 2 branches
| Branch | True | False | Total |
| if (p && q) |
0 |
0 |
0 |
| if (p && q) |
0 |
0 |
0 |
|
| 3436 |
|
| { |
| 3437 |
0 |
| add_right(p, ix, iy); |
| 3438 |
0 |
| merge_left(p, q, out_poly); |
| 3439 |
0 |
| e0->outp[ABOVE]= NULL; |
| 3440 |
0 |
| e1->outp[ABOVE]= NULL; |
| 3441 |
|
| } |
| 3442 |
0 |
| break; |
| 3443 |
0 |
| case IMM: |
| 3444 |
0 |
▶ | if (p && q) |
Branch: 2 branches
| Branch | True | False | Total |
| if (p && q) |
0 |
0 |
0 |
| if (p && q) |
0 |
0 |
0 |
|
| 3445 |
|
| { |
| 3446 |
0 |
| add_right(p, ix, iy); |
| 3447 |
0 |
| merge_left(p, q, out_poly); |
| 3448 |
0 |
| add_local_min(&out_poly, e0, ix, iy); |
| 3449 |
0 |
| e1->outp[ABOVE]= e0->outp[ABOVE]; |
| 3450 |
|
| } |
| 3451 |
0 |
| break; |
| 3452 |
0 |
| case EMM: |
| 3453 |
0 |
▶ | if (p && q) |
Branch: 2 branches
| Branch | True | False | Total |
| if (p && q) |
0 |
0 |
0 |
| if (p && q) |
0 |
0 |
0 |
|
| 3454 |
|
| { |
| 3455 |
0 |
| add_left(p, ix, iy); |
| 3456 |
0 |
| merge_right(p, q, out_poly); |
| 3457 |
0 |
| add_local_min(&out_poly, e0, ix, iy); |
| 3458 |
0 |
| e1->outp[ABOVE]= e0->outp[ABOVE]; |
| 3459 |
|
| } |
| 3460 |
0 |
| break; |
| 3461 |
0 |
| default: |
| 3462 |
0 |
| break; |
| 3463 |
|
| } /* End of switch */ |
| 3464 |
|
| } /* End of contributing intersection conditional */ |
| 3465 |
|
| |
| 3466 |
|
| /* Swap bundle sides in response to edge crossing */ |
| 3467 |
0 |
▶ | if (e0->bundle[ABOVE][CLIP]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e0->bundle[ABOVE][CLIP]) |
0 |
0 |
0 |
|
| 3468 |
0 |
| e1->bside[CLIP]= !e1->bside[CLIP]; |
| 3469 |
0 |
▶ | if (e1->bundle[ABOVE][CLIP]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e1->bundle[ABOVE][CLIP]) |
0 |
0 |
0 |
|
| 3470 |
0 |
| e0->bside[CLIP]= !e0->bside[CLIP]; |
| 3471 |
0 |
▶ | if (e0->bundle[ABOVE][SUBJ]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e0->bundle[ABOVE][SUBJ]) |
0 |
0 |
0 |
|
| 3472 |
0 |
| e1->bside[SUBJ]= !e1->bside[SUBJ]; |
| 3473 |
0 |
▶ | if (e1->bundle[ABOVE][SUBJ]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e1->bundle[ABOVE][SUBJ]) |
0 |
0 |
0 |
|
| 3474 |
0 |
| e0->bside[SUBJ]= !e0->bside[SUBJ]; |
| 3475 |
|
| |
| 3476 |
|
| /* Swap e0 and e1 bundles in the AET */ |
| 3477 |
0 |
| prev_edge= e0->prev; |
| 3478 |
0 |
| next_edge= e1->next; |
| 3479 |
0 |
▶ | if (next_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (next_edge) |
0 |
0 |
0 |
|
| 3480 |
0 |
| next_edge->prev= e0; |
| 3481 |
|
| |
| 3482 |
0 |
▶ | if (e0->bstate[ABOVE] == BUNDLE_HEAD) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e0->bstate[ABOVE] == BUNDLE_HEAD) |
0 |
0 |
0 |
|
| 3483 |
|
| { |
| 3484 |
0 |
| search= TRUE; |
| 3485 |
0 |
▶ | while (search) |
Branch: 1 branch
| Branch | True | False | Total |
| while (search) |
0 |
0 |
0 |
|
| 3486 |
|
| { |
| 3487 |
0 |
| prev_edge= prev_edge->prev; |
| 3488 |
0 |
▶ | if (prev_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge) |
0 |
0 |
0 |
|
| 3489 |
|
| { |
| 3490 |
0 |
▶ | if (prev_edge->bstate[ABOVE] != BUNDLE_TAIL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge->bstate[ABOVE] != BUNDLE_TAIL) |
0 |
0 |
0 |
|
| 3491 |
0 |
| search= FALSE; |
| 3492 |
|
| } |
| 3493 |
|
| else |
| 3494 |
0 |
| search= FALSE; |
| 3495 |
|
| } |
| 3496 |
|
| } |
| 3497 |
0 |
▶ | if (!prev_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!prev_edge) |
0 |
0 |
0 |
|
| 3498 |
|
| { |
| 3499 |
0 |
| aet->prev= e1; |
| 3500 |
0 |
| e1->next= aet; |
| 3501 |
0 |
| aet= e0->next; |
| 3502 |
|
| } |
| 3503 |
|
| else |
| 3504 |
|
| { |
| 3505 |
0 |
| prev_edge->next->prev= e1; |
| 3506 |
0 |
| e1->next= prev_edge->next; |
| 3507 |
0 |
| prev_edge->next= e0->next; |
| 3508 |
|
| } |
| 3509 |
0 |
| e0->next->prev= prev_edge; |
| 3510 |
0 |
| e1->next->prev= e1; |
| 3511 |
0 |
| e0->next= next_edge; |
| 3512 |
|
| } /* End of IT loop*/ |
| 3513 |
|
| |
| 3514 |
|
| /* Prepare for next scanbeam */ |
| 3515 |
11 |
▶ | for (edge= aet; edge; edge= next_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| for (edge= aet; edge; edge= next_edge) |
8 |
3 |
11 |
|
| 3516 |
|
| { |
| 3517 |
8 |
| next_edge= edge->next; |
| 3518 |
8 |
| succ_edge= edge->succ; |
| 3519 |
|
| |
| 3520 |
8 |
▶ | if ((edge->top.y == yt) && succ_edge) |
Branch: 2 branches
| Branch | True | False | Total |
| if ((edge->top.y == yt) && succ_edge) |
4 |
4 |
8 |
| if ((edge->top.y == yt) && succ_edge) |
0 |
4 |
4 |
|
| 3521 |
|
| { |
| 3522 |
|
| /* Replace AET edge by its successor */ |
| 3523 |
0 |
| succ_edge->outp[BELOW]= edge->outp[ABOVE]; |
| 3524 |
0 |
| succ_edge->bstate[BELOW]= edge->bstate[ABOVE]; |
| 3525 |
0 |
| succ_edge->bundle[BELOW][CLIP]= edge->bundle[ABOVE][CLIP]; |
| 3526 |
0 |
| succ_edge->bundle[BELOW][SUBJ]= edge->bundle[ABOVE][SUBJ]; |
| 3527 |
0 |
| prev_edge= edge->prev; |
| 3528 |
0 |
▶ | if (prev_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge) |
0 |
0 |
0 |
|
| 3529 |
0 |
| prev_edge->next= succ_edge; |
| 3530 |
|
| else |
| 3531 |
0 |
| aet= succ_edge; |
| 3532 |
0 |
▶ | if (next_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (next_edge) |
0 |
0 |
0 |
|
| 3533 |
0 |
| next_edge->prev= succ_edge; |
| 3534 |
0 |
| succ_edge->prev= prev_edge; |
| 3535 |
0 |
| succ_edge->next= next_edge; |
| 3536 |
|
| } |
| 3537 |
|
| else |
| 3538 |
|
| { |
| 3539 |
|
| /* Update this edge */ |
| 3540 |
8 |
| edge->outp[BELOW]= edge->outp[ABOVE]; |
| 3541 |
8 |
| edge->bstate[BELOW]= edge->bstate[ABOVE]; |
| 3542 |
8 |
| edge->bundle[BELOW][CLIP]= edge->bundle[ABOVE][CLIP]; |
| 3543 |
8 |
| edge->bundle[BELOW][SUBJ]= edge->bundle[ABOVE][SUBJ]; |
| 3544 |
8 |
| edge->xb= edge->xt; |
| 3545 |
|
| } |
| 3546 |
8 |
| edge->outp[ABOVE]= NULL; |
| 3547 |
|
| } |
| 3548 |
|
| } |
| 3549 |
|
| } /* ### END OF SCANBEAM PROCESSING ################################## */ |
| 3550 |
|
| |
| 3551 |
|
| /* Generate result polygon from out_poly */ |
| 3552 |
1 |
| result->contour= NULL; |
| 3553 |
1 |
| result->hole= NULL; |
| 3554 |
1 |
| result->num_contours= count_contours(out_poly); |
| 3555 |
1 |
▶ | if (result->num_contours > 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (result->num_contours > 0) |
1 |
0 |
1 |
|
| 3556 |
|
| { |
| 3557 |
1 |
▶ | MALLOC(result->hole, result->num_contours |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(result->hole, result->num_contours |
1 |
0 |
1 |
| MALLOC(result->hole, result->num_contours |
0 |
1 |
1 |
|
| 3558 |
|
| * sizeof(int), "hole flag table creation"); |
| 3559 |
1 |
▶ | MALLOC(result->contour, result->num_contours |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(result->contour, result->num_contours |
1 |
0 |
1 |
| MALLOC(result->contour, result->num_contours |
0 |
1 |
1 |
|
| 3560 |
|
| * sizeof(gpc_vertex_list), "contour creation"); |
| 3561 |
|
| |
| 3562 |
1 |
| c= 0; |
| 3563 |
2 |
▶ | for (poly= out_poly; poly; poly= npoly) |
Branch: 1 branch
| Branch | True | False | Total |
| for (poly= out_poly; poly; poly= npoly) |
1 |
1 |
2 |
|
| 3564 |
|
| { |
| 3565 |
1 |
| npoly= poly->next; |
| 3566 |
1 |
▶ | if (poly->active) |
Branch: 1 branch
| Branch | True | False | Total |
| if (poly->active) |
1 |
0 |
1 |
|
| 3567 |
|
| { |
| 3568 |
1 |
| result->hole[c]= poly->proxy->hole; |
| 3569 |
1 |
| result->contour[c].num_vertices= poly->active; |
| 3570 |
1 |
▶ | MALLOC(result->contour[c].vertex, |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(result->contour[c].vertex, |
1 |
0 |
1 |
| MALLOC(result->contour[c].vertex, |
0 |
1 |
1 |
|
| 3571 |
|
| result->contour[c].num_vertices * sizeof(gpc_vertex), |
| 3572 |
|
| "vertex creation"); |
| 3573 |
|
| |
| 3574 |
1 |
| v= result->contour[c].num_vertices - 1; |
| 3575 |
9 |
▶ | for (vtx= poly->proxy->v[LEFT]; vtx; vtx= nv) |
Branch: 1 branch
| Branch | True | False | Total |
| for (vtx= poly->proxy->v[LEFT]; vtx; vtx= nv) |
8 |
1 |
9 |
|
| 3576 |
|
| { |
| 3577 |
8 |
| nv= vtx->next; |
| 3578 |
8 |
| result->contour[c].vertex[v].x= vtx->x; |
| 3579 |
8 |
| result->contour[c].vertex[v].y= vtx->y; |
| 3580 |
8 |
| CFREE(vtx); /* CBSTEH */ |
| 3581 |
8 |
| v--; |
| 3582 |
|
| } |
| 3583 |
1 |
| c++; |
| 3584 |
|
| } |
| 3585 |
1 |
| CFREE(poly); /* CBSTEH */ |
| 3586 |
|
| } |
| 3587 |
|
| } |
| 3588 |
|
| |
| 3589 |
|
| /* Tidy up */ |
| 3590 |
1 |
| reset_it(&it); |
| 3591 |
1 |
| reset_lmt(&lmt); |
| 3592 |
1 |
▶ | FREE(c_heap); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(c_heap); |
1 |
0 |
1 |
|
| 3593 |
1 |
▶ | FREE(s_heap); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(s_heap); |
1 |
0 |
1 |
|
| 3594 |
1 |
▶ | FREE(sbt); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(sbt); |
1 |
0 |
1 |
|
| 3595 |
|
| } |
| 3596 |
|
| |
| 3597 |
|
| |
| 3598 |
0 |
| void gpc_free_tristrip(gpc_tristrip *t) |
| 3599 |
|
| { |
| 3600 |
|
| int s; |
| 3601 |
|
| |
| 3602 |
0 |
▶ | for (s= 0; s < t->num_strips; s++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (s= 0; s < t->num_strips; s++) |
0 |
0 |
0 |
|
| 3603 |
0 |
▶ | FREE(t->strip[s].vertex); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(t->strip[s].vertex); |
0 |
0 |
0 |
|
| 3604 |
0 |
▶ | FREE(t->strip); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(t->strip); |
0 |
0 |
0 |
|
| 3605 |
0 |
| t->num_strips= 0; |
| 3606 |
0 |
| } |
| 3607 |
|
| |
| 3608 |
|
| |
| 3609 |
0 |
| void gpc_polygon_to_tristrip(gpc_polygon *s, gpc_tristrip *t) |
| 3610 |
|
| { |
| 3611 |
|
| gpc_polygon c; |
| 3612 |
|
| |
| 3613 |
0 |
| c.num_contours= 0; |
| 3614 |
0 |
| c.hole= NULL; |
| 3615 |
0 |
| c.contour= NULL; |
| 3616 |
0 |
| gpc_tristrip_clip(GPC_DIFF, s, &c, t); |
| 3617 |
0 |
| } |
| 3618 |
|
| |
| 3619 |
|
| |
| 3620 |
0 |
| void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, |
| 3621 |
|
| gpc_tristrip *result) |
| 3622 |
|
| { |
| 3623 |
0 |
| sb_tree *sbtree= NULL; |
| 3624 |
0 |
| it_node *it= NULL, *intersect; |
| 3625 |
|
| edge_node *edge, *prev_edge, *next_edge, *succ_edge, *e0, *e1; |
| 3626 |
0 |
| edge_node *aet= NULL, *c_heap= NULL, *s_heap= NULL, *cf; |
| 3627 |
0 |
| lmt_node *lmt= NULL, *local_min; |
| 3628 |
0 |
| polygon_node *tlist= NULL, *tn, *tnn, *p, *q; |
| 3629 |
|
| vertex_node *lt, *ltn, *rt, *rtn; |
| 3630 |
|
| h_state horiz[2]; |
| 3631 |
0 |
| vertex_type cft = NUL; /* CBSTEH: initialise! */ |
| 3632 |
0 |
| int in[2], exists[2], parity[2]= {LEFT, LEFT}; |
| 3633 |
0 |
| int s, v, contributing, search, scanbeam= 0, sbt_entries= 0; |
| 3634 |
|
| int vclass, bl, br, tl, tr; |
| 3635 |
0 |
| double *sbt= NULL, xb, px, nx, yb, yt, dy, ix, iy; |
| 3636 |
0 |
| int bInvert_TriStrips = INVERT_TRISTRIPS; /* CBSTEH: added to avoid compiler warnings */ |
| 3637 |
|
| |
| 3638 |
|
| /* Test for trivial NULL result cases */ |
| 3639 |
0 |
▶ | if (((subj->num_contours == 0) && (clip->num_contours == 0)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (((subj->num_contours == 0) && (clip->num_contours == 0)) |
0 |
0 |
0 |
| if (((subj->num_contours == 0) && (clip->num_contours == 0)) |
0 |
0 |
0 |
|
| 3640 |
0 |
▶ | || ((subj->num_contours == 0) && ((op == GPC_INT) || (op == GPC_DIFF))) |
Branch: 3 branches
| Branch | True | False | Total |
| || ((subj->num_contours == 0) && ((op == GPC_INT) || (op == GPC_DIFF))) |
0 |
0 |
0 |
| || ((subj->num_contours == 0) && ((op == GPC_INT) || (op == GPC_DIFF))) |
0 |
0 |
0 |
| || ((subj->num_contours == 0) && ((op == GPC_INT) || (op == GPC_DIFF))) |
0 |
0 |
0 |
|
| 3641 |
0 |
▶ | || ((clip->num_contours == 0) && (op == GPC_INT))) |
Branch: 2 branches
| Branch | True | False | Total |
| || ((clip->num_contours == 0) && (op == GPC_INT))) |
0 |
0 |
0 |
| || ((clip->num_contours == 0) && (op == GPC_INT))) |
0 |
0 |
0 |
|
| 3642 |
|
| { |
| 3643 |
0 |
| result->num_strips= 0; |
| 3644 |
0 |
| result->strip= NULL; |
| 3645 |
0 |
| return; |
| 3646 |
|
| } |
| 3647 |
|
| |
| 3648 |
|
| /* Identify potentialy contributing contours */ |
| 3649 |
0 |
▶ | if (((op == GPC_INT) || (op == GPC_DIFF)) |
Branch: 2 branches
| Branch | True | False | Total |
| if (((op == GPC_INT) || (op == GPC_DIFF)) |
0 |
0 |
0 |
| if (((op == GPC_INT) || (op == GPC_DIFF)) |
0 |
0 |
0 |
|
| 3650 |
0 |
▶ | && (subj->num_contours > 0) && (clip->num_contours > 0)) |
Branch: 2 branches
| Branch | True | False | Total |
| && (subj->num_contours > 0) && (clip->num_contours > 0)) |
0 |
0 |
0 |
| && (subj->num_contours > 0) && (clip->num_contours > 0)) |
0 |
0 |
0 |
|
| 3651 |
0 |
| minimax_test(subj, clip, op); |
| 3652 |
|
| |
| 3653 |
|
| /* Build LMT */ |
| 3654 |
0 |
▶ | if (subj->num_contours > 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (subj->num_contours > 0) |
0 |
0 |
0 |
|
| 3655 |
0 |
| s_heap= build_lmt(&lmt, &sbtree, &sbt_entries, subj, SUBJ, op); |
| 3656 |
0 |
▶ | if (clip->num_contours > 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (clip->num_contours > 0) |
0 |
0 |
0 |
|
| 3657 |
0 |
| c_heap= build_lmt(&lmt, &sbtree, &sbt_entries, clip, CLIP, op); |
| 3658 |
|
| |
| 3659 |
|
| /* Return a NULL result if no contours contribute */ |
| 3660 |
0 |
▶ | if (lmt == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (lmt == NULL) |
0 |
0 |
0 |
|
| 3661 |
|
| { |
| 3662 |
0 |
| result->num_strips= 0; |
| 3663 |
0 |
| result->strip= NULL; |
| 3664 |
0 |
| reset_lmt(&lmt); |
| 3665 |
0 |
▶ | FREE(s_heap); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(s_heap); |
0 |
0 |
0 |
|
| 3666 |
0 |
▶ | FREE(c_heap); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(c_heap); |
0 |
0 |
0 |
|
| 3667 |
0 |
| return; |
| 3668 |
|
| } |
| 3669 |
|
| |
| 3670 |
|
| /* Build scanbeam table from scanbeam tree */ |
| 3671 |
0 |
▶ | MALLOC(sbt, sbt_entries * sizeof(double), "sbt creation"); |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(sbt, sbt_entries * sizeof(double), "sbt creation"); |
0 |
0 |
0 |
| MALLOC(sbt, sbt_entries * sizeof(double), "sbt creation"); |
0 |
0 |
0 |
|
| 3672 |
0 |
| build_sbt(&scanbeam, sbt, sbtree); |
| 3673 |
0 |
| scanbeam= 0; |
| 3674 |
0 |
| free_sbtree(&sbtree); |
| 3675 |
|
| |
| 3676 |
|
| /* Invert clip polygon for difference operation */ |
| 3677 |
0 |
▶ | if (op == GPC_DIFF) |
Branch: 1 branch
| Branch | True | False | Total |
| if (op == GPC_DIFF) |
0 |
0 |
0 |
|
| 3678 |
0 |
| parity[CLIP]= RIGHT; |
| 3679 |
|
| |
| 3680 |
0 |
| local_min= lmt; |
| 3681 |
|
| |
| 3682 |
|
| /* Process each scanbeam */ |
| 3683 |
0 |
▶ | while (scanbeam < sbt_entries) |
Branch: 1 branch
| Branch | True | False | Total |
| while (scanbeam < sbt_entries) |
0 |
0 |
0 |
|
| 3684 |
|
| { |
| 3685 |
|
| /* Set yb and yt to the bottom and top of the scanbeam */ |
| 3686 |
0 |
| yb= sbt[scanbeam++]; |
| 3687 |
0 |
▶ | if (scanbeam < sbt_entries) |
Branch: 1 branch
| Branch | True | False | Total |
| if (scanbeam < sbt_entries) |
0 |
0 |
0 |
|
| 3688 |
|
| { |
| 3689 |
0 |
| yt= sbt[scanbeam]; |
| 3690 |
0 |
| dy= yt - yb; |
| 3691 |
|
| } |
| 3692 |
|
| |
| 3693 |
|
| /* ### SCANBEAM BOUNDARY PROCESSING ################################ */ |
| 3694 |
|
| |
| 3695 |
|
| /* If LMT node corresponding to yb exists */ |
| 3696 |
0 |
▶ | if (local_min) |
Branch: 1 branch
| Branch | True | False | Total |
| if (local_min) |
0 |
0 |
0 |
|
| 3697 |
|
| { |
| 3698 |
0 |
▶ | if (local_min->y == yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (local_min->y == yb) |
0 |
0 |
0 |
|
| 3699 |
|
| { |
| 3700 |
|
| /* Add edges starting at this local minimum to the AET */ |
| 3701 |
0 |
▶ | for (edge= local_min->first_bound; edge; edge= edge->next_bound) |
Branch: 1 branch
| Branch | True | False | Total |
| for (edge= local_min->first_bound; edge; edge= edge->next_bound) |
0 |
0 |
0 |
|
| 3702 |
0 |
| add_edge_to_aet(&aet, edge, NULL); |
| 3703 |
|
| |
| 3704 |
0 |
| local_min= local_min->next; |
| 3705 |
|
| } |
| 3706 |
|
| } |
| 3707 |
|
| |
| 3708 |
|
| /* Set dummy previous x value */ |
| 3709 |
0 |
| px= -DBL_MAX; |
| 3710 |
|
| |
| 3711 |
|
| /* Create bundles within AET */ |
| 3712 |
0 |
| e0= aet; |
| 3713 |
|
| /* e1= aet; */ /* CBSTEH */ |
| 3714 |
|
| |
| 3715 |
|
| /* Set up bundle fields of first edge */ |
| 3716 |
0 |
| aet->bundle[ABOVE][ aet->type]= (aet->top.y != yb); |
| 3717 |
0 |
| aet->bundle[ABOVE][!aet->type]= FALSE; |
| 3718 |
0 |
| aet->bstate[ABOVE]= UNBUNDLED; |
| 3719 |
|
| |
| 3720 |
0 |
▶ | for (next_edge= aet->next; next_edge; next_edge= next_edge->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (next_edge= aet->next; next_edge; next_edge= next_edge->next) |
0 |
0 |
0 |
|
| 3721 |
|
| { |
| 3722 |
|
| /* Set up bundle fields of next edge */ |
| 3723 |
0 |
| next_edge->bundle[ABOVE][ next_edge->type]= (next_edge->top.y != yb); |
| 3724 |
0 |
| next_edge->bundle[ABOVE][!next_edge->type]= FALSE; |
| 3725 |
0 |
| next_edge->bstate[ABOVE]= UNBUNDLED; |
| 3726 |
|
| |
| 3727 |
|
| /* Bundle edges above the scanbeam boundary if they coincide */ |
| 3728 |
0 |
▶ | if (next_edge->bundle[ABOVE][next_edge->type]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (next_edge->bundle[ABOVE][next_edge->type]) |
0 |
0 |
0 |
|
| 3729 |
|
| { |
| 3730 |
0 |
▶ | if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx) |
Branch: 2 branches
| Branch | True | False | Total |
| if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx) |
0 |
0 |
0 |
| if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx) |
0 |
0 |
0 |
|
| 3731 |
0 |
▶ | && (e0->top.y != yb)) |
Branch: 1 branch
| Branch | True | False | Total |
| && (e0->top.y != yb)) |
0 |
0 |
0 |
|
| 3732 |
|
| { |
| 3733 |
0 |
| next_edge->bundle[ABOVE][ next_edge->type]^= |
| 3734 |
0 |
| e0->bundle[ABOVE][ next_edge->type]; |
| 3735 |
0 |
| next_edge->bundle[ABOVE][!next_edge->type]= |
| 3736 |
0 |
| e0->bundle[ABOVE][!next_edge->type]; |
| 3737 |
0 |
| next_edge->bstate[ABOVE]= BUNDLE_HEAD; |
| 3738 |
0 |
| e0->bundle[ABOVE][CLIP]= FALSE; |
| 3739 |
0 |
| e0->bundle[ABOVE][SUBJ]= FALSE; |
| 3740 |
0 |
| e0->bstate[ABOVE]= BUNDLE_TAIL; |
| 3741 |
|
| } |
| 3742 |
0 |
| e0= next_edge; |
| 3743 |
|
| } |
| 3744 |
|
| } |
| 3745 |
|
| |
| 3746 |
0 |
| horiz[CLIP]= NH; |
| 3747 |
0 |
| horiz[SUBJ]= NH; |
| 3748 |
|
| |
| 3749 |
|
| /* Process each edge at this scanbeam boundary */ |
| 3750 |
0 |
▶ | for (edge= aet; edge; edge= edge->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (edge= aet; edge; edge= edge->next) |
0 |
0 |
0 |
|
| 3751 |
|
| { |
| 3752 |
0 |
| exists[CLIP]= edge->bundle[ABOVE][CLIP] + |
| 3753 |
0 |
| (edge->bundle[BELOW][CLIP] << 1); |
| 3754 |
0 |
| exists[SUBJ]= edge->bundle[ABOVE][SUBJ] + |
| 3755 |
0 |
| (edge->bundle[BELOW][SUBJ] << 1); |
| 3756 |
|
| |
| 3757 |
0 |
▶ | if (exists[CLIP] || exists[SUBJ]) |
Branch: 2 branches
| Branch | True | False | Total |
| if (exists[CLIP] || exists[SUBJ]) |
0 |
0 |
0 |
| if (exists[CLIP] || exists[SUBJ]) |
0 |
0 |
0 |
|
| 3758 |
|
| { |
| 3759 |
|
| /* Set bundle side */ |
| 3760 |
0 |
| edge->bside[CLIP]= parity[CLIP]; |
| 3761 |
0 |
| edge->bside[SUBJ]= parity[SUBJ]; |
| 3762 |
|
| |
| 3763 |
|
| /* Determine contributing status and quadrant occupancies */ |
| 3764 |
0 |
| switch (op) |
| 3765 |
|
| { |
| 3766 |
0 |
| case GPC_DIFF: |
| 3767 |
|
| case GPC_INT: |
| 3768 |
0 |
▶ | contributing= (exists[CLIP] && (parity[SUBJ] || horiz[SUBJ])) |
Branch: 2 branches
| Branch | True | False | Total |
| contributing= (exists[CLIP] && (parity[SUBJ] || horiz[SUBJ])) |
0 |
0 |
0 |
| contributing= (exists[CLIP] && (parity[SUBJ] || horiz[SUBJ])) |
0 |
0 |
0 |
|
| 3769 |
0 |
▶ | || (exists[SUBJ] && (parity[CLIP] || horiz[CLIP])) |
Branch: 3 branches
| Branch | True | False | Total |
| || (exists[SUBJ] && (parity[CLIP] || horiz[CLIP])) |
0 |
0 |
0 |
| || (exists[SUBJ] && (parity[CLIP] || horiz[CLIP])) |
0 |
0 |
0 |
| || (exists[SUBJ] && (parity[CLIP] || horiz[CLIP])) |
0 |
0 |
0 |
|
| 3770 |
0 |
▶ | || (exists[CLIP] && exists[SUBJ] |
Branch: 3 branches
| Branch | True | False | Total |
| || (exists[CLIP] && exists[SUBJ] |
0 |
0 |
0 |
| || (exists[CLIP] && exists[SUBJ] |
0 |
0 |
0 |
| || (exists[CLIP] && exists[SUBJ] |
0 |
0 |
0 |
|
| 3771 |
0 |
▶ | && (parity[CLIP] == parity[SUBJ])); |
Branch: 1 branch
| Branch | True | False | Total |
| && (parity[CLIP] == parity[SUBJ])); |
0 |
0 |
0 |
|
| 3772 |
0 |
| br= (parity[CLIP]) |
| 3773 |
0 |
▶ | && (parity[SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (parity[SUBJ]); |
0 |
0 |
0 |
| && (parity[SUBJ]); |
0 |
0 |
0 |
|
| 3774 |
0 |
| bl= (parity[CLIP] ^ edge->bundle[ABOVE][CLIP]) |
| 3775 |
0 |
▶ | && (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| && (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 3776 |
0 |
| tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) |
| 3777 |
0 |
▶ | && (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
Branch: 2 branches
| Branch | True | False | Total |
| && (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
0 |
0 |
0 |
| && (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
0 |
0 |
0 |
|
| 3778 |
0 |
| tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) |
| 3779 |
0 |
▶ | && (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
0 |
0 |
0 |
| && (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
0 |
0 |
0 |
|
| 3780 |
0 |
| break; |
| 3781 |
0 |
| case GPC_XOR: |
| 3782 |
0 |
▶ | contributing= exists[CLIP] || exists[SUBJ]; |
Branch: 2 branches
| Branch | True | False | Total |
| contributing= exists[CLIP] || exists[SUBJ]; |
0 |
0 |
0 |
| contributing= exists[CLIP] || exists[SUBJ]; |
0 |
0 |
0 |
|
| 3783 |
0 |
| br= (parity[CLIP]) |
| 3784 |
0 |
| ^ (parity[SUBJ]); |
| 3785 |
0 |
| bl= (parity[CLIP] ^ edge->bundle[ABOVE][CLIP]) |
| 3786 |
0 |
| ^ (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
| 3787 |
0 |
| tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) |
| 3788 |
0 |
| ^ (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
| 3789 |
0 |
| tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) |
| 3790 |
0 |
| ^ (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
| 3791 |
0 |
| break; |
| 3792 |
0 |
| case GPC_UNION: |
| 3793 |
0 |
▶ | contributing= (exists[CLIP] && (!parity[SUBJ] || horiz[SUBJ])) |
Branch: 2 branches
| Branch | True | False | Total |
| contributing= (exists[CLIP] && (!parity[SUBJ] || horiz[SUBJ])) |
0 |
0 |
0 |
| contributing= (exists[CLIP] && (!parity[SUBJ] || horiz[SUBJ])) |
0 |
0 |
0 |
|
| 3794 |
0 |
▶ | || (exists[SUBJ] && (!parity[CLIP] || horiz[CLIP])) |
Branch: 3 branches
| Branch | True | False | Total |
| || (exists[SUBJ] && (!parity[CLIP] || horiz[CLIP])) |
0 |
0 |
0 |
| || (exists[SUBJ] && (!parity[CLIP] || horiz[CLIP])) |
0 |
0 |
0 |
| || (exists[SUBJ] && (!parity[CLIP] || horiz[CLIP])) |
0 |
0 |
0 |
|
| 3795 |
0 |
▶ | || (exists[CLIP] && exists[SUBJ] |
Branch: 3 branches
| Branch | True | False | Total |
| || (exists[CLIP] && exists[SUBJ] |
0 |
0 |
0 |
| || (exists[CLIP] && exists[SUBJ] |
0 |
0 |
0 |
| || (exists[CLIP] && exists[SUBJ] |
0 |
0 |
0 |
|
| 3796 |
0 |
▶ | && (parity[CLIP] == parity[SUBJ])); |
Branch: 1 branch
| Branch | True | False | Total |
| && (parity[CLIP] == parity[SUBJ])); |
0 |
0 |
0 |
|
| 3797 |
0 |
| br= (parity[CLIP]) |
| 3798 |
0 |
▶ | || (parity[SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (parity[SUBJ]); |
0 |
0 |
0 |
| || (parity[SUBJ]); |
0 |
0 |
0 |
|
| 3799 |
0 |
| bl= (parity[CLIP] ^ edge->bundle[ABOVE][CLIP]) |
| 3800 |
0 |
▶ | || (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| || (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 3801 |
0 |
| tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) |
| 3802 |
0 |
▶ | || (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
Branch: 2 branches
| Branch | True | False | Total |
| || (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
0 |
0 |
0 |
| || (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); |
0 |
0 |
0 |
|
| 3803 |
0 |
| tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) |
| 3804 |
0 |
▶ | || (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
0 |
0 |
0 |
| || (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); |
0 |
0 |
0 |
|
| 3805 |
0 |
| break; |
| 3806 |
|
| } |
| 3807 |
|
| |
| 3808 |
|
| /* Update parity */ |
| 3809 |
0 |
| parity[CLIP]^= edge->bundle[ABOVE][CLIP]; |
| 3810 |
0 |
| parity[SUBJ]^= edge->bundle[ABOVE][SUBJ]; |
| 3811 |
|
| |
| 3812 |
|
| /* Update horizontal state */ |
| 3813 |
0 |
▶ | if (exists[CLIP]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (exists[CLIP]) |
0 |
0 |
0 |
|
| 3814 |
0 |
| horiz[CLIP]= |
| 3815 |
0 |
| next_h_state[horiz[CLIP]] |
| 3816 |
0 |
| [((exists[CLIP] - 1) << 1) + parity[CLIP]]; |
| 3817 |
0 |
▶ | if (exists[SUBJ]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (exists[SUBJ]) |
0 |
0 |
0 |
|
| 3818 |
0 |
| horiz[SUBJ]= |
| 3819 |
0 |
| next_h_state[horiz[SUBJ]] |
| 3820 |
0 |
| [((exists[SUBJ] - 1) << 1) + parity[SUBJ]]; |
| 3821 |
|
| |
| 3822 |
0 |
| vclass= tr + (tl << 1) + (br << 2) + (bl << 3); |
| 3823 |
|
| |
| 3824 |
0 |
▶ | if (contributing) |
Branch: 1 branch
| Branch | True | False | Total |
| if (contributing) |
0 |
0 |
0 |
|
| 3825 |
|
| { |
| 3826 |
0 |
| xb= edge->xb; |
| 3827 |
|
| |
| 3828 |
0 |
| switch (vclass) |
| 3829 |
|
| { |
| 3830 |
0 |
| case EMN: |
| 3831 |
0 |
| new_tristrip(&tlist, edge, xb, yb); |
| 3832 |
0 |
| cf= edge; |
| 3833 |
0 |
| break; |
| 3834 |
0 |
| case ERI: |
| 3835 |
0 |
| edge->outp[ABOVE]= cf->outp[ABOVE]; |
| 3836 |
0 |
▶ | if (xb != cf->xb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (xb != cf->xb) |
0 |
0 |
0 |
|
| 3837 |
0 |
| VERTEX(edge, ABOVE, RIGHT, xb, yb); |
| 3838 |
0 |
| cf= NULL; |
| 3839 |
0 |
| break; |
| 3840 |
0 |
| case ELI: |
| 3841 |
0 |
| VERTEX(edge, BELOW, LEFT, xb, yb); |
| 3842 |
0 |
| edge->outp[ABOVE]= NULL; |
| 3843 |
0 |
| cf= edge; |
| 3844 |
0 |
| break; |
| 3845 |
0 |
| case EMX: |
| 3846 |
0 |
▶ | if (xb != cf->xb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (xb != cf->xb) |
0 |
0 |
0 |
|
| 3847 |
0 |
| VERTEX(edge, BELOW, RIGHT, xb, yb); |
| 3848 |
0 |
| edge->outp[ABOVE]= NULL; |
| 3849 |
0 |
| cf= NULL; |
| 3850 |
0 |
| break; |
| 3851 |
0 |
| case IMN: |
| 3852 |
0 |
▶ | if (cft == LED) |
Branch: 1 branch
| Branch | True | False | Total |
| if (cft == LED) |
0 |
0 |
0 |
|
| 3853 |
|
| { |
| 3854 |
0 |
▶ | if (cf->bot.y != yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (cf->bot.y != yb) |
0 |
0 |
0 |
|
| 3855 |
0 |
| VERTEX(cf, BELOW, LEFT, cf->xb, yb); |
| 3856 |
0 |
| new_tristrip(&tlist, cf, cf->xb, yb); |
| 3857 |
|
| } |
| 3858 |
0 |
| edge->outp[ABOVE]= cf->outp[ABOVE]; |
| 3859 |
0 |
| VERTEX(edge, ABOVE, RIGHT, xb, yb); |
| 3860 |
0 |
| break; |
| 3861 |
0 |
| case ILI: |
| 3862 |
0 |
| new_tristrip(&tlist, edge, xb, yb); |
| 3863 |
0 |
| cf= edge; |
| 3864 |
0 |
| cft= ILI; |
| 3865 |
0 |
| break; |
| 3866 |
0 |
| case IRI: |
| 3867 |
0 |
▶ | if (cft == LED) |
Branch: 1 branch
| Branch | True | False | Total |
| if (cft == LED) |
0 |
0 |
0 |
|
| 3868 |
|
| { |
| 3869 |
0 |
▶ | if (cf->bot.y != yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (cf->bot.y != yb) |
0 |
0 |
0 |
|
| 3870 |
0 |
| VERTEX(cf, BELOW, LEFT, cf->xb, yb); |
| 3871 |
0 |
| new_tristrip(&tlist, cf, cf->xb, yb); |
| 3872 |
|
| } |
| 3873 |
0 |
| VERTEX(edge, BELOW, RIGHT, xb, yb); |
| 3874 |
0 |
| edge->outp[ABOVE]= NULL; |
| 3875 |
0 |
| break; |
| 3876 |
0 |
| case IMX: |
| 3877 |
0 |
| VERTEX(edge, BELOW, LEFT, xb, yb); |
| 3878 |
0 |
| edge->outp[ABOVE]= NULL; |
| 3879 |
0 |
| cft= IMX; |
| 3880 |
0 |
| break; |
| 3881 |
0 |
| case IMM: |
| 3882 |
0 |
| VERTEX(edge, BELOW, LEFT, xb, yb); |
| 3883 |
0 |
| edge->outp[ABOVE]= cf->outp[ABOVE]; |
| 3884 |
0 |
▶ | if (xb != cf->xb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (xb != cf->xb) |
0 |
0 |
0 |
|
| 3885 |
0 |
| VERTEX(cf, ABOVE, RIGHT, xb, yb); |
| 3886 |
0 |
| cf= edge; |
| 3887 |
0 |
| break; |
| 3888 |
0 |
| case EMM: |
| 3889 |
0 |
| VERTEX(edge, BELOW, RIGHT, xb, yb); |
| 3890 |
0 |
| edge->outp[ABOVE]= NULL; |
| 3891 |
0 |
| new_tristrip(&tlist, edge, xb, yb); |
| 3892 |
0 |
| cf= edge; |
| 3893 |
0 |
| break; |
| 3894 |
0 |
| case LED: |
| 3895 |
0 |
▶ | if (edge->bot.y == yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->bot.y == yb) |
0 |
0 |
0 |
|
| 3896 |
0 |
| VERTEX(edge, BELOW, LEFT, xb, yb); |
| 3897 |
0 |
| edge->outp[ABOVE]= edge->outp[BELOW]; |
| 3898 |
0 |
| cf= edge; |
| 3899 |
0 |
| cft= LED; |
| 3900 |
0 |
| break; |
| 3901 |
0 |
| case RED: |
| 3902 |
0 |
| edge->outp[ABOVE]= cf->outp[ABOVE]; |
| 3903 |
0 |
▶ | if (cft == LED) |
Branch: 1 branch
| Branch | True | False | Total |
| if (cft == LED) |
0 |
0 |
0 |
|
| 3904 |
|
| { |
| 3905 |
0 |
▶ | if (cf->bot.y == yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (cf->bot.y == yb) |
0 |
0 |
0 |
|
| 3906 |
|
| { |
| 3907 |
0 |
| VERTEX(edge, BELOW, RIGHT, xb, yb); |
| 3908 |
|
| } |
| 3909 |
|
| else |
| 3910 |
|
| { |
| 3911 |
0 |
▶ | if (edge->bot.y == yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->bot.y == yb) |
0 |
0 |
0 |
|
| 3912 |
|
| { |
| 3913 |
0 |
| VERTEX(cf, BELOW, LEFT, cf->xb, yb); |
| 3914 |
0 |
| VERTEX(edge, BELOW, RIGHT, xb, yb); |
| 3915 |
|
| } |
| 3916 |
|
| } |
| 3917 |
|
| } |
| 3918 |
|
| else |
| 3919 |
|
| { |
| 3920 |
0 |
| VERTEX(edge, BELOW, RIGHT, xb, yb); |
| 3921 |
0 |
| VERTEX(edge, ABOVE, RIGHT, xb, yb); |
| 3922 |
|
| } |
| 3923 |
0 |
| cf= NULL; |
| 3924 |
0 |
| break; |
| 3925 |
0 |
| default: |
| 3926 |
0 |
| break; |
| 3927 |
|
| } /* End of switch */ |
| 3928 |
|
| } /* End of contributing conditional */ |
| 3929 |
|
| } /* End of edge exists conditional */ |
| 3930 |
|
| } /* End of AET loop */ |
| 3931 |
|
| |
| 3932 |
|
| /* Delete terminating edges from the AET, otherwise compute xt */ |
| 3933 |
0 |
▶ | for (edge= aet; edge; edge= edge->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (edge= aet; edge; edge= edge->next) |
0 |
0 |
0 |
|
| 3934 |
|
| { |
| 3935 |
0 |
▶ | if (edge->top.y == yb) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->top.y == yb) |
0 |
0 |
0 |
|
| 3936 |
|
| { |
| 3937 |
0 |
| prev_edge= edge->prev; |
| 3938 |
0 |
| next_edge= edge->next; |
| 3939 |
0 |
▶ | if (prev_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge) |
0 |
0 |
0 |
|
| 3940 |
0 |
| prev_edge->next= next_edge; |
| 3941 |
|
| else |
| 3942 |
0 |
| aet= next_edge; |
| 3943 |
0 |
▶ | if (next_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (next_edge) |
0 |
0 |
0 |
|
| 3944 |
0 |
| next_edge->prev= prev_edge; |
| 3945 |
|
| |
| 3946 |
|
| /* Copy bundle head state to the adjacent tail edge if required */ |
| 3947 |
0 |
▶ | if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge) |
Branch: 2 branches
| Branch | True | False | Total |
| if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge) |
0 |
0 |
0 |
| if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge) |
0 |
0 |
0 |
|
| 3948 |
|
| { |
| 3949 |
0 |
▶ | if (prev_edge->bstate[BELOW] == BUNDLE_TAIL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge->bstate[BELOW] == BUNDLE_TAIL) |
0 |
0 |
0 |
|
| 3950 |
|
| { |
| 3951 |
0 |
| prev_edge->outp[BELOW]= edge->outp[BELOW]; |
| 3952 |
0 |
| prev_edge->bstate[BELOW]= UNBUNDLED; |
| 3953 |
0 |
▶ | if (prev_edge->prev) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge->prev) |
0 |
0 |
0 |
|
| 3954 |
0 |
▶ | if (prev_edge->prev->bstate[BELOW] == BUNDLE_TAIL) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge->prev->bstate[BELOW] == BUNDLE_TAIL) |
0 |
0 |
0 |
|
| 3955 |
0 |
| prev_edge->bstate[BELOW]= BUNDLE_HEAD; |
| 3956 |
|
| } |
| 3957 |
|
| } |
| 3958 |
|
| } |
| 3959 |
|
| else |
| 3960 |
|
| { |
| 3961 |
0 |
▶ | if (edge->top.y == yt) |
Branch: 1 branch
| Branch | True | False | Total |
| if (edge->top.y == yt) |
0 |
0 |
0 |
|
| 3962 |
0 |
| edge->xt= edge->top.x; |
| 3963 |
|
| else |
| 3964 |
0 |
| edge->xt= edge->bot.x + edge->dx * (yt - edge->bot.y); |
| 3965 |
|
| } |
| 3966 |
|
| } |
| 3967 |
|
| |
| 3968 |
0 |
▶ | if (scanbeam < sbt_entries) |
Branch: 1 branch
| Branch | True | False | Total |
| if (scanbeam < sbt_entries) |
0 |
0 |
0 |
|
| 3969 |
|
| { |
| 3970 |
|
| /* ### SCANBEAM INTERIOR PROCESSING ############################## */ |
| 3971 |
|
| |
| 3972 |
0 |
| build_intersection_table(&it, aet, dy); |
| 3973 |
|
| |
| 3974 |
|
| /* Process each node in the intersection table */ |
| 3975 |
0 |
▶ | for (intersect= it; intersect; intersect= intersect->next) |
Branch: 1 branch
| Branch | True | False | Total |
| for (intersect= it; intersect; intersect= intersect->next) |
0 |
0 |
0 |
|
| 3976 |
|
| { |
| 3977 |
0 |
| e0= intersect->ie[0]; |
| 3978 |
0 |
| e1= intersect->ie[1]; |
| 3979 |
|
| |
| 3980 |
|
| /* Only generate output for contributing intersections */ |
| 3981 |
0 |
▶ | if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ]) |
Branch: 2 branches
| Branch | True | False | Total |
| if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ]) |
0 |
0 |
0 |
| if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ]) |
0 |
0 |
0 |
|
| 3982 |
0 |
▶ | && (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ])) |
Branch: 2 branches
| Branch | True | False | Total |
| && (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ])) |
0 |
0 |
0 |
| && (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ])) |
0 |
0 |
0 |
|
| 3983 |
|
| { |
| 3984 |
0 |
| p= e0->outp[ABOVE]; |
| 3985 |
0 |
| q= e1->outp[ABOVE]; |
| 3986 |
0 |
| ix= intersect->point.x; |
| 3987 |
0 |
| iy= intersect->point.y + yb; |
| 3988 |
|
| |
| 3989 |
0 |
▶ | in[CLIP]= ( e0->bundle[ABOVE][CLIP] && !e0->bside[CLIP]) |
Branch: 1 branch
| Branch | True | False | Total |
| in[CLIP]= ( e0->bundle[ABOVE][CLIP] && !e0->bside[CLIP]) |
0 |
0 |
0 |
|
| 3990 |
0 |
▶ | || ( e1->bundle[ABOVE][CLIP] && e1->bside[CLIP]) |
Branch: 2 branches
| Branch | True | False | Total |
| || ( e1->bundle[ABOVE][CLIP] && e1->bside[CLIP]) |
0 |
0 |
0 |
| || ( e1->bundle[ABOVE][CLIP] && e1->bside[CLIP]) |
0 |
0 |
0 |
|
| 3991 |
0 |
▶ | || (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP] |
Branch: 3 branches
| Branch | True | False | Total |
| || (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP] |
0 |
0 |
0 |
| || (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP] |
0 |
0 |
0 |
| || (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP] |
0 |
0 |
0 |
|
| 3992 |
0 |
▶ | && e0->bside[CLIP] && e1->bside[CLIP]); |
Branch: 2 branches
| Branch | True | False | Total |
| && e0->bside[CLIP] && e1->bside[CLIP]); |
0 |
0 |
0 |
| && e0->bside[CLIP] && e1->bside[CLIP]); |
0 |
0 |
0 |
|
| 3993 |
0 |
▶ | in[SUBJ]= ( e0->bundle[ABOVE][SUBJ] && !e0->bside[SUBJ]) |
Branch: 1 branch
| Branch | True | False | Total |
| in[SUBJ]= ( e0->bundle[ABOVE][SUBJ] && !e0->bside[SUBJ]) |
0 |
0 |
0 |
|
| 3994 |
0 |
▶ | || ( e1->bundle[ABOVE][SUBJ] && e1->bside[SUBJ]) |
Branch: 2 branches
| Branch | True | False | Total |
| || ( e1->bundle[ABOVE][SUBJ] && e1->bside[SUBJ]) |
0 |
0 |
0 |
| || ( e1->bundle[ABOVE][SUBJ] && e1->bside[SUBJ]) |
0 |
0 |
0 |
|
| 3995 |
0 |
▶ | || (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ] |
Branch: 3 branches
| Branch | True | False | Total |
| || (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ] |
0 |
0 |
0 |
| || (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ] |
0 |
0 |
0 |
| || (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ] |
0 |
0 |
0 |
|
| 3996 |
0 |
▶ | && e0->bside[SUBJ] && e1->bside[SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && e0->bside[SUBJ] && e1->bside[SUBJ]); |
0 |
0 |
0 |
| && e0->bside[SUBJ] && e1->bside[SUBJ]); |
0 |
0 |
0 |
|
| 3997 |
|
| |
| 3998 |
|
| /* Determine quadrant occupancies */ |
| 3999 |
0 |
| switch (op) |
| 4000 |
|
| { |
| 4001 |
0 |
| case GPC_DIFF: |
| 4002 |
|
| case GPC_INT: |
| 4003 |
0 |
| tr= (in[CLIP]) |
| 4004 |
0 |
▶ | && (in[SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (in[SUBJ]); |
0 |
0 |
0 |
| && (in[SUBJ]); |
0 |
0 |
0 |
|
| 4005 |
0 |
| tl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP]) |
| 4006 |
0 |
▶ | && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 4007 |
0 |
| br= (in[CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 4008 |
0 |
▶ | && (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| && (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 4009 |
0 |
| bl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 4010 |
0 |
▶ | && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| && (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 4011 |
0 |
| break; |
| 4012 |
0 |
| case GPC_XOR: |
| 4013 |
0 |
| tr= (in[CLIP]) |
| 4014 |
0 |
| ^ (in[SUBJ]); |
| 4015 |
0 |
| tl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP]) |
| 4016 |
0 |
| ^ (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
| 4017 |
0 |
| br= (in[CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 4018 |
0 |
| ^ (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
| 4019 |
0 |
| bl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 4020 |
0 |
| ^ (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
| 4021 |
0 |
| break; |
| 4022 |
0 |
| case GPC_UNION: |
| 4023 |
0 |
| tr= (in[CLIP]) |
| 4024 |
0 |
▶ | || (in[SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (in[SUBJ]); |
0 |
0 |
0 |
| || (in[SUBJ]); |
0 |
0 |
0 |
|
| 4025 |
0 |
| tl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP]) |
| 4026 |
0 |
▶ | || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 4027 |
0 |
| br= (in[CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 4028 |
0 |
▶ | || (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| || (in[SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 4029 |
0 |
| bl= (in[CLIP] ^ e1->bundle[ABOVE][CLIP] ^ e0->bundle[ABOVE][CLIP]) |
| 4030 |
0 |
▶ | || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
Branch: 2 branches
| Branch | True | False | Total |
| || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
| || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); |
0 |
0 |
0 |
|
| 4031 |
0 |
| break; |
| 4032 |
|
| } |
| 4033 |
|
| |
| 4034 |
0 |
| vclass= tr + (tl << 1) + (br << 2) + (bl << 3); |
| 4035 |
|
| |
| 4036 |
0 |
| switch (vclass) |
| 4037 |
|
| { |
| 4038 |
0 |
| case EMN: |
| 4039 |
0 |
| new_tristrip(&tlist, e1, ix, iy); |
| 4040 |
0 |
| e0->outp[ABOVE]= e1->outp[ABOVE]; |
| 4041 |
0 |
| break; |
| 4042 |
0 |
| case ERI: |
| 4043 |
0 |
▶ | if (p) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) |
0 |
0 |
0 |
|
| 4044 |
|
| { |
| 4045 |
0 |
▶ | P_EDGE(prev_edge, e0, ABOVE, px, iy); |
Branch: 1 branch
| Branch | True | False | Total |
| P_EDGE(prev_edge, e0, ABOVE, px, iy); |
0 |
0 |
0 |
|
| 4046 |
0 |
| VERTEX(prev_edge, ABOVE, LEFT, px, iy); |
| 4047 |
0 |
| VERTEX(e0, ABOVE, RIGHT, ix, iy); |
| 4048 |
0 |
| e1->outp[ABOVE]= e0->outp[ABOVE]; |
| 4049 |
0 |
| e0->outp[ABOVE]= NULL; |
| 4050 |
|
| } |
| 4051 |
0 |
| break; |
| 4052 |
0 |
| case ELI: |
| 4053 |
0 |
▶ | if (q) |
Branch: 1 branch
| Branch | True | False | Total |
| if (q) |
0 |
0 |
0 |
|
| 4054 |
|
| { |
| 4055 |
0 |
▶ | N_EDGE(next_edge, e1, ABOVE, nx, iy); |
Branch: 1 branch
| Branch | True | False | Total |
| N_EDGE(next_edge, e1, ABOVE, nx, iy); |
0 |
0 |
0 |
|
| 4056 |
0 |
| VERTEX(e1, ABOVE, LEFT, ix, iy); |
| 4057 |
0 |
| VERTEX(next_edge, ABOVE, RIGHT, nx, iy); |
| 4058 |
0 |
| e0->outp[ABOVE]= e1->outp[ABOVE]; |
| 4059 |
0 |
| e1->outp[ABOVE]= NULL; |
| 4060 |
|
| } |
| 4061 |
0 |
| break; |
| 4062 |
0 |
| case EMX: |
| 4063 |
0 |
▶ | if (p && q) |
Branch: 2 branches
| Branch | True | False | Total |
| if (p && q) |
0 |
0 |
0 |
| if (p && q) |
0 |
0 |
0 |
|
| 4064 |
|
| { |
| 4065 |
0 |
| VERTEX(e0, ABOVE, LEFT, ix, iy); |
| 4066 |
0 |
| e0->outp[ABOVE]= NULL; |
| 4067 |
0 |
| e1->outp[ABOVE]= NULL; |
| 4068 |
|
| } |
| 4069 |
0 |
| break; |
| 4070 |
0 |
| case IMN: |
| 4071 |
0 |
▶ | P_EDGE(prev_edge, e0, ABOVE, px, iy); |
Branch: 1 branch
| Branch | True | False | Total |
| P_EDGE(prev_edge, e0, ABOVE, px, iy); |
0 |
0 |
0 |
|
| 4072 |
0 |
| VERTEX(prev_edge, ABOVE, LEFT, px, iy); |
| 4073 |
0 |
▶ | N_EDGE(next_edge, e1, ABOVE, nx, iy); |
Branch: 1 branch
| Branch | True | False | Total |
| N_EDGE(next_edge, e1, ABOVE, nx, iy); |
0 |
0 |
0 |
|
| 4074 |
0 |
| VERTEX(next_edge, ABOVE, RIGHT, nx, iy); |
| 4075 |
0 |
| new_tristrip(&tlist, prev_edge, px, iy); |
| 4076 |
0 |
| e1->outp[ABOVE]= prev_edge->outp[ABOVE]; |
| 4077 |
0 |
| VERTEX(e1, ABOVE, RIGHT, ix, iy); |
| 4078 |
0 |
| new_tristrip(&tlist, e0, ix, iy); |
| 4079 |
0 |
| next_edge->outp[ABOVE]= e0->outp[ABOVE]; |
| 4080 |
0 |
| VERTEX(next_edge, ABOVE, RIGHT, nx, iy); |
| 4081 |
0 |
| break; |
| 4082 |
0 |
| case ILI: |
| 4083 |
0 |
▶ | if (p) |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) |
0 |
0 |
0 |
|
| 4084 |
|
| { |
| 4085 |
0 |
| VERTEX(e0, ABOVE, LEFT, ix, iy); |
| 4086 |
0 |
▶ | N_EDGE(next_edge, e1, ABOVE, nx, iy); |
Branch: 1 branch
| Branch | True | False | Total |
| N_EDGE(next_edge, e1, ABOVE, nx, iy); |
0 |
0 |
0 |
|
| 4087 |
0 |
| VERTEX(next_edge, ABOVE, RIGHT, nx, iy); |
| 4088 |
0 |
| e1->outp[ABOVE]= e0->outp[ABOVE]; |
| 4089 |
0 |
| e0->outp[ABOVE]= NULL; |
| 4090 |
|
| } |
| 4091 |
0 |
| break; |
| 4092 |
0 |
| case IRI: |
| 4093 |
0 |
▶ | if (q) |
Branch: 1 branch
| Branch | True | False | Total |
| if (q) |
0 |
0 |
0 |
|
| 4094 |
|
| { |
| 4095 |
0 |
| VERTEX(e1, ABOVE, RIGHT, ix, iy); |
| 4096 |
0 |
▶ | P_EDGE(prev_edge, e0, ABOVE, px, iy); |
Branch: 1 branch
| Branch | True | False | Total |
| P_EDGE(prev_edge, e0, ABOVE, px, iy); |
0 |
0 |
0 |
|
| 4097 |
0 |
| VERTEX(prev_edge, ABOVE, LEFT, px, iy); |
| 4098 |
0 |
| e0->outp[ABOVE]= e1->outp[ABOVE]; |
| 4099 |
0 |
| e1->outp[ABOVE]= NULL; |
| 4100 |
|
| } |
| 4101 |
0 |
| break; |
| 4102 |
0 |
| case IMX: |
| 4103 |
0 |
▶ | if (p && q) |
Branch: 2 branches
| Branch | True | False | Total |
| if (p && q) |
0 |
0 |
0 |
| if (p && q) |
0 |
0 |
0 |
|
| 4104 |
|
| { |
| 4105 |
0 |
| VERTEX(e0, ABOVE, RIGHT, ix, iy); |
| 4106 |
0 |
| VERTEX(e1, ABOVE, LEFT, ix, iy); |
| 4107 |
0 |
| e0->outp[ABOVE]= NULL; |
| 4108 |
0 |
| e1->outp[ABOVE]= NULL; |
| 4109 |
0 |
▶ | P_EDGE(prev_edge, e0, ABOVE, px, iy); |
Branch: 1 branch
| Branch | True | False | Total |
| P_EDGE(prev_edge, e0, ABOVE, px, iy); |
0 |
0 |
0 |
|
| 4110 |
0 |
| VERTEX(prev_edge, ABOVE, LEFT, px, iy); |
| 4111 |
0 |
| new_tristrip(&tlist, prev_edge, px, iy); |
| 4112 |
0 |
▶ | N_EDGE(next_edge, e1, ABOVE, nx, iy); |
Branch: 1 branch
| Branch | True | False | Total |
| N_EDGE(next_edge, e1, ABOVE, nx, iy); |
0 |
0 |
0 |
|
| 4113 |
0 |
| VERTEX(next_edge, ABOVE, RIGHT, nx, iy); |
| 4114 |
0 |
| next_edge->outp[ABOVE]= prev_edge->outp[ABOVE]; |
| 4115 |
0 |
| VERTEX(next_edge, ABOVE, RIGHT, nx, iy); |
| 4116 |
|
| } |
| 4117 |
0 |
| break; |
| 4118 |
0 |
| case IMM: |
| 4119 |
0 |
▶ | if (p && q) |
Branch: 2 branches
| Branch | True | False | Total |
| if (p && q) |
0 |
0 |
0 |
| if (p && q) |
0 |
0 |
0 |
|
| 4120 |
|
| { |
| 4121 |
0 |
| VERTEX(e0, ABOVE, RIGHT, ix, iy); |
| 4122 |
0 |
| VERTEX(e1, ABOVE, LEFT, ix, iy); |
| 4123 |
0 |
▶ | P_EDGE(prev_edge, e0, ABOVE, px, iy); |
Branch: 1 branch
| Branch | True | False | Total |
| P_EDGE(prev_edge, e0, ABOVE, px, iy); |
0 |
0 |
0 |
|
| 4124 |
0 |
| VERTEX(prev_edge, ABOVE, LEFT, px, iy); |
| 4125 |
0 |
| new_tristrip(&tlist, prev_edge, px, iy); |
| 4126 |
0 |
▶ | N_EDGE(next_edge, e1, ABOVE, nx, iy); |
Branch: 1 branch
| Branch | True | False | Total |
| N_EDGE(next_edge, e1, ABOVE, nx, iy); |
0 |
0 |
0 |
|
| 4127 |
0 |
| VERTEX(next_edge, ABOVE, RIGHT, nx, iy); |
| 4128 |
0 |
| e1->outp[ABOVE]= prev_edge->outp[ABOVE]; |
| 4129 |
0 |
| VERTEX(e1, ABOVE, RIGHT, ix, iy); |
| 4130 |
0 |
| new_tristrip(&tlist, e0, ix, iy); |
| 4131 |
0 |
| next_edge->outp[ABOVE]= e0->outp[ABOVE]; |
| 4132 |
0 |
| VERTEX(next_edge, ABOVE, RIGHT, nx, iy); |
| 4133 |
|
| } |
| 4134 |
0 |
| break; |
| 4135 |
0 |
| case EMM: |
| 4136 |
0 |
▶ | if (p && q) |
Branch: 2 branches
| Branch | True | False | Total |
| if (p && q) |
0 |
0 |
0 |
| if (p && q) |
0 |
0 |
0 |
|
| 4137 |
|
| { |
| 4138 |
0 |
| VERTEX(e0, ABOVE, LEFT, ix, iy); |
| 4139 |
0 |
| new_tristrip(&tlist, e1, ix, iy); |
| 4140 |
0 |
| e0->outp[ABOVE]= e1->outp[ABOVE]; |
| 4141 |
|
| } |
| 4142 |
0 |
| break; |
| 4143 |
0 |
| default: |
| 4144 |
0 |
| break; |
| 4145 |
|
| } /* End of switch */ |
| 4146 |
|
| } /* End of contributing intersection conditional */ |
| 4147 |
|
| |
| 4148 |
|
| /* Swap bundle sides in response to edge crossing */ |
| 4149 |
0 |
▶ | if (e0->bundle[ABOVE][CLIP]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e0->bundle[ABOVE][CLIP]) |
0 |
0 |
0 |
|
| 4150 |
0 |
| e1->bside[CLIP]= !e1->bside[CLIP]; |
| 4151 |
0 |
▶ | if (e1->bundle[ABOVE][CLIP]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e1->bundle[ABOVE][CLIP]) |
0 |
0 |
0 |
|
| 4152 |
0 |
| e0->bside[CLIP]= !e0->bside[CLIP]; |
| 4153 |
0 |
▶ | if (e0->bundle[ABOVE][SUBJ]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e0->bundle[ABOVE][SUBJ]) |
0 |
0 |
0 |
|
| 4154 |
0 |
| e1->bside[SUBJ]= !e1->bside[SUBJ]; |
| 4155 |
0 |
▶ | if (e1->bundle[ABOVE][SUBJ]) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e1->bundle[ABOVE][SUBJ]) |
0 |
0 |
0 |
|
| 4156 |
0 |
| e0->bside[SUBJ]= !e0->bside[SUBJ]; |
| 4157 |
|
| |
| 4158 |
|
| /* Swap e0 and e1 bundles in the AET */ |
| 4159 |
0 |
| prev_edge= e0->prev; |
| 4160 |
0 |
| next_edge= e1->next; |
| 4161 |
0 |
▶ | if (e1->next) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e1->next) |
0 |
0 |
0 |
|
| 4162 |
0 |
| e1->next->prev= e0; |
| 4163 |
|
| |
| 4164 |
0 |
▶ | if (e0->bstate[ABOVE] == BUNDLE_HEAD) |
Branch: 1 branch
| Branch | True | False | Total |
| if (e0->bstate[ABOVE] == BUNDLE_HEAD) |
0 |
0 |
0 |
|
| 4165 |
|
| { |
| 4166 |
0 |
| search= TRUE; |
| 4167 |
0 |
▶ | while (search) |
Branch: 1 branch
| Branch | True | False | Total |
| while (search) |
0 |
0 |
0 |
|
| 4168 |
|
| { |
| 4169 |
0 |
| prev_edge= prev_edge->prev; |
| 4170 |
0 |
▶ | if (prev_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge) |
0 |
0 |
0 |
|
| 4171 |
|
| { |
| 4172 |
0 |
▶ | if (prev_edge->bundle[ABOVE][CLIP] |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge->bundle[ABOVE][CLIP] |
0 |
0 |
0 |
|
| 4173 |
0 |
▶ | || prev_edge->bundle[ABOVE][SUBJ] |
Branch: 1 branch
| Branch | True | False | Total |
| || prev_edge->bundle[ABOVE][SUBJ] |
0 |
0 |
0 |
|
| 4174 |
0 |
▶ | || (prev_edge->bstate[ABOVE] == BUNDLE_HEAD)) |
Branch: 1 branch
| Branch | True | False | Total |
| || (prev_edge->bstate[ABOVE] == BUNDLE_HEAD)) |
0 |
0 |
0 |
|
| 4175 |
0 |
| search= FALSE; |
| 4176 |
|
| } |
| 4177 |
|
| else |
| 4178 |
0 |
| search= FALSE; |
| 4179 |
|
| } |
| 4180 |
|
| } |
| 4181 |
0 |
▶ | if (!prev_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!prev_edge) |
0 |
0 |
0 |
|
| 4182 |
|
| { |
| 4183 |
0 |
| e1->next= aet; |
| 4184 |
0 |
| aet= e0->next; |
| 4185 |
|
| } |
| 4186 |
|
| else |
| 4187 |
|
| { |
| 4188 |
0 |
| e1->next= prev_edge->next; |
| 4189 |
0 |
| prev_edge->next= e0->next; |
| 4190 |
|
| } |
| 4191 |
0 |
| e0->next->prev= prev_edge; |
| 4192 |
0 |
| e1->next->prev= e1; |
| 4193 |
0 |
| e0->next= next_edge; |
| 4194 |
|
| } /* End of IT loop*/ |
| 4195 |
|
| |
| 4196 |
|
| /* Prepare for next scanbeam */ |
| 4197 |
0 |
▶ | for (edge= aet; edge; edge= next_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| for (edge= aet; edge; edge= next_edge) |
0 |
0 |
0 |
|
| 4198 |
|
| { |
| 4199 |
0 |
| next_edge= edge->next; |
| 4200 |
0 |
| succ_edge= edge->succ; |
| 4201 |
|
| |
| 4202 |
0 |
▶ | if ((edge->top.y == yt) && succ_edge) |
Branch: 2 branches
| Branch | True | False | Total |
| if ((edge->top.y == yt) && succ_edge) |
0 |
0 |
0 |
| if ((edge->top.y == yt) && succ_edge) |
0 |
0 |
0 |
|
| 4203 |
|
| { |
| 4204 |
|
| /* Replace AET edge by its successor */ |
| 4205 |
0 |
| succ_edge->outp[BELOW]= edge->outp[ABOVE]; |
| 4206 |
0 |
| succ_edge->bstate[BELOW]= edge->bstate[ABOVE]; |
| 4207 |
0 |
| succ_edge->bundle[BELOW][CLIP]= edge->bundle[ABOVE][CLIP]; |
| 4208 |
0 |
| succ_edge->bundle[BELOW][SUBJ]= edge->bundle[ABOVE][SUBJ]; |
| 4209 |
0 |
| prev_edge= edge->prev; |
| 4210 |
0 |
▶ | if (prev_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (prev_edge) |
0 |
0 |
0 |
|
| 4211 |
0 |
| prev_edge->next= succ_edge; |
| 4212 |
|
| else |
| 4213 |
0 |
| aet= succ_edge; |
| 4214 |
0 |
▶ | if (next_edge) |
Branch: 1 branch
| Branch | True | False | Total |
| if (next_edge) |
0 |
0 |
0 |
|
| 4215 |
0 |
| next_edge->prev= succ_edge; |
| 4216 |
0 |
| succ_edge->prev= prev_edge; |
| 4217 |
0 |
| succ_edge->next= next_edge; |
| 4218 |
|
| } |
| 4219 |
|
| else |
| 4220 |
|
| { |
| 4221 |
|
| /* Update this edge */ |
| 4222 |
0 |
| edge->outp[BELOW]= edge->outp[ABOVE]; |
| 4223 |
0 |
| edge->bstate[BELOW]= edge->bstate[ABOVE]; |
| 4224 |
0 |
| edge->bundle[BELOW][CLIP]= edge->bundle[ABOVE][CLIP]; |
| 4225 |
0 |
| edge->bundle[BELOW][SUBJ]= edge->bundle[ABOVE][SUBJ]; |
| 4226 |
0 |
| edge->xb= edge->xt; |
| 4227 |
|
| } |
| 4228 |
0 |
| edge->outp[ABOVE]= NULL; |
| 4229 |
|
| } |
| 4230 |
|
| } |
| 4231 |
|
| } /* ### END OF SCANBEAM PROCESSING ################################## */ |
| 4232 |
|
| |
| 4233 |
|
| /* Generate result tristrip from tlist */ |
| 4234 |
0 |
| result->strip= NULL; |
| 4235 |
0 |
| result->num_strips= count_tristrips(tlist); |
| 4236 |
0 |
▶ | if (result->num_strips > 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (result->num_strips > 0) |
0 |
0 |
0 |
|
| 4237 |
|
| { |
| 4238 |
0 |
▶ | MALLOC(result->strip, result->num_strips * sizeof(gpc_vertex_list), |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(result->strip, result->num_strips * sizeof(gpc_vertex_list), |
0 |
0 |
0 |
| MALLOC(result->strip, result->num_strips * sizeof(gpc_vertex_list), |
0 |
0 |
0 |
|
| 4239 |
|
| "tristrip list creation"); |
| 4240 |
|
| |
| 4241 |
0 |
| s= 0; |
| 4242 |
0 |
▶ | for (tn= tlist; tn; tn= tnn) |
Branch: 1 branch
| Branch | True | False | Total |
| for (tn= tlist; tn; tn= tnn) |
0 |
0 |
0 |
|
| 4243 |
|
| { |
| 4244 |
0 |
| tnn= tn->next; |
| 4245 |
|
| |
| 4246 |
0 |
▶ | if (tn->active > 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if (tn->active > 2) |
0 |
0 |
0 |
|
| 4247 |
|
| { |
| 4248 |
|
| /* Valid tristrip: copy the vertices and free the heap */ |
| 4249 |
0 |
| result->strip[s].num_vertices= tn->active; |
| 4250 |
0 |
▶ | MALLOC(result->strip[s].vertex, tn->active * sizeof(gpc_vertex), |
Branch: 2 branches
| Branch | True | False | Total |
| MALLOC(result->strip[s].vertex, tn->active * sizeof(gpc_vertex), |
0 |
0 |
0 |
| MALLOC(result->strip[s].vertex, tn->active * sizeof(gpc_vertex), |
0 |
0 |
0 |
|
| 4251 |
|
| "tristrip creation"); |
| 4252 |
0 |
| v= 0; |
| 4253 |
0 |
▶ | if (bInvert_TriStrips /* INVERT_TRISTRIPS */) /* CBSTEH */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (bInvert_TriStrips /* INVERT_TRISTRIPS */) /* CBSTEH */ |
0 |
0 |
0 |
|
| 4254 |
|
| { |
| 4255 |
0 |
| lt= tn->v[RIGHT]; |
| 4256 |
0 |
| rt= tn->v[LEFT]; |
| 4257 |
|
| } |
| 4258 |
|
| else |
| 4259 |
|
| { |
| 4260 |
0 |
| lt= tn->v[LEFT]; |
| 4261 |
0 |
| rt= tn->v[RIGHT]; |
| 4262 |
|
| } |
| 4263 |
0 |
▶ | while (lt || rt) |
Branch: 2 branches
| Branch | True | False | Total |
| while (lt || rt) |
0 |
0 |
0 |
| while (lt || rt) |
0 |
0 |
0 |
|
| 4264 |
|
| { |
| 4265 |
0 |
▶ | if (lt) |
Branch: 1 branch
| Branch | True | False | Total |
| if (lt) |
0 |
0 |
0 |
|
| 4266 |
|
| { |
| 4267 |
0 |
| ltn= lt->next; |
| 4268 |
0 |
| result->strip[s].vertex[v].x= lt->x; |
| 4269 |
0 |
| result->strip[s].vertex[v].y= lt->y; |
| 4270 |
0 |
| v++; |
| 4271 |
0 |
| CFREE(lt); /* CBSTEH */ |
| 4272 |
0 |
| lt= ltn; |
| 4273 |
|
| } |
| 4274 |
0 |
▶ | if (rt) |
Branch: 1 branch
| Branch | True | False | Total |
| if (rt) |
0 |
0 |
0 |
|
| 4275 |
|
| { |
| 4276 |
0 |
| rtn= rt->next; |
| 4277 |
0 |
| result->strip[s].vertex[v].x= rt->x; |
| 4278 |
0 |
| result->strip[s].vertex[v].y= rt->y; |
| 4279 |
0 |
| v++; |
| 4280 |
0 |
| CFREE(rt); /* CBSTEH */ |
| 4281 |
0 |
| rt= rtn; |
| 4282 |
|
| } |
| 4283 |
|
| } |
| 4284 |
0 |
| s++; |
| 4285 |
|
| } |
| 4286 |
|
| else |
| 4287 |
|
| { |
| 4288 |
|
| /* Invalid tristrip: just free the heap */ |
| 4289 |
0 |
▶ | for (lt= tn->v[LEFT]; lt; lt= ltn) |
Branch: 1 branch
| Branch | True | False | Total |
| for (lt= tn->v[LEFT]; lt; lt= ltn) |
0 |
0 |
0 |
|
| 4290 |
|
| { |
| 4291 |
0 |
| ltn= lt->next; |
| 4292 |
0 |
| CFREE(lt); /* CBSTEH */ |
| 4293 |
|
| } |
| 4294 |
0 |
▶ | for (rt= tn->v[RIGHT]; rt; rt=rtn) |
Branch: 1 branch
| Branch | True | False | Total |
| for (rt= tn->v[RIGHT]; rt; rt=rtn) |
0 |
0 |
0 |
|
| 4295 |
|
| { |
| 4296 |
0 |
| rtn= rt->next; |
| 4297 |
0 |
| CFREE(rt); /* CBSTEH */ |
| 4298 |
|
| } |
| 4299 |
|
| } |
| 4300 |
0 |
| CFREE(tn); /* CBSTEH */ |
| 4301 |
|
| } |
| 4302 |
|
| } |
| 4303 |
|
| |
| 4304 |
|
| /* Tidy up */ |
| 4305 |
0 |
| reset_it(&it); |
| 4306 |
0 |
| reset_lmt(&lmt); |
| 4307 |
0 |
▶ | FREE(c_heap); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(c_heap); |
0 |
0 |
0 |
|
| 4308 |
0 |
▶ | FREE(s_heap); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(s_heap); |
0 |
0 |
0 |
|
| 4309 |
0 |
▶ | FREE(sbt); |
Branch: 1 branch
| Branch | True | False | Total |
| FREE(sbt); |
0 |
0 |
0 |
|
| 4310 |
|
| } |
| 4311 |
|
| |
| 4312 |
|
| /* |
| 4313 |
|
| ########################################################################### |
| 4314 |
|
| End of file: gpc.c |
| 4315 |
|
| ########################################################################### |
| 4316 |
|
| */ |