bezierTools.c 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768
  1. /* Generated by Cython 3.2.4 */
  2. /* BEGIN: Cython Metadata
  3. {
  4. "distutils": {
  5. "name": "fontTools.misc.bezierTools",
  6. "sources": [
  7. "Lib/fontTools/misc/bezierTools.py"
  8. ]
  9. },
  10. "module_name": "fontTools.misc.bezierTools"
  11. }
  12. END: Cython Metadata */
  13. #ifndef PY_SSIZE_T_CLEAN
  14. #define PY_SSIZE_T_CLEAN
  15. #endif /* PY_SSIZE_T_CLEAN */
  16. /* InitLimitedAPI */
  17. #if defined(Py_LIMITED_API)
  18. #if !defined(CYTHON_LIMITED_API)
  19. #define CYTHON_LIMITED_API 1
  20. #endif
  21. #elif defined(CYTHON_LIMITED_API)
  22. #ifdef _MSC_VER
  23. #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.")
  24. #else
  25. #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.
  26. #endif
  27. #endif
  28. #include "Python.h"
  29. #ifndef Py_PYTHON_H
  30. #error Python headers needed to compile C extensions, please install development version of Python.
  31. #elif PY_VERSION_HEX < 0x03080000
  32. #error Cython requires Python 3.8+.
  33. #else
  34. #define __PYX_ABI_VERSION "3_2_4"
  35. #define CYTHON_HEX_VERSION 0x030204F0
  36. #define CYTHON_FUTURE_DIVISION 1
  37. /* CModulePreamble */
  38. #include <stddef.h>
  39. #ifndef offsetof
  40. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  41. #endif
  42. #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
  43. #ifndef __stdcall
  44. #define __stdcall
  45. #endif
  46. #ifndef __cdecl
  47. #define __cdecl
  48. #endif
  49. #ifndef __fastcall
  50. #define __fastcall
  51. #endif
  52. #endif
  53. #ifndef DL_IMPORT
  54. #define DL_IMPORT(t) t
  55. #endif
  56. #ifndef DL_EXPORT
  57. #define DL_EXPORT(t) t
  58. #endif
  59. #define __PYX_COMMA ,
  60. #ifndef PY_LONG_LONG
  61. #define PY_LONG_LONG LONG_LONG
  62. #endif
  63. #ifndef Py_HUGE_VAL
  64. #define Py_HUGE_VAL HUGE_VAL
  65. #endif
  66. #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
  67. #if defined(GRAALVM_PYTHON)
  68. /* For very preliminary testing purposes. Most variables are set the same as PyPy.
  69. The existence of this section does not imply that anything works or is even tested */
  70. #define CYTHON_COMPILING_IN_PYPY 0
  71. #define CYTHON_COMPILING_IN_CPYTHON 0
  72. #define CYTHON_COMPILING_IN_LIMITED_API 0
  73. #define CYTHON_COMPILING_IN_GRAAL 1
  74. #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  75. #undef CYTHON_USE_TYPE_SLOTS
  76. #define CYTHON_USE_TYPE_SLOTS 0
  77. #undef CYTHON_USE_TYPE_SPECS
  78. #define CYTHON_USE_TYPE_SPECS 0
  79. #undef CYTHON_USE_PYTYPE_LOOKUP
  80. #define CYTHON_USE_PYTYPE_LOOKUP 0
  81. #undef CYTHON_USE_PYLIST_INTERNALS
  82. #define CYTHON_USE_PYLIST_INTERNALS 0
  83. #undef CYTHON_USE_UNICODE_INTERNALS
  84. #define CYTHON_USE_UNICODE_INTERNALS 0
  85. #undef CYTHON_USE_UNICODE_WRITER
  86. #define CYTHON_USE_UNICODE_WRITER 0
  87. #undef CYTHON_USE_PYLONG_INTERNALS
  88. #define CYTHON_USE_PYLONG_INTERNALS 0
  89. #undef CYTHON_AVOID_BORROWED_REFS
  90. #define CYTHON_AVOID_BORROWED_REFS 1
  91. #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  92. #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  93. #undef CYTHON_ASSUME_SAFE_MACROS
  94. #define CYTHON_ASSUME_SAFE_MACROS 0
  95. #undef CYTHON_ASSUME_SAFE_SIZE
  96. #define CYTHON_ASSUME_SAFE_SIZE 0
  97. #undef CYTHON_UNPACK_METHODS
  98. #define CYTHON_UNPACK_METHODS 0
  99. #undef CYTHON_FAST_THREAD_STATE
  100. #define CYTHON_FAST_THREAD_STATE 0
  101. #undef CYTHON_FAST_GIL
  102. #define CYTHON_FAST_GIL 0
  103. #undef CYTHON_METH_FASTCALL
  104. #define CYTHON_METH_FASTCALL 0
  105. #undef CYTHON_FAST_PYCALL
  106. #define CYTHON_FAST_PYCALL 0
  107. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  108. #define CYTHON_PEP487_INIT_SUBCLASS 1
  109. #endif
  110. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  111. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  112. #undef CYTHON_USE_MODULE_STATE
  113. #define CYTHON_USE_MODULE_STATE 0
  114. #undef CYTHON_USE_SYS_MONITORING
  115. #define CYTHON_USE_SYS_MONITORING 0
  116. #undef CYTHON_USE_TP_FINALIZE
  117. #define CYTHON_USE_TP_FINALIZE 0
  118. #undef CYTHON_USE_AM_SEND
  119. #define CYTHON_USE_AM_SEND 0
  120. #undef CYTHON_USE_DICT_VERSIONS
  121. #define CYTHON_USE_DICT_VERSIONS 0
  122. #undef CYTHON_USE_EXC_INFO_STACK
  123. #define CYTHON_USE_EXC_INFO_STACK 1
  124. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  125. #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  126. #endif
  127. #undef CYTHON_USE_FREELISTS
  128. #define CYTHON_USE_FREELISTS 0
  129. #undef CYTHON_IMMORTAL_CONSTANTS
  130. #define CYTHON_IMMORTAL_CONSTANTS 0
  131. #elif defined(PYPY_VERSION)
  132. #define CYTHON_COMPILING_IN_PYPY 1
  133. #define CYTHON_COMPILING_IN_CPYTHON 0
  134. #define CYTHON_COMPILING_IN_LIMITED_API 0
  135. #define CYTHON_COMPILING_IN_GRAAL 0
  136. #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  137. #undef CYTHON_USE_TYPE_SLOTS
  138. #define CYTHON_USE_TYPE_SLOTS 1
  139. #ifndef CYTHON_USE_TYPE_SPECS
  140. #define CYTHON_USE_TYPE_SPECS 0
  141. #endif
  142. #undef CYTHON_USE_PYTYPE_LOOKUP
  143. #define CYTHON_USE_PYTYPE_LOOKUP 0
  144. #undef CYTHON_USE_PYLIST_INTERNALS
  145. #define CYTHON_USE_PYLIST_INTERNALS 0
  146. #undef CYTHON_USE_UNICODE_INTERNALS
  147. #define CYTHON_USE_UNICODE_INTERNALS 0
  148. #undef CYTHON_USE_UNICODE_WRITER
  149. #define CYTHON_USE_UNICODE_WRITER 0
  150. #undef CYTHON_USE_PYLONG_INTERNALS
  151. #define CYTHON_USE_PYLONG_INTERNALS 0
  152. #undef CYTHON_AVOID_BORROWED_REFS
  153. #define CYTHON_AVOID_BORROWED_REFS 1
  154. #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  155. #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  156. #undef CYTHON_ASSUME_SAFE_MACROS
  157. #define CYTHON_ASSUME_SAFE_MACROS 0
  158. #ifndef CYTHON_ASSUME_SAFE_SIZE
  159. #define CYTHON_ASSUME_SAFE_SIZE 1
  160. #endif
  161. #undef CYTHON_UNPACK_METHODS
  162. #define CYTHON_UNPACK_METHODS 0
  163. #undef CYTHON_FAST_THREAD_STATE
  164. #define CYTHON_FAST_THREAD_STATE 0
  165. #undef CYTHON_FAST_GIL
  166. #define CYTHON_FAST_GIL 0
  167. #undef CYTHON_METH_FASTCALL
  168. #define CYTHON_METH_FASTCALL 0
  169. #undef CYTHON_FAST_PYCALL
  170. #define CYTHON_FAST_PYCALL 0
  171. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  172. #define CYTHON_PEP487_INIT_SUBCLASS 1
  173. #endif
  174. #if PY_VERSION_HEX < 0x03090000
  175. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  176. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  177. #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
  178. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  179. #endif
  180. #undef CYTHON_USE_MODULE_STATE
  181. #define CYTHON_USE_MODULE_STATE 0
  182. #undef CYTHON_USE_SYS_MONITORING
  183. #define CYTHON_USE_SYS_MONITORING 0
  184. #ifndef CYTHON_USE_TP_FINALIZE
  185. #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
  186. #endif
  187. #undef CYTHON_USE_AM_SEND
  188. #define CYTHON_USE_AM_SEND 0
  189. #undef CYTHON_USE_DICT_VERSIONS
  190. #define CYTHON_USE_DICT_VERSIONS 0
  191. #undef CYTHON_USE_EXC_INFO_STACK
  192. #define CYTHON_USE_EXC_INFO_STACK 0
  193. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  194. #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
  195. #endif
  196. #undef CYTHON_USE_FREELISTS
  197. #define CYTHON_USE_FREELISTS 0
  198. #undef CYTHON_IMMORTAL_CONSTANTS
  199. #define CYTHON_IMMORTAL_CONSTANTS 0
  200. #elif defined(CYTHON_LIMITED_API)
  201. #ifdef Py_LIMITED_API
  202. #undef __PYX_LIMITED_VERSION_HEX
  203. #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
  204. #endif
  205. #define CYTHON_COMPILING_IN_PYPY 0
  206. #define CYTHON_COMPILING_IN_CPYTHON 0
  207. #define CYTHON_COMPILING_IN_LIMITED_API 1
  208. #define CYTHON_COMPILING_IN_GRAAL 0
  209. #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  210. #undef CYTHON_USE_TYPE_SLOTS
  211. #define CYTHON_USE_TYPE_SLOTS 0
  212. #undef CYTHON_USE_TYPE_SPECS
  213. #define CYTHON_USE_TYPE_SPECS 1
  214. #undef CYTHON_USE_PYTYPE_LOOKUP
  215. #define CYTHON_USE_PYTYPE_LOOKUP 0
  216. #undef CYTHON_USE_PYLIST_INTERNALS
  217. #define CYTHON_USE_PYLIST_INTERNALS 0
  218. #undef CYTHON_USE_UNICODE_INTERNALS
  219. #define CYTHON_USE_UNICODE_INTERNALS 0
  220. #ifndef CYTHON_USE_UNICODE_WRITER
  221. #define CYTHON_USE_UNICODE_WRITER 0
  222. #endif
  223. #undef CYTHON_USE_PYLONG_INTERNALS
  224. #define CYTHON_USE_PYLONG_INTERNALS 0
  225. #ifndef CYTHON_AVOID_BORROWED_REFS
  226. #define CYTHON_AVOID_BORROWED_REFS 0
  227. #endif
  228. #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  229. #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  230. #endif
  231. #undef CYTHON_ASSUME_SAFE_MACROS
  232. #define CYTHON_ASSUME_SAFE_MACROS 0
  233. #undef CYTHON_ASSUME_SAFE_SIZE
  234. #define CYTHON_ASSUME_SAFE_SIZE 0
  235. #undef CYTHON_UNPACK_METHODS
  236. #define CYTHON_UNPACK_METHODS 0
  237. #undef CYTHON_FAST_THREAD_STATE
  238. #define CYTHON_FAST_THREAD_STATE 0
  239. #undef CYTHON_FAST_GIL
  240. #define CYTHON_FAST_GIL 0
  241. #undef CYTHON_METH_FASTCALL
  242. #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  243. #undef CYTHON_FAST_PYCALL
  244. #define CYTHON_FAST_PYCALL 0
  245. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  246. #define CYTHON_PEP487_INIT_SUBCLASS 1
  247. #endif
  248. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  249. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  250. #endif
  251. #ifndef CYTHON_USE_MODULE_STATE
  252. #define CYTHON_USE_MODULE_STATE 0
  253. #endif
  254. #undef CYTHON_USE_SYS_MONITORING
  255. #define CYTHON_USE_SYS_MONITORING 0
  256. #ifndef CYTHON_USE_TP_FINALIZE
  257. #define CYTHON_USE_TP_FINALIZE 0
  258. #endif
  259. #ifndef CYTHON_USE_AM_SEND
  260. #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  261. #endif
  262. #undef CYTHON_USE_DICT_VERSIONS
  263. #define CYTHON_USE_DICT_VERSIONS 0
  264. #undef CYTHON_USE_EXC_INFO_STACK
  265. #define CYTHON_USE_EXC_INFO_STACK 0
  266. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  267. #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
  268. #endif
  269. #ifndef CYTHON_USE_FREELISTS
  270. #define CYTHON_USE_FREELISTS 1
  271. #endif
  272. #undef CYTHON_IMMORTAL_CONSTANTS
  273. #define CYTHON_IMMORTAL_CONSTANTS 0
  274. #else
  275. #define CYTHON_COMPILING_IN_PYPY 0
  276. #define CYTHON_COMPILING_IN_CPYTHON 1
  277. #define CYTHON_COMPILING_IN_LIMITED_API 0
  278. #define CYTHON_COMPILING_IN_GRAAL 0
  279. #ifdef Py_GIL_DISABLED
  280. #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
  281. #else
  282. #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
  283. #endif
  284. #if PY_VERSION_HEX < 0x030A0000
  285. #undef CYTHON_USE_TYPE_SLOTS
  286. #define CYTHON_USE_TYPE_SLOTS 1
  287. #elif !defined(CYTHON_USE_TYPE_SLOTS)
  288. #define CYTHON_USE_TYPE_SLOTS 1
  289. #endif
  290. #ifndef CYTHON_USE_TYPE_SPECS
  291. #define CYTHON_USE_TYPE_SPECS 0
  292. #endif
  293. #ifndef CYTHON_USE_PYTYPE_LOOKUP
  294. #define CYTHON_USE_PYTYPE_LOOKUP 1
  295. #endif
  296. #ifndef CYTHON_USE_PYLONG_INTERNALS
  297. #define CYTHON_USE_PYLONG_INTERNALS 1
  298. #endif
  299. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  300. #undef CYTHON_USE_PYLIST_INTERNALS
  301. #define CYTHON_USE_PYLIST_INTERNALS 0
  302. #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
  303. #define CYTHON_USE_PYLIST_INTERNALS 1
  304. #endif
  305. #ifndef CYTHON_USE_UNICODE_INTERNALS
  306. #define CYTHON_USE_UNICODE_INTERNALS 1
  307. #endif
  308. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
  309. #undef CYTHON_USE_UNICODE_WRITER
  310. #define CYTHON_USE_UNICODE_WRITER 0
  311. #elif !defined(CYTHON_USE_UNICODE_WRITER)
  312. #define CYTHON_USE_UNICODE_WRITER 1
  313. #endif
  314. #ifndef CYTHON_AVOID_BORROWED_REFS
  315. #define CYTHON_AVOID_BORROWED_REFS 0
  316. #endif
  317. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  318. #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  319. #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
  320. #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
  321. #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
  322. #endif
  323. #ifndef CYTHON_ASSUME_SAFE_MACROS
  324. #define CYTHON_ASSUME_SAFE_MACROS 1
  325. #endif
  326. #ifndef CYTHON_ASSUME_SAFE_SIZE
  327. #define CYTHON_ASSUME_SAFE_SIZE 1
  328. #endif
  329. #ifndef CYTHON_UNPACK_METHODS
  330. #define CYTHON_UNPACK_METHODS 1
  331. #endif
  332. #ifndef CYTHON_FAST_THREAD_STATE
  333. #define CYTHON_FAST_THREAD_STATE 1
  334. #endif
  335. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  336. #undef CYTHON_FAST_GIL
  337. #define CYTHON_FAST_GIL 0
  338. #elif !defined(CYTHON_FAST_GIL)
  339. #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
  340. #endif
  341. #ifndef CYTHON_METH_FASTCALL
  342. #define CYTHON_METH_FASTCALL 1
  343. #endif
  344. #ifndef CYTHON_FAST_PYCALL
  345. #define CYTHON_FAST_PYCALL 1
  346. #endif
  347. #ifndef CYTHON_PEP487_INIT_SUBCLASS
  348. #define CYTHON_PEP487_INIT_SUBCLASS 1
  349. #endif
  350. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  351. #define CYTHON_PEP489_MULTI_PHASE_INIT 1
  352. #endif
  353. #ifndef CYTHON_USE_MODULE_STATE
  354. #define CYTHON_USE_MODULE_STATE 0
  355. #endif
  356. #ifndef CYTHON_USE_SYS_MONITORING
  357. #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
  358. #endif
  359. #ifndef CYTHON_USE_TP_FINALIZE
  360. #define CYTHON_USE_TP_FINALIZE 1
  361. #endif
  362. #ifndef CYTHON_USE_AM_SEND
  363. #define CYTHON_USE_AM_SEND 1
  364. #endif
  365. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  366. #undef CYTHON_USE_DICT_VERSIONS
  367. #define CYTHON_USE_DICT_VERSIONS 0
  368. #elif !defined(CYTHON_USE_DICT_VERSIONS)
  369. #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
  370. #endif
  371. #ifndef CYTHON_USE_EXC_INFO_STACK
  372. #define CYTHON_USE_EXC_INFO_STACK 1
  373. #endif
  374. #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
  375. #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
  376. #endif
  377. #ifndef CYTHON_USE_FREELISTS
  378. #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  379. #endif
  380. #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000
  381. #undef CYTHON_IMMORTAL_CONSTANTS
  382. #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work
  383. #elif !defined(CYTHON_IMMORTAL_CONSTANTS)
  384. #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
  385. #endif
  386. #endif
  387. #ifndef CYTHON_COMPRESS_STRINGS
  388. #define CYTHON_COMPRESS_STRINGS 1
  389. #endif
  390. #ifndef CYTHON_FAST_PYCCALL
  391. #define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL
  392. #endif
  393. #ifndef CYTHON_VECTORCALL
  394. #if CYTHON_COMPILING_IN_LIMITED_API
  395. #define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
  396. #else
  397. #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL)
  398. #endif
  399. #endif
  400. #if CYTHON_USE_PYLONG_INTERNALS
  401. #undef SHIFT
  402. #undef BASE
  403. #undef MASK
  404. #ifdef SIZEOF_VOID_P
  405. enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  406. #endif
  407. #endif
  408. #ifndef __has_attribute
  409. #define __has_attribute(x) 0
  410. #endif
  411. #ifndef __has_cpp_attribute
  412. #define __has_cpp_attribute(x) 0
  413. #endif
  414. #ifndef CYTHON_RESTRICT
  415. #if defined(__GNUC__)
  416. #define CYTHON_RESTRICT __restrict__
  417. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  418. #define CYTHON_RESTRICT __restrict
  419. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  420. #define CYTHON_RESTRICT restrict
  421. #else
  422. #define CYTHON_RESTRICT
  423. #endif
  424. #endif
  425. #ifndef CYTHON_UNUSED
  426. #if defined(__cplusplus)
  427. /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
  428. * but leads to warnings with -pedantic, since it is a C++17 feature */
  429. #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
  430. #if __has_cpp_attribute(maybe_unused)
  431. #define CYTHON_UNUSED [[maybe_unused]]
  432. #endif
  433. #endif
  434. #endif
  435. #endif
  436. #ifndef CYTHON_UNUSED
  437. # if defined(__GNUC__)
  438. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  439. # define CYTHON_UNUSED __attribute__ ((__unused__))
  440. # else
  441. # define CYTHON_UNUSED
  442. # endif
  443. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  444. # define CYTHON_UNUSED __attribute__ ((__unused__))
  445. # else
  446. # define CYTHON_UNUSED
  447. # endif
  448. #endif
  449. #ifndef CYTHON_UNUSED_VAR
  450. # if defined(__cplusplus)
  451. template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
  452. # else
  453. # define CYTHON_UNUSED_VAR(x) (void)(x)
  454. # endif
  455. #endif
  456. #ifndef CYTHON_MAYBE_UNUSED_VAR
  457. #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
  458. #endif
  459. #ifndef CYTHON_NCP_UNUSED
  460. # if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  461. # define CYTHON_NCP_UNUSED
  462. # else
  463. # define CYTHON_NCP_UNUSED CYTHON_UNUSED
  464. # endif
  465. #endif
  466. #ifndef CYTHON_USE_CPP_STD_MOVE
  467. #if defined(__cplusplus) && (\
  468. __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
  469. #define CYTHON_USE_CPP_STD_MOVE 1
  470. #else
  471. #define CYTHON_USE_CPP_STD_MOVE 0
  472. #endif
  473. #endif
  474. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  475. #include <stdint.h>
  476. typedef uintptr_t __pyx_uintptr_t;
  477. #ifndef CYTHON_FALLTHROUGH
  478. #if defined(__cplusplus)
  479. /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
  480. * but leads to warnings with -pedantic, since it is a C++17 feature */
  481. #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
  482. #if __has_cpp_attribute(fallthrough)
  483. #define CYTHON_FALLTHROUGH [[fallthrough]]
  484. #endif
  485. #endif
  486. #ifndef CYTHON_FALLTHROUGH
  487. #if __has_cpp_attribute(clang::fallthrough)
  488. #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  489. #elif __has_cpp_attribute(gnu::fallthrough)
  490. #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  491. #endif
  492. #endif
  493. #endif
  494. #ifndef CYTHON_FALLTHROUGH
  495. #if __has_attribute(fallthrough)
  496. #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  497. #else
  498. #define CYTHON_FALLTHROUGH
  499. #endif
  500. #endif
  501. #if defined(__clang__) && defined(__apple_build_version__)
  502. #if __apple_build_version__ < 7000000
  503. #undef CYTHON_FALLTHROUGH
  504. #define CYTHON_FALLTHROUGH
  505. #endif
  506. #endif
  507. #endif
  508. #ifndef Py_UNREACHABLE
  509. #define Py_UNREACHABLE() assert(0); abort()
  510. #endif
  511. #ifdef __cplusplus
  512. template <typename T>
  513. struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
  514. #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
  515. #else
  516. #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
  517. #endif
  518. #if CYTHON_COMPILING_IN_PYPY == 1
  519. #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000)
  520. #else
  521. #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000)
  522. #endif
  523. #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
  524. /* CInitCode */
  525. #ifndef CYTHON_INLINE
  526. #if defined(__clang__)
  527. #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  528. #elif defined(__GNUC__)
  529. #define CYTHON_INLINE __inline__
  530. #elif defined(_MSC_VER)
  531. #define CYTHON_INLINE __inline
  532. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  533. #define CYTHON_INLINE inline
  534. #else
  535. #define CYTHON_INLINE
  536. #endif
  537. #endif
  538. /* PythonCompatibility */
  539. #define __PYX_BUILD_PY_SSIZE_T "n"
  540. #define CYTHON_FORMAT_SSIZE_T "z"
  541. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  542. #define __Pyx_DefaultClassType PyType_Type
  543. #if CYTHON_COMPILING_IN_LIMITED_API
  544. #ifndef CO_OPTIMIZED
  545. static int CO_OPTIMIZED;
  546. #endif
  547. #ifndef CO_NEWLOCALS
  548. static int CO_NEWLOCALS;
  549. #endif
  550. #ifndef CO_VARARGS
  551. static int CO_VARARGS;
  552. #endif
  553. #ifndef CO_VARKEYWORDS
  554. static int CO_VARKEYWORDS;
  555. #endif
  556. #ifndef CO_ASYNC_GENERATOR
  557. static int CO_ASYNC_GENERATOR;
  558. #endif
  559. #ifndef CO_GENERATOR
  560. static int CO_GENERATOR;
  561. #endif
  562. #ifndef CO_COROUTINE
  563. static int CO_COROUTINE;
  564. #endif
  565. #else
  566. #ifndef CO_COROUTINE
  567. #define CO_COROUTINE 0x80
  568. #endif
  569. #ifndef CO_ASYNC_GENERATOR
  570. #define CO_ASYNC_GENERATOR 0x200
  571. #endif
  572. #endif
  573. static int __Pyx_init_co_variables(void);
  574. #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
  575. #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
  576. #else
  577. #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
  578. #endif
  579. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
  580. #define __Pyx_Py_Is(x, y) Py_Is(x, y)
  581. #else
  582. #define __Pyx_Py_Is(x, y) ((x) == (y))
  583. #endif
  584. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
  585. #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
  586. #else
  587. #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
  588. #endif
  589. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
  590. #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
  591. #else
  592. #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
  593. #endif
  594. #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
  595. #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
  596. #else
  597. #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
  598. #endif
  599. #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
  600. #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
  601. #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
  602. #else
  603. #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
  604. #endif
  605. #ifndef Py_TPFLAGS_CHECKTYPES
  606. #define Py_TPFLAGS_CHECKTYPES 0
  607. #endif
  608. #ifndef Py_TPFLAGS_HAVE_INDEX
  609. #define Py_TPFLAGS_HAVE_INDEX 0
  610. #endif
  611. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  612. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  613. #endif
  614. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  615. #define Py_TPFLAGS_HAVE_FINALIZE 0
  616. #endif
  617. #ifndef Py_TPFLAGS_SEQUENCE
  618. #define Py_TPFLAGS_SEQUENCE 0
  619. #endif
  620. #ifndef Py_TPFLAGS_MAPPING
  621. #define Py_TPFLAGS_MAPPING 0
  622. #endif
  623. #ifndef Py_TPFLAGS_IMMUTABLETYPE
  624. #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
  625. #endif
  626. #ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION
  627. #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
  628. #endif
  629. #ifndef METH_STACKLESS
  630. #define METH_STACKLESS 0
  631. #endif
  632. #ifndef METH_FASTCALL
  633. #ifndef METH_FASTCALL
  634. #define METH_FASTCALL 0x80
  635. #endif
  636. typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  637. typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  638. Py_ssize_t nargs, PyObject *kwnames);
  639. #else
  640. #if PY_VERSION_HEX >= 0x030d00A4
  641. # define __Pyx_PyCFunctionFast PyCFunctionFast
  642. # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
  643. #else
  644. # define __Pyx_PyCFunctionFast _PyCFunctionFast
  645. # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  646. #endif
  647. #endif
  648. #if CYTHON_METH_FASTCALL
  649. #define __Pyx_METH_FASTCALL METH_FASTCALL
  650. #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
  651. #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
  652. #else
  653. #define __Pyx_METH_FASTCALL METH_VARARGS
  654. #define __Pyx_PyCFunction_FastCall PyCFunction
  655. #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
  656. #endif
  657. #if CYTHON_VECTORCALL
  658. #define __pyx_vectorcallfunc vectorcallfunc
  659. #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
  660. #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
  661. #else
  662. #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
  663. #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
  664. #endif
  665. #if PY_VERSION_HEX >= 0x030900B1
  666. #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
  667. #else
  668. #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
  669. #endif
  670. #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
  671. #if CYTHON_COMPILING_IN_CPYTHON
  672. #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
  673. #elif !CYTHON_COMPILING_IN_LIMITED_API
  674. #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
  675. #endif
  676. #if CYTHON_COMPILING_IN_CPYTHON
  677. #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
  678. static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
  679. return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
  680. }
  681. #endif
  682. static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
  683. #if CYTHON_COMPILING_IN_LIMITED_API
  684. return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
  685. #else
  686. return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  687. #endif
  688. }
  689. #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
  690. #if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
  691. #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
  692. typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
  693. #else
  694. #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
  695. #define __Pyx_PyCMethod PyCMethod
  696. #endif
  697. #ifndef METH_METHOD
  698. #define METH_METHOD 0x200
  699. #endif
  700. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  701. #define PyObject_Malloc(s) PyMem_Malloc(s)
  702. #define PyObject_Free(p) PyMem_Free(p)
  703. #define PyObject_Realloc(p) PyMem_Realloc(p)
  704. #endif
  705. #if CYTHON_COMPILING_IN_LIMITED_API
  706. #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
  707. #elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  708. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  709. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno))
  710. #elif CYTHON_COMPILING_IN_GRAAL
  711. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  712. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno))
  713. #else
  714. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  715. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
  716. #endif
  717. #if CYTHON_COMPILING_IN_LIMITED_API
  718. #define __Pyx_PyThreadState_Current PyThreadState_Get()
  719. #elif !CYTHON_FAST_THREAD_STATE
  720. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  721. #elif PY_VERSION_HEX >= 0x030d00A1
  722. #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
  723. #else
  724. #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  725. #endif
  726. #if CYTHON_USE_MODULE_STATE
  727. static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
  728. {
  729. void *result;
  730. result = PyModule_GetState(op);
  731. if (!result)
  732. Py_FatalError("Couldn't find the module state");
  733. return result;
  734. }
  735. #define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
  736. #else
  737. #define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
  738. #endif
  739. #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
  740. #define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
  741. #define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
  742. #define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
  743. #if CYTHON_USE_TYPE_SLOTS
  744. #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
  745. #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
  746. #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
  747. #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
  748. #else
  749. #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
  750. #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
  751. ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
  752. (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
  753. __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
  754. #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
  755. #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
  756. #endif
  757. #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
  758. #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  759. #else
  760. #define __Pyx_PyDict_NewPresized(n) PyDict_New()
  761. #endif
  762. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  763. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  764. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
  765. #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  766. static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
  767. PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
  768. if (res == NULL) PyErr_Clear();
  769. return res;
  770. }
  771. #elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
  772. #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
  773. #define __Pyx_PyDict_GetItemStr PyDict_GetItem
  774. #else
  775. static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
  776. #if CYTHON_COMPILING_IN_PYPY
  777. return PyDict_GetItem(dict, name);
  778. #else
  779. PyDictEntry *ep;
  780. PyDictObject *mp = (PyDictObject*) dict;
  781. long hash = ((PyStringObject *) name)->ob_shash;
  782. assert(hash != -1);
  783. ep = (mp->ma_lookup)(mp, name, hash);
  784. if (ep == NULL) {
  785. return NULL;
  786. }
  787. return ep->me_value;
  788. #endif
  789. }
  790. #define __Pyx_PyDict_GetItemStr PyDict_GetItem
  791. #endif
  792. #if CYTHON_USE_TYPE_SLOTS
  793. #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
  794. #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
  795. #else
  796. #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
  797. #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
  798. #endif
  799. #define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
  800. #if CYTHON_USE_TYPE_SPECS
  801. #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
  802. PyTypeObject *type = Py_TYPE((PyObject*)obj);\
  803. assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
  804. PyObject_GC_Del(obj);\
  805. Py_DECREF(type);\
  806. }
  807. #else
  808. #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
  809. #endif
  810. #if CYTHON_COMPILING_IN_LIMITED_API
  811. #define __Pyx_PyUnicode_READY(op) (0)
  812. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
  813. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
  814. #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
  815. #define __Pyx_PyUnicode_DATA(u) ((void*)u)
  816. #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
  817. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
  818. #else
  819. #if PY_VERSION_HEX >= 0x030C0000
  820. #define __Pyx_PyUnicode_READY(op) (0)
  821. #else
  822. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  823. 0 : _PyUnicode_Ready((PyObject *)(op)))
  824. #endif
  825. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  826. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
  827. #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
  828. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  829. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  830. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
  831. #if PY_VERSION_HEX >= 0x030C0000
  832. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
  833. #else
  834. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
  835. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
  836. #else
  837. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  838. #endif
  839. #endif
  840. #endif
  841. #if CYTHON_COMPILING_IN_PYPY
  842. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  843. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  844. #else
  845. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  846. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  847. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  848. #endif
  849. #if CYTHON_COMPILING_IN_PYPY
  850. #if !defined(PyUnicode_DecodeUnicodeEscape)
  851. #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
  852. #endif
  853. #if !defined(PyUnicode_Contains)
  854. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  855. #endif
  856. #if !defined(PyByteArray_Check)
  857. #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
  858. #endif
  859. #if !defined(PyObject_Format)
  860. #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
  861. #endif
  862. #endif
  863. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  864. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  865. #define __Pyx_PySequence_ListKeepNew(obj)\
  866. (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj))
  867. #elif CYTHON_COMPILING_IN_CPYTHON
  868. #define __Pyx_PySequence_ListKeepNew(obj)\
  869. (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
  870. #else
  871. #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
  872. #endif
  873. #ifndef PySet_CheckExact
  874. #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
  875. #endif
  876. #if PY_VERSION_HEX >= 0x030900A4
  877. #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  878. #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
  879. #else
  880. #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  881. #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
  882. #endif
  883. enum __Pyx_ReferenceSharing {
  884. __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check
  885. __Pyx_ReferenceSharing_OwnStrongReference,
  886. __Pyx_ReferenceSharing_FunctionArgument,
  887. __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar
  888. };
  889. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000
  890. #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\
  891. (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\
  892. (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\
  893. (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0)))
  894. #elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API
  895. #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1)
  896. #else
  897. #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0)
  898. #endif
  899. #if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  900. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  901. #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  902. #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  903. #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  904. #else
  905. #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i)
  906. #endif
  907. #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
  908. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  909. #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
  910. #else
  911. #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i))
  912. #endif
  913. #else
  914. #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i))
  915. #endif
  916. #if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS
  917. #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
  918. __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i))
  919. #else
  920. #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i)
  921. #endif
  922. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  923. #define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
  924. #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  925. static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  926. *result = PyObject_GetItem(dict, key);
  927. if (*result == NULL) {
  928. if (PyErr_ExceptionMatches(PyExc_KeyError)) {
  929. PyErr_Clear();
  930. return 0;
  931. }
  932. return -1;
  933. }
  934. return 1;
  935. }
  936. #else
  937. static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
  938. *result = PyDict_GetItemWithError(dict, key);
  939. if (*result == NULL) {
  940. return PyErr_Occurred() ? -1 : 0;
  941. }
  942. Py_INCREF(*result);
  943. return 1;
  944. }
  945. #endif
  946. #if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
  947. #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj)
  948. #else
  949. #define __Pyx_VISIT_CONST(obj)
  950. #endif
  951. #if CYTHON_ASSUME_SAFE_MACROS
  952. #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
  953. #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
  954. #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
  955. #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
  956. #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
  957. #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
  958. #else
  959. #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
  960. #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
  961. #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
  962. #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
  963. #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
  964. #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
  965. #endif
  966. #if CYTHON_ASSUME_SAFE_SIZE
  967. #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
  968. #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
  969. #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
  970. #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
  971. #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
  972. #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
  973. #else
  974. #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
  975. #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
  976. #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
  977. #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
  978. #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
  979. #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
  980. #endif
  981. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
  982. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  983. #endif
  984. #define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
  985. #define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t
  986. #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
  987. #define __Pyx_PySendResult PySendResult
  988. #else
  989. typedef enum {
  990. PYGEN_RETURN = 0,
  991. PYGEN_ERROR = -1,
  992. PYGEN_NEXT = 1,
  993. } __Pyx_PySendResult;
  994. #endif
  995. #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
  996. typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
  997. #else
  998. #define __Pyx_pyiter_sendfunc sendfunc
  999. #endif
  1000. #if !CYTHON_USE_AM_SEND
  1001. #define __PYX_HAS_PY_AM_SEND 0
  1002. #elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
  1003. #define __PYX_HAS_PY_AM_SEND 1
  1004. #else
  1005. #define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation
  1006. #endif
  1007. #if __PYX_HAS_PY_AM_SEND < 2
  1008. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  1009. #else
  1010. typedef struct {
  1011. unaryfunc am_await;
  1012. unaryfunc am_aiter;
  1013. unaryfunc am_anext;
  1014. __Pyx_pyiter_sendfunc am_send;
  1015. } __Pyx_PyAsyncMethodsStruct;
  1016. #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
  1017. #endif
  1018. #if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
  1019. #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
  1020. #else
  1021. #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
  1022. #endif
  1023. #if PY_VERSION_HEX >= 0x03090000
  1024. #define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
  1025. #else
  1026. #define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
  1027. #endif
  1028. #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
  1029. #ifdef __cplusplus
  1030. extern "C"
  1031. #endif
  1032. PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
  1033. #endif
  1034. #if CYTHON_COMPILING_IN_LIMITED_API
  1035. static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
  1036. int value;
  1037. PyObject *py_value = PyObject_GetAttrString(inspect, name);
  1038. if (!py_value) return 0;
  1039. value = (int) PyLong_AsLong(py_value);
  1040. Py_DECREF(py_value);
  1041. *write_to = value;
  1042. return value != -1 || !PyErr_Occurred();
  1043. }
  1044. static int __Pyx_init_co_variables(void) {
  1045. PyObject *inspect;
  1046. int result;
  1047. inspect = PyImport_ImportModule("inspect");
  1048. result =
  1049. #if !defined(CO_OPTIMIZED)
  1050. __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
  1051. #endif
  1052. #if !defined(CO_NEWLOCALS)
  1053. __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
  1054. #endif
  1055. #if !defined(CO_VARARGS)
  1056. __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
  1057. #endif
  1058. #if !defined(CO_VARKEYWORDS)
  1059. __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
  1060. #endif
  1061. #if !defined(CO_ASYNC_GENERATOR)
  1062. __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
  1063. #endif
  1064. #if !defined(CO_GENERATOR)
  1065. __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
  1066. #endif
  1067. #if !defined(CO_COROUTINE)
  1068. __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
  1069. #endif
  1070. 1;
  1071. Py_DECREF(inspect);
  1072. return result ? 0 : -1;
  1073. }
  1074. #else
  1075. static int __Pyx_init_co_variables(void) {
  1076. return 0; // It's a limited API-only feature
  1077. }
  1078. #endif
  1079. /* MathInitCode */
  1080. #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
  1081. #ifndef _USE_MATH_DEFINES
  1082. #define _USE_MATH_DEFINES
  1083. #endif
  1084. #endif
  1085. #include <math.h>
  1086. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  1087. #define __Pyx_truncl trunc
  1088. #else
  1089. #define __Pyx_truncl truncl
  1090. #endif
  1091. #ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  1092. #define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
  1093. #endif
  1094. #ifndef CYTHON_CLINE_IN_TRACEBACK
  1095. #define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  1096. #endif
  1097. #if CYTHON_CLINE_IN_TRACEBACK
  1098. #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; }
  1099. #else
  1100. #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
  1101. #endif
  1102. #define __PYX_ERR(f_index, lineno, Ln_error) \
  1103. { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
  1104. #ifdef CYTHON_EXTERN_C
  1105. #undef __PYX_EXTERN_C
  1106. #define __PYX_EXTERN_C CYTHON_EXTERN_C
  1107. #elif defined(__PYX_EXTERN_C)
  1108. #ifdef _MSC_VER
  1109. #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
  1110. #else
  1111. #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
  1112. #endif
  1113. #else
  1114. #ifdef __cplusplus
  1115. #define __PYX_EXTERN_C extern "C"
  1116. #else
  1117. #define __PYX_EXTERN_C extern
  1118. #endif
  1119. #endif
  1120. #define __PYX_HAVE__fontTools__misc__bezierTools
  1121. #define __PYX_HAVE_API__fontTools__misc__bezierTools
  1122. /* Early includes */
  1123. #ifdef _OPENMP
  1124. #include <omp.h>
  1125. #endif /* _OPENMP */
  1126. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  1127. #define CYTHON_WITHOUT_ASSERTIONS
  1128. #endif
  1129. #ifdef CYTHON_FREETHREADING_COMPATIBLE
  1130. #if CYTHON_FREETHREADING_COMPATIBLE
  1131. #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
  1132. #else
  1133. #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
  1134. #endif
  1135. #else
  1136. #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
  1137. #endif
  1138. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  1139. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  1140. #define __PYX_DEFAULT_STRING_ENCODING ""
  1141. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  1142. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  1143. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  1144. #define __Pyx_long_cast(x) ((long)x)
  1145. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  1146. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  1147. (sizeof(type) > sizeof(Py_ssize_t) &&\
  1148. likely(v < (type)PY_SSIZE_T_MAX ||\
  1149. v == (type)PY_SSIZE_T_MAX) &&\
  1150. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  1151. v == (type)PY_SSIZE_T_MIN))) ||\
  1152. (sizeof(type) == sizeof(Py_ssize_t) &&\
  1153. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  1154. v == (type)PY_SSIZE_T_MAX))) )
  1155. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  1156. return (size_t) i < (size_t) limit;
  1157. }
  1158. #if defined (__cplusplus) && __cplusplus >= 201103L
  1159. #include <cstdlib>
  1160. #define __Pyx_sst_abs(value) std::abs(value)
  1161. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  1162. #define __Pyx_sst_abs(value) abs(value)
  1163. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  1164. #define __Pyx_sst_abs(value) labs(value)
  1165. #elif defined (_MSC_VER)
  1166. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  1167. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  1168. #define __Pyx_sst_abs(value) llabs(value)
  1169. #elif defined (__GNUC__)
  1170. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  1171. #else
  1172. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  1173. #endif
  1174. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
  1175. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  1176. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  1177. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
  1178. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  1179. #define __Pyx_PyBytes_FromString PyBytes_FromString
  1180. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  1181. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  1182. #if CYTHON_ASSUME_SAFE_MACROS
  1183. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  1184. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  1185. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  1186. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  1187. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  1188. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  1189. #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
  1190. #else
  1191. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s))
  1192. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s))
  1193. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s))
  1194. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s))
  1195. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s))
  1196. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s))
  1197. #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
  1198. #endif
  1199. #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1200. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1201. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1202. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  1203. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  1204. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  1205. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  1206. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  1207. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  1208. #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
  1209. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  1210. static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
  1211. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
  1212. return Py_NewRef(obj);
  1213. #else
  1214. Py_INCREF(obj);
  1215. return obj;
  1216. #endif
  1217. }
  1218. static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
  1219. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
  1220. return Py_XNewRef(obj);
  1221. #else
  1222. Py_XINCREF(obj);
  1223. return obj;
  1224. #endif
  1225. }
  1226. static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
  1227. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  1228. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  1229. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  1230. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
  1231. #define __Pyx_PySequence_Tuple(obj)\
  1232. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  1233. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  1234. static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
  1235. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
  1236. #if CYTHON_ASSUME_SAFE_MACROS
  1237. #define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  1238. #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
  1239. #else
  1240. #define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  1241. #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
  1242. #endif
  1243. #define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
  1244. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  1245. #if CYTHON_USE_PYLONG_INTERNALS
  1246. #if PY_VERSION_HEX >= 0x030C00A7
  1247. #ifndef _PyLong_SIGN_MASK
  1248. #define _PyLong_SIGN_MASK 3
  1249. #endif
  1250. #ifndef _PyLong_NON_SIZE_BITS
  1251. #define _PyLong_NON_SIZE_BITS 3
  1252. #endif
  1253. #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  1254. #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
  1255. #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
  1256. #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
  1257. #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
  1258. #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
  1259. #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  1260. #define __Pyx_PyLong_SignedDigitCount(x)\
  1261. ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  1262. #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
  1263. #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
  1264. #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
  1265. #else
  1266. #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
  1267. #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  1268. #endif
  1269. typedef Py_ssize_t __Pyx_compact_pylong;
  1270. typedef size_t __Pyx_compact_upylong;
  1271. #else
  1272. #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
  1273. #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
  1274. #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
  1275. #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
  1276. #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  1277. #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
  1278. #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
  1279. #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  1280. #define __Pyx_PyLong_CompactValue(x)\
  1281. ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  1282. typedef sdigit __Pyx_compact_pylong;
  1283. typedef digit __Pyx_compact_upylong;
  1284. #endif
  1285. #if PY_VERSION_HEX >= 0x030C00A5
  1286. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
  1287. #else
  1288. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
  1289. #endif
  1290. #endif
  1291. #if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  1292. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  1293. #elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  1294. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
  1295. #else
  1296. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  1297. #endif
  1298. /* Test for GCC > 2.95 */
  1299. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  1300. #define likely(x) __builtin_expect(!!(x), 1)
  1301. #define unlikely(x) __builtin_expect(!!(x), 0)
  1302. #else /* !__GNUC__ or GCC < 2.95 */
  1303. #define likely(x) (x)
  1304. #define unlikely(x) (x)
  1305. #endif /* __GNUC__ */
  1306. /* PretendToInitialize */
  1307. #ifdef __cplusplus
  1308. #if __cplusplus > 201103L
  1309. #include <type_traits>
  1310. #endif
  1311. template <typename T>
  1312. static void __Pyx_pretend_to_initialize(T* ptr) {
  1313. #if __cplusplus > 201103L
  1314. if ((std::is_trivially_default_constructible<T>::value))
  1315. #endif
  1316. *ptr = T();
  1317. (void)ptr;
  1318. }
  1319. #else
  1320. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  1321. #endif
  1322. #if !CYTHON_USE_MODULE_STATE
  1323. static PyObject *__pyx_m = NULL;
  1324. #endif
  1325. static int __pyx_lineno;
  1326. static int __pyx_clineno = 0;
  1327. static const char * const __pyx_cfilenm = __FILE__;
  1328. static const char *__pyx_filename;
  1329. /* Header.proto */
  1330. #if !defined(CYTHON_CCOMPLEX)
  1331. #if defined(__cplusplus)
  1332. #define CYTHON_CCOMPLEX 1
  1333. #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER))
  1334. #define CYTHON_CCOMPLEX 1
  1335. #else
  1336. #define CYTHON_CCOMPLEX 0
  1337. #endif
  1338. #endif
  1339. #if CYTHON_CCOMPLEX
  1340. #ifdef __cplusplus
  1341. #include <complex>
  1342. #else
  1343. #include <complex.h>
  1344. #endif
  1345. #endif
  1346. #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  1347. #undef _Complex_I
  1348. #define _Complex_I 1.0fj
  1349. #endif
  1350. /* #### Code section: filename_table ### */
  1351. static const char* const __pyx_f[] = {
  1352. "Lib/fontTools/misc/bezierTools.py",
  1353. };
  1354. /* #### Code section: utility_code_proto_before_types ### */
  1355. /* Atomics.proto (used by UnpackUnboundCMethod) */
  1356. #include <pythread.h>
  1357. #ifndef CYTHON_ATOMICS
  1358. #define CYTHON_ATOMICS 1
  1359. #endif
  1360. #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
  1361. #define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1362. #define __pyx_atomic_int_type int
  1363. #define __pyx_nonatomic_int_type int
  1364. #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
  1365. (__STDC_VERSION__ >= 201112L) &&\
  1366. !defined(__STDC_NO_ATOMICS__))
  1367. #include <stdatomic.h>
  1368. #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
  1369. (__cplusplus >= 201103L) ||\
  1370. (defined(_MSC_VER) && _MSC_VER >= 1700)))
  1371. #include <atomic>
  1372. #endif
  1373. #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
  1374. (__STDC_VERSION__ >= 201112L) &&\
  1375. !defined(__STDC_NO_ATOMICS__) &&\
  1376. ATOMIC_INT_LOCK_FREE == 2)
  1377. #undef __pyx_atomic_int_type
  1378. #define __pyx_atomic_int_type atomic_int
  1379. #define __pyx_atomic_ptr_type atomic_uintptr_t
  1380. #define __pyx_nonatomic_ptr_type uintptr_t
  1381. #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
  1382. #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
  1383. #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
  1384. #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
  1385. #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
  1386. #define __pyx_atomic_load(value) atomic_load(value)
  1387. #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
  1388. #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
  1389. #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
  1390. #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
  1391. #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
  1392. #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
  1393. #pragma message ("Using standard C atomics")
  1394. #elif defined(__PYX_DEBUG_ATOMICS)
  1395. #warning "Using standard C atomics"
  1396. #endif
  1397. #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
  1398. (__cplusplus >= 201103L) ||\
  1399. \
  1400. (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
  1401. ATOMIC_INT_LOCK_FREE == 2)
  1402. #undef __pyx_atomic_int_type
  1403. #define __pyx_atomic_int_type std::atomic_int
  1404. #define __pyx_atomic_ptr_type std::atomic_uintptr_t
  1405. #define __pyx_nonatomic_ptr_type uintptr_t
  1406. #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
  1407. #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
  1408. #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
  1409. #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
  1410. #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
  1411. #define __pyx_atomic_load(value) std::atomic_load(value)
  1412. #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
  1413. #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
  1414. #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
  1415. #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
  1416. #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
  1417. #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
  1418. #pragma message ("Using standard C++ atomics")
  1419. #elif defined(__PYX_DEBUG_ATOMICS)
  1420. #warning "Using standard C++ atomics"
  1421. #endif
  1422. #elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
  1423. (__GNUC_MINOR__ > 1 ||\
  1424. (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
  1425. #define __pyx_atomic_ptr_type void*
  1426. #define __pyx_nonatomic_ptr_type void*
  1427. #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
  1428. #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
  1429. #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
  1430. #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
  1431. static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
  1432. __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
  1433. int result = old == *expected;
  1434. *expected = old;
  1435. return result;
  1436. }
  1437. #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
  1438. #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
  1439. #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
  1440. #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
  1441. #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
  1442. static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
  1443. __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
  1444. int result = old == *expected;
  1445. *expected = old;
  1446. return result;
  1447. }
  1448. #ifdef __PYX_DEBUG_ATOMICS
  1449. #warning "Using GNU atomics"
  1450. #endif
  1451. #elif CYTHON_ATOMICS && defined(_MSC_VER)
  1452. #include <intrin.h>
  1453. #undef __pyx_atomic_int_type
  1454. #define __pyx_atomic_int_type long
  1455. #define __pyx_atomic_ptr_type void*
  1456. #undef __pyx_nonatomic_int_type
  1457. #define __pyx_nonatomic_int_type long
  1458. #define __pyx_nonatomic_ptr_type void*
  1459. #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
  1460. #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
  1461. #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
  1462. #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
  1463. #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
  1464. static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
  1465. __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
  1466. int result = old == *expected;
  1467. *expected = old;
  1468. return result;
  1469. }
  1470. #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
  1471. #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
  1472. #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
  1473. #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
  1474. #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
  1475. static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
  1476. __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
  1477. int result = old == *expected;
  1478. *expected = old;
  1479. return result;
  1480. }
  1481. #ifdef __PYX_DEBUG_ATOMICS
  1482. #pragma message ("Using MSVC atomics")
  1483. #endif
  1484. #else
  1485. #undef CYTHON_ATOMICS
  1486. #define CYTHON_ATOMICS 0
  1487. #ifdef __PYX_DEBUG_ATOMICS
  1488. #warning "Not using atomics"
  1489. #endif
  1490. #endif
  1491. /* CriticalSectionsDefinition.proto (used by CriticalSections) */
  1492. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1493. #define __Pyx_PyCriticalSection void*
  1494. #define __Pyx_PyCriticalSection2 void*
  1495. #define __Pyx_PyCriticalSection_End(cs)
  1496. #define __Pyx_PyCriticalSection2_End(cs)
  1497. #else
  1498. #define __Pyx_PyCriticalSection PyCriticalSection
  1499. #define __Pyx_PyCriticalSection2 PyCriticalSection2
  1500. #define __Pyx_PyCriticalSection_End PyCriticalSection_End
  1501. #define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
  1502. #endif
  1503. /* CriticalSections.proto (used by ParseKeywordsImpl) */
  1504. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1505. #define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
  1506. #define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
  1507. #else
  1508. #define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
  1509. #define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
  1510. #endif
  1511. #if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  1512. #define __Pyx_BEGIN_CRITICAL_SECTION(o) {
  1513. #define __Pyx_END_CRITICAL_SECTION() }
  1514. #else
  1515. #define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
  1516. #define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
  1517. #endif
  1518. /* IncludeStructmemberH.proto (used by FixUpExtensionType) */
  1519. #include <structmember.h>
  1520. /* #### Code section: numeric_typedefs ### */
  1521. /* #### Code section: complex_type_declarations ### */
  1522. /* Declarations.proto */
  1523. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  1524. #ifdef __cplusplus
  1525. typedef ::std::complex< double > __pyx_t_double_complex;
  1526. #else
  1527. typedef double _Complex __pyx_t_double_complex;
  1528. #endif
  1529. #else
  1530. typedef struct { double real, imag; } __pyx_t_double_complex;
  1531. #endif
  1532. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
  1533. /* #### Code section: type_declarations ### */
  1534. /*--- Type declarations ---*/
  1535. struct __pyx_defaults;
  1536. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr;
  1537. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr;
  1538. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC;
  1539. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC;
  1540. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr;
  1541. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t;
  1542. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr;
  1543. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr;
  1544. /* "fontTools/misc/bezierTools.py":815
  1545. *
  1546. *
  1547. * def solveQuadratic(a, b, c, sqrt=sqrt): # <<<<<<<<<<<<<<
  1548. * """Solve a quadratic equation.
  1549. *
  1550. */
  1551. struct __pyx_defaults {
  1552. PyObject_HEAD
  1553. PyObject *arg0;
  1554. };
  1555. /* "fontTools/misc/bezierTools.py":546
  1556. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where
  1557. * )
  1558. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  1559. * if not solutions:
  1560. * return [(pt1, pt2, pt3)]
  1561. */
  1562. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr {
  1563. PyObject_HEAD
  1564. PyObject *__pyx_genexpr_arg_0;
  1565. PyObject *__pyx_v_t;
  1566. };
  1567. /* "fontTools/misc/bezierTools.py":583
  1568. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where
  1569. * )
  1570. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  1571. * if not solutions:
  1572. * return [(pt1, pt2, pt3, pt4)]
  1573. */
  1574. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr {
  1575. PyObject_HEAD
  1576. PyObject *__pyx_genexpr_arg_0;
  1577. PyObject *__pyx_v_t;
  1578. };
  1579. /* "fontTools/misc/bezierTools.py":644
  1580. *
  1581. *
  1582. * @cython.locals( # <<<<<<<<<<<<<<
  1583. * pt1=cython.complex,
  1584. * pt2=cython.complex,
  1585. */
  1586. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC {
  1587. PyObject_HEAD
  1588. __pyx_t_double_complex __pyx_v_a;
  1589. __pyx_t_double_complex __pyx_v_b;
  1590. __pyx_t_double_complex __pyx_v_c;
  1591. __pyx_t_double_complex __pyx_v_d;
  1592. __pyx_t_double_complex __pyx_v_pt1;
  1593. __pyx_t_double_complex __pyx_v_pt2;
  1594. __pyx_t_double_complex __pyx_v_pt3;
  1595. __pyx_t_double_complex __pyx_v_pt4;
  1596. PyObject *__pyx_v_ts;
  1597. };
  1598. /* "fontTools/misc/bezierTools.py":770
  1599. *
  1600. *
  1601. * @cython.locals( # <<<<<<<<<<<<<<
  1602. * a=cython.complex,
  1603. * b=cython.complex,
  1604. */
  1605. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC {
  1606. PyObject_HEAD
  1607. __pyx_t_double_complex __pyx_v_a;
  1608. __pyx_t_double_complex __pyx_v_a1;
  1609. __pyx_t_double_complex __pyx_v_b;
  1610. __pyx_t_double_complex __pyx_v_b1;
  1611. __pyx_t_double_complex __pyx_v_c;
  1612. __pyx_t_double_complex __pyx_v_c1;
  1613. __pyx_t_double_complex __pyx_v_d;
  1614. __pyx_t_double_complex __pyx_v_d1;
  1615. double __pyx_v_delta;
  1616. double __pyx_v_delta_2;
  1617. double __pyx_v_delta_3;
  1618. PyObject *__pyx_v_i;
  1619. PyObject *__pyx_v_pt1;
  1620. PyObject *__pyx_v_pt2;
  1621. PyObject *__pyx_v_pt3;
  1622. PyObject *__pyx_v_pt4;
  1623. double __pyx_v_t1;
  1624. double __pyx_v_t1_2;
  1625. double __pyx_v_t1_3;
  1626. double __pyx_v_t2;
  1627. PyObject *__pyx_v_ts;
  1628. PyObject *__pyx_t_0;
  1629. PyObject *(*__pyx_t_1)(PyObject *);
  1630. };
  1631. /* "fontTools/misc/bezierTools.py":1252
  1632. * else:
  1633. * raise ValueError("Unknown curve degree")
  1634. * return sorted(i for i in intersections if 0.0 <= i <= 1) # <<<<<<<<<<<<<<
  1635. *
  1636. *
  1637. */
  1638. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr {
  1639. PyObject_HEAD
  1640. PyObject *__pyx_genexpr_arg_0;
  1641. PyObject *__pyx_v_i;
  1642. };
  1643. /* "fontTools/misc/bezierTools.py":1313
  1644. *
  1645. *
  1646. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  1647. * curve1, curve2, precision=1e-3, range1=None, range2=None
  1648. * ):
  1649. */
  1650. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t {
  1651. PyObject_HEAD
  1652. PyObject *__pyx_v_precision;
  1653. };
  1654. /* "fontTools/misc/bezierTools.py":1382
  1655. * def _is_linelike(segment):
  1656. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  1657. * return all(math.isclose(p[1], 0.0) for p in maybeline) # <<<<<<<<<<<<<<
  1658. *
  1659. *
  1660. */
  1661. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr {
  1662. PyObject_HEAD
  1663. PyObject *__pyx_genexpr_arg_0;
  1664. PyObject *__pyx_v_p;
  1665. };
  1666. /* "fontTools/misc/bezierTools.py":1485
  1667. * return "%g" % obj
  1668. * else:
  1669. * return "(%s)" % ", ".join(_segmentrepr(x) for x in it) # <<<<<<<<<<<<<<
  1670. *
  1671. *
  1672. */
  1673. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr {
  1674. PyObject_HEAD
  1675. PyObject *__pyx_genexpr_arg_0;
  1676. PyObject *__pyx_v_x;
  1677. };
  1678. /* #### Code section: utility_code_proto ### */
  1679. /* --- Runtime support code (head) --- */
  1680. /* Refnanny.proto */
  1681. #ifndef CYTHON_REFNANNY
  1682. #define CYTHON_REFNANNY 0
  1683. #endif
  1684. #if CYTHON_REFNANNY
  1685. typedef struct {
  1686. void (*INCREF)(void*, PyObject*, Py_ssize_t);
  1687. void (*DECREF)(void*, PyObject*, Py_ssize_t);
  1688. void (*GOTREF)(void*, PyObject*, Py_ssize_t);
  1689. void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
  1690. void* (*SetupContext)(const char*, Py_ssize_t, const char*);
  1691. void (*FinishContext)(void**);
  1692. } __Pyx_RefNannyAPIStruct;
  1693. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1694. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1695. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1696. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1697. if (acquire_gil) {\
  1698. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1699. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1700. PyGILState_Release(__pyx_gilstate_save);\
  1701. } else {\
  1702. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1703. }
  1704. #define __Pyx_RefNannyFinishContextNogil() {\
  1705. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1706. __Pyx_RefNannyFinishContext();\
  1707. PyGILState_Release(__pyx_gilstate_save);\
  1708. }
  1709. #define __Pyx_RefNannyFinishContextNogil() {\
  1710. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1711. __Pyx_RefNannyFinishContext();\
  1712. PyGILState_Release(__pyx_gilstate_save);\
  1713. }
  1714. #define __Pyx_RefNannyFinishContext()\
  1715. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1716. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1717. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1718. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1719. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1720. #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  1721. #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  1722. #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  1723. #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
  1724. #else
  1725. #define __Pyx_RefNannyDeclarations
  1726. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1727. #define __Pyx_RefNannyFinishContextNogil()
  1728. #define __Pyx_RefNannyFinishContext()
  1729. #define __Pyx_INCREF(r) Py_INCREF(r)
  1730. #define __Pyx_DECREF(r) Py_DECREF(r)
  1731. #define __Pyx_GOTREF(r)
  1732. #define __Pyx_GIVEREF(r)
  1733. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1734. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1735. #define __Pyx_XGOTREF(r)
  1736. #define __Pyx_XGIVEREF(r)
  1737. #endif
  1738. #define __Pyx_Py_XDECREF_SET(r, v) do {\
  1739. PyObject *tmp = (PyObject *) r;\
  1740. r = v; Py_XDECREF(tmp);\
  1741. } while (0)
  1742. #define __Pyx_XDECREF_SET(r, v) do {\
  1743. PyObject *tmp = (PyObject *) r;\
  1744. r = v; __Pyx_XDECREF(tmp);\
  1745. } while (0)
  1746. #define __Pyx_DECREF_SET(r, v) do {\
  1747. PyObject *tmp = (PyObject *) r;\
  1748. r = v; __Pyx_DECREF(tmp);\
  1749. } while (0)
  1750. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1751. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1752. /* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
  1753. #if CYTHON_FAST_THREAD_STATE
  1754. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1755. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1756. #else
  1757. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1758. #endif
  1759. /* PyThreadStateGet.proto (used by PyErrFetchRestore) */
  1760. #if CYTHON_FAST_THREAD_STATE
  1761. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1762. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1763. #if PY_VERSION_HEX >= 0x030C00A6
  1764. #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
  1765. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
  1766. #else
  1767. #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
  1768. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
  1769. #endif
  1770. #else
  1771. #define __Pyx_PyThreadState_declare
  1772. #define __Pyx_PyThreadState_assign
  1773. #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
  1774. #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
  1775. #endif
  1776. /* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
  1777. #if CYTHON_FAST_THREAD_STATE
  1778. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1779. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1780. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1781. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1782. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1783. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1784. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1785. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
  1786. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1787. #else
  1788. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1789. #endif
  1790. #else
  1791. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1792. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1793. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1794. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1795. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1796. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1797. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1798. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1799. #endif
  1800. /* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
  1801. #if CYTHON_USE_TYPE_SLOTS
  1802. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1803. #else
  1804. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1805. #endif
  1806. /* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */
  1807. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
  1808. /* GetBuiltinName.proto */
  1809. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1810. /* TupleAndListFromArray.proto (used by fastcall) */
  1811. #if CYTHON_COMPILING_IN_CPYTHON
  1812. static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
  1813. #endif
  1814. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
  1815. static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
  1816. #endif
  1817. /* IncludeStringH.proto (used by BytesEquals) */
  1818. #include <string.h>
  1819. /* BytesEquals.proto (used by UnicodeEquals) */
  1820. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
  1821. /* UnicodeEquals.proto (used by fastcall) */
  1822. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
  1823. /* fastcall.proto */
  1824. #if CYTHON_AVOID_BORROWED_REFS
  1825. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
  1826. #elif CYTHON_ASSUME_SAFE_MACROS
  1827. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
  1828. #else
  1829. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
  1830. #endif
  1831. #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
  1832. #define __Pyx_KwValues_VARARGS(args, nargs) NULL
  1833. #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
  1834. #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
  1835. #if CYTHON_METH_FASTCALL
  1836. #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
  1837. #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
  1838. #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
  1839. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  1840. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  1841. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  1842. #else
  1843. #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  1844. #endif
  1845. #else
  1846. #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
  1847. #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
  1848. #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
  1849. #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
  1850. #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
  1851. #endif
  1852. #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1853. #if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  1854. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
  1855. #else
  1856. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1857. #endif
  1858. /* py_dict_items.proto (used by OwnedDictNext) */
  1859. static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
  1860. /* CallCFunction.proto (used by CallUnboundCMethod0) */
  1861. #define __Pyx_CallCFunction(cfunc, self, args)\
  1862. ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
  1863. #define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
  1864. ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
  1865. #define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
  1866. ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
  1867. #define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
  1868. ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)
  1869. /* PyObjectCall.proto (used by PyObjectFastCall) */
  1870. #if CYTHON_COMPILING_IN_CPYTHON
  1871. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1872. #else
  1873. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1874. #endif
  1875. /* PyObjectCallMethO.proto (used by PyObjectFastCall) */
  1876. #if CYTHON_COMPILING_IN_CPYTHON
  1877. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1878. #endif
  1879. /* PyObjectFastCall.proto (used by PyObjectCallOneArg) */
  1880. #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
  1881. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);
  1882. /* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */
  1883. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1884. /* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
  1885. typedef struct {
  1886. PyObject *type;
  1887. PyObject **method_name;
  1888. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
  1889. __pyx_atomic_int_type initialized;
  1890. #endif
  1891. PyCFunction func;
  1892. PyObject *method;
  1893. int flag;
  1894. } __Pyx_CachedCFunction;
  1895. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1896. static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
  1897. #if !CYTHON_ATOMICS
  1898. return 1;
  1899. #else
  1900. __pyx_nonatomic_int_type expected = 0;
  1901. if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
  1902. return 0;
  1903. }
  1904. return expected;
  1905. #endif
  1906. }
  1907. static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
  1908. #if CYTHON_ATOMICS
  1909. __pyx_atomic_store(&cfunc->initialized, 2);
  1910. #endif
  1911. }
  1912. #else
  1913. #define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
  1914. #define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
  1915. #endif
  1916. /* CallUnboundCMethod0.proto */
  1917. CYTHON_UNUSED
  1918. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
  1919. #if CYTHON_COMPILING_IN_CPYTHON
  1920. static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
  1921. #else
  1922. #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
  1923. #endif
  1924. /* py_dict_values.proto (used by OwnedDictNext) */
  1925. static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);
  1926. /* OwnedDictNext.proto (used by ParseKeywordsImpl) */
  1927. #if CYTHON_AVOID_BORROWED_REFS
  1928. static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
  1929. #else
  1930. CYTHON_INLINE
  1931. static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
  1932. #endif
  1933. /* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */
  1934. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1935. /* ParseKeywordsImpl.export */
  1936. static int __Pyx_ParseKeywordsTuple(
  1937. PyObject *kwds,
  1938. PyObject * const *kwvalues,
  1939. PyObject ** const argnames[],
  1940. PyObject *kwds2,
  1941. PyObject *values[],
  1942. Py_ssize_t num_pos_args,
  1943. Py_ssize_t num_kwargs,
  1944. const char* function_name,
  1945. int ignore_unknown_kwargs
  1946. );
  1947. static int __Pyx_ParseKeywordDictToDict(
  1948. PyObject *kwds,
  1949. PyObject ** const argnames[],
  1950. PyObject *kwds2,
  1951. PyObject *values[],
  1952. Py_ssize_t num_pos_args,
  1953. const char* function_name
  1954. );
  1955. static int __Pyx_ParseKeywordDict(
  1956. PyObject *kwds,
  1957. PyObject ** const argnames[],
  1958. PyObject *values[],
  1959. Py_ssize_t num_pos_args,
  1960. Py_ssize_t num_kwargs,
  1961. const char* function_name,
  1962. int ignore_unknown_kwargs
  1963. );
  1964. /* CallUnboundCMethod2.proto */
  1965. CYTHON_UNUSED
  1966. static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
  1967. #if CYTHON_COMPILING_IN_CPYTHON
  1968. static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
  1969. #else
  1970. #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
  1971. #endif
  1972. /* ParseKeywords.proto */
  1973. static CYTHON_INLINE int __Pyx_ParseKeywords(
  1974. PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
  1975. PyObject *kwds2, PyObject *values[],
  1976. Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
  1977. const char* function_name,
  1978. int ignore_unknown_kwargs
  1979. );
  1980. /* RaiseArgTupleInvalid.proto */
  1981. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1982. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1983. /* PyDictVersioning.proto (used by GetModuleGlobalName) */
  1984. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  1985. #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
  1986. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  1987. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  1988. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  1989. (cache_var) = (value);
  1990. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  1991. static PY_UINT64_T __pyx_dict_version = 0;\
  1992. static PyObject *__pyx_dict_cached_value = NULL;\
  1993. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  1994. (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\
  1995. } else {\
  1996. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  1997. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  1998. }\
  1999. }
  2000. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  2001. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  2002. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  2003. #else
  2004. #define __PYX_GET_DICT_VERSION(dict) (0)
  2005. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  2006. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  2007. #endif
  2008. /* GetModuleGlobalName.proto */
  2009. #if CYTHON_USE_DICT_VERSIONS
  2010. #define __Pyx_GetModuleGlobalName(var, name) do {\
  2011. static PY_UINT64_T __pyx_dict_version = 0;\
  2012. static PyObject *__pyx_dict_cached_value = NULL;\
  2013. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\
  2014. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  2015. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  2016. } while(0)
  2017. #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
  2018. PY_UINT64_T __pyx_dict_version;\
  2019. PyObject *__pyx_dict_cached_value;\
  2020. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  2021. } while(0)
  2022. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  2023. #else
  2024. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  2025. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  2026. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  2027. #endif
  2028. /* PyLongBinop.proto */
  2029. #if !CYTHON_COMPILING_IN_PYPY
  2030. static CYTHON_INLINE PyObject* __Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2031. #else
  2032. #define __Pyx_PyLong_MultiplyCObj(op1, op2, intval, inplace, zerodivision_check)\
  2033. (inplace ? PyNumber_InPlaceMultiply(op1, op2) : PyNumber_Multiply(op1, op2))
  2034. #endif
  2035. /* RaiseTooManyValuesToUnpack.proto */
  2036. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  2037. /* RaiseNeedMoreValuesToUnpack.proto */
  2038. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  2039. /* IterFinish.proto */
  2040. static CYTHON_INLINE int __Pyx_IterFinish(void);
  2041. /* UnpackItemEndCheck.proto */
  2042. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  2043. /* PyLongBinop.proto */
  2044. #if !CYTHON_COMPILING_IN_PYPY
  2045. static CYTHON_INLINE PyObject* __Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2046. #else
  2047. #define __Pyx_PyLong_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
  2048. (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
  2049. #endif
  2050. /* IncludeStdlibH.proto */
  2051. #include <stdlib.h>
  2052. /* PyLongCompare.proto */
  2053. static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  2054. /* ListAppend.proto */
  2055. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  2056. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  2057. PyListObject* L = (PyListObject*) list;
  2058. Py_ssize_t len = Py_SIZE(list);
  2059. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  2060. Py_INCREF(x);
  2061. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  2062. L->ob_item[len] = x;
  2063. #else
  2064. PyList_SET_ITEM(list, len, x);
  2065. #endif
  2066. __Pyx_SET_SIZE(list, len + 1);
  2067. return 0;
  2068. }
  2069. return PyList_Append(list, x);
  2070. }
  2071. #else
  2072. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  2073. #endif
  2074. /* ListCompAppend.proto */
  2075. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  2076. static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
  2077. PyListObject* L = (PyListObject*) list;
  2078. Py_ssize_t len = Py_SIZE(list);
  2079. if (likely(L->allocated > len)) {
  2080. Py_INCREF(x);
  2081. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  2082. L->ob_item[len] = x;
  2083. #else
  2084. PyList_SET_ITEM(list, len, x);
  2085. #endif
  2086. __Pyx_SET_SIZE(list, len + 1);
  2087. return 0;
  2088. }
  2089. return PyList_Append(list, x);
  2090. }
  2091. #else
  2092. #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
  2093. #endif
  2094. /* GetItemInt.proto */
  2095. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  2096. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  2097. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\
  2098. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  2099. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  2100. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  2101. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  2102. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
  2103. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  2104. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  2105. int wraparound, int boundscheck, int unsafe_shared);
  2106. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  2107. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  2108. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
  2109. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  2110. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  2111. int wraparound, int boundscheck, int unsafe_shared);
  2112. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  2113. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  2114. int is_list, int wraparound, int boundscheck, int unsafe_shared);
  2115. /* ObjectGetItem.proto */
  2116. #if CYTHON_USE_TYPE_SLOTS
  2117. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
  2118. #else
  2119. #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
  2120. #endif
  2121. /* PyLongCompare.proto */
  2122. static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  2123. /* RaiseUnboundLocalError.proto */
  2124. static void __Pyx_RaiseUnboundLocalError(const char *varname);
  2125. /* GetException.proto (used by pep479) */
  2126. #if CYTHON_FAST_THREAD_STATE
  2127. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  2128. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2129. #else
  2130. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  2131. #endif
  2132. /* pep479.proto */
  2133. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);
  2134. /* SliceObject.proto */
  2135. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
  2136. PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
  2137. PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
  2138. int has_cstart, int has_cstop, int wraparound);
  2139. /* ListExtend.proto */
  2140. static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
  2141. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00a2
  2142. return PyList_Extend(L, v);
  2143. #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  2144. PyObject* none = _PyList_Extend((PyListObject*)L, v);
  2145. if (unlikely(!none))
  2146. return -1;
  2147. Py_DECREF(none);
  2148. return 0;
  2149. #else
  2150. return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
  2151. #endif
  2152. }
  2153. /* SetItemInt.proto */
  2154. #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  2155. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  2156. __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\
  2157. (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
  2158. __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
  2159. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
  2160. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
  2161. int is_list, int wraparound, int boundscheck, int unsafe_shared);
  2162. /* dict_setdefault.proto (used by FetchCommonType) */
  2163. static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);
  2164. /* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
  2165. #if CYTHON_COMPILING_IN_LIMITED_API
  2166. static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
  2167. #endif
  2168. /* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
  2169. static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
  2170. #define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)
  2171. /* FixUpExtensionType.proto (used by FetchCommonType) */
  2172. static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
  2173. /* AddModuleRef.proto (used by FetchSharedCythonModule) */
  2174. #if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
  2175. __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  2176. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
  2177. #else
  2178. #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  2179. #endif
  2180. /* FetchSharedCythonModule.proto (used by FetchCommonType) */
  2181. static PyObject *__Pyx_FetchSharedCythonABIModule(void);
  2182. /* FetchCommonType.proto (used by CommonTypesMetaclass) */
  2183. static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);
  2184. /* CommonTypesMetaclass.proto (used by CoroutineBase) */
  2185. static int __pyx_CommonTypesMetaclass_init(PyObject *module);
  2186. #define __Pyx_CommonTypesMetaclass_USED
  2187. /* RaiseException.export */
  2188. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  2189. /* GetTopmostException.proto (used by SaveResetException) */
  2190. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  2191. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  2192. #endif
  2193. /* SaveResetException.proto (used by CoroutineBase) */
  2194. #if CYTHON_FAST_THREAD_STATE
  2195. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  2196. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2197. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  2198. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  2199. #else
  2200. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  2201. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  2202. #endif
  2203. /* SwapException.proto (used by CoroutineBase) */
  2204. #if CYTHON_FAST_THREAD_STATE
  2205. #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
  2206. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2207. #else
  2208. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
  2209. #endif
  2210. /* CallTypeTraverse.proto (used by CoroutineBase) */
  2211. #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
  2212. #define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
  2213. #else
  2214. static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
  2215. #endif
  2216. /* IterNextPlain.proto (used by CoroutineBase) */
  2217. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
  2218. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  2219. static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
  2220. #endif
  2221. /* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */
  2222. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
  2223. /* PyObjectGetMethod.proto (used by PyObjectCallMethod1) */
  2224. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  2225. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
  2226. #endif
  2227. /* PyObjectCallMethod1.proto (used by CoroutineBase) */
  2228. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
  2229. /* PyObjectCallNoArg.proto (used by CoroutineBase) */
  2230. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
  2231. /* ReturnWithStopIteration.proto (used by CoroutineBase) */
  2232. static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);
  2233. /* CoroutineBase.proto (used by Generator) */
  2234. struct __pyx_CoroutineObject;
  2235. typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
  2236. #if CYTHON_USE_EXC_INFO_STACK
  2237. #define __Pyx_ExcInfoStruct _PyErr_StackItem
  2238. #else
  2239. typedef struct {
  2240. PyObject *exc_type;
  2241. PyObject *exc_value;
  2242. PyObject *exc_traceback;
  2243. } __Pyx_ExcInfoStruct;
  2244. #endif
  2245. typedef struct __pyx_CoroutineObject {
  2246. PyObject_HEAD
  2247. __pyx_coroutine_body_t body;
  2248. PyObject *closure;
  2249. __Pyx_ExcInfoStruct gi_exc_state;
  2250. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  2251. PyObject *gi_weakreflist;
  2252. #endif
  2253. PyObject *classobj;
  2254. PyObject *yieldfrom;
  2255. __Pyx_pyiter_sendfunc yieldfrom_am_send;
  2256. PyObject *gi_name;
  2257. PyObject *gi_qualname;
  2258. PyObject *gi_modulename;
  2259. PyObject *gi_code;
  2260. PyObject *gi_frame;
  2261. #if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
  2262. PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
  2263. uint64_t __pyx_pymonitoring_version;
  2264. #endif
  2265. int resume_label;
  2266. char is_running;
  2267. } __pyx_CoroutineObject;
  2268. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  2269. PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2270. PyObject *name, PyObject *qualname, PyObject *module_name);
  2271. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  2272. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2273. PyObject *name, PyObject *qualname, PyObject *module_name);
  2274. static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
  2275. static int __Pyx_Coroutine_clear(PyObject *self);
  2276. static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
  2277. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
  2278. static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
  2279. static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
  2280. #if CYTHON_USE_EXC_INFO_STACK
  2281. #define __Pyx_Coroutine_SwapException(self)
  2282. #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
  2283. #else
  2284. #define __Pyx_Coroutine_SwapException(self) {\
  2285. __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
  2286. __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
  2287. }
  2288. #define __Pyx_Coroutine_ResetAndClearException(self) {\
  2289. __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
  2290. (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
  2291. }
  2292. #endif
  2293. #if CYTHON_FAST_THREAD_STATE
  2294. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2295. __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
  2296. #else
  2297. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2298. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
  2299. #endif
  2300. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
  2301. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
  2302. static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
  2303. static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
  2304. static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
  2305. static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
  2306. #if __PYX_HAS_PY_AM_SEND == 2
  2307. static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
  2308. #endif
  2309. static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);
  2310. /* Generator.proto (used by GeneratorYieldFrom) */
  2311. #define __Pyx_Generator_USED
  2312. #define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType)
  2313. #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
  2314. __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
  2315. static PyObject *__Pyx_Generator_Next(PyObject *self);
  2316. static int __pyx_Generator_init(PyObject *module);
  2317. static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);
  2318. /* GeneratorYieldFrom.proto */
  2319. static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval);
  2320. /* append.proto */
  2321. static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
  2322. /* PyRange_Check.proto */
  2323. #if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check)
  2324. #define PyRange_Check(obj) __Pyx_TypeCheck((obj), &PyRange_Type)
  2325. #endif
  2326. /* PyLongBinop.proto */
  2327. #if !CYTHON_COMPILING_IN_PYPY
  2328. static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2329. #else
  2330. #define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
  2331. (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
  2332. #endif
  2333. /* py_abs.proto */
  2334. #if CYTHON_USE_PYLONG_INTERNALS
  2335. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
  2336. #define __Pyx_PyNumber_Absolute(x)\
  2337. ((likely(PyLong_CheckExact(x))) ?\
  2338. (likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) :\
  2339. PyNumber_Absolute(x))
  2340. #else
  2341. #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
  2342. #endif
  2343. /* PyFloatBinop.proto */
  2344. #if !CYTHON_COMPILING_IN_PYPY
  2345. static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
  2346. #else
  2347. #define __Pyx_PyFloat_TrueDivideObjC(op1, op2, floatval, inplace, zerodivision_check)\
  2348. (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
  2349. #endif
  2350. /* pybytes_as_double.proto (used by pynumber_float) */
  2351. static double __Pyx_SlowPyString_AsDouble(PyObject *obj);
  2352. static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length);
  2353. static CYTHON_INLINE double __Pyx_PyBytes_AsDouble(PyObject *obj) {
  2354. char* as_c_string;
  2355. Py_ssize_t size;
  2356. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  2357. as_c_string = PyBytes_AS_STRING(obj);
  2358. size = PyBytes_GET_SIZE(obj);
  2359. #else
  2360. if (PyBytes_AsStringAndSize(obj, &as_c_string, &size) < 0) {
  2361. return (double)-1;
  2362. }
  2363. #endif
  2364. return __Pyx__PyBytes_AsDouble(obj, as_c_string, size);
  2365. }
  2366. static CYTHON_INLINE double __Pyx_PyByteArray_AsDouble(PyObject *obj) {
  2367. char* as_c_string;
  2368. Py_ssize_t size;
  2369. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  2370. as_c_string = PyByteArray_AS_STRING(obj);
  2371. size = PyByteArray_GET_SIZE(obj);
  2372. #else
  2373. as_c_string = PyByteArray_AsString(obj);
  2374. if (as_c_string == NULL) {
  2375. return (double)-1;
  2376. }
  2377. size = PyByteArray_Size(obj);
  2378. #endif
  2379. return __Pyx__PyBytes_AsDouble(obj, as_c_string, size);
  2380. }
  2381. /* pyunicode_as_double.proto (used by pynumber_float) */
  2382. #if !CYTHON_COMPILING_IN_PYPY && CYTHON_ASSUME_SAFE_MACROS
  2383. static const char* __Pyx__PyUnicode_AsDouble_Copy(const void* data, const int kind, char* buffer, Py_ssize_t start, Py_ssize_t end) {
  2384. int last_was_punctuation;
  2385. Py_ssize_t i;
  2386. last_was_punctuation = 1;
  2387. for (i=start; i <= end; i++) {
  2388. Py_UCS4 chr = PyUnicode_READ(kind, data, i);
  2389. int is_punctuation = (chr == '_') | (chr == '.');
  2390. *buffer = (char)chr;
  2391. buffer += (chr != '_');
  2392. if (unlikely(chr > 127)) goto parse_failure;
  2393. if (unlikely(last_was_punctuation & is_punctuation)) goto parse_failure;
  2394. last_was_punctuation = is_punctuation;
  2395. }
  2396. if (unlikely(last_was_punctuation)) goto parse_failure;
  2397. *buffer = '\0';
  2398. return buffer;
  2399. parse_failure:
  2400. return NULL;
  2401. }
  2402. static double __Pyx__PyUnicode_AsDouble_inf_nan(const void* data, int kind, Py_ssize_t start, Py_ssize_t length) {
  2403. int matches = 1;
  2404. Py_UCS4 chr;
  2405. Py_UCS4 sign = PyUnicode_READ(kind, data, start);
  2406. int is_signed = (sign == '-') | (sign == '+');
  2407. start += is_signed;
  2408. length -= is_signed;
  2409. switch (PyUnicode_READ(kind, data, start)) {
  2410. #ifdef Py_NAN
  2411. case 'n':
  2412. case 'N':
  2413. if (unlikely(length != 3)) goto parse_failure;
  2414. chr = PyUnicode_READ(kind, data, start+1);
  2415. matches &= (chr == 'a') | (chr == 'A');
  2416. chr = PyUnicode_READ(kind, data, start+2);
  2417. matches &= (chr == 'n') | (chr == 'N');
  2418. if (unlikely(!matches)) goto parse_failure;
  2419. return (sign == '-') ? -Py_NAN : Py_NAN;
  2420. #endif
  2421. case 'i':
  2422. case 'I':
  2423. if (unlikely(length < 3)) goto parse_failure;
  2424. chr = PyUnicode_READ(kind, data, start+1);
  2425. matches &= (chr == 'n') | (chr == 'N');
  2426. chr = PyUnicode_READ(kind, data, start+2);
  2427. matches &= (chr == 'f') | (chr == 'F');
  2428. if (likely(length == 3 && matches))
  2429. return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
  2430. if (unlikely(length != 8)) goto parse_failure;
  2431. chr = PyUnicode_READ(kind, data, start+3);
  2432. matches &= (chr == 'i') | (chr == 'I');
  2433. chr = PyUnicode_READ(kind, data, start+4);
  2434. matches &= (chr == 'n') | (chr == 'N');
  2435. chr = PyUnicode_READ(kind, data, start+5);
  2436. matches &= (chr == 'i') | (chr == 'I');
  2437. chr = PyUnicode_READ(kind, data, start+6);
  2438. matches &= (chr == 't') | (chr == 'T');
  2439. chr = PyUnicode_READ(kind, data, start+7);
  2440. matches &= (chr == 'y') | (chr == 'Y');
  2441. if (unlikely(!matches)) goto parse_failure;
  2442. return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
  2443. case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
  2444. break;
  2445. default:
  2446. goto parse_failure;
  2447. }
  2448. return 0.0;
  2449. parse_failure:
  2450. return -1.0;
  2451. }
  2452. static double __Pyx_PyUnicode_AsDouble_WithSpaces(PyObject *obj) {
  2453. double value;
  2454. const char *last;
  2455. char *end;
  2456. Py_ssize_t start, length = PyUnicode_GET_LENGTH(obj);
  2457. const int kind = PyUnicode_KIND(obj);
  2458. const void* data = PyUnicode_DATA(obj);
  2459. start = 0;
  2460. while (Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, start)))
  2461. start++;
  2462. while (start < length - 1 && Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, length - 1)))
  2463. length--;
  2464. length -= start;
  2465. if (unlikely(length <= 0)) goto fallback;
  2466. value = __Pyx__PyUnicode_AsDouble_inf_nan(data, kind, start, length);
  2467. if (unlikely(value == -1.0)) goto fallback;
  2468. if (value != 0.0) return value;
  2469. if (length < 40) {
  2470. char number[40];
  2471. last = __Pyx__PyUnicode_AsDouble_Copy(data, kind, number, start, start + length);
  2472. if (unlikely(!last)) goto fallback;
  2473. value = PyOS_string_to_double(number, &end, NULL);
  2474. } else {
  2475. char *number = (char*) PyMem_Malloc((length + 1) * sizeof(char));
  2476. if (unlikely(!number)) goto fallback;
  2477. last = __Pyx__PyUnicode_AsDouble_Copy(data, kind, number, start, start + length);
  2478. if (unlikely(!last)) {
  2479. PyMem_Free(number);
  2480. goto fallback;
  2481. }
  2482. value = PyOS_string_to_double(number, &end, NULL);
  2483. PyMem_Free(number);
  2484. }
  2485. if (likely(end == last) || (value == (double)-1 && PyErr_Occurred())) {
  2486. return value;
  2487. }
  2488. fallback:
  2489. return __Pyx_SlowPyString_AsDouble(obj);
  2490. }
  2491. #endif
  2492. static CYTHON_INLINE double __Pyx_PyUnicode_AsDouble(PyObject *obj) {
  2493. #if !CYTHON_COMPILING_IN_PYPY && CYTHON_ASSUME_SAFE_MACROS
  2494. if (unlikely(__Pyx_PyUnicode_READY(obj) == -1))
  2495. return (double)-1;
  2496. if (likely(PyUnicode_IS_ASCII(obj))) {
  2497. const char *s;
  2498. Py_ssize_t length;
  2499. s = PyUnicode_AsUTF8AndSize(obj, &length);
  2500. return __Pyx__PyBytes_AsDouble(obj, s, length);
  2501. }
  2502. return __Pyx_PyUnicode_AsDouble_WithSpaces(obj);
  2503. #else
  2504. return __Pyx_SlowPyString_AsDouble(obj);
  2505. #endif
  2506. }
  2507. /* pynumber_float.proto */
  2508. static CYTHON_INLINE PyObject* __Pyx__PyNumber_Float(PyObject* obj);
  2509. #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : __Pyx__PyNumber_Float(x))
  2510. /* PyFloatBinop.proto */
  2511. #if !CYTHON_COMPILING_IN_PYPY
  2512. static int __Pyx_PyFloat_BoolEqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
  2513. #else
  2514. #define __Pyx_PyFloat_BoolEqObjC(op1, op2, floatval, inplace, zerodivision_check)\
  2515. __Pyx_PyObject_IsTrueAndDecref(PyObject_RichCompare(op1, op2, Py_EQ))
  2516. #endif
  2517. /* pow2.proto */
  2518. #define __Pyx_PyNumber_Power2(a, b) PyNumber_Power(a, b, Py_None)
  2519. /* PyLongBinop.proto */
  2520. #if !CYTHON_COMPILING_IN_PYPY
  2521. static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2522. #else
  2523. #define __Pyx_PyLong_SubtractCObj(op1, op2, intval, inplace, zerodivision_check)\
  2524. (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
  2525. #endif
  2526. /* PyValueError_Check.proto */
  2527. #define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError)
  2528. /* PyObjectVectorCallKwBuilder.proto */
  2529. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2530. #if CYTHON_VECTORCALL
  2531. #if PY_VERSION_HEX >= 0x03090000
  2532. #define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
  2533. #else
  2534. #define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
  2535. #endif
  2536. #define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
  2537. static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2538. static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2539. #else
  2540. #define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
  2541. #define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
  2542. #define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
  2543. #define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
  2544. #endif
  2545. /* PyObjectFastCallMethod.proto */
  2546. #if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
  2547. #define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL)
  2548. #else
  2549. static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf);
  2550. #endif
  2551. /* RaiseClosureNameError.proto */
  2552. static void __Pyx_RaiseClosureNameError(const char *varname);
  2553. /* PyMethodNew.proto (used by CythonFunctionShared) */
  2554. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);
  2555. /* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */
  2556. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  2557. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
  2558. #endif
  2559. /* CythonFunctionShared.proto (used by CythonFunction) */
  2560. #define __Pyx_CyFunction_USED
  2561. #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
  2562. #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
  2563. #define __Pyx_CYFUNCTION_CCLASS 0x04
  2564. #define __Pyx_CYFUNCTION_COROUTINE 0x08
  2565. #define __Pyx_CyFunction_GetClosure(f)\
  2566. (((__pyx_CyFunctionObject *) (f))->func_closure)
  2567. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2568. #define __Pyx_CyFunction_GetClassObj(f)\
  2569. (((__pyx_CyFunctionObject *) (f))->func_classobj)
  2570. #else
  2571. #define __Pyx_CyFunction_GetClassObj(f)\
  2572. ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
  2573. #endif
  2574. #define __Pyx_CyFunction_SetClassObj(f, classobj)\
  2575. __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
  2576. #define __Pyx_CyFunction_Defaults(type, f)\
  2577. ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
  2578. #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
  2579. ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
  2580. typedef struct {
  2581. #if CYTHON_COMPILING_IN_LIMITED_API
  2582. PyObject_HEAD
  2583. PyObject *func;
  2584. #elif PY_VERSION_HEX < 0x030900B1
  2585. PyCFunctionObject func;
  2586. #else
  2587. PyCMethodObject func;
  2588. #endif
  2589. #if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
  2590. __pyx_vectorcallfunc func_vectorcall;
  2591. #endif
  2592. #if CYTHON_COMPILING_IN_LIMITED_API
  2593. PyObject *func_weakreflist;
  2594. #endif
  2595. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  2596. PyObject *func_dict;
  2597. #endif
  2598. PyObject *func_name;
  2599. PyObject *func_qualname;
  2600. PyObject *func_doc;
  2601. PyObject *func_globals;
  2602. PyObject *func_code;
  2603. PyObject *func_closure;
  2604. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2605. PyObject *func_classobj;
  2606. #endif
  2607. PyObject *defaults;
  2608. int flags;
  2609. PyObject *defaults_tuple;
  2610. PyObject *defaults_kwdict;
  2611. PyObject *(*defaults_getter)(PyObject *);
  2612. PyObject *func_annotations;
  2613. PyObject *func_is_coroutine;
  2614. } __pyx_CyFunctionObject;
  2615. #undef __Pyx_CyOrPyCFunction_Check
  2616. #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
  2617. #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
  2618. #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
  2619. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
  2620. #undef __Pyx_IsSameCFunction
  2621. #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
  2622. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
  2623. int flags, PyObject* qualname,
  2624. PyObject *closure,
  2625. PyObject *module, PyObject *globals,
  2626. PyObject* code);
  2627. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
  2628. static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
  2629. PyTypeObject *defaults_type);
  2630. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
  2631. PyObject *tuple);
  2632. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
  2633. PyObject *dict);
  2634. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
  2635. PyObject *dict);
  2636. static int __pyx_CyFunction_init(PyObject *module);
  2637. #if CYTHON_METH_FASTCALL
  2638. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2639. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2640. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2641. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2642. #if CYTHON_COMPILING_IN_LIMITED_API
  2643. #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
  2644. #else
  2645. #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
  2646. #endif
  2647. #endif
  2648. /* CythonFunction.proto */
  2649. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
  2650. int flags, PyObject* qualname,
  2651. PyObject *closure,
  2652. PyObject *module, PyObject *globals,
  2653. PyObject* code);
  2654. /* pyfrozenset_new.proto (used by PySetContains) */
  2655. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);
  2656. /* PySetContains.proto */
  2657. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);
  2658. /* PyTypeError_Check.proto */
  2659. #define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError)
  2660. /* AllocateExtensionType.proto */
  2661. static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);
  2662. /* CheckTypeForFreelists.proto */
  2663. #if CYTHON_USE_FREELISTS
  2664. #if CYTHON_USE_TYPE_SPECS
  2665. #define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
  2666. #define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT
  2667. #else
  2668. #define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
  2669. #define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
  2670. #endif
  2671. #define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
  2672. (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
  2673. (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
  2674. #endif
  2675. /* PyObjectCallMethod0.proto (used by PyType_Ready) */
  2676. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
  2677. /* ValidateBasesTuple.proto (used by PyType_Ready) */
  2678. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  2679. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
  2680. #endif
  2681. /* PyType_Ready.proto */
  2682. CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);
  2683. /* HasAttr.proto (used by ImportImpl) */
  2684. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  2685. #define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n)
  2686. #else
  2687. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
  2688. #endif
  2689. /* ImportImpl.export */
  2690. static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level);
  2691. /* Import.proto */
  2692. static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);
  2693. /* ImportFrom.proto */
  2694. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  2695. /* ListPack.proto */
  2696. static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...);
  2697. /* CLineInTraceback.proto (used by AddTraceback) */
  2698. #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  2699. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  2700. #else
  2701. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  2702. #endif
  2703. /* CodeObjectCache.proto (used by AddTraceback) */
  2704. #if CYTHON_COMPILING_IN_LIMITED_API
  2705. typedef PyObject __Pyx_CachedCodeObjectType;
  2706. #else
  2707. typedef PyCodeObject __Pyx_CachedCodeObjectType;
  2708. #endif
  2709. typedef struct {
  2710. __Pyx_CachedCodeObjectType* code_object;
  2711. int code_line;
  2712. } __Pyx_CodeObjectCacheEntry;
  2713. struct __Pyx_CodeObjectCache {
  2714. int count;
  2715. int max_count;
  2716. __Pyx_CodeObjectCacheEntry* entries;
  2717. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  2718. __pyx_atomic_int_type accessor_count;
  2719. #endif
  2720. };
  2721. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  2722. static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
  2723. static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);
  2724. /* AddTraceback.proto */
  2725. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  2726. int py_line, const char *filename);
  2727. /* RealImag.proto */
  2728. #if CYTHON_CCOMPLEX
  2729. #ifdef __cplusplus
  2730. #define __Pyx_CREAL(z) ((z).real())
  2731. #define __Pyx_CIMAG(z) ((z).imag())
  2732. #else
  2733. #define __Pyx_CREAL(z) (__real__(z))
  2734. #define __Pyx_CIMAG(z) (__imag__(z))
  2735. #endif
  2736. #else
  2737. #define __Pyx_CREAL(z) ((z).real)
  2738. #define __Pyx_CIMAG(z) ((z).imag)
  2739. #endif
  2740. #if defined(__cplusplus) && CYTHON_CCOMPLEX\
  2741. && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
  2742. #define __Pyx_SET_CREAL(z,x) ((z).real(x))
  2743. #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
  2744. #else
  2745. #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
  2746. #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
  2747. #endif
  2748. /* Arithmetic.proto */
  2749. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  2750. #define __Pyx_c_eq_double(a, b) ((a)==(b))
  2751. #define __Pyx_c_sum_double(a, b) ((a)+(b))
  2752. #define __Pyx_c_diff_double(a, b) ((a)-(b))
  2753. #define __Pyx_c_prod_double(a, b) ((a)*(b))
  2754. #define __Pyx_c_quot_double(a, b) ((a)/(b))
  2755. #define __Pyx_c_neg_double(a) (-(a))
  2756. #ifdef __cplusplus
  2757. #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
  2758. #define __Pyx_c_conj_double(z) (::std::conj(z))
  2759. #if 1
  2760. #define __Pyx_c_abs_double(z) (::std::abs(z))
  2761. #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
  2762. #endif
  2763. #else
  2764. #define __Pyx_c_is_zero_double(z) ((z)==0)
  2765. #define __Pyx_c_conj_double(z) (conj(z))
  2766. #if 1
  2767. #define __Pyx_c_abs_double(z) (cabs(z))
  2768. #define __Pyx_c_pow_double(a, b) (cpow(a, b))
  2769. #endif
  2770. #endif
  2771. #else
  2772. static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2773. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2774. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2775. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2776. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2777. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
  2778. static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
  2779. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
  2780. #if 1
  2781. static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
  2782. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2783. #endif
  2784. #endif
  2785. /* FromPy.proto */
  2786. static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject*);
  2787. /* ToPy.proto */
  2788. #define __pyx_PyComplex_FromComplex(z)\
  2789. PyComplex_FromDoubles((double)__Pyx_CREAL(z),\
  2790. (double)__Pyx_CIMAG(z))
  2791. /* GCCDiagnostics.proto */
  2792. #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  2793. #define __Pyx_HAS_GCC_DIAGNOSTIC
  2794. #endif
  2795. /* CIntToPy.proto */
  2796. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value);
  2797. /* FormatTypeName.proto */
  2798. #if CYTHON_COMPILING_IN_LIMITED_API
  2799. typedef PyObject *__Pyx_TypeName;
  2800. #define __Pyx_FMT_TYPENAME "%U"
  2801. #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
  2802. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  2803. #define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
  2804. #else
  2805. static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
  2806. #endif
  2807. #else // !LIMITED_API
  2808. typedef const char *__Pyx_TypeName;
  2809. #define __Pyx_FMT_TYPENAME "%.200s"
  2810. #define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
  2811. #define __Pyx_DECREF_TypeName(obj)
  2812. #endif
  2813. /* CIntFromPy.proto */
  2814. static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *);
  2815. /* CIntFromPy.proto */
  2816. static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *);
  2817. /* FastTypeChecks.proto */
  2818. #if CYTHON_COMPILING_IN_CPYTHON
  2819. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  2820. #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
  2821. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  2822. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
  2823. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  2824. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  2825. #else
  2826. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  2827. #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
  2828. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  2829. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
  2830. return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
  2831. }
  2832. #endif
  2833. #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
  2834. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  2835. #ifdef PyExceptionInstance_Check
  2836. #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
  2837. #else
  2838. #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
  2839. #endif
  2840. /* GetRuntimeVersion.proto */
  2841. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  2842. static unsigned long __Pyx_cached_runtime_version = 0;
  2843. static void __Pyx_init_runtime_version(void);
  2844. #else
  2845. #define __Pyx_init_runtime_version()
  2846. #endif
  2847. static unsigned long __Pyx_get_runtime_version(void);
  2848. /* CheckBinaryVersion.proto */
  2849. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
  2850. /* DecompressString.proto */
  2851. static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);
  2852. /* MultiPhaseInitModuleState.proto */
  2853. #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
  2854. static PyObject *__Pyx_State_FindModule(void*);
  2855. static int __Pyx_State_AddModule(PyObject* module, void*);
  2856. static int __Pyx_State_RemoveModule(void*);
  2857. #elif CYTHON_USE_MODULE_STATE
  2858. #define __Pyx_State_FindModule PyState_FindModule
  2859. #define __Pyx_State_AddModule PyState_AddModule
  2860. #define __Pyx_State_RemoveModule PyState_RemoveModule
  2861. #endif
  2862. /* #### Code section: module_declarations ### */
  2863. /* CythonABIVersion.proto */
  2864. #if CYTHON_COMPILING_IN_LIMITED_API
  2865. #if CYTHON_METH_FASTCALL
  2866. #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall"
  2867. #else
  2868. #define __PYX_FASTCALL_ABI_SUFFIX
  2869. #endif
  2870. #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
  2871. #else
  2872. #define __PYX_LIMITED_ABI_SUFFIX
  2873. #endif
  2874. #if __PYX_HAS_PY_AM_SEND == 1
  2875. #define __PYX_AM_SEND_ABI_SUFFIX
  2876. #elif __PYX_HAS_PY_AM_SEND == 2
  2877. #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
  2878. #else
  2879. #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
  2880. #endif
  2881. #ifndef __PYX_MONITORING_ABI_SUFFIX
  2882. #define __PYX_MONITORING_ABI_SUFFIX
  2883. #endif
  2884. #if CYTHON_USE_TP_FINALIZE
  2885. #define __PYX_TP_FINALIZE_ABI_SUFFIX
  2886. #else
  2887. #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
  2888. #endif
  2889. #if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
  2890. #define __PYX_FREELISTS_ABI_SUFFIX
  2891. #else
  2892. #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
  2893. #endif
  2894. #define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
  2895. #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
  2896. #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
  2897. /* Module declarations from "cython" */
  2898. /* Module declarations from "fontTools.misc.bezierTools" */
  2899. static CYTHON_INLINE double __pyx_f_9fontTools_4misc_11bezierTools__dot(__pyx_t_double_complex, __pyx_t_double_complex); /*proto*/
  2900. static CYTHON_INLINE double __pyx_f_9fontTools_4misc_11bezierTools__intSecAtan(double); /*proto*/
  2901. static CYTHON_INLINE PyObject *__pyx_f_9fontTools_4misc_11bezierTools_calcCubicParametersC(__pyx_t_double_complex, __pyx_t_double_complex, __pyx_t_double_complex, __pyx_t_double_complex); /*proto*/
  2902. static CYTHON_INLINE PyObject *__pyx_f_9fontTools_4misc_11bezierTools_calcCubicPointsC(__pyx_t_double_complex, __pyx_t_double_complex, __pyx_t_double_complex, __pyx_t_double_complex); /*proto*/
  2903. /* #### Code section: typeinfo ### */
  2904. /* #### Code section: before_global_var ### */
  2905. #define __Pyx_MODULE_NAME "fontTools.misc.bezierTools"
  2906. extern int __pyx_module_is_main_fontTools__misc__bezierTools;
  2907. int __pyx_module_is_main_fontTools__misc__bezierTools = 0;
  2908. /* Implementation of "fontTools.misc.bezierTools" */
  2909. /* #### Code section: global_var ### */
  2910. static PyObject *__pyx_builtin_round;
  2911. static PyObject *__pyx_builtin_print;
  2912. /* #### Code section: string_decls ### */
  2913. static const char __pyx_k_fontTools_misc_bezierTools_py_to[] = "fontTools.misc.bezierTools.py -- tools for working with Bezier path segments.\n";
  2914. /* #### Code section: decls ### */
  2915. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_calcCubicArcLength(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4, PyObject *__pyx_v_tolerance); /* proto */
  2916. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_2_split_cubic_into_two(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p0, PyObject *__pyx_v_p1, PyObject *__pyx_v_p2, PyObject *__pyx_v_p3); /* proto */
  2917. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_4_calcCubicArcLengthCRecurse(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_mult, __pyx_t_double_complex __pyx_v_p0, __pyx_t_double_complex __pyx_v_p1, __pyx_t_double_complex __pyx_v_p2, __pyx_t_double_complex __pyx_v_p3); /* proto */
  2918. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_6calcCubicArcLengthC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4, double __pyx_v_tolerance); /* proto */
  2919. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_8calcQuadraticArcLength(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3); /* proto */
  2920. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_10calcQuadraticArcLengthC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3); /* proto */
  2921. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_12approximateQuadraticArcLength(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3); /* proto */
  2922. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_14approximateQuadraticArcLengthC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3); /* proto */
  2923. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_16calcQuadraticBounds(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3); /* proto */
  2924. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_18approximateCubicArcLength(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4); /* proto */
  2925. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_20approximateCubicArcLengthC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4); /* proto */
  2926. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_22calcCubicBounds(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4); /* proto */
  2927. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_24splitLine(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_where, PyObject *__pyx_v_isHorizontal); /* proto */
  2928. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_14splitQuadratic_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2929. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_26splitQuadratic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_where, PyObject *__pyx_v_isHorizontal); /* proto */
  2930. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_10splitCubic_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2931. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_28splitCubic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4, PyObject *__pyx_v_where, PyObject *__pyx_v_isHorizontal); /* proto */
  2932. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_30splitQuadraticAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_ts); /* proto */
  2933. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_32splitCubicAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4, PyObject *__pyx_v_ts); /* proto */
  2934. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_34splitCubicAtTC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4, PyObject *__pyx_v_ts); /* proto */
  2935. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_37splitCubicIntoTwoAtTC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4, double __pyx_v_t); /* proto */
  2936. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_39_splitQuadraticAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_ts); /* proto */
  2937. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_41_splitCubicAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_ts); /* proto */
  2938. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_43_splitCubicAtTC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_a, __pyx_t_double_complex __pyx_v_b, __pyx_t_double_complex __pyx_v_c, __pyx_t_double_complex __pyx_v_d, PyObject *__pyx_v_ts); /* proto */
  2939. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_96__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
  2940. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_46solveQuadratic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_sqrt); /* proto */
  2941. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_48solveCubic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d); /* proto */
  2942. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_50calcQuadraticParameters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3); /* proto */
  2943. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_52calcCubicParameters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4); /* proto */
  2944. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_54calcQuadraticPoints(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c); /* proto */
  2945. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_56calcCubicPoints(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d); /* proto */
  2946. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_58linePointAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_t); /* proto */
  2947. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_60quadraticPointAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_t); /* proto */
  2948. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_62cubicPointAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4, PyObject *__pyx_v_t); /* proto */
  2949. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_64cubicPointAtTC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4, double __pyx_v_t); /* proto */
  2950. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_66segmentPointAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_seg, PyObject *__pyx_v_t); /* proto */
  2951. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_68_line_t_of_pt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_e, PyObject *__pyx_v_pt); /* proto */
  2952. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_70_both_points_are_on_same_side_of_origin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_origin); /* proto */
  2953. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_72lineLineIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_e1, PyObject *__pyx_v_s2, PyObject *__pyx_v_e2); /* proto */
  2954. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_74_alignment_transformation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segment); /* proto */
  2955. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2956. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_76_curve_line_intersections_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve, PyObject *__pyx_v_line); /* proto */
  2957. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_78curveLineIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve, PyObject *__pyx_v_line); /* proto */
  2958. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_80_curve_bounds(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_c); /* proto */
  2959. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_82_split_segment_at_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_c, PyObject *__pyx_v_t); /* proto */
  2960. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_r); /* proto */
  2961. static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_ts); /* proto */
  2962. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_84_curve_curve_intersections_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve1, PyObject *__pyx_v_curve2, PyObject *__pyx_v_precision, PyObject *__pyx_v_range1, PyObject *__pyx_v_range2); /* proto */
  2963. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_12_is_linelike_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2964. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_86_is_linelike(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segment); /* proto */
  2965. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_88curveCurveIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve1, PyObject *__pyx_v_curve2); /* proto */
  2966. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_90segmentSegmentIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_seg1, PyObject *__pyx_v_seg2); /* proto */
  2967. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_12_segmentrepr_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2968. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_92_segmentrepr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */
  2969. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_94printSegments(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segments); /* proto */
  2970. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_defaults(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2971. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2972. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2973. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2974. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2975. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2976. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2977. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2978. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2979. /* #### Code section: late_includes ### */
  2980. /* #### Code section: module_state ### */
  2981. /* SmallCodeConfig */
  2982. #ifndef CYTHON_SMALL_CODE
  2983. #if defined(__clang__)
  2984. #define CYTHON_SMALL_CODE
  2985. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  2986. #define CYTHON_SMALL_CODE __attribute__((cold))
  2987. #else
  2988. #define CYTHON_SMALL_CODE
  2989. #endif
  2990. #endif
  2991. typedef struct {
  2992. PyObject *__pyx_d;
  2993. PyObject *__pyx_b;
  2994. PyObject *__pyx_cython_runtime;
  2995. PyObject *__pyx_empty_tuple;
  2996. PyObject *__pyx_empty_bytes;
  2997. PyObject *__pyx_empty_unicode;
  2998. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults;
  2999. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr;
  3000. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr;
  3001. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC;
  3002. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC;
  3003. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr;
  3004. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t;
  3005. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr;
  3006. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr;
  3007. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults;
  3008. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr;
  3009. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr;
  3010. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC;
  3011. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC;
  3012. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr;
  3013. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t;
  3014. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr;
  3015. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr;
  3016. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  3017. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  3018. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  3019. PyObject *__pyx_slice[2];
  3020. PyObject *__pyx_tuple[4];
  3021. PyObject *__pyx_codeobj_tab[54];
  3022. PyObject *__pyx_string_tab[387];
  3023. PyObject *__pyx_number_tab[21];
  3024. /* #### Code section: module_state_contents ### */
  3025. /* CommonTypesMetaclass.module_state_decls */
  3026. PyTypeObject *__pyx_CommonTypesMetaclassType;
  3027. /* IterNextPlain.module_state_decls */
  3028. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  3029. PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
  3030. #endif
  3031. /* Generator.module_state_decls */
  3032. PyTypeObject *__pyx_GeneratorType;
  3033. /* CachedMethodType.module_state_decls */
  3034. #if CYTHON_COMPILING_IN_LIMITED_API
  3035. PyObject *__Pyx_CachedMethodType;
  3036. #endif
  3037. /* CythonFunctionShared.module_state_decls */
  3038. PyTypeObject *__pyx_CyFunctionType;
  3039. #if CYTHON_USE_FREELISTS
  3040. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr[8];
  3041. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr;
  3042. #endif
  3043. #if CYTHON_USE_FREELISTS
  3044. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr[8];
  3045. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr;
  3046. #endif
  3047. #if CYTHON_USE_FREELISTS
  3048. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC[8];
  3049. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC;
  3050. #endif
  3051. #if CYTHON_USE_FREELISTS
  3052. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC[8];
  3053. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC;
  3054. #endif
  3055. #if CYTHON_USE_FREELISTS
  3056. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr[8];
  3057. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr;
  3058. #endif
  3059. #if CYTHON_USE_FREELISTS
  3060. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t[8];
  3061. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t;
  3062. #endif
  3063. #if CYTHON_USE_FREELISTS
  3064. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr[8];
  3065. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr;
  3066. #endif
  3067. #if CYTHON_USE_FREELISTS
  3068. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr[8];
  3069. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr;
  3070. #endif
  3071. /* CodeObjectCache.module_state_decls */
  3072. struct __Pyx_CodeObjectCache __pyx_code_cache;
  3073. /* #### Code section: module_state_end ### */
  3074. } __pyx_mstatetype;
  3075. #if CYTHON_USE_MODULE_STATE
  3076. #ifdef __cplusplus
  3077. namespace {
  3078. extern struct PyModuleDef __pyx_moduledef;
  3079. } /* anonymous namespace */
  3080. #else
  3081. static struct PyModuleDef __pyx_moduledef;
  3082. #endif
  3083. #define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))
  3084. #define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
  3085. #else
  3086. static __pyx_mstatetype __pyx_mstate_global_static =
  3087. #ifdef __cplusplus
  3088. {};
  3089. #else
  3090. {0};
  3091. #endif
  3092. static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
  3093. #endif
  3094. /* #### Code section: constant_name_defines ### */
  3095. #define __pyx_kp_u_ __pyx_string_tab[0]
  3096. #define __pyx_kp_u_Approximates_the_arc_length_for __pyx_string_tab[1]
  3097. #define __pyx_kp_u_Calculates_the_arc_length_for_a __pyx_string_tab[2]
  3098. #define __pyx_kp_u_Calculates_the_bounding_rectangl __pyx_string_tab[3]
  3099. #define __pyx_kp_u_Calculates_the_bounding_rectangl_2 __pyx_string_tab[4]
  3100. #define __pyx_kp_u_Couldn_t_work_out_which_intersec __pyx_string_tab[5]
  3101. #define __pyx_kp_u_Finds_intersections_between_a_cu __pyx_string_tab[6]
  3102. #define __pyx_kp_u_Finds_intersections_between_a_cu_2 __pyx_string_tab[7]
  3103. #define __pyx_kp_u_Finds_intersections_between_two __pyx_string_tab[8]
  3104. #define __pyx_kp_u_Finds_intersections_between_two_2 __pyx_string_tab[9]
  3105. #define __pyx_kp_u_Lib_fontTools_misc_bezierTools_p __pyx_string_tab[10]
  3106. #define __pyx_kp_u_Solve_a_cubic_equation_Solves_a __pyx_string_tab[11]
  3107. #define __pyx_kp_u_Split_a_cubic_Bezier_curve_at_a __pyx_string_tab[12]
  3108. #define __pyx_kp_u_Split_a_cubic_Bezier_curve_at_on __pyx_string_tab[13]
  3109. #define __pyx_kp_u_Split_a_line_at_a_given_coordina __pyx_string_tab[14]
  3110. #define __pyx_kp_u_Split_a_quadratic_Bezier_curve_a __pyx_string_tab[15]
  3111. #define __pyx_kp_u_Split_a_quadratic_Bezier_curve_a_2 __pyx_string_tab[16]
  3112. #define __pyx_kp_u_Unknown_curve_degree __pyx_string_tab[17]
  3113. #define __pyx_kp_u__2 __pyx_string_tab[18]
  3114. #define __pyx_kp_u__3 __pyx_string_tab[19]
  3115. #define __pyx_kp_u_approximateCubicArcLength_line_3 __pyx_string_tab[20]
  3116. #define __pyx_kp_u_calcCubicBounds_line_412 __pyx_string_tab[21]
  3117. #define __pyx_kp_u_calcQuadraticArcLength_line_151 __pyx_string_tab[22]
  3118. #define __pyx_kp_u_calcQuadraticBounds_line_298 __pyx_string_tab[23]
  3119. #define __pyx_kp_u_curveCurveIntersections_line_138 __pyx_string_tab[24]
  3120. #define __pyx_kp_u_curveLineIntersections_line_1255 __pyx_string_tab[25]
  3121. #define __pyx_kp_u_disable __pyx_string_tab[26]
  3122. #define __pyx_kp_u_enable __pyx_string_tab[27]
  3123. #define __pyx_kp_u_g __pyx_string_tab[28]
  3124. #define __pyx_kp_u_gc __pyx_string_tab[29]
  3125. #define __pyx_kp_u_isenabled __pyx_string_tab[30]
  3126. #define __pyx_kp_u_lineLineIntersections_line_1154 __pyx_string_tab[31]
  3127. #define __pyx_kp_u_s_2 __pyx_string_tab[32]
  3128. #define __pyx_kp_u_segmentSegmentIntersections_line __pyx_string_tab[33]
  3129. #define __pyx_kp_u_segmentrepr_1_2_3_2_3_4_0_1_2 __pyx_string_tab[34]
  3130. #define __pyx_kp_u_segmentrepr_line_1475 __pyx_string_tab[35]
  3131. #define __pyx_kp_u_solveCubic_line_848 __pyx_string_tab[36]
  3132. #define __pyx_kp_u_splitCubicAtT_line_613 __pyx_string_tab[37]
  3133. #define __pyx_kp_u_splitCubic_line_552 __pyx_string_tab[38]
  3134. #define __pyx_kp_u_splitLine_line_450 __pyx_string_tab[39]
  3135. #define __pyx_kp_u_splitQuadraticAtT_line_589 __pyx_string_tab[40]
  3136. #define __pyx_kp_u_splitQuadratic_line_507 __pyx_string_tab[41]
  3137. #define __pyx_n_u_1_t __pyx_string_tab[42]
  3138. #define __pyx_n_u_1_t_2 __pyx_string_tab[43]
  3139. #define __pyx_n_u_2_t_1_t __pyx_string_tab[44]
  3140. #define __pyx_n_u_COMPILED __pyx_string_tab[45]
  3141. #define __pyx_n_u_DD __pyx_string_tab[46]
  3142. #define __pyx_n_u_EPSILON __pyx_string_tab[47]
  3143. #define __pyx_n_u_Identity __pyx_string_tab[48]
  3144. #define __pyx_n_u_Intersection __pyx_string_tab[49]
  3145. #define __pyx_n_u_Len __pyx_string_tab[50]
  3146. #define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[51]
  3147. #define __pyx_n_u_Q __pyx_string_tab[52]
  3148. #define __pyx_n_u_Q3 __pyx_string_tab[53]
  3149. #define __pyx_n_u_R __pyx_string_tab[54]
  3150. #define __pyx_n_u_R2 __pyx_string_tab[55]
  3151. #define __pyx_n_u_R2_Q3 __pyx_string_tab[56]
  3152. #define __pyx_n_u__6 __pyx_string_tab[57]
  3153. #define __pyx_n_u_a __pyx_string_tab[58]
  3154. #define __pyx_n_u_a1 __pyx_string_tab[59]
  3155. #define __pyx_n_u_a1_3 __pyx_string_tab[60]
  3156. #define __pyx_n_u_a1x __pyx_string_tab[61]
  3157. #define __pyx_n_u_a1y __pyx_string_tab[62]
  3158. #define __pyx_n_u_a2 __pyx_string_tab[63]
  3159. #define __pyx_n_u_a3 __pyx_string_tab[64]
  3160. #define __pyx_n_u_acos __pyx_string_tab[65]
  3161. #define __pyx_n_u_aligned_curve __pyx_string_tab[66]
  3162. #define __pyx_n_u_alignment_transformation __pyx_string_tab[67]
  3163. #define __pyx_n_u_all __pyx_string_tab[68]
  3164. #define __pyx_n_u_angle __pyx_string_tab[69]
  3165. #define __pyx_n_u_append __pyx_string_tab[70]
  3166. #define __pyx_n_u_approximateCubicArcLength __pyx_string_tab[71]
  3167. #define __pyx_n_u_approximateCubicArcLengthC __pyx_string_tab[72]
  3168. #define __pyx_n_u_approximateQuadraticArcLength __pyx_string_tab[73]
  3169. #define __pyx_n_u_approximateQuadraticArcLengthC __pyx_string_tab[74]
  3170. #define __pyx_n_u_arch __pyx_string_tab[75]
  3171. #define __pyx_n_u_asinh __pyx_string_tab[76]
  3172. #define __pyx_n_u_asyncio_coroutines __pyx_string_tab[77]
  3173. #define __pyx_n_u_atan2 __pyx_string_tab[78]
  3174. #define __pyx_n_u_ax __pyx_string_tab[79]
  3175. #define __pyx_n_u_ax2 __pyx_string_tab[80]
  3176. #define __pyx_n_u_ax3 __pyx_string_tab[81]
  3177. #define __pyx_n_u_ay __pyx_string_tab[82]
  3178. #define __pyx_n_u_ay2 __pyx_string_tab[83]
  3179. #define __pyx_n_u_ay3 __pyx_string_tab[84]
  3180. #define __pyx_n_u_b __pyx_string_tab[85]
  3181. #define __pyx_n_u_b1 __pyx_string_tab[86]
  3182. #define __pyx_n_u_b1x __pyx_string_tab[87]
  3183. #define __pyx_n_u_b1y __pyx_string_tab[88]
  3184. #define __pyx_n_u_both_points_are_on_same_side_of __pyx_string_tab[89]
  3185. #define __pyx_n_u_bounds1 __pyx_string_tab[90]
  3186. #define __pyx_n_u_bounds2 __pyx_string_tab[91]
  3187. #define __pyx_n_u_box __pyx_string_tab[92]
  3188. #define __pyx_n_u_bx __pyx_string_tab[93]
  3189. #define __pyx_n_u_bx2 __pyx_string_tab[94]
  3190. #define __pyx_n_u_by __pyx_string_tab[95]
  3191. #define __pyx_n_u_by2 __pyx_string_tab[96]
  3192. #define __pyx_n_u_c __pyx_string_tab[97]
  3193. #define __pyx_n_u_c1 __pyx_string_tab[98]
  3194. #define __pyx_n_u_c11 __pyx_string_tab[99]
  3195. #define __pyx_n_u_c11_range __pyx_string_tab[100]
  3196. #define __pyx_n_u_c12 __pyx_string_tab[101]
  3197. #define __pyx_n_u_c12_range __pyx_string_tab[102]
  3198. #define __pyx_n_u_c1x __pyx_string_tab[103]
  3199. #define __pyx_n_u_c1y __pyx_string_tab[104]
  3200. #define __pyx_n_u_c21 __pyx_string_tab[105]
  3201. #define __pyx_n_u_c21_range __pyx_string_tab[106]
  3202. #define __pyx_n_u_c22 __pyx_string_tab[107]
  3203. #define __pyx_n_u_c22_range __pyx_string_tab[108]
  3204. #define __pyx_n_u_calcBounds __pyx_string_tab[109]
  3205. #define __pyx_n_u_calcCubicArcLength __pyx_string_tab[110]
  3206. #define __pyx_n_u_calcCubicArcLengthC __pyx_string_tab[111]
  3207. #define __pyx_n_u_calcCubicArcLengthCRecurse __pyx_string_tab[112]
  3208. #define __pyx_n_u_calcCubicBounds __pyx_string_tab[113]
  3209. #define __pyx_n_u_calcCubicParameters __pyx_string_tab[114]
  3210. #define __pyx_n_u_calcCubicPoints __pyx_string_tab[115]
  3211. #define __pyx_n_u_calcQuadraticArcLength __pyx_string_tab[116]
  3212. #define __pyx_n_u_calcQuadraticArcLengthC __pyx_string_tab[117]
  3213. #define __pyx_n_u_calcQuadraticBounds __pyx_string_tab[118]
  3214. #define __pyx_n_u_calcQuadraticParameters __pyx_string_tab[119]
  3215. #define __pyx_n_u_calcQuadraticPoints __pyx_string_tab[120]
  3216. #define __pyx_n_u_class_getitem __pyx_string_tab[121]
  3217. #define __pyx_n_u_cline_in_traceback __pyx_string_tab[122]
  3218. #define __pyx_n_u_close __pyx_string_tab[123]
  3219. #define __pyx_n_u_collections __pyx_string_tab[124]
  3220. #define __pyx_n_u_cos __pyx_string_tab[125]
  3221. #define __pyx_n_u_cubicPointAtT __pyx_string_tab[126]
  3222. #define __pyx_n_u_cubicPointAtTC __pyx_string_tab[127]
  3223. #define __pyx_n_u_curve __pyx_string_tab[128]
  3224. #define __pyx_n_u_curve1 __pyx_string_tab[129]
  3225. #define __pyx_n_u_curve2 __pyx_string_tab[130]
  3226. #define __pyx_n_u_curveCurveIntersections __pyx_string_tab[131]
  3227. #define __pyx_n_u_curveLineIntersections __pyx_string_tab[132]
  3228. #define __pyx_n_u_curve_bounds __pyx_string_tab[133]
  3229. #define __pyx_n_u_curve_curve_intersections_t __pyx_string_tab[134]
  3230. #define __pyx_n_u_curve_curve_intersections_t_loc __pyx_string_tab[135]
  3231. #define __pyx_n_u_curve_curve_intersections_t_loc_2 __pyx_string_tab[136]
  3232. #define __pyx_n_u_curve_line_intersections_t __pyx_string_tab[137]
  3233. #define __pyx_n_u_curve_line_intersections_t_loca __pyx_string_tab[138]
  3234. #define __pyx_n_u_cx __pyx_string_tab[139]
  3235. #define __pyx_n_u_cy __pyx_string_tab[140]
  3236. #define __pyx_n_u_d __pyx_string_tab[141]
  3237. #define __pyx_n_u_d0 __pyx_string_tab[142]
  3238. #define __pyx_n_u_d1 __pyx_string_tab[143]
  3239. #define __pyx_n_u_d1x __pyx_string_tab[144]
  3240. #define __pyx_n_u_d1y __pyx_string_tab[145]
  3241. #define __pyx_n_u_delta __pyx_string_tab[146]
  3242. #define __pyx_n_u_delta_2 __pyx_string_tab[147]
  3243. #define __pyx_n_u_delta_3 __pyx_string_tab[148]
  3244. #define __pyx_n_u_deriv3 __pyx_string_tab[149]
  3245. #define __pyx_n_u_doctest __pyx_string_tab[150]
  3246. #define __pyx_n_u_dx __pyx_string_tab[151]
  3247. #define __pyx_n_u_dy __pyx_string_tab[152]
  3248. #define __pyx_n_u_e __pyx_string_tab[153]
  3249. #define __pyx_n_u_e1 __pyx_string_tab[154]
  3250. #define __pyx_n_u_e1x __pyx_string_tab[155]
  3251. #define __pyx_n_u_e1y __pyx_string_tab[156]
  3252. #define __pyx_n_u_e2 __pyx_string_tab[157]
  3253. #define __pyx_n_u_e2x __pyx_string_tab[158]
  3254. #define __pyx_n_u_e2y __pyx_string_tab[159]
  3255. #define __pyx_n_u_end __pyx_string_tab[160]
  3256. #define __pyx_n_u_epsilon __pyx_string_tab[161]
  3257. #define __pyx_n_u_epsilonDigits __pyx_string_tab[162]
  3258. #define __pyx_n_u_ex __pyx_string_tab[163]
  3259. #define __pyx_n_u_exit __pyx_string_tab[164]
  3260. #define __pyx_n_u_ey __pyx_string_tab[165]
  3261. #define __pyx_n_u_failed __pyx_string_tab[166]
  3262. #define __pyx_n_u_fontTools_misc_arrayTools __pyx_string_tab[167]
  3263. #define __pyx_n_u_fontTools_misc_bezierTools __pyx_string_tab[168]
  3264. #define __pyx_n_u_fontTools_misc_transform __pyx_string_tab[169]
  3265. #define __pyx_n_u_found __pyx_string_tab[170]
  3266. #define __pyx_n_u_func __pyx_string_tab[171]
  3267. #define __pyx_n_u_genexpr __pyx_string_tab[172]
  3268. #define __pyx_n_u_hits __pyx_string_tab[173]
  3269. #define __pyx_n_u_i __pyx_string_tab[174]
  3270. #define __pyx_n_u_insert __pyx_string_tab[175]
  3271. #define __pyx_n_u_intersection_ts __pyx_string_tab[176]
  3272. #define __pyx_n_u_intersections __pyx_string_tab[177]
  3273. #define __pyx_n_u_intersects __pyx_string_tab[178]
  3274. #define __pyx_n_u_isHorizontal __pyx_string_tab[179]
  3275. #define __pyx_n_u_is_coroutine __pyx_string_tab[180]
  3276. #define __pyx_n_u_is_linelike __pyx_string_tab[181]
  3277. #define __pyx_n_u_is_linelike_locals_genexpr __pyx_string_tab[182]
  3278. #define __pyx_n_u_isclose __pyx_string_tab[183]
  3279. #define __pyx_n_u_it __pyx_string_tab[184]
  3280. #define __pyx_n_u_items __pyx_string_tab[185]
  3281. #define __pyx_n_u_key __pyx_string_tab[186]
  3282. #define __pyx_n_u_lambda __pyx_string_tab[187]
  3283. #define __pyx_n_u_line __pyx_string_tab[188]
  3284. #define __pyx_n_u_line1 __pyx_string_tab[189]
  3285. #define __pyx_n_u_line2 __pyx_string_tab[190]
  3286. #define __pyx_n_u_lineLineIntersections __pyx_string_tab[191]
  3287. #define __pyx_n_u_linePointAtT __pyx_string_tab[192]
  3288. #define __pyx_n_u_line_t __pyx_string_tab[193]
  3289. #define __pyx_n_u_line_t_of_pt __pyx_string_tab[194]
  3290. #define __pyx_n_u_main __pyx_string_tab[195]
  3291. #define __pyx_n_u_math __pyx_string_tab[196]
  3292. #define __pyx_n_u_maybeline __pyx_string_tab[197]
  3293. #define __pyx_n_u_mid __pyx_string_tab[198]
  3294. #define __pyx_n_u_midPt __pyx_string_tab[199]
  3295. #define __pyx_n_u_midpoint __pyx_string_tab[200]
  3296. #define __pyx_n_u_module __pyx_string_tab[201]
  3297. #define __pyx_n_u_mult __pyx_string_tab[202]
  3298. #define __pyx_n_u_n __pyx_string_tab[203]
  3299. #define __pyx_n_u_name __pyx_string_tab[204]
  3300. #define __pyx_n_u_namedtuple __pyx_string_tab[205]
  3301. #define __pyx_n_u_next __pyx_string_tab[206]
  3302. #define __pyx_n_u_obj __pyx_string_tab[207]
  3303. #define __pyx_n_u_off1 __pyx_string_tab[208]
  3304. #define __pyx_n_u_off2 __pyx_string_tab[209]
  3305. #define __pyx_n_u_one __pyx_string_tab[210]
  3306. #define __pyx_n_u_origDist __pyx_string_tab[211]
  3307. #define __pyx_n_u_origin __pyx_string_tab[212]
  3308. #define __pyx_n_u_p __pyx_string_tab[213]
  3309. #define __pyx_n_u_p0 __pyx_string_tab[214]
  3310. #define __pyx_n_u_p1 __pyx_string_tab[215]
  3311. #define __pyx_n_u_p2 __pyx_string_tab[216]
  3312. #define __pyx_n_u_p3 __pyx_string_tab[217]
  3313. #define __pyx_n_u_pi __pyx_string_tab[218]
  3314. #define __pyx_n_u_pointAtT __pyx_string_tab[219]
  3315. #define __pyx_n_u_pointFinder __pyx_string_tab[220]
  3316. #define __pyx_n_u_points __pyx_string_tab[221]
  3317. #define __pyx_n_u_pop __pyx_string_tab[222]
  3318. #define __pyx_n_u_precision __pyx_string_tab[223]
  3319. #define __pyx_n_u_print __pyx_string_tab[224]
  3320. #define __pyx_n_u_printSegments __pyx_string_tab[225]
  3321. #define __pyx_n_u_pt __pyx_string_tab[226]
  3322. #define __pyx_n_u_pt1 __pyx_string_tab[227]
  3323. #define __pyx_n_u_pt1x __pyx_string_tab[228]
  3324. #define __pyx_n_u_pt1y __pyx_string_tab[229]
  3325. #define __pyx_n_u_pt2 __pyx_string_tab[230]
  3326. #define __pyx_n_u_pt2x __pyx_string_tab[231]
  3327. #define __pyx_n_u_pt2y __pyx_string_tab[232]
  3328. #define __pyx_n_u_pt3 __pyx_string_tab[233]
  3329. #define __pyx_n_u_pt4 __pyx_string_tab[234]
  3330. #define __pyx_n_u_px __pyx_string_tab[235]
  3331. #define __pyx_n_u_py __pyx_string_tab[236]
  3332. #define __pyx_n_u_quadraticPointAtT __pyx_string_tab[237]
  3333. #define __pyx_n_u_qualname __pyx_string_tab[238]
  3334. #define __pyx_n_u_r __pyx_string_tab[239]
  3335. #define __pyx_n_u_rDD __pyx_string_tab[240]
  3336. #define __pyx_n_u_rQ2 __pyx_string_tab[241]
  3337. #define __pyx_n_u_range1 __pyx_string_tab[242]
  3338. #define __pyx_n_u_range2 __pyx_string_tab[243]
  3339. #define __pyx_n_u_rectArea __pyx_string_tab[244]
  3340. #define __pyx_n_u_roots __pyx_string_tab[245]
  3341. #define __pyx_n_u_rotate __pyx_string_tab[246]
  3342. #define __pyx_n_u_round __pyx_string_tab[247]
  3343. #define __pyx_n_u_s __pyx_string_tab[248]
  3344. #define __pyx_n_u_s1 __pyx_string_tab[249]
  3345. #define __pyx_n_u_s1x __pyx_string_tab[250]
  3346. #define __pyx_n_u_s1y __pyx_string_tab[251]
  3347. #define __pyx_n_u_s2 __pyx_string_tab[252]
  3348. #define __pyx_n_u_s2x __pyx_string_tab[253]
  3349. #define __pyx_n_u_s2y __pyx_string_tab[254]
  3350. #define __pyx_n_u_scale __pyx_string_tab[255]
  3351. #define __pyx_n_u_sectRect __pyx_string_tab[256]
  3352. #define __pyx_n_u_seen __pyx_string_tab[257]
  3353. #define __pyx_n_u_seg __pyx_string_tab[258]
  3354. #define __pyx_n_u_seg1 __pyx_string_tab[259]
  3355. #define __pyx_n_u_seg2 __pyx_string_tab[260]
  3356. #define __pyx_n_u_segment __pyx_string_tab[261]
  3357. #define __pyx_n_u_segmentPointAtT __pyx_string_tab[262]
  3358. #define __pyx_n_u_segmentSegmentIntersections __pyx_string_tab[263]
  3359. #define __pyx_n_u_segmentrepr __pyx_string_tab[264]
  3360. #define __pyx_n_u_segmentrepr_locals_genexpr __pyx_string_tab[265]
  3361. #define __pyx_n_u_segments __pyx_string_tab[266]
  3362. #define __pyx_n_u_send __pyx_string_tab[267]
  3363. #define __pyx_n_u_set_name __pyx_string_tab[268]
  3364. #define __pyx_n_u_setdefault __pyx_string_tab[269]
  3365. #define __pyx_n_u_slope12 __pyx_string_tab[270]
  3366. #define __pyx_n_u_slope34 __pyx_string_tab[271]
  3367. #define __pyx_n_u_solutions __pyx_string_tab[272]
  3368. #define __pyx_n_u_solveCubic __pyx_string_tab[273]
  3369. #define __pyx_n_u_solveQuadratic __pyx_string_tab[274]
  3370. #define __pyx_n_u_split __pyx_string_tab[275]
  3371. #define __pyx_n_u_splitCubic __pyx_string_tab[276]
  3372. #define __pyx_n_u_splitCubicAtT __pyx_string_tab[277]
  3373. #define __pyx_n_u_splitCubicAtTC __pyx_string_tab[278]
  3374. #define __pyx_n_u_splitCubicAtTC_2 __pyx_string_tab[279]
  3375. #define __pyx_n_u_splitCubicAtT_2 __pyx_string_tab[280]
  3376. #define __pyx_n_u_splitCubicIntoTwoAtTC __pyx_string_tab[281]
  3377. #define __pyx_n_u_splitCubic_locals_genexpr __pyx_string_tab[282]
  3378. #define __pyx_n_u_splitLine __pyx_string_tab[283]
  3379. #define __pyx_n_u_splitQuadratic __pyx_string_tab[284]
  3380. #define __pyx_n_u_splitQuadraticAtT __pyx_string_tab[285]
  3381. #define __pyx_n_u_splitQuadraticAtT_2 __pyx_string_tab[286]
  3382. #define __pyx_n_u_splitQuadratic_locals_genexpr __pyx_string_tab[287]
  3383. #define __pyx_n_u_split_cubic_into_two __pyx_string_tab[288]
  3384. #define __pyx_n_u_split_segment_at_t __pyx_string_tab[289]
  3385. #define __pyx_n_u_sqrt __pyx_string_tab[290]
  3386. #define __pyx_n_u_start __pyx_string_tab[291]
  3387. #define __pyx_n_u_swapped __pyx_string_tab[292]
  3388. #define __pyx_n_u_sx __pyx_string_tab[293]
  3389. #define __pyx_n_u_sy __pyx_string_tab[294]
  3390. #define __pyx_n_u_sys __pyx_string_tab[295]
  3391. #define __pyx_n_u_t __pyx_string_tab[296]
  3392. #define __pyx_n_u_t1 __pyx_string_tab[297]
  3393. #define __pyx_n_u_t1_2 __pyx_string_tab[298]
  3394. #define __pyx_n_u_t1_3 __pyx_string_tab[299]
  3395. #define __pyx_n_u_t2 __pyx_string_tab[300]
  3396. #define __pyx_n_u_test __pyx_string_tab[301]
  3397. #define __pyx_n_u_testmod __pyx_string_tab[302]
  3398. #define __pyx_n_u_theta __pyx_string_tab[303]
  3399. #define __pyx_n_u_throw __pyx_string_tab[304]
  3400. #define __pyx_n_u_tolerance __pyx_string_tab[305]
  3401. #define __pyx_n_u_transformPoints __pyx_string_tab[306]
  3402. #define __pyx_n_u_translate __pyx_string_tab[307]
  3403. #define __pyx_n_u_ts __pyx_string_tab[308]
  3404. #define __pyx_n_u_two __pyx_string_tab[309]
  3405. #define __pyx_n_u_unique_key __pyx_string_tab[310]
  3406. #define __pyx_n_u_unique_values __pyx_string_tab[311]
  3407. #define __pyx_n_u_v0 __pyx_string_tab[312]
  3408. #define __pyx_n_u_v1 __pyx_string_tab[313]
  3409. #define __pyx_n_u_v2 __pyx_string_tab[314]
  3410. #define __pyx_n_u_v3 __pyx_string_tab[315]
  3411. #define __pyx_n_u_v4 __pyx_string_tab[316]
  3412. #define __pyx_n_u_value __pyx_string_tab[317]
  3413. #define __pyx_n_u_values __pyx_string_tab[318]
  3414. #define __pyx_n_u_where __pyx_string_tab[319]
  3415. #define __pyx_n_u_x __pyx_string_tab[320]
  3416. #define __pyx_n_u_x0 __pyx_string_tab[321]
  3417. #define __pyx_n_u_x1 __pyx_string_tab[322]
  3418. #define __pyx_n_u_x2 __pyx_string_tab[323]
  3419. #define __pyx_n_u_x3 __pyx_string_tab[324]
  3420. #define __pyx_n_u_x4 __pyx_string_tab[325]
  3421. #define __pyx_n_u_xDiff __pyx_string_tab[326]
  3422. #define __pyx_n_u_xRoots __pyx_string_tab[327]
  3423. #define __pyx_n_u_y __pyx_string_tab[328]
  3424. #define __pyx_n_u_y1 __pyx_string_tab[329]
  3425. #define __pyx_n_u_y2 __pyx_string_tab[330]
  3426. #define __pyx_n_u_y3 __pyx_string_tab[331]
  3427. #define __pyx_n_u_y4 __pyx_string_tab[332]
  3428. #define __pyx_n_u_yDiff __pyx_string_tab[333]
  3429. #define __pyx_n_u_yRoots __pyx_string_tab[334]
  3430. #define __pyx_kp_b_iso88591_0_2Q_2Rq_U_A_r_2Rq_r_b_Bb_7_Bb __pyx_string_tab[335]
  3431. #define __pyx_kp_b_iso88591_1 __pyx_string_tab[336]
  3432. #define __pyx_kp_b_iso88591_1A_at6_1_q_F_4vRq_1L_AU_Qe3auD __pyx_string_tab[337]
  3433. #define __pyx_kp_b_iso88591_1_Ql_1 __pyx_string_tab[338]
  3434. #define __pyx_kp_b_iso88591_1_a_r_wb_gRvWBfA __pyx_string_tab[339]
  3435. #define __pyx_kp_b_iso88591_2B_1_1 __pyx_string_tab[340]
  3436. #define __pyx_kp_b_iso88591_2Q_2Rq_U_A_7_E_4r_3gRr_4r_b_2U __pyx_string_tab[341]
  3437. #define __pyx_kp_b_iso88591_2Q_2Rq_U_A_r_b_1A_Cwb_Cq_2U_Cr __pyx_string_tab[342]
  3438. #define __pyx_kp_b_iso88591_2S_2Rs_Cq_2Rs_Bc_2Rs_3b_Bb_1A_2 __pyx_string_tab[343]
  3439. #define __pyx_kp_b_iso88591_2_Q_r_wb_gRvWBa __pyx_string_tab[344]
  3440. #define __pyx_kp_b_iso88591_3as_A_Qc_4r_AS_b_1Cr_uBe2XS_RuB __pyx_string_tab[345]
  3441. #define __pyx_kp_b_iso88591_3b_S_b_Ba_c_3b_2T_1_c_4r_d_HA_d __pyx_string_tab[346]
  3442. #define __pyx_kp_b_iso88591_4r_Rq_avU_uA __pyx_string_tab[347]
  3443. #define __pyx_kp_b_iso88591_6_rQR __pyx_string_tab[348]
  3444. #define __pyx_kp_b_iso88591_6_s_T_AU_uA_1O1A_2Q_aq_t1_r_e5 __pyx_string_tab[349]
  3445. #define __pyx_kp_b_iso88591_7_F_6 __pyx_string_tab[350]
  3446. #define __pyx_kp_b_iso88591_AS_Cr_3b_1Cr_c_S_Cr_AS __pyx_string_tab[351]
  3447. #define __pyx_kp_b_iso88591_AT_5_A_2Q_Ba_Ba_Ba_AT_4r_RuBa_A __pyx_string_tab[352]
  3448. #define __pyx_kp_b_iso88591_A_t3aq_2Qaq __pyx_string_tab[353]
  3449. #define __pyx_kp_b_iso88591_B_A_2T_5Rt2_PPRRS_AT_5_A_Bd_6b __pyx_string_tab[354]
  3450. #define __pyx_kp_b_iso88591_F_s_Qe5_a_1N_A_aq_t1_r_e1_Qc_D __pyx_string_tab[355]
  3451. #define __pyx_kp_b_iso88591_G1A_1_D_as_3b_Qd_Qc_5_87_1F_AQe __pyx_string_tab[356]
  3452. #define __pyx_kp_b_iso88591_H_b_b_S_r_A_r_a_s_c_1_r_D_2Rr_S __pyx_string_tab[357]
  3453. #define __pyx_kp_b_iso88591_L_s_3b_Qc_A_Qa_2Q_2Q_2Q_Bc_4r_R __pyx_string_tab[358]
  3454. #define __pyx_kp_b_iso88591_M_m1A_m1A_t1_q_t1_q_HAYa_t1_q_x __pyx_string_tab[359]
  3455. #define __pyx_kp_b_iso88591_Q_Q_Q_Q_Rt2Q_Rt2Q_Rt2T_1_Rt2T_1 __pyx_string_tab[360]
  3456. #define __pyx_kp_b_iso88591_Q_Q_Q_Q_RuBa_RuBa_Rt2T_1_Rt2T_1 __pyx_string_tab[361]
  3457. #define __pyx_kp_b_iso88591_Q_Q_Q_Rt2Q_Rt2Q_Bc_1_Bc_1_1D_d __pyx_string_tab[362]
  3458. #define __pyx_kp_b_iso88591_Q_Q_Q_RuBa_RuBa_Bc_1_Bc_1_1D_d __pyx_string_tab[363]
  3459. #define __pyx_kp_b_iso88591_Q_Q_Q_s_3b_Bhd_Qc_4r_s_3b_Bc_Rq __pyx_string_tab[364]
  3460. #define __pyx_kp_b_iso88591_Qa_gQc_gQa_q_Q_Q_Q_Q_U_3at2Q_Rq __pyx_string_tab[365]
  3461. #define __pyx_kp_b_iso88591_Qa_q_gQc_gQa_Q_Q_Q_U_3at2Q_Rq_R __pyx_string_tab[366]
  3462. #define __pyx_kp_b_iso88591_Qas_F_4s_1Cr_q_Qas_F_4s_1Cr_q_5 __pyx_string_tab[367]
  3463. #define __pyx_kp_b_iso88591_Qe3C1A_s_7_Q_3d_1_aq_Qat1AQ_AWC __pyx_string_tab[368]
  3464. #define __pyx_kp_b_iso88591_Rq_Rq_2Q_A_Cq_vS_s_4r_t1Cq_s_Rq __pyx_string_tab[369]
  3465. #define __pyx_kp_b_iso88591_S_1Cr_S_1Cr __pyx_string_tab[370]
  3466. #define __pyx_kp_b_iso88591_T_t6_V4v_e5PQ_Rq_Rq_Rq_Rq_Qb_E __pyx_string_tab[371]
  3467. #define __pyx_kp_b_iso88591_T_t6_V_5_Q_Rq_Rq_A_t3a_WAQc_1_t __pyx_string_tab[372]
  3468. #define __pyx_kp_b_iso88591_T_uBa_wb_E_a __pyx_string_tab[373]
  3469. #define __pyx_kp_b_iso88591__4 __pyx_string_tab[374]
  3470. #define __pyx_kp_b_iso88591__5 __pyx_string_tab[375]
  3471. #define __pyx_kp_b_iso88591_a_2 __pyx_string_tab[376]
  3472. #define __pyx_kp_b_iso88591_a_s_6_3aq_gV1_s_6_1_3avRq_31F_2 __pyx_string_tab[377]
  3473. #define __pyx_kp_b_iso88591_q __pyx_string_tab[378]
  3474. #define __pyx_kp_b_iso88591_q_q_q_q_HAU_t4xq_U_d_hauTU_q_HA __pyx_string_tab[379]
  3475. #define __pyx_kp_b_iso88591_s_3b_3as_A_A_AQb_Rr_2T_2Rq_3c_a __pyx_string_tab[380]
  3476. #define __pyx_kp_b_iso88591_s_3c_4q_q_3a_r_L_s_3c_Q_AS_1_Bc __pyx_string_tab[381]
  3477. #define __pyx_kp_b_iso88591_s_3c_A_AS_1_b_AQ __pyx_string_tab[382]
  3478. #define __pyx_kp_b_iso88591_s_5_1_2U_AU_Q_q_AU_Q_Be1_AQ __pyx_string_tab[383]
  3479. #define __pyx_kp_b_iso88591_s_7_Q_a_AWCq_a_j_A_b_a_6_WA_T_C __pyx_string_tab[384]
  3480. #define __pyx_kp_b_iso88591_s_Qe5_Qc_D __pyx_string_tab[385]
  3481. #define __pyx_kp_b_iso88591_s_T_AU_uA_N_3c_D_e1Baq_6_r_3d_1 __pyx_string_tab[386]
  3482. #define __pyx_float_0_0 __pyx_number_tab[0]
  3483. #define __pyx_float_0_5 __pyx_number_tab[1]
  3484. #define __pyx_float_1_0 __pyx_number_tab[2]
  3485. #define __pyx_float_neg_2_0 __pyx_number_tab[3]
  3486. #define __pyx_float_2_0 __pyx_number_tab[4]
  3487. #define __pyx_float_3_0 __pyx_number_tab[5]
  3488. #define __pyx_float_4_0 __pyx_number_tab[6]
  3489. #define __pyx_float_9_0 __pyx_number_tab[7]
  3490. #define __pyx_float_1eneg_3 __pyx_number_tab[8]
  3491. #define __pyx_float_1eneg_9 __pyx_number_tab[9]
  3492. #define __pyx_float_27_0 __pyx_number_tab[10]
  3493. #define __pyx_float_54_0 __pyx_number_tab[11]
  3494. #define __pyx_float_0_005 __pyx_number_tab[12]
  3495. #define __pyx_float_0_125 __pyx_number_tab[13]
  3496. #define __pyx_float_1eneg_10 __pyx_number_tab[14]
  3497. #define __pyx_int_0 __pyx_number_tab[15]
  3498. #define __pyx_int_neg_1 __pyx_number_tab[16]
  3499. #define __pyx_int_1 __pyx_number_tab[17]
  3500. #define __pyx_int_2 __pyx_number_tab[18]
  3501. #define __pyx_int_3 __pyx_number_tab[19]
  3502. #define __pyx_int_6 __pyx_number_tab[20]
  3503. /* #### Code section: module_state_clear ### */
  3504. #if CYTHON_USE_MODULE_STATE
  3505. static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  3506. __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  3507. if (!clear_module_state) return 0;
  3508. Py_CLEAR(clear_module_state->__pyx_d);
  3509. Py_CLEAR(clear_module_state->__pyx_b);
  3510. Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  3511. Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  3512. Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  3513. Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  3514. #if CYTHON_PEP489_MULTI_PHASE_INIT
  3515. __Pyx_State_RemoveModule(NULL);
  3516. #endif
  3517. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults);
  3518. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults);
  3519. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr);
  3520. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr);
  3521. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr);
  3522. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr);
  3523. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC);
  3524. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC);
  3525. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC);
  3526. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC);
  3527. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr);
  3528. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr);
  3529. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t);
  3530. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t);
  3531. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr);
  3532. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr);
  3533. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr);
  3534. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr);
  3535. for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); }
  3536. for (int i=0; i<4; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  3537. for (int i=0; i<54; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  3538. for (int i=0; i<387; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  3539. for (int i=0; i<21; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
  3540. /* #### Code section: module_state_clear_contents ### */
  3541. /* CommonTypesMetaclass.module_state_clear */
  3542. Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);
  3543. /* Generator.module_state_clear */
  3544. Py_CLEAR(clear_module_state->__pyx_GeneratorType);
  3545. /* CythonFunctionShared.module_state_clear */
  3546. Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
  3547. /* #### Code section: module_state_clear_end ### */
  3548. return 0;
  3549. }
  3550. #endif
  3551. /* #### Code section: module_state_traverse ### */
  3552. #if CYTHON_USE_MODULE_STATE
  3553. static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  3554. __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  3555. if (!traverse_module_state) return 0;
  3556. Py_VISIT(traverse_module_state->__pyx_d);
  3557. Py_VISIT(traverse_module_state->__pyx_b);
  3558. Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  3559. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  3560. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  3561. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  3562. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults);
  3563. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults);
  3564. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr);
  3565. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr);
  3566. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr);
  3567. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr);
  3568. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC);
  3569. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC);
  3570. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC);
  3571. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC);
  3572. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr);
  3573. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr);
  3574. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t);
  3575. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t);
  3576. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr);
  3577. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr);
  3578. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr);
  3579. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr);
  3580. for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); }
  3581. for (int i=0; i<4; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  3582. for (int i=0; i<54; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  3583. for (int i=0; i<387; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  3584. for (int i=0; i<21; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
  3585. /* #### Code section: module_state_traverse_contents ### */
  3586. /* CommonTypesMetaclass.module_state_traverse */
  3587. Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);
  3588. /* Generator.module_state_traverse */
  3589. Py_VISIT(traverse_module_state->__pyx_GeneratorType);
  3590. /* CythonFunctionShared.module_state_traverse */
  3591. Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
  3592. /* #### Code section: module_state_traverse_end ### */
  3593. return 0;
  3594. }
  3595. #endif
  3596. /* #### Code section: module_code ### */
  3597. /* "fontTools/misc/bezierTools.py":56
  3598. *
  3599. *
  3600. * def calcCubicArcLength(pt1, pt2, pt3, pt4, tolerance=0.005): # <<<<<<<<<<<<<<
  3601. * """Calculates the arc length for a cubic Bezier segment.
  3602. *
  3603. */
  3604. /* Python wrapper */
  3605. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_1calcCubicArcLength(PyObject *__pyx_self,
  3606. #if CYTHON_METH_FASTCALL
  3607. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3608. #else
  3609. PyObject *__pyx_args, PyObject *__pyx_kwds
  3610. #endif
  3611. ); /*proto*/
  3612. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_calcCubicArcLength, "calcCubicArcLength(pt1, pt2, pt3, pt4, tolerance=0.005)\n\nCalculates the arc length for a cubic Bezier segment.\n\nWhereas :func:`approximateCubicArcLength` approximates the length, this\nfunction calculates it by \"measuring\", recursively dividing the curve\nuntil the divided segments are shorter than ``tolerance``.\n\nArgs:\n pt1,pt2,pt3,pt4: Control points of the Bezier as 2D tuples.\n tolerance: Controls the precision of the calcuation.\n\nReturns:\n Arc length value.");
  3613. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_1calcCubicArcLength = {"calcCubicArcLength", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_1calcCubicArcLength, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_calcCubicArcLength};
  3614. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_1calcCubicArcLength(PyObject *__pyx_self,
  3615. #if CYTHON_METH_FASTCALL
  3616. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3617. #else
  3618. PyObject *__pyx_args, PyObject *__pyx_kwds
  3619. #endif
  3620. ) {
  3621. PyObject *__pyx_v_pt1 = 0;
  3622. PyObject *__pyx_v_pt2 = 0;
  3623. PyObject *__pyx_v_pt3 = 0;
  3624. PyObject *__pyx_v_pt4 = 0;
  3625. PyObject *__pyx_v_tolerance = 0;
  3626. #if !CYTHON_METH_FASTCALL
  3627. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  3628. #endif
  3629. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  3630. PyObject* values[5] = {0,0,0,0,0};
  3631. int __pyx_lineno = 0;
  3632. const char *__pyx_filename = NULL;
  3633. int __pyx_clineno = 0;
  3634. PyObject *__pyx_r = 0;
  3635. __Pyx_RefNannyDeclarations
  3636. __Pyx_RefNannySetupContext("calcCubicArcLength (wrapper)", 0);
  3637. #if !CYTHON_METH_FASTCALL
  3638. #if CYTHON_ASSUME_SAFE_SIZE
  3639. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  3640. #else
  3641. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  3642. #endif
  3643. #endif
  3644. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  3645. {
  3646. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,&__pyx_mstate_global->__pyx_n_u_tolerance,0};
  3647. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  3648. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 56, __pyx_L3_error)
  3649. if (__pyx_kwds_len > 0) {
  3650. switch (__pyx_nargs) {
  3651. case 5:
  3652. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  3653. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 56, __pyx_L3_error)
  3654. CYTHON_FALLTHROUGH;
  3655. case 4:
  3656. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  3657. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 56, __pyx_L3_error)
  3658. CYTHON_FALLTHROUGH;
  3659. case 3:
  3660. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  3661. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 56, __pyx_L3_error)
  3662. CYTHON_FALLTHROUGH;
  3663. case 2:
  3664. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3665. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 56, __pyx_L3_error)
  3666. CYTHON_FALLTHROUGH;
  3667. case 1:
  3668. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3669. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 56, __pyx_L3_error)
  3670. CYTHON_FALLTHROUGH;
  3671. case 0: break;
  3672. default: goto __pyx_L5_argtuple_error;
  3673. }
  3674. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  3675. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "calcCubicArcLength", 0) < (0)) __PYX_ERR(0, 56, __pyx_L3_error)
  3676. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_005)));
  3677. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  3678. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcCubicArcLength", 0, 4, 5, i); __PYX_ERR(0, 56, __pyx_L3_error) }
  3679. }
  3680. } else {
  3681. switch (__pyx_nargs) {
  3682. case 5:
  3683. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  3684. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 56, __pyx_L3_error)
  3685. CYTHON_FALLTHROUGH;
  3686. case 4:
  3687. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  3688. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 56, __pyx_L3_error)
  3689. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  3690. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 56, __pyx_L3_error)
  3691. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3692. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 56, __pyx_L3_error)
  3693. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3694. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 56, __pyx_L3_error)
  3695. break;
  3696. default: goto __pyx_L5_argtuple_error;
  3697. }
  3698. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_005)));
  3699. }
  3700. __pyx_v_pt1 = values[0];
  3701. __pyx_v_pt2 = values[1];
  3702. __pyx_v_pt3 = values[2];
  3703. __pyx_v_pt4 = values[3];
  3704. __pyx_v_tolerance = values[4];
  3705. }
  3706. goto __pyx_L6_skip;
  3707. __pyx_L5_argtuple_error:;
  3708. __Pyx_RaiseArgtupleInvalid("calcCubicArcLength", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 56, __pyx_L3_error)
  3709. __pyx_L6_skip:;
  3710. goto __pyx_L4_argument_unpacking_done;
  3711. __pyx_L3_error:;
  3712. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3713. Py_XDECREF(values[__pyx_temp]);
  3714. }
  3715. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3716. __Pyx_RefNannyFinishContext();
  3717. return NULL;
  3718. __pyx_L4_argument_unpacking_done:;
  3719. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_calcCubicArcLength(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4, __pyx_v_tolerance);
  3720. /* function exit code */
  3721. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3722. Py_XDECREF(values[__pyx_temp]);
  3723. }
  3724. __Pyx_RefNannyFinishContext();
  3725. return __pyx_r;
  3726. }
  3727. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_calcCubicArcLength(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4, PyObject *__pyx_v_tolerance) {
  3728. PyObject *__pyx_r = NULL;
  3729. __Pyx_RefNannyDeclarations
  3730. PyObject *__pyx_t_1 = NULL;
  3731. PyObject *__pyx_t_2 = NULL;
  3732. PyObject *__pyx_t_3 = NULL;
  3733. PyObject *__pyx_t_4 = NULL;
  3734. PyObject *__pyx_t_5 = NULL;
  3735. PyObject *__pyx_t_6 = NULL;
  3736. PyObject *__pyx_t_7 = NULL;
  3737. PyObject *__pyx_t_8 = NULL;
  3738. size_t __pyx_t_9;
  3739. int __pyx_lineno = 0;
  3740. const char *__pyx_filename = NULL;
  3741. int __pyx_clineno = 0;
  3742. __Pyx_RefNannySetupContext("calcCubicArcLength", 0);
  3743. /* "fontTools/misc/bezierTools.py":70
  3744. * Arc length value.
  3745. * """
  3746. * return calcCubicArcLengthC( # <<<<<<<<<<<<<<
  3747. * complex(*pt1), complex(*pt2), complex(*pt3), complex(*pt4), tolerance
  3748. * )
  3749. */
  3750. __Pyx_XDECREF(__pyx_r);
  3751. __pyx_t_2 = NULL;
  3752. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
  3753. __Pyx_GOTREF(__pyx_t_3);
  3754. /* "fontTools/misc/bezierTools.py":71
  3755. * """
  3756. * return calcCubicArcLengthC(
  3757. * complex(*pt1), complex(*pt2), complex(*pt3), complex(*pt4), tolerance # <<<<<<<<<<<<<<
  3758. * )
  3759. *
  3760. */
  3761. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
  3762. __Pyx_GOTREF(__pyx_t_4);
  3763. __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L1_error)
  3764. __Pyx_GOTREF(__pyx_t_5);
  3765. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3766. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
  3767. __Pyx_GOTREF(__pyx_t_4);
  3768. __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 71, __pyx_L1_error)
  3769. __Pyx_GOTREF(__pyx_t_6);
  3770. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3771. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
  3772. __Pyx_GOTREF(__pyx_t_4);
  3773. __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 71, __pyx_L1_error)
  3774. __Pyx_GOTREF(__pyx_t_7);
  3775. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3776. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
  3777. __Pyx_GOTREF(__pyx_t_4);
  3778. __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 71, __pyx_L1_error)
  3779. __Pyx_GOTREF(__pyx_t_8);
  3780. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3781. __pyx_t_9 = 1;
  3782. #if CYTHON_UNPACK_METHODS
  3783. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  3784. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  3785. assert(__pyx_t_2);
  3786. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  3787. __Pyx_INCREF(__pyx_t_2);
  3788. __Pyx_INCREF(__pyx__function);
  3789. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  3790. __pyx_t_9 = 0;
  3791. }
  3792. #endif
  3793. {
  3794. PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_v_tolerance};
  3795. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_9, (6-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  3796. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  3797. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3798. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3799. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3800. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3801. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3802. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
  3803. __Pyx_GOTREF(__pyx_t_1);
  3804. }
  3805. __pyx_r = __pyx_t_1;
  3806. __pyx_t_1 = 0;
  3807. goto __pyx_L0;
  3808. /* "fontTools/misc/bezierTools.py":56
  3809. *
  3810. *
  3811. * def calcCubicArcLength(pt1, pt2, pt3, pt4, tolerance=0.005): # <<<<<<<<<<<<<<
  3812. * """Calculates the arc length for a cubic Bezier segment.
  3813. *
  3814. */
  3815. /* function exit code */
  3816. __pyx_L1_error:;
  3817. __Pyx_XDECREF(__pyx_t_1);
  3818. __Pyx_XDECREF(__pyx_t_2);
  3819. __Pyx_XDECREF(__pyx_t_3);
  3820. __Pyx_XDECREF(__pyx_t_4);
  3821. __Pyx_XDECREF(__pyx_t_5);
  3822. __Pyx_XDECREF(__pyx_t_6);
  3823. __Pyx_XDECREF(__pyx_t_7);
  3824. __Pyx_XDECREF(__pyx_t_8);
  3825. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3826. __pyx_r = NULL;
  3827. __pyx_L0:;
  3828. __Pyx_XGIVEREF(__pyx_r);
  3829. __Pyx_RefNannyFinishContext();
  3830. return __pyx_r;
  3831. }
  3832. /* "fontTools/misc/bezierTools.py":75
  3833. *
  3834. *
  3835. * def _split_cubic_into_two(p0, p1, p2, p3): # <<<<<<<<<<<<<<
  3836. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  3837. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  3838. */
  3839. /* Python wrapper */
  3840. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_3_split_cubic_into_two(PyObject *__pyx_self,
  3841. #if CYTHON_METH_FASTCALL
  3842. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3843. #else
  3844. PyObject *__pyx_args, PyObject *__pyx_kwds
  3845. #endif
  3846. ); /*proto*/
  3847. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_2_split_cubic_into_two, "_split_cubic_into_two(p0, p1, p2, p3)");
  3848. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_3_split_cubic_into_two = {"_split_cubic_into_two", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_3_split_cubic_into_two, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_2_split_cubic_into_two};
  3849. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_3_split_cubic_into_two(PyObject *__pyx_self,
  3850. #if CYTHON_METH_FASTCALL
  3851. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3852. #else
  3853. PyObject *__pyx_args, PyObject *__pyx_kwds
  3854. #endif
  3855. ) {
  3856. PyObject *__pyx_v_p0 = 0;
  3857. PyObject *__pyx_v_p1 = 0;
  3858. PyObject *__pyx_v_p2 = 0;
  3859. PyObject *__pyx_v_p3 = 0;
  3860. #if !CYTHON_METH_FASTCALL
  3861. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  3862. #endif
  3863. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  3864. PyObject* values[4] = {0,0,0,0};
  3865. int __pyx_lineno = 0;
  3866. const char *__pyx_filename = NULL;
  3867. int __pyx_clineno = 0;
  3868. PyObject *__pyx_r = 0;
  3869. __Pyx_RefNannyDeclarations
  3870. __Pyx_RefNannySetupContext("_split_cubic_into_two (wrapper)", 0);
  3871. #if !CYTHON_METH_FASTCALL
  3872. #if CYTHON_ASSUME_SAFE_SIZE
  3873. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  3874. #else
  3875. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  3876. #endif
  3877. #endif
  3878. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  3879. {
  3880. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_p0,&__pyx_mstate_global->__pyx_n_u_p1,&__pyx_mstate_global->__pyx_n_u_p2,&__pyx_mstate_global->__pyx_n_u_p3,0};
  3881. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  3882. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 75, __pyx_L3_error)
  3883. if (__pyx_kwds_len > 0) {
  3884. switch (__pyx_nargs) {
  3885. case 4:
  3886. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  3887. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 75, __pyx_L3_error)
  3888. CYTHON_FALLTHROUGH;
  3889. case 3:
  3890. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  3891. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 75, __pyx_L3_error)
  3892. CYTHON_FALLTHROUGH;
  3893. case 2:
  3894. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3895. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 75, __pyx_L3_error)
  3896. CYTHON_FALLTHROUGH;
  3897. case 1:
  3898. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3899. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 75, __pyx_L3_error)
  3900. CYTHON_FALLTHROUGH;
  3901. case 0: break;
  3902. default: goto __pyx_L5_argtuple_error;
  3903. }
  3904. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  3905. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_split_cubic_into_two", 0) < (0)) __PYX_ERR(0, 75, __pyx_L3_error)
  3906. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  3907. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_split_cubic_into_two", 1, 4, 4, i); __PYX_ERR(0, 75, __pyx_L3_error) }
  3908. }
  3909. } else if (unlikely(__pyx_nargs != 4)) {
  3910. goto __pyx_L5_argtuple_error;
  3911. } else {
  3912. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3913. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 75, __pyx_L3_error)
  3914. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3915. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 75, __pyx_L3_error)
  3916. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  3917. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 75, __pyx_L3_error)
  3918. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  3919. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 75, __pyx_L3_error)
  3920. }
  3921. __pyx_v_p0 = values[0];
  3922. __pyx_v_p1 = values[1];
  3923. __pyx_v_p2 = values[2];
  3924. __pyx_v_p3 = values[3];
  3925. }
  3926. goto __pyx_L6_skip;
  3927. __pyx_L5_argtuple_error:;
  3928. __Pyx_RaiseArgtupleInvalid("_split_cubic_into_two", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 75, __pyx_L3_error)
  3929. __pyx_L6_skip:;
  3930. goto __pyx_L4_argument_unpacking_done;
  3931. __pyx_L3_error:;
  3932. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3933. Py_XDECREF(values[__pyx_temp]);
  3934. }
  3935. __Pyx_AddTraceback("fontTools.misc.bezierTools._split_cubic_into_two", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3936. __Pyx_RefNannyFinishContext();
  3937. return NULL;
  3938. __pyx_L4_argument_unpacking_done:;
  3939. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_2_split_cubic_into_two(__pyx_self, __pyx_v_p0, __pyx_v_p1, __pyx_v_p2, __pyx_v_p3);
  3940. /* function exit code */
  3941. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3942. Py_XDECREF(values[__pyx_temp]);
  3943. }
  3944. __Pyx_RefNannyFinishContext();
  3945. return __pyx_r;
  3946. }
  3947. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_2_split_cubic_into_two(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p0, PyObject *__pyx_v_p1, PyObject *__pyx_v_p2, PyObject *__pyx_v_p3) {
  3948. PyObject *__pyx_v_mid = NULL;
  3949. PyObject *__pyx_v_deriv3 = NULL;
  3950. PyObject *__pyx_r = NULL;
  3951. __Pyx_RefNannyDeclarations
  3952. PyObject *__pyx_t_1 = NULL;
  3953. PyObject *__pyx_t_2 = NULL;
  3954. PyObject *__pyx_t_3 = NULL;
  3955. PyObject *__pyx_t_4 = NULL;
  3956. int __pyx_lineno = 0;
  3957. const char *__pyx_filename = NULL;
  3958. int __pyx_clineno = 0;
  3959. __Pyx_RefNannySetupContext("_split_cubic_into_two", 0);
  3960. /* "fontTools/misc/bezierTools.py":76
  3961. *
  3962. * def _split_cubic_into_two(p0, p1, p2, p3):
  3963. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125 # <<<<<<<<<<<<<<
  3964. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  3965. * return (
  3966. */
  3967. __pyx_t_1 = PyNumber_Add(__pyx_v_p1, __pyx_v_p2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
  3968. __Pyx_GOTREF(__pyx_t_1);
  3969. __pyx_t_2 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_3, __pyx_t_1, 3, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
  3970. __Pyx_GOTREF(__pyx_t_2);
  3971. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3972. __pyx_t_1 = PyNumber_Add(__pyx_v_p0, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
  3973. __Pyx_GOTREF(__pyx_t_1);
  3974. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3975. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_p3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
  3976. __Pyx_GOTREF(__pyx_t_2);
  3977. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3978. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_mstate_global->__pyx_float_0_125); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
  3979. __Pyx_GOTREF(__pyx_t_1);
  3980. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3981. __pyx_v_mid = __pyx_t_1;
  3982. __pyx_t_1 = 0;
  3983. /* "fontTools/misc/bezierTools.py":77
  3984. * def _split_cubic_into_two(p0, p1, p2, p3):
  3985. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  3986. * deriv3 = (p3 + p2 - p1 - p0) * 0.125 # <<<<<<<<<<<<<<
  3987. * return (
  3988. * (p0, (p0 + p1) * 0.5, mid - deriv3, mid),
  3989. */
  3990. __pyx_t_1 = PyNumber_Add(__pyx_v_p3, __pyx_v_p2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
  3991. __Pyx_GOTREF(__pyx_t_1);
  3992. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_p1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
  3993. __Pyx_GOTREF(__pyx_t_2);
  3994. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3995. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_p0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
  3996. __Pyx_GOTREF(__pyx_t_1);
  3997. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3998. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_mstate_global->__pyx_float_0_125); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
  3999. __Pyx_GOTREF(__pyx_t_2);
  4000. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4001. __pyx_v_deriv3 = __pyx_t_2;
  4002. __pyx_t_2 = 0;
  4003. /* "fontTools/misc/bezierTools.py":78
  4004. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  4005. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  4006. * return ( # <<<<<<<<<<<<<<
  4007. * (p0, (p0 + p1) * 0.5, mid - deriv3, mid),
  4008. * (mid, mid + deriv3, (p2 + p3) * 0.5, p3),
  4009. */
  4010. __Pyx_XDECREF(__pyx_r);
  4011. /* "fontTools/misc/bezierTools.py":79
  4012. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  4013. * return (
  4014. * (p0, (p0 + p1) * 0.5, mid - deriv3, mid), # <<<<<<<<<<<<<<
  4015. * (mid, mid + deriv3, (p2 + p3) * 0.5, p3),
  4016. * )
  4017. */
  4018. __pyx_t_2 = PyNumber_Add(__pyx_v_p0, __pyx_v_p1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
  4019. __Pyx_GOTREF(__pyx_t_2);
  4020. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
  4021. __Pyx_GOTREF(__pyx_t_1);
  4022. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4023. __pyx_t_2 = PyNumber_Subtract(__pyx_v_mid, __pyx_v_deriv3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
  4024. __Pyx_GOTREF(__pyx_t_2);
  4025. __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
  4026. __Pyx_GOTREF(__pyx_t_3);
  4027. __Pyx_INCREF(__pyx_v_p0);
  4028. __Pyx_GIVEREF(__pyx_v_p0);
  4029. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_p0) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4030. __Pyx_GIVEREF(__pyx_t_1);
  4031. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4032. __Pyx_GIVEREF(__pyx_t_2);
  4033. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4034. __Pyx_INCREF(__pyx_v_mid);
  4035. __Pyx_GIVEREF(__pyx_v_mid);
  4036. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_mid) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4037. __pyx_t_1 = 0;
  4038. __pyx_t_2 = 0;
  4039. /* "fontTools/misc/bezierTools.py":80
  4040. * return (
  4041. * (p0, (p0 + p1) * 0.5, mid - deriv3, mid),
  4042. * (mid, mid + deriv3, (p2 + p3) * 0.5, p3), # <<<<<<<<<<<<<<
  4043. * )
  4044. *
  4045. */
  4046. __pyx_t_2 = PyNumber_Add(__pyx_v_mid, __pyx_v_deriv3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error)
  4047. __Pyx_GOTREF(__pyx_t_2);
  4048. __pyx_t_1 = PyNumber_Add(__pyx_v_p2, __pyx_v_p3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
  4049. __Pyx_GOTREF(__pyx_t_1);
  4050. __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error)
  4051. __Pyx_GOTREF(__pyx_t_4);
  4052. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4053. __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
  4054. __Pyx_GOTREF(__pyx_t_1);
  4055. __Pyx_INCREF(__pyx_v_mid);
  4056. __Pyx_GIVEREF(__pyx_v_mid);
  4057. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mid) != (0)) __PYX_ERR(0, 80, __pyx_L1_error);
  4058. __Pyx_GIVEREF(__pyx_t_2);
  4059. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 80, __pyx_L1_error);
  4060. __Pyx_GIVEREF(__pyx_t_4);
  4061. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(0, 80, __pyx_L1_error);
  4062. __Pyx_INCREF(__pyx_v_p3);
  4063. __Pyx_GIVEREF(__pyx_v_p3);
  4064. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_p3) != (0)) __PYX_ERR(0, 80, __pyx_L1_error);
  4065. __pyx_t_2 = 0;
  4066. __pyx_t_4 = 0;
  4067. /* "fontTools/misc/bezierTools.py":79
  4068. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  4069. * return (
  4070. * (p0, (p0 + p1) * 0.5, mid - deriv3, mid), # <<<<<<<<<<<<<<
  4071. * (mid, mid + deriv3, (p2 + p3) * 0.5, p3),
  4072. * )
  4073. */
  4074. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
  4075. __Pyx_GOTREF(__pyx_t_4);
  4076. __Pyx_GIVEREF(__pyx_t_3);
  4077. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4078. __Pyx_GIVEREF(__pyx_t_1);
  4079. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4080. __pyx_t_3 = 0;
  4081. __pyx_t_1 = 0;
  4082. __pyx_r = __pyx_t_4;
  4083. __pyx_t_4 = 0;
  4084. goto __pyx_L0;
  4085. /* "fontTools/misc/bezierTools.py":75
  4086. *
  4087. *
  4088. * def _split_cubic_into_two(p0, p1, p2, p3): # <<<<<<<<<<<<<<
  4089. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  4090. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  4091. */
  4092. /* function exit code */
  4093. __pyx_L1_error:;
  4094. __Pyx_XDECREF(__pyx_t_1);
  4095. __Pyx_XDECREF(__pyx_t_2);
  4096. __Pyx_XDECREF(__pyx_t_3);
  4097. __Pyx_XDECREF(__pyx_t_4);
  4098. __Pyx_AddTraceback("fontTools.misc.bezierTools._split_cubic_into_two", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4099. __pyx_r = NULL;
  4100. __pyx_L0:;
  4101. __Pyx_XDECREF(__pyx_v_mid);
  4102. __Pyx_XDECREF(__pyx_v_deriv3);
  4103. __Pyx_XGIVEREF(__pyx_r);
  4104. __Pyx_RefNannyFinishContext();
  4105. return __pyx_r;
  4106. }
  4107. /* "fontTools/misc/bezierTools.py":84
  4108. *
  4109. *
  4110. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  4111. * @cython.locals(
  4112. * p0=cython.complex,
  4113. */
  4114. /* Python wrapper */
  4115. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_5_calcCubicArcLengthCRecurse(PyObject *__pyx_self,
  4116. #if CYTHON_METH_FASTCALL
  4117. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4118. #else
  4119. PyObject *__pyx_args, PyObject *__pyx_kwds
  4120. #endif
  4121. ); /*proto*/
  4122. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_4_calcCubicArcLengthCRecurse, "_calcCubicArcLengthCRecurse(double mult, double complex p0, double complex p1, double complex p2, double complex p3)");
  4123. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_5_calcCubicArcLengthCRecurse = {"_calcCubicArcLengthCRecurse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_5_calcCubicArcLengthCRecurse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_4_calcCubicArcLengthCRecurse};
  4124. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_5_calcCubicArcLengthCRecurse(PyObject *__pyx_self,
  4125. #if CYTHON_METH_FASTCALL
  4126. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4127. #else
  4128. PyObject *__pyx_args, PyObject *__pyx_kwds
  4129. #endif
  4130. ) {
  4131. double __pyx_v_mult;
  4132. __pyx_t_double_complex __pyx_v_p0;
  4133. __pyx_t_double_complex __pyx_v_p1;
  4134. __pyx_t_double_complex __pyx_v_p2;
  4135. __pyx_t_double_complex __pyx_v_p3;
  4136. #if !CYTHON_METH_FASTCALL
  4137. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4138. #endif
  4139. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4140. PyObject* values[5] = {0,0,0,0,0};
  4141. int __pyx_lineno = 0;
  4142. const char *__pyx_filename = NULL;
  4143. int __pyx_clineno = 0;
  4144. PyObject *__pyx_r = 0;
  4145. __Pyx_RefNannyDeclarations
  4146. __Pyx_RefNannySetupContext("_calcCubicArcLengthCRecurse (wrapper)", 0);
  4147. #if !CYTHON_METH_FASTCALL
  4148. #if CYTHON_ASSUME_SAFE_SIZE
  4149. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4150. #else
  4151. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4152. #endif
  4153. #endif
  4154. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4155. {
  4156. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_mult,&__pyx_mstate_global->__pyx_n_u_p0,&__pyx_mstate_global->__pyx_n_u_p1,&__pyx_mstate_global->__pyx_n_u_p2,&__pyx_mstate_global->__pyx_n_u_p3,0};
  4157. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  4158. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 84, __pyx_L3_error)
  4159. if (__pyx_kwds_len > 0) {
  4160. switch (__pyx_nargs) {
  4161. case 5:
  4162. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  4163. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 84, __pyx_L3_error)
  4164. CYTHON_FALLTHROUGH;
  4165. case 4:
  4166. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  4167. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 84, __pyx_L3_error)
  4168. CYTHON_FALLTHROUGH;
  4169. case 3:
  4170. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4171. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 84, __pyx_L3_error)
  4172. CYTHON_FALLTHROUGH;
  4173. case 2:
  4174. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4175. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 84, __pyx_L3_error)
  4176. CYTHON_FALLTHROUGH;
  4177. case 1:
  4178. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4179. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 84, __pyx_L3_error)
  4180. CYTHON_FALLTHROUGH;
  4181. case 0: break;
  4182. default: goto __pyx_L5_argtuple_error;
  4183. }
  4184. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4185. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_calcCubicArcLengthCRecurse", 0) < (0)) __PYX_ERR(0, 84, __pyx_L3_error)
  4186. for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
  4187. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_calcCubicArcLengthCRecurse", 1, 5, 5, i); __PYX_ERR(0, 84, __pyx_L3_error) }
  4188. }
  4189. } else if (unlikely(__pyx_nargs != 5)) {
  4190. goto __pyx_L5_argtuple_error;
  4191. } else {
  4192. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4193. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 84, __pyx_L3_error)
  4194. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4195. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 84, __pyx_L3_error)
  4196. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4197. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 84, __pyx_L3_error)
  4198. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  4199. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 84, __pyx_L3_error)
  4200. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  4201. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 84, __pyx_L3_error)
  4202. }
  4203. __pyx_v_mult = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mult == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
  4204. __pyx_v_p0 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
  4205. __pyx_v_p1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
  4206. __pyx_v_p2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
  4207. __pyx_v_p3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[4]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
  4208. }
  4209. goto __pyx_L6_skip;
  4210. __pyx_L5_argtuple_error:;
  4211. __Pyx_RaiseArgtupleInvalid("_calcCubicArcLengthCRecurse", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 84, __pyx_L3_error)
  4212. __pyx_L6_skip:;
  4213. goto __pyx_L4_argument_unpacking_done;
  4214. __pyx_L3_error:;
  4215. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4216. Py_XDECREF(values[__pyx_temp]);
  4217. }
  4218. __Pyx_AddTraceback("fontTools.misc.bezierTools._calcCubicArcLengthCRecurse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4219. __Pyx_RefNannyFinishContext();
  4220. return NULL;
  4221. __pyx_L4_argument_unpacking_done:;
  4222. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_4_calcCubicArcLengthCRecurse(__pyx_self, __pyx_v_mult, __pyx_v_p0, __pyx_v_p1, __pyx_v_p2, __pyx_v_p3);
  4223. /* function exit code */
  4224. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4225. Py_XDECREF(values[__pyx_temp]);
  4226. }
  4227. __Pyx_RefNannyFinishContext();
  4228. return __pyx_r;
  4229. }
  4230. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_4_calcCubicArcLengthCRecurse(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_mult, __pyx_t_double_complex __pyx_v_p0, __pyx_t_double_complex __pyx_v_p1, __pyx_t_double_complex __pyx_v_p2, __pyx_t_double_complex __pyx_v_p3) {
  4231. double __pyx_v_arch;
  4232. double __pyx_v_box;
  4233. PyObject *__pyx_v_one = NULL;
  4234. PyObject *__pyx_v_two = NULL;
  4235. PyObject *__pyx_r = NULL;
  4236. __Pyx_RefNannyDeclarations
  4237. PyObject *__pyx_t_1 = NULL;
  4238. PyObject *__pyx_t_2 = NULL;
  4239. PyObject *__pyx_t_3 = NULL;
  4240. int __pyx_t_4;
  4241. PyObject *__pyx_t_5 = NULL;
  4242. PyObject *__pyx_t_6 = NULL;
  4243. PyObject *__pyx_t_7 = NULL;
  4244. PyObject *__pyx_t_8 = NULL;
  4245. size_t __pyx_t_9;
  4246. PyObject *(*__pyx_t_10)(PyObject *);
  4247. int __pyx_lineno = 0;
  4248. const char *__pyx_filename = NULL;
  4249. int __pyx_clineno = 0;
  4250. __Pyx_RefNannySetupContext("_calcCubicArcLengthCRecurse", 0);
  4251. /* "fontTools/misc/bezierTools.py":93
  4252. * @cython.locals(mult=cython.double, arch=cython.double, box=cython.double)
  4253. * def _calcCubicArcLengthCRecurse(mult, p0, p1, p2, p3):
  4254. * arch = abs(p0 - p3) # <<<<<<<<<<<<<<
  4255. * box = abs(p0 - p1) + abs(p1 - p2) + abs(p2 - p3)
  4256. * if arch * mult + EPSILON >= box:
  4257. */
  4258. __pyx_v_arch = __Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_p0, __pyx_v_p3));
  4259. /* "fontTools/misc/bezierTools.py":94
  4260. * def _calcCubicArcLengthCRecurse(mult, p0, p1, p2, p3):
  4261. * arch = abs(p0 - p3)
  4262. * box = abs(p0 - p1) + abs(p1 - p2) + abs(p2 - p3) # <<<<<<<<<<<<<<
  4263. * if arch * mult + EPSILON >= box:
  4264. * return (arch + box) * 0.5
  4265. */
  4266. __pyx_v_box = ((__Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_p0, __pyx_v_p1)) + __Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_p1, __pyx_v_p2))) + __Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_p2, __pyx_v_p3)));
  4267. /* "fontTools/misc/bezierTools.py":95
  4268. * arch = abs(p0 - p3)
  4269. * box = abs(p0 - p1) + abs(p1 - p2) + abs(p2 - p3)
  4270. * if arch * mult + EPSILON >= box: # <<<<<<<<<<<<<<
  4271. * return (arch + box) * 0.5
  4272. * else:
  4273. */
  4274. __pyx_t_1 = PyFloat_FromDouble((__pyx_v_arch * __pyx_v_mult)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
  4275. __Pyx_GOTREF(__pyx_t_1);
  4276. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EPSILON); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
  4277. __Pyx_GOTREF(__pyx_t_2);
  4278. __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
  4279. __Pyx_GOTREF(__pyx_t_3);
  4280. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4281. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4282. __pyx_t_2 = PyFloat_FromDouble(__pyx_v_box); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
  4283. __Pyx_GOTREF(__pyx_t_2);
  4284. __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
  4285. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4286. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4287. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 95, __pyx_L1_error)
  4288. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4289. if (__pyx_t_4) {
  4290. /* "fontTools/misc/bezierTools.py":96
  4291. * box = abs(p0 - p1) + abs(p1 - p2) + abs(p2 - p3)
  4292. * if arch * mult + EPSILON >= box:
  4293. * return (arch + box) * 0.5 # <<<<<<<<<<<<<<
  4294. * else:
  4295. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4296. */
  4297. __Pyx_XDECREF(__pyx_r);
  4298. __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_arch + __pyx_v_box) * 0.5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
  4299. __Pyx_GOTREF(__pyx_t_1);
  4300. __pyx_r = __pyx_t_1;
  4301. __pyx_t_1 = 0;
  4302. goto __pyx_L0;
  4303. /* "fontTools/misc/bezierTools.py":95
  4304. * arch = abs(p0 - p3)
  4305. * box = abs(p0 - p1) + abs(p1 - p2) + abs(p2 - p3)
  4306. * if arch * mult + EPSILON >= box: # <<<<<<<<<<<<<<
  4307. * return (arch + box) * 0.5
  4308. * else:
  4309. */
  4310. }
  4311. /* "fontTools/misc/bezierTools.py":98
  4312. * return (arch + box) * 0.5
  4313. * else:
  4314. * one, two = _split_cubic_into_two(p0, p1, p2, p3) # <<<<<<<<<<<<<<
  4315. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse(
  4316. * mult, *two
  4317. */
  4318. /*else*/ {
  4319. __pyx_t_2 = NULL;
  4320. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_split_cubic_into_two); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
  4321. __Pyx_GOTREF(__pyx_t_3);
  4322. __pyx_t_5 = __pyx_PyComplex_FromComplex(__pyx_v_p0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error)
  4323. __Pyx_GOTREF(__pyx_t_5);
  4324. __pyx_t_6 = __pyx_PyComplex_FromComplex(__pyx_v_p1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error)
  4325. __Pyx_GOTREF(__pyx_t_6);
  4326. __pyx_t_7 = __pyx_PyComplex_FromComplex(__pyx_v_p2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L1_error)
  4327. __Pyx_GOTREF(__pyx_t_7);
  4328. __pyx_t_8 = __pyx_PyComplex_FromComplex(__pyx_v_p3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L1_error)
  4329. __Pyx_GOTREF(__pyx_t_8);
  4330. __pyx_t_9 = 1;
  4331. #if CYTHON_UNPACK_METHODS
  4332. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  4333. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  4334. assert(__pyx_t_2);
  4335. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  4336. __Pyx_INCREF(__pyx_t_2);
  4337. __Pyx_INCREF(__pyx__function);
  4338. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  4339. __pyx_t_9 = 0;
  4340. }
  4341. #endif
  4342. {
  4343. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8};
  4344. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_9, (5-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  4345. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4346. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4347. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4348. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4349. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4350. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4351. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
  4352. __Pyx_GOTREF(__pyx_t_1);
  4353. }
  4354. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  4355. PyObject* sequence = __pyx_t_1;
  4356. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  4357. if (unlikely(size != 2)) {
  4358. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4359. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4360. __PYX_ERR(0, 98, __pyx_L1_error)
  4361. }
  4362. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4363. if (likely(PyTuple_CheckExact(sequence))) {
  4364. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  4365. __Pyx_INCREF(__pyx_t_3);
  4366. __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
  4367. __Pyx_INCREF(__pyx_t_8);
  4368. } else {
  4369. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  4370. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
  4371. __Pyx_XGOTREF(__pyx_t_3);
  4372. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  4373. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L1_error)
  4374. __Pyx_XGOTREF(__pyx_t_8);
  4375. }
  4376. #else
  4377. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
  4378. __Pyx_GOTREF(__pyx_t_3);
  4379. __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L1_error)
  4380. __Pyx_GOTREF(__pyx_t_8);
  4381. #endif
  4382. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4383. } else {
  4384. Py_ssize_t index = -1;
  4385. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L1_error)
  4386. __Pyx_GOTREF(__pyx_t_7);
  4387. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4388. __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  4389. index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
  4390. __Pyx_GOTREF(__pyx_t_3);
  4391. index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_8)) goto __pyx_L4_unpacking_failed;
  4392. __Pyx_GOTREF(__pyx_t_8);
  4393. if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
  4394. __pyx_t_10 = NULL;
  4395. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4396. goto __pyx_L5_unpacking_done;
  4397. __pyx_L4_unpacking_failed:;
  4398. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4399. __pyx_t_10 = NULL;
  4400. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  4401. __PYX_ERR(0, 98, __pyx_L1_error)
  4402. __pyx_L5_unpacking_done:;
  4403. }
  4404. __pyx_v_one = __pyx_t_3;
  4405. __pyx_t_3 = 0;
  4406. __pyx_v_two = __pyx_t_8;
  4407. __pyx_t_8 = 0;
  4408. /* "fontTools/misc/bezierTools.py":99
  4409. * else:
  4410. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4411. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse( # <<<<<<<<<<<<<<
  4412. * mult, *two
  4413. * )
  4414. */
  4415. __Pyx_XDECREF(__pyx_r);
  4416. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthCRecurse); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
  4417. __Pyx_GOTREF(__pyx_t_1);
  4418. __pyx_t_8 = PyFloat_FromDouble(__pyx_v_mult); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L1_error)
  4419. __Pyx_GOTREF(__pyx_t_8);
  4420. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
  4421. __Pyx_GOTREF(__pyx_t_3);
  4422. __Pyx_GIVEREF(__pyx_t_8);
  4423. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8) != (0)) __PYX_ERR(0, 99, __pyx_L1_error);
  4424. __pyx_t_8 = 0;
  4425. __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_v_one); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L1_error)
  4426. __Pyx_GOTREF(__pyx_t_8);
  4427. __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L1_error)
  4428. __Pyx_GOTREF(__pyx_t_7);
  4429. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4430. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4431. __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L1_error)
  4432. __Pyx_GOTREF(__pyx_t_8);
  4433. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4434. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4435. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthCRecurse); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L1_error)
  4436. __Pyx_GOTREF(__pyx_t_7);
  4437. /* "fontTools/misc/bezierTools.py":100
  4438. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4439. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse(
  4440. * mult, *two # <<<<<<<<<<<<<<
  4441. * )
  4442. *
  4443. */
  4444. __pyx_t_1 = PyFloat_FromDouble(__pyx_v_mult); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
  4445. __Pyx_GOTREF(__pyx_t_1);
  4446. /* "fontTools/misc/bezierTools.py":99
  4447. * else:
  4448. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4449. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse( # <<<<<<<<<<<<<<
  4450. * mult, *two
  4451. * )
  4452. */
  4453. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
  4454. __Pyx_GOTREF(__pyx_t_3);
  4455. __Pyx_GIVEREF(__pyx_t_1);
  4456. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 99, __pyx_L1_error);
  4457. __pyx_t_1 = 0;
  4458. /* "fontTools/misc/bezierTools.py":100
  4459. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4460. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse(
  4461. * mult, *two # <<<<<<<<<<<<<<
  4462. * )
  4463. *
  4464. */
  4465. __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_two); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
  4466. __Pyx_GOTREF(__pyx_t_1);
  4467. /* "fontTools/misc/bezierTools.py":99
  4468. * else:
  4469. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4470. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse( # <<<<<<<<<<<<<<
  4471. * mult, *two
  4472. * )
  4473. */
  4474. __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
  4475. __Pyx_GOTREF(__pyx_t_6);
  4476. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4477. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4478. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
  4479. __Pyx_GOTREF(__pyx_t_1);
  4480. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4481. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4482. __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
  4483. __Pyx_GOTREF(__pyx_t_6);
  4484. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4485. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4486. __pyx_r = __pyx_t_6;
  4487. __pyx_t_6 = 0;
  4488. goto __pyx_L0;
  4489. }
  4490. /* "fontTools/misc/bezierTools.py":84
  4491. *
  4492. *
  4493. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  4494. * @cython.locals(
  4495. * p0=cython.complex,
  4496. */
  4497. /* function exit code */
  4498. __pyx_L1_error:;
  4499. __Pyx_XDECREF(__pyx_t_1);
  4500. __Pyx_XDECREF(__pyx_t_2);
  4501. __Pyx_XDECREF(__pyx_t_3);
  4502. __Pyx_XDECREF(__pyx_t_5);
  4503. __Pyx_XDECREF(__pyx_t_6);
  4504. __Pyx_XDECREF(__pyx_t_7);
  4505. __Pyx_XDECREF(__pyx_t_8);
  4506. __Pyx_AddTraceback("fontTools.misc.bezierTools._calcCubicArcLengthCRecurse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4507. __pyx_r = NULL;
  4508. __pyx_L0:;
  4509. __Pyx_XDECREF(__pyx_v_one);
  4510. __Pyx_XDECREF(__pyx_v_two);
  4511. __Pyx_XGIVEREF(__pyx_r);
  4512. __Pyx_RefNannyFinishContext();
  4513. return __pyx_r;
  4514. }
  4515. /* "fontTools/misc/bezierTools.py":104
  4516. *
  4517. *
  4518. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  4519. * @cython.locals(
  4520. * pt1=cython.complex,
  4521. */
  4522. /* Python wrapper */
  4523. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_7calcCubicArcLengthC(PyObject *__pyx_self,
  4524. #if CYTHON_METH_FASTCALL
  4525. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4526. #else
  4527. PyObject *__pyx_args, PyObject *__pyx_kwds
  4528. #endif
  4529. ); /*proto*/
  4530. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_6calcCubicArcLengthC, "calcCubicArcLengthC(double complex pt1, double complex pt2, double complex pt3, double complex pt4, double tolerance=0.005)\n\nCalculates the arc length for a cubic Bezier segment.\n\nArgs:\n pt1,pt2,pt3,pt4: Control points of the Bezier as complex numbers.\n tolerance: Controls the precision of the calcuation.\n\nReturns:\n Arc length value.");
  4531. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_7calcCubicArcLengthC = {"calcCubicArcLengthC", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_7calcCubicArcLengthC, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_6calcCubicArcLengthC};
  4532. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_7calcCubicArcLengthC(PyObject *__pyx_self,
  4533. #if CYTHON_METH_FASTCALL
  4534. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4535. #else
  4536. PyObject *__pyx_args, PyObject *__pyx_kwds
  4537. #endif
  4538. ) {
  4539. __pyx_t_double_complex __pyx_v_pt1;
  4540. __pyx_t_double_complex __pyx_v_pt2;
  4541. __pyx_t_double_complex __pyx_v_pt3;
  4542. __pyx_t_double_complex __pyx_v_pt4;
  4543. double __pyx_v_tolerance;
  4544. #if !CYTHON_METH_FASTCALL
  4545. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4546. #endif
  4547. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4548. PyObject* values[5] = {0,0,0,0,0};
  4549. int __pyx_lineno = 0;
  4550. const char *__pyx_filename = NULL;
  4551. int __pyx_clineno = 0;
  4552. PyObject *__pyx_r = 0;
  4553. __Pyx_RefNannyDeclarations
  4554. __Pyx_RefNannySetupContext("calcCubicArcLengthC (wrapper)", 0);
  4555. #if !CYTHON_METH_FASTCALL
  4556. #if CYTHON_ASSUME_SAFE_SIZE
  4557. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4558. #else
  4559. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4560. #endif
  4561. #endif
  4562. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4563. {
  4564. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,&__pyx_mstate_global->__pyx_n_u_tolerance,0};
  4565. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  4566. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 104, __pyx_L3_error)
  4567. if (__pyx_kwds_len > 0) {
  4568. switch (__pyx_nargs) {
  4569. case 5:
  4570. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  4571. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 104, __pyx_L3_error)
  4572. CYTHON_FALLTHROUGH;
  4573. case 4:
  4574. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  4575. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 104, __pyx_L3_error)
  4576. CYTHON_FALLTHROUGH;
  4577. case 3:
  4578. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4579. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 104, __pyx_L3_error)
  4580. CYTHON_FALLTHROUGH;
  4581. case 2:
  4582. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4583. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 104, __pyx_L3_error)
  4584. CYTHON_FALLTHROUGH;
  4585. case 1:
  4586. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4587. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 104, __pyx_L3_error)
  4588. CYTHON_FALLTHROUGH;
  4589. case 0: break;
  4590. default: goto __pyx_L5_argtuple_error;
  4591. }
  4592. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4593. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "calcCubicArcLengthC", 0) < (0)) __PYX_ERR(0, 104, __pyx_L3_error)
  4594. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  4595. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcCubicArcLengthC", 0, 4, 5, i); __PYX_ERR(0, 104, __pyx_L3_error) }
  4596. }
  4597. } else {
  4598. switch (__pyx_nargs) {
  4599. case 5:
  4600. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  4601. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 104, __pyx_L3_error)
  4602. CYTHON_FALLTHROUGH;
  4603. case 4:
  4604. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  4605. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 104, __pyx_L3_error)
  4606. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4607. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 104, __pyx_L3_error)
  4608. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4609. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 104, __pyx_L3_error)
  4610. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4611. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 104, __pyx_L3_error)
  4612. break;
  4613. default: goto __pyx_L5_argtuple_error;
  4614. }
  4615. }
  4616. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error)
  4617. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error)
  4618. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error)
  4619. __pyx_v_pt4 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error)
  4620. if (values[4]) {
  4621. __pyx_v_tolerance = __Pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error)
  4622. } else {
  4623. __pyx_v_tolerance = ((double)((double)0.005));
  4624. }
  4625. }
  4626. goto __pyx_L6_skip;
  4627. __pyx_L5_argtuple_error:;
  4628. __Pyx_RaiseArgtupleInvalid("calcCubicArcLengthC", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 104, __pyx_L3_error)
  4629. __pyx_L6_skip:;
  4630. goto __pyx_L4_argument_unpacking_done;
  4631. __pyx_L3_error:;
  4632. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4633. Py_XDECREF(values[__pyx_temp]);
  4634. }
  4635. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4636. __Pyx_RefNannyFinishContext();
  4637. return NULL;
  4638. __pyx_L4_argument_unpacking_done:;
  4639. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_6calcCubicArcLengthC(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4, __pyx_v_tolerance);
  4640. /* function exit code */
  4641. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4642. Py_XDECREF(values[__pyx_temp]);
  4643. }
  4644. __Pyx_RefNannyFinishContext();
  4645. return __pyx_r;
  4646. }
  4647. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_6calcCubicArcLengthC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4, double __pyx_v_tolerance) {
  4648. double __pyx_v_mult;
  4649. PyObject *__pyx_r = NULL;
  4650. __Pyx_RefNannyDeclarations
  4651. PyObject *__pyx_t_1 = NULL;
  4652. PyObject *__pyx_t_2 = NULL;
  4653. PyObject *__pyx_t_3 = NULL;
  4654. PyObject *__pyx_t_4 = NULL;
  4655. PyObject *__pyx_t_5 = NULL;
  4656. PyObject *__pyx_t_6 = NULL;
  4657. PyObject *__pyx_t_7 = NULL;
  4658. PyObject *__pyx_t_8 = NULL;
  4659. size_t __pyx_t_9;
  4660. int __pyx_lineno = 0;
  4661. const char *__pyx_filename = NULL;
  4662. int __pyx_clineno = 0;
  4663. __Pyx_RefNannySetupContext("calcCubicArcLengthC", 0);
  4664. /* "fontTools/misc/bezierTools.py":125
  4665. * Arc length value.
  4666. * """
  4667. * mult = 1.0 + 1.5 * tolerance # The 1.5 is a empirical hack; no math # <<<<<<<<<<<<<<
  4668. * return _calcCubicArcLengthCRecurse(mult, pt1, pt2, pt3, pt4)
  4669. *
  4670. */
  4671. __pyx_v_mult = (1.0 + (1.5 * __pyx_v_tolerance));
  4672. /* "fontTools/misc/bezierTools.py":126
  4673. * """
  4674. * mult = 1.0 + 1.5 * tolerance # The 1.5 is a empirical hack; no math
  4675. * return _calcCubicArcLengthCRecurse(mult, pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  4676. *
  4677. *
  4678. */
  4679. __Pyx_XDECREF(__pyx_r);
  4680. __pyx_t_2 = NULL;
  4681. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthCRecurse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
  4682. __Pyx_GOTREF(__pyx_t_3);
  4683. __pyx_t_4 = PyFloat_FromDouble(__pyx_v_mult); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error)
  4684. __Pyx_GOTREF(__pyx_t_4);
  4685. __pyx_t_5 = __pyx_PyComplex_FromComplex(__pyx_v_pt1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __pyx_L1_error)
  4686. __Pyx_GOTREF(__pyx_t_5);
  4687. __pyx_t_6 = __pyx_PyComplex_FromComplex(__pyx_v_pt2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 126, __pyx_L1_error)
  4688. __Pyx_GOTREF(__pyx_t_6);
  4689. __pyx_t_7 = __pyx_PyComplex_FromComplex(__pyx_v_pt3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 126, __pyx_L1_error)
  4690. __Pyx_GOTREF(__pyx_t_7);
  4691. __pyx_t_8 = __pyx_PyComplex_FromComplex(__pyx_v_pt4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 126, __pyx_L1_error)
  4692. __Pyx_GOTREF(__pyx_t_8);
  4693. __pyx_t_9 = 1;
  4694. #if CYTHON_UNPACK_METHODS
  4695. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  4696. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  4697. assert(__pyx_t_2);
  4698. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  4699. __Pyx_INCREF(__pyx_t_2);
  4700. __Pyx_INCREF(__pyx__function);
  4701. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  4702. __pyx_t_9 = 0;
  4703. }
  4704. #endif
  4705. {
  4706. PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8};
  4707. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_9, (6-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  4708. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4709. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4710. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4711. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4712. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4713. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4714. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4715. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
  4716. __Pyx_GOTREF(__pyx_t_1);
  4717. }
  4718. __pyx_r = __pyx_t_1;
  4719. __pyx_t_1 = 0;
  4720. goto __pyx_L0;
  4721. /* "fontTools/misc/bezierTools.py":104
  4722. *
  4723. *
  4724. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  4725. * @cython.locals(
  4726. * pt1=cython.complex,
  4727. */
  4728. /* function exit code */
  4729. __pyx_L1_error:;
  4730. __Pyx_XDECREF(__pyx_t_1);
  4731. __Pyx_XDECREF(__pyx_t_2);
  4732. __Pyx_XDECREF(__pyx_t_3);
  4733. __Pyx_XDECREF(__pyx_t_4);
  4734. __Pyx_XDECREF(__pyx_t_5);
  4735. __Pyx_XDECREF(__pyx_t_6);
  4736. __Pyx_XDECREF(__pyx_t_7);
  4737. __Pyx_XDECREF(__pyx_t_8);
  4738. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4739. __pyx_r = NULL;
  4740. __pyx_L0:;
  4741. __Pyx_XGIVEREF(__pyx_r);
  4742. __Pyx_RefNannyFinishContext();
  4743. return __pyx_r;
  4744. }
  4745. /* "fontTools/misc/bezierTools.py":133
  4746. *
  4747. *
  4748. * @cython.cfunc # <<<<<<<<<<<<<<
  4749. * @cython.inline
  4750. * @cython.returns(cython.double)
  4751. */
  4752. static CYTHON_INLINE double __pyx_f_9fontTools_4misc_11bezierTools__dot(__pyx_t_double_complex __pyx_v_v1, __pyx_t_double_complex __pyx_v_v2) {
  4753. double __pyx_r;
  4754. /* "fontTools/misc/bezierTools.py":138
  4755. * @cython.locals(v1=cython.complex, v2=cython.complex)
  4756. * def _dot(v1, v2):
  4757. * return (v1 * v2.conjugate()).real # <<<<<<<<<<<<<<
  4758. *
  4759. *
  4760. */
  4761. __pyx_r = __Pyx_CREAL(__Pyx_c_prod_double(__pyx_v_v1, __Pyx_c_conj_double(__pyx_v_v2)));
  4762. goto __pyx_L0;
  4763. /* "fontTools/misc/bezierTools.py":133
  4764. *
  4765. *
  4766. * @cython.cfunc # <<<<<<<<<<<<<<
  4767. * @cython.inline
  4768. * @cython.returns(cython.double)
  4769. */
  4770. /* function exit code */
  4771. __pyx_L0:;
  4772. return __pyx_r;
  4773. }
  4774. /* "fontTools/misc/bezierTools.py":141
  4775. *
  4776. *
  4777. * @cython.cfunc # <<<<<<<<<<<<<<
  4778. * @cython.inline
  4779. * @cython.returns(cython.double)
  4780. */
  4781. static CYTHON_INLINE double __pyx_f_9fontTools_4misc_11bezierTools__intSecAtan(double __pyx_v_x) {
  4782. double __pyx_r;
  4783. __Pyx_RefNannyDeclarations
  4784. PyObject *__pyx_t_1 = NULL;
  4785. PyObject *__pyx_t_2 = NULL;
  4786. PyObject *__pyx_t_3 = NULL;
  4787. PyObject *__pyx_t_4 = NULL;
  4788. PyObject *__pyx_t_5 = NULL;
  4789. size_t __pyx_t_6;
  4790. double __pyx_t_7;
  4791. int __pyx_lineno = 0;
  4792. const char *__pyx_filename = NULL;
  4793. int __pyx_clineno = 0;
  4794. __Pyx_RefNannySetupContext("_intSecAtan", 0);
  4795. /* "fontTools/misc/bezierTools.py":148
  4796. * # In : sympy.integrate(sp.sec(sp.atan(x)))
  4797. * # Out: x*sqrt(x**2 + 1)/2 + asinh(x)/2
  4798. * return x * math.sqrt(x**2 + 1) / 2 + math.asinh(x) / 2 # <<<<<<<<<<<<<<
  4799. *
  4800. *
  4801. */
  4802. __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
  4803. __Pyx_GOTREF(__pyx_t_1);
  4804. __pyx_t_3 = NULL;
  4805. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
  4806. __Pyx_GOTREF(__pyx_t_4);
  4807. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_sqrt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
  4808. __Pyx_GOTREF(__pyx_t_5);
  4809. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4810. __pyx_t_4 = PyFloat_FromDouble((pow(__pyx_v_x, 2.0) + 1.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
  4811. __Pyx_GOTREF(__pyx_t_4);
  4812. __pyx_t_6 = 1;
  4813. #if CYTHON_UNPACK_METHODS
  4814. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  4815. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
  4816. assert(__pyx_t_3);
  4817. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  4818. __Pyx_INCREF(__pyx_t_3);
  4819. __Pyx_INCREF(__pyx__function);
  4820. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  4821. __pyx_t_6 = 0;
  4822. }
  4823. #endif
  4824. {
  4825. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
  4826. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  4827. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4828. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4829. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4830. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
  4831. __Pyx_GOTREF(__pyx_t_2);
  4832. }
  4833. __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
  4834. __Pyx_GOTREF(__pyx_t_5);
  4835. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4836. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4837. __pyx_t_2 = __Pyx_PyLong_TrueDivideObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
  4838. __Pyx_GOTREF(__pyx_t_2);
  4839. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4840. __pyx_t_1 = NULL;
  4841. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
  4842. __Pyx_GOTREF(__pyx_t_4);
  4843. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_asinh); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  4844. __Pyx_GOTREF(__pyx_t_3);
  4845. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4846. __pyx_t_4 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
  4847. __Pyx_GOTREF(__pyx_t_4);
  4848. __pyx_t_6 = 1;
  4849. #if CYTHON_UNPACK_METHODS
  4850. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  4851. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
  4852. assert(__pyx_t_1);
  4853. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  4854. __Pyx_INCREF(__pyx_t_1);
  4855. __Pyx_INCREF(__pyx__function);
  4856. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  4857. __pyx_t_6 = 0;
  4858. }
  4859. #endif
  4860. {
  4861. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4};
  4862. __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  4863. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  4864. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4865. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4866. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
  4867. __Pyx_GOTREF(__pyx_t_5);
  4868. }
  4869. __pyx_t_3 = __Pyx_PyLong_TrueDivideObjC(__pyx_t_5, __pyx_mstate_global->__pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  4870. __Pyx_GOTREF(__pyx_t_3);
  4871. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4872. __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
  4873. __Pyx_GOTREF(__pyx_t_5);
  4874. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4875. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4876. __pyx_t_7 = __Pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error)
  4877. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4878. __pyx_r = __pyx_t_7;
  4879. goto __pyx_L0;
  4880. /* "fontTools/misc/bezierTools.py":141
  4881. *
  4882. *
  4883. * @cython.cfunc # <<<<<<<<<<<<<<
  4884. * @cython.inline
  4885. * @cython.returns(cython.double)
  4886. */
  4887. /* function exit code */
  4888. __pyx_L1_error:;
  4889. __Pyx_XDECREF(__pyx_t_1);
  4890. __Pyx_XDECREF(__pyx_t_2);
  4891. __Pyx_XDECREF(__pyx_t_3);
  4892. __Pyx_XDECREF(__pyx_t_4);
  4893. __Pyx_XDECREF(__pyx_t_5);
  4894. __Pyx_AddTraceback("fontTools.misc.bezierTools._intSecAtan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4895. __pyx_r = -1;
  4896. __pyx_L0:;
  4897. __Pyx_RefNannyFinishContext();
  4898. return __pyx_r;
  4899. }
  4900. /* "fontTools/misc/bezierTools.py":151
  4901. *
  4902. *
  4903. * def calcQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  4904. * """Calculates the arc length for a quadratic Bezier segment.
  4905. *
  4906. */
  4907. /* Python wrapper */
  4908. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_9calcQuadraticArcLength(PyObject *__pyx_self,
  4909. #if CYTHON_METH_FASTCALL
  4910. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4911. #else
  4912. PyObject *__pyx_args, PyObject *__pyx_kwds
  4913. #endif
  4914. ); /*proto*/
  4915. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_8calcQuadraticArcLength, "calcQuadraticArcLength(pt1, pt2, pt3)\n\nCalculates the arc length for a quadratic Bezier segment.\n\nArgs:\n pt1: Start point of the Bezier as 2D tuple.\n pt2: Handle point of the Bezier as 2D tuple.\n pt3: End point of the Bezier as 2D tuple.\n\nReturns:\n Arc length value.\n\nExample::\n\n >>> calcQuadraticArcLength((0, 0), (0, 0), (0, 0)) # empty segment\n 0.0\n >>> calcQuadraticArcLength((0, 0), (50, 0), (80, 0)) # collinear points\n 80.0\n >>> calcQuadraticArcLength((0, 0), (0, 50), (0, 80)) # collinear points vertical\n 80.0\n >>> calcQuadraticArcLength((0, 0), (50, 20), (100, 40)) # collinear points\n 107.70329614269008\n >>> calcQuadraticArcLength((0, 0), (0, 100), (100, 0))\n 154.02976155645263\n >>> calcQuadraticArcLength((0, 0), (0, 50), (100, 0))\n 120.21581243984076\n >>> calcQuadraticArcLength((0, 0), (50, -10), (80, 50))\n 102.53273816445825\n >>> calcQuadraticArcLength((0, 0), (40, 0), (-40, 0)) # collinear points, control point outside\n 66.66666666666667\n >>> calcQuadraticArcLength((0, 0), (40, 0), (0, 0)) # collinear points, looping back\n 40.0");
  4916. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_9calcQuadraticArcLength = {"calcQuadraticArcLength", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_9calcQuadraticArcLength, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_8calcQuadraticArcLength};
  4917. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_9calcQuadraticArcLength(PyObject *__pyx_self,
  4918. #if CYTHON_METH_FASTCALL
  4919. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4920. #else
  4921. PyObject *__pyx_args, PyObject *__pyx_kwds
  4922. #endif
  4923. ) {
  4924. PyObject *__pyx_v_pt1 = 0;
  4925. PyObject *__pyx_v_pt2 = 0;
  4926. PyObject *__pyx_v_pt3 = 0;
  4927. #if !CYTHON_METH_FASTCALL
  4928. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4929. #endif
  4930. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4931. PyObject* values[3] = {0,0,0};
  4932. int __pyx_lineno = 0;
  4933. const char *__pyx_filename = NULL;
  4934. int __pyx_clineno = 0;
  4935. PyObject *__pyx_r = 0;
  4936. __Pyx_RefNannyDeclarations
  4937. __Pyx_RefNannySetupContext("calcQuadraticArcLength (wrapper)", 0);
  4938. #if !CYTHON_METH_FASTCALL
  4939. #if CYTHON_ASSUME_SAFE_SIZE
  4940. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4941. #else
  4942. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4943. #endif
  4944. #endif
  4945. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4946. {
  4947. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,0};
  4948. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  4949. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 151, __pyx_L3_error)
  4950. if (__pyx_kwds_len > 0) {
  4951. switch (__pyx_nargs) {
  4952. case 3:
  4953. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4954. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 151, __pyx_L3_error)
  4955. CYTHON_FALLTHROUGH;
  4956. case 2:
  4957. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4958. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 151, __pyx_L3_error)
  4959. CYTHON_FALLTHROUGH;
  4960. case 1:
  4961. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4962. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 151, __pyx_L3_error)
  4963. CYTHON_FALLTHROUGH;
  4964. case 0: break;
  4965. default: goto __pyx_L5_argtuple_error;
  4966. }
  4967. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4968. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "calcQuadraticArcLength", 0) < (0)) __PYX_ERR(0, 151, __pyx_L3_error)
  4969. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  4970. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcQuadraticArcLength", 1, 3, 3, i); __PYX_ERR(0, 151, __pyx_L3_error) }
  4971. }
  4972. } else if (unlikely(__pyx_nargs != 3)) {
  4973. goto __pyx_L5_argtuple_error;
  4974. } else {
  4975. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4976. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 151, __pyx_L3_error)
  4977. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4978. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 151, __pyx_L3_error)
  4979. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4980. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 151, __pyx_L3_error)
  4981. }
  4982. __pyx_v_pt1 = values[0];
  4983. __pyx_v_pt2 = values[1];
  4984. __pyx_v_pt3 = values[2];
  4985. }
  4986. goto __pyx_L6_skip;
  4987. __pyx_L5_argtuple_error:;
  4988. __Pyx_RaiseArgtupleInvalid("calcQuadraticArcLength", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 151, __pyx_L3_error)
  4989. __pyx_L6_skip:;
  4990. goto __pyx_L4_argument_unpacking_done;
  4991. __pyx_L3_error:;
  4992. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4993. Py_XDECREF(values[__pyx_temp]);
  4994. }
  4995. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4996. __Pyx_RefNannyFinishContext();
  4997. return NULL;
  4998. __pyx_L4_argument_unpacking_done:;
  4999. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_8calcQuadraticArcLength(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  5000. /* function exit code */
  5001. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5002. Py_XDECREF(values[__pyx_temp]);
  5003. }
  5004. __Pyx_RefNannyFinishContext();
  5005. return __pyx_r;
  5006. }
  5007. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_8calcQuadraticArcLength(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3) {
  5008. PyObject *__pyx_r = NULL;
  5009. __Pyx_RefNannyDeclarations
  5010. PyObject *__pyx_t_1 = NULL;
  5011. PyObject *__pyx_t_2 = NULL;
  5012. PyObject *__pyx_t_3 = NULL;
  5013. PyObject *__pyx_t_4 = NULL;
  5014. PyObject *__pyx_t_5 = NULL;
  5015. PyObject *__pyx_t_6 = NULL;
  5016. PyObject *__pyx_t_7 = NULL;
  5017. size_t __pyx_t_8;
  5018. int __pyx_lineno = 0;
  5019. const char *__pyx_filename = NULL;
  5020. int __pyx_clineno = 0;
  5021. __Pyx_RefNannySetupContext("calcQuadraticArcLength", 0);
  5022. /* "fontTools/misc/bezierTools.py":183
  5023. * 40.0
  5024. * """
  5025. * return calcQuadraticArcLengthC(complex(*pt1), complex(*pt2), complex(*pt3)) # <<<<<<<<<<<<<<
  5026. *
  5027. *
  5028. */
  5029. __Pyx_XDECREF(__pyx_r);
  5030. __pyx_t_2 = NULL;
  5031. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcQuadraticArcLengthC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error)
  5032. __Pyx_GOTREF(__pyx_t_3);
  5033. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  5034. __Pyx_GOTREF(__pyx_t_4);
  5035. __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 183, __pyx_L1_error)
  5036. __Pyx_GOTREF(__pyx_t_5);
  5037. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5038. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  5039. __Pyx_GOTREF(__pyx_t_4);
  5040. __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error)
  5041. __Pyx_GOTREF(__pyx_t_6);
  5042. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5043. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  5044. __Pyx_GOTREF(__pyx_t_4);
  5045. __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __pyx_L1_error)
  5046. __Pyx_GOTREF(__pyx_t_7);
  5047. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5048. __pyx_t_8 = 1;
  5049. #if CYTHON_UNPACK_METHODS
  5050. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  5051. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  5052. assert(__pyx_t_2);
  5053. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  5054. __Pyx_INCREF(__pyx_t_2);
  5055. __Pyx_INCREF(__pyx__function);
  5056. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  5057. __pyx_t_8 = 0;
  5058. }
  5059. #endif
  5060. {
  5061. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_7};
  5062. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (4-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  5063. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  5064. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5065. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5066. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5067. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5068. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error)
  5069. __Pyx_GOTREF(__pyx_t_1);
  5070. }
  5071. __pyx_r = __pyx_t_1;
  5072. __pyx_t_1 = 0;
  5073. goto __pyx_L0;
  5074. /* "fontTools/misc/bezierTools.py":151
  5075. *
  5076. *
  5077. * def calcQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  5078. * """Calculates the arc length for a quadratic Bezier segment.
  5079. *
  5080. */
  5081. /* function exit code */
  5082. __pyx_L1_error:;
  5083. __Pyx_XDECREF(__pyx_t_1);
  5084. __Pyx_XDECREF(__pyx_t_2);
  5085. __Pyx_XDECREF(__pyx_t_3);
  5086. __Pyx_XDECREF(__pyx_t_4);
  5087. __Pyx_XDECREF(__pyx_t_5);
  5088. __Pyx_XDECREF(__pyx_t_6);
  5089. __Pyx_XDECREF(__pyx_t_7);
  5090. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5091. __pyx_r = NULL;
  5092. __pyx_L0:;
  5093. __Pyx_XGIVEREF(__pyx_r);
  5094. __Pyx_RefNannyFinishContext();
  5095. return __pyx_r;
  5096. }
  5097. /* "fontTools/misc/bezierTools.py":186
  5098. *
  5099. *
  5100. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  5101. * @cython.locals(
  5102. * pt1=cython.complex,
  5103. */
  5104. /* Python wrapper */
  5105. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_11calcQuadraticArcLengthC(PyObject *__pyx_self,
  5106. #if CYTHON_METH_FASTCALL
  5107. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5108. #else
  5109. PyObject *__pyx_args, PyObject *__pyx_kwds
  5110. #endif
  5111. ); /*proto*/
  5112. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_10calcQuadraticArcLengthC, "calcQuadraticArcLengthC(double complex pt1, double complex pt2, double complex pt3)\n\nCalculates the arc length for a quadratic Bezier segment.\n\nArgs:\n pt1: Start point of the Bezier as a complex number.\n pt2: Handle point of the Bezier as a complex number.\n pt3: End point of the Bezier as a complex number.\n\nReturns:\n Arc length value.");
  5113. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_11calcQuadraticArcLengthC = {"calcQuadraticArcLengthC", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_11calcQuadraticArcLengthC, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_10calcQuadraticArcLengthC};
  5114. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_11calcQuadraticArcLengthC(PyObject *__pyx_self,
  5115. #if CYTHON_METH_FASTCALL
  5116. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5117. #else
  5118. PyObject *__pyx_args, PyObject *__pyx_kwds
  5119. #endif
  5120. ) {
  5121. __pyx_t_double_complex __pyx_v_pt1;
  5122. __pyx_t_double_complex __pyx_v_pt2;
  5123. __pyx_t_double_complex __pyx_v_pt3;
  5124. #if !CYTHON_METH_FASTCALL
  5125. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5126. #endif
  5127. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5128. PyObject* values[3] = {0,0,0};
  5129. int __pyx_lineno = 0;
  5130. const char *__pyx_filename = NULL;
  5131. int __pyx_clineno = 0;
  5132. PyObject *__pyx_r = 0;
  5133. __Pyx_RefNannyDeclarations
  5134. __Pyx_RefNannySetupContext("calcQuadraticArcLengthC (wrapper)", 0);
  5135. #if !CYTHON_METH_FASTCALL
  5136. #if CYTHON_ASSUME_SAFE_SIZE
  5137. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5138. #else
  5139. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5140. #endif
  5141. #endif
  5142. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5143. {
  5144. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,0};
  5145. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  5146. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 186, __pyx_L3_error)
  5147. if (__pyx_kwds_len > 0) {
  5148. switch (__pyx_nargs) {
  5149. case 3:
  5150. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5151. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 186, __pyx_L3_error)
  5152. CYTHON_FALLTHROUGH;
  5153. case 2:
  5154. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5155. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 186, __pyx_L3_error)
  5156. CYTHON_FALLTHROUGH;
  5157. case 1:
  5158. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5159. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 186, __pyx_L3_error)
  5160. CYTHON_FALLTHROUGH;
  5161. case 0: break;
  5162. default: goto __pyx_L5_argtuple_error;
  5163. }
  5164. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5165. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "calcQuadraticArcLengthC", 0) < (0)) __PYX_ERR(0, 186, __pyx_L3_error)
  5166. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  5167. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcQuadraticArcLengthC", 1, 3, 3, i); __PYX_ERR(0, 186, __pyx_L3_error) }
  5168. }
  5169. } else if (unlikely(__pyx_nargs != 3)) {
  5170. goto __pyx_L5_argtuple_error;
  5171. } else {
  5172. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5173. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 186, __pyx_L3_error)
  5174. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5175. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 186, __pyx_L3_error)
  5176. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5177. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 186, __pyx_L3_error)
  5178. }
  5179. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L3_error)
  5180. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L3_error)
  5181. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L3_error)
  5182. }
  5183. goto __pyx_L6_skip;
  5184. __pyx_L5_argtuple_error:;
  5185. __Pyx_RaiseArgtupleInvalid("calcQuadraticArcLengthC", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 186, __pyx_L3_error)
  5186. __pyx_L6_skip:;
  5187. goto __pyx_L4_argument_unpacking_done;
  5188. __pyx_L3_error:;
  5189. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5190. Py_XDECREF(values[__pyx_temp]);
  5191. }
  5192. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5193. __Pyx_RefNannyFinishContext();
  5194. return NULL;
  5195. __pyx_L4_argument_unpacking_done:;
  5196. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_10calcQuadraticArcLengthC(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  5197. /* function exit code */
  5198. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5199. Py_XDECREF(values[__pyx_temp]);
  5200. }
  5201. __Pyx_RefNannyFinishContext();
  5202. return __pyx_r;
  5203. }
  5204. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_10calcQuadraticArcLengthC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3) {
  5205. double __pyx_v_scale;
  5206. double __pyx_v_origDist;
  5207. double __pyx_v_a;
  5208. double __pyx_v_b;
  5209. double __pyx_v_x0;
  5210. double __pyx_v_x1;
  5211. double __pyx_v_Len;
  5212. __pyx_t_double_complex __pyx_v_d0;
  5213. __pyx_t_double_complex __pyx_v_d1;
  5214. __pyx_t_double_complex __pyx_v_d;
  5215. __pyx_t_double_complex __pyx_v_n;
  5216. PyObject *__pyx_r = NULL;
  5217. __Pyx_RefNannyDeclarations
  5218. int __pyx_t_1;
  5219. PyObject *__pyx_t_2 = NULL;
  5220. double __pyx_t_3;
  5221. PyObject *__pyx_t_4 = NULL;
  5222. PyObject *__pyx_t_5 = NULL;
  5223. double __pyx_t_6;
  5224. double __pyx_t_7;
  5225. int __pyx_lineno = 0;
  5226. const char *__pyx_filename = NULL;
  5227. int __pyx_clineno = 0;
  5228. __Pyx_RefNannySetupContext("calcQuadraticArcLengthC", 0);
  5229. /* "fontTools/misc/bezierTools.py":218
  5230. * # Analytical solution to the length of a quadratic bezier.
  5231. * # Documentation: https://github.com/fonttools/fonttools/issues/3055
  5232. * d0 = pt2 - pt1 # <<<<<<<<<<<<<<
  5233. * d1 = pt3 - pt2
  5234. * d = d1 - d0
  5235. */
  5236. __pyx_v_d0 = __Pyx_c_diff_double(__pyx_v_pt2, __pyx_v_pt1);
  5237. /* "fontTools/misc/bezierTools.py":219
  5238. * # Documentation: https://github.com/fonttools/fonttools/issues/3055
  5239. * d0 = pt2 - pt1
  5240. * d1 = pt3 - pt2 # <<<<<<<<<<<<<<
  5241. * d = d1 - d0
  5242. * n = d * 1j
  5243. */
  5244. __pyx_v_d1 = __Pyx_c_diff_double(__pyx_v_pt3, __pyx_v_pt2);
  5245. /* "fontTools/misc/bezierTools.py":220
  5246. * d0 = pt2 - pt1
  5247. * d1 = pt3 - pt2
  5248. * d = d1 - d0 # <<<<<<<<<<<<<<
  5249. * n = d * 1j
  5250. * scale = abs(n)
  5251. */
  5252. __pyx_v_d = __Pyx_c_diff_double(__pyx_v_d1, __pyx_v_d0);
  5253. /* "fontTools/misc/bezierTools.py":221
  5254. * d1 = pt3 - pt2
  5255. * d = d1 - d0
  5256. * n = d * 1j # <<<<<<<<<<<<<<
  5257. * scale = abs(n)
  5258. * if scale == 0.0:
  5259. */
  5260. __pyx_v_n = __Pyx_c_prod_double(__pyx_v_d, __pyx_t_double_complex_from_parts(0, 1.0));
  5261. /* "fontTools/misc/bezierTools.py":222
  5262. * d = d1 - d0
  5263. * n = d * 1j
  5264. * scale = abs(n) # <<<<<<<<<<<<<<
  5265. * if scale == 0.0:
  5266. * return abs(pt3 - pt1)
  5267. */
  5268. __pyx_v_scale = __Pyx_c_abs_double(__pyx_v_n);
  5269. /* "fontTools/misc/bezierTools.py":223
  5270. * n = d * 1j
  5271. * scale = abs(n)
  5272. * if scale == 0.0: # <<<<<<<<<<<<<<
  5273. * return abs(pt3 - pt1)
  5274. * origDist = _dot(n, d0)
  5275. */
  5276. __pyx_t_1 = (__pyx_v_scale == 0.0);
  5277. if (__pyx_t_1) {
  5278. /* "fontTools/misc/bezierTools.py":224
  5279. * scale = abs(n)
  5280. * if scale == 0.0:
  5281. * return abs(pt3 - pt1) # <<<<<<<<<<<<<<
  5282. * origDist = _dot(n, d0)
  5283. * if abs(origDist) < epsilon:
  5284. */
  5285. __Pyx_XDECREF(__pyx_r);
  5286. __pyx_t_2 = PyFloat_FromDouble(__Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_pt3, __pyx_v_pt1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
  5287. __Pyx_GOTREF(__pyx_t_2);
  5288. __pyx_r = __pyx_t_2;
  5289. __pyx_t_2 = 0;
  5290. goto __pyx_L0;
  5291. /* "fontTools/misc/bezierTools.py":223
  5292. * n = d * 1j
  5293. * scale = abs(n)
  5294. * if scale == 0.0: # <<<<<<<<<<<<<<
  5295. * return abs(pt3 - pt1)
  5296. * origDist = _dot(n, d0)
  5297. */
  5298. }
  5299. /* "fontTools/misc/bezierTools.py":225
  5300. * if scale == 0.0:
  5301. * return abs(pt3 - pt1)
  5302. * origDist = _dot(n, d0) # <<<<<<<<<<<<<<
  5303. * if abs(origDist) < epsilon:
  5304. * if _dot(d0, d1) >= 0:
  5305. */
  5306. __pyx_t_3 = __pyx_f_9fontTools_4misc_11bezierTools__dot(__pyx_v_n, __pyx_v_d0); if (unlikely(__pyx_t_3 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L1_error)
  5307. __pyx_v_origDist = __pyx_t_3;
  5308. /* "fontTools/misc/bezierTools.py":226
  5309. * return abs(pt3 - pt1)
  5310. * origDist = _dot(n, d0)
  5311. * if abs(origDist) < epsilon: # <<<<<<<<<<<<<<
  5312. * if _dot(d0, d1) >= 0:
  5313. * return abs(pt3 - pt1)
  5314. */
  5315. __pyx_t_3 = fabs(__pyx_v_origDist);
  5316. __pyx_t_2 = PyFloat_FromDouble(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
  5317. __Pyx_GOTREF(__pyx_t_2);
  5318. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
  5319. __Pyx_GOTREF(__pyx_t_4);
  5320. __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
  5321. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5322. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5323. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 226, __pyx_L1_error)
  5324. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5325. if (__pyx_t_1) {
  5326. /* "fontTools/misc/bezierTools.py":227
  5327. * origDist = _dot(n, d0)
  5328. * if abs(origDist) < epsilon:
  5329. * if _dot(d0, d1) >= 0: # <<<<<<<<<<<<<<
  5330. * return abs(pt3 - pt1)
  5331. * a, b = abs(d0), abs(d1)
  5332. */
  5333. __pyx_t_3 = __pyx_f_9fontTools_4misc_11bezierTools__dot(__pyx_v_d0, __pyx_v_d1); if (unlikely(__pyx_t_3 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 227, __pyx_L1_error)
  5334. __pyx_t_1 = (__pyx_t_3 >= 0.0);
  5335. if (__pyx_t_1) {
  5336. /* "fontTools/misc/bezierTools.py":228
  5337. * if abs(origDist) < epsilon:
  5338. * if _dot(d0, d1) >= 0:
  5339. * return abs(pt3 - pt1) # <<<<<<<<<<<<<<
  5340. * a, b = abs(d0), abs(d1)
  5341. * return (a * a + b * b) / (a + b)
  5342. */
  5343. __Pyx_XDECREF(__pyx_r);
  5344. __pyx_t_5 = PyFloat_FromDouble(__Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_pt3, __pyx_v_pt1))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 228, __pyx_L1_error)
  5345. __Pyx_GOTREF(__pyx_t_5);
  5346. __pyx_r = __pyx_t_5;
  5347. __pyx_t_5 = 0;
  5348. goto __pyx_L0;
  5349. /* "fontTools/misc/bezierTools.py":227
  5350. * origDist = _dot(n, d0)
  5351. * if abs(origDist) < epsilon:
  5352. * if _dot(d0, d1) >= 0: # <<<<<<<<<<<<<<
  5353. * return abs(pt3 - pt1)
  5354. * a, b = abs(d0), abs(d1)
  5355. */
  5356. }
  5357. /* "fontTools/misc/bezierTools.py":229
  5358. * if _dot(d0, d1) >= 0:
  5359. * return abs(pt3 - pt1)
  5360. * a, b = abs(d0), abs(d1) # <<<<<<<<<<<<<<
  5361. * return (a * a + b * b) / (a + b)
  5362. * x0 = _dot(d, d0) / origDist
  5363. */
  5364. __pyx_t_3 = __Pyx_c_abs_double(__pyx_v_d0);
  5365. __pyx_t_6 = __Pyx_c_abs_double(__pyx_v_d1);
  5366. __pyx_v_a = __pyx_t_3;
  5367. __pyx_v_b = __pyx_t_6;
  5368. /* "fontTools/misc/bezierTools.py":230
  5369. * return abs(pt3 - pt1)
  5370. * a, b = abs(d0), abs(d1)
  5371. * return (a * a + b * b) / (a + b) # <<<<<<<<<<<<<<
  5372. * x0 = _dot(d, d0) / origDist
  5373. * x1 = _dot(d, d1) / origDist
  5374. */
  5375. __Pyx_XDECREF(__pyx_r);
  5376. __pyx_t_6 = ((__pyx_v_a * __pyx_v_a) + (__pyx_v_b * __pyx_v_b));
  5377. __pyx_t_3 = (__pyx_v_a + __pyx_v_b);
  5378. if (unlikely(__pyx_t_3 == 0)) {
  5379. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  5380. __PYX_ERR(0, 230, __pyx_L1_error)
  5381. }
  5382. __pyx_t_5 = PyFloat_FromDouble((__pyx_t_6 / __pyx_t_3)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
  5383. __Pyx_GOTREF(__pyx_t_5);
  5384. __pyx_r = __pyx_t_5;
  5385. __pyx_t_5 = 0;
  5386. goto __pyx_L0;
  5387. /* "fontTools/misc/bezierTools.py":226
  5388. * return abs(pt3 - pt1)
  5389. * origDist = _dot(n, d0)
  5390. * if abs(origDist) < epsilon: # <<<<<<<<<<<<<<
  5391. * if _dot(d0, d1) >= 0:
  5392. * return abs(pt3 - pt1)
  5393. */
  5394. }
  5395. /* "fontTools/misc/bezierTools.py":231
  5396. * a, b = abs(d0), abs(d1)
  5397. * return (a * a + b * b) / (a + b)
  5398. * x0 = _dot(d, d0) / origDist # <<<<<<<<<<<<<<
  5399. * x1 = _dot(d, d1) / origDist
  5400. * Len = abs(2 * (_intSecAtan(x1) - _intSecAtan(x0)) * origDist / (scale * (x1 - x0)))
  5401. */
  5402. __pyx_t_3 = __pyx_f_9fontTools_4misc_11bezierTools__dot(__pyx_v_d, __pyx_v_d0); if (unlikely(__pyx_t_3 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error)
  5403. if (unlikely(__pyx_v_origDist == 0)) {
  5404. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  5405. __PYX_ERR(0, 231, __pyx_L1_error)
  5406. }
  5407. __pyx_v_x0 = (__pyx_t_3 / __pyx_v_origDist);
  5408. /* "fontTools/misc/bezierTools.py":232
  5409. * return (a * a + b * b) / (a + b)
  5410. * x0 = _dot(d, d0) / origDist
  5411. * x1 = _dot(d, d1) / origDist # <<<<<<<<<<<<<<
  5412. * Len = abs(2 * (_intSecAtan(x1) - _intSecAtan(x0)) * origDist / (scale * (x1 - x0)))
  5413. * return Len
  5414. */
  5415. __pyx_t_3 = __pyx_f_9fontTools_4misc_11bezierTools__dot(__pyx_v_d, __pyx_v_d1); if (unlikely(__pyx_t_3 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error)
  5416. if (unlikely(__pyx_v_origDist == 0)) {
  5417. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  5418. __PYX_ERR(0, 232, __pyx_L1_error)
  5419. }
  5420. __pyx_v_x1 = (__pyx_t_3 / __pyx_v_origDist);
  5421. /* "fontTools/misc/bezierTools.py":233
  5422. * x0 = _dot(d, d0) / origDist
  5423. * x1 = _dot(d, d1) / origDist
  5424. * Len = abs(2 * (_intSecAtan(x1) - _intSecAtan(x0)) * origDist / (scale * (x1 - x0))) # <<<<<<<<<<<<<<
  5425. * return Len
  5426. *
  5427. */
  5428. __pyx_t_3 = __pyx_f_9fontTools_4misc_11bezierTools__intSecAtan(__pyx_v_x1); if (unlikely(__pyx_t_3 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error)
  5429. __pyx_t_6 = __pyx_f_9fontTools_4misc_11bezierTools__intSecAtan(__pyx_v_x0); if (unlikely(__pyx_t_6 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error)
  5430. __pyx_t_7 = ((2.0 * (__pyx_t_3 - __pyx_t_6)) * __pyx_v_origDist);
  5431. __pyx_t_6 = (__pyx_v_scale * (__pyx_v_x1 - __pyx_v_x0));
  5432. if (unlikely(__pyx_t_6 == 0)) {
  5433. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  5434. __PYX_ERR(0, 233, __pyx_L1_error)
  5435. }
  5436. __pyx_t_3 = fabs((__pyx_t_7 / __pyx_t_6));
  5437. __pyx_v_Len = __pyx_t_3;
  5438. /* "fontTools/misc/bezierTools.py":234
  5439. * x1 = _dot(d, d1) / origDist
  5440. * Len = abs(2 * (_intSecAtan(x1) - _intSecAtan(x0)) * origDist / (scale * (x1 - x0)))
  5441. * return Len # <<<<<<<<<<<<<<
  5442. *
  5443. *
  5444. */
  5445. __Pyx_XDECREF(__pyx_r);
  5446. __pyx_t_5 = PyFloat_FromDouble(__pyx_v_Len); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
  5447. __Pyx_GOTREF(__pyx_t_5);
  5448. __pyx_r = __pyx_t_5;
  5449. __pyx_t_5 = 0;
  5450. goto __pyx_L0;
  5451. /* "fontTools/misc/bezierTools.py":186
  5452. *
  5453. *
  5454. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  5455. * @cython.locals(
  5456. * pt1=cython.complex,
  5457. */
  5458. /* function exit code */
  5459. __pyx_L1_error:;
  5460. __Pyx_XDECREF(__pyx_t_2);
  5461. __Pyx_XDECREF(__pyx_t_4);
  5462. __Pyx_XDECREF(__pyx_t_5);
  5463. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5464. __pyx_r = NULL;
  5465. __pyx_L0:;
  5466. __Pyx_XGIVEREF(__pyx_r);
  5467. __Pyx_RefNannyFinishContext();
  5468. return __pyx_r;
  5469. }
  5470. /* "fontTools/misc/bezierTools.py":237
  5471. *
  5472. *
  5473. * def approximateQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  5474. * """Calculates the arc length for a quadratic Bezier segment.
  5475. *
  5476. */
  5477. /* Python wrapper */
  5478. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_13approximateQuadraticArcLength(PyObject *__pyx_self,
  5479. #if CYTHON_METH_FASTCALL
  5480. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5481. #else
  5482. PyObject *__pyx_args, PyObject *__pyx_kwds
  5483. #endif
  5484. ); /*proto*/
  5485. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_12approximateQuadraticArcLength, "approximateQuadraticArcLength(pt1, pt2, pt3)\n\nCalculates the arc length for a quadratic Bezier segment.\n\nUses Gauss-Legendre quadrature for a branch-free approximation.\nSee :func:`calcQuadraticArcLength` for a slower but more accurate result.\n\nArgs:\n pt1: Start point of the Bezier as 2D tuple.\n pt2: Handle point of the Bezier as 2D tuple.\n pt3: End point of the Bezier as 2D tuple.\n\nReturns:\n Approximate arc length value.");
  5486. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_13approximateQuadraticArcLength = {"approximateQuadraticArcLength", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_13approximateQuadraticArcLength, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_12approximateQuadraticArcLength};
  5487. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_13approximateQuadraticArcLength(PyObject *__pyx_self,
  5488. #if CYTHON_METH_FASTCALL
  5489. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5490. #else
  5491. PyObject *__pyx_args, PyObject *__pyx_kwds
  5492. #endif
  5493. ) {
  5494. PyObject *__pyx_v_pt1 = 0;
  5495. PyObject *__pyx_v_pt2 = 0;
  5496. PyObject *__pyx_v_pt3 = 0;
  5497. #if !CYTHON_METH_FASTCALL
  5498. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5499. #endif
  5500. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5501. PyObject* values[3] = {0,0,0};
  5502. int __pyx_lineno = 0;
  5503. const char *__pyx_filename = NULL;
  5504. int __pyx_clineno = 0;
  5505. PyObject *__pyx_r = 0;
  5506. __Pyx_RefNannyDeclarations
  5507. __Pyx_RefNannySetupContext("approximateQuadraticArcLength (wrapper)", 0);
  5508. #if !CYTHON_METH_FASTCALL
  5509. #if CYTHON_ASSUME_SAFE_SIZE
  5510. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5511. #else
  5512. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5513. #endif
  5514. #endif
  5515. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5516. {
  5517. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,0};
  5518. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  5519. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 237, __pyx_L3_error)
  5520. if (__pyx_kwds_len > 0) {
  5521. switch (__pyx_nargs) {
  5522. case 3:
  5523. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5524. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 237, __pyx_L3_error)
  5525. CYTHON_FALLTHROUGH;
  5526. case 2:
  5527. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5528. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 237, __pyx_L3_error)
  5529. CYTHON_FALLTHROUGH;
  5530. case 1:
  5531. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5532. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 237, __pyx_L3_error)
  5533. CYTHON_FALLTHROUGH;
  5534. case 0: break;
  5535. default: goto __pyx_L5_argtuple_error;
  5536. }
  5537. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5538. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "approximateQuadraticArcLength", 0) < (0)) __PYX_ERR(0, 237, __pyx_L3_error)
  5539. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  5540. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("approximateQuadraticArcLength", 1, 3, 3, i); __PYX_ERR(0, 237, __pyx_L3_error) }
  5541. }
  5542. } else if (unlikely(__pyx_nargs != 3)) {
  5543. goto __pyx_L5_argtuple_error;
  5544. } else {
  5545. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5546. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 237, __pyx_L3_error)
  5547. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5548. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 237, __pyx_L3_error)
  5549. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5550. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 237, __pyx_L3_error)
  5551. }
  5552. __pyx_v_pt1 = values[0];
  5553. __pyx_v_pt2 = values[1];
  5554. __pyx_v_pt3 = values[2];
  5555. }
  5556. goto __pyx_L6_skip;
  5557. __pyx_L5_argtuple_error:;
  5558. __Pyx_RaiseArgtupleInvalid("approximateQuadraticArcLength", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 237, __pyx_L3_error)
  5559. __pyx_L6_skip:;
  5560. goto __pyx_L4_argument_unpacking_done;
  5561. __pyx_L3_error:;
  5562. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5563. Py_XDECREF(values[__pyx_temp]);
  5564. }
  5565. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateQuadraticArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5566. __Pyx_RefNannyFinishContext();
  5567. return NULL;
  5568. __pyx_L4_argument_unpacking_done:;
  5569. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_12approximateQuadraticArcLength(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  5570. /* function exit code */
  5571. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5572. Py_XDECREF(values[__pyx_temp]);
  5573. }
  5574. __Pyx_RefNannyFinishContext();
  5575. return __pyx_r;
  5576. }
  5577. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_12approximateQuadraticArcLength(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3) {
  5578. PyObject *__pyx_r = NULL;
  5579. __Pyx_RefNannyDeclarations
  5580. PyObject *__pyx_t_1 = NULL;
  5581. PyObject *__pyx_t_2 = NULL;
  5582. PyObject *__pyx_t_3 = NULL;
  5583. PyObject *__pyx_t_4 = NULL;
  5584. PyObject *__pyx_t_5 = NULL;
  5585. PyObject *__pyx_t_6 = NULL;
  5586. PyObject *__pyx_t_7 = NULL;
  5587. size_t __pyx_t_8;
  5588. int __pyx_lineno = 0;
  5589. const char *__pyx_filename = NULL;
  5590. int __pyx_clineno = 0;
  5591. __Pyx_RefNannySetupContext("approximateQuadraticArcLength", 0);
  5592. /* "fontTools/misc/bezierTools.py":251
  5593. * Approximate arc length value.
  5594. * """
  5595. * return approximateQuadraticArcLengthC(complex(*pt1), complex(*pt2), complex(*pt3)) # <<<<<<<<<<<<<<
  5596. *
  5597. *
  5598. */
  5599. __Pyx_XDECREF(__pyx_r);
  5600. __pyx_t_2 = NULL;
  5601. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_approximateQuadraticArcLengthC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
  5602. __Pyx_GOTREF(__pyx_t_3);
  5603. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  5604. __Pyx_GOTREF(__pyx_t_4);
  5605. __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 251, __pyx_L1_error)
  5606. __Pyx_GOTREF(__pyx_t_5);
  5607. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5608. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  5609. __Pyx_GOTREF(__pyx_t_4);
  5610. __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 251, __pyx_L1_error)
  5611. __Pyx_GOTREF(__pyx_t_6);
  5612. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5613. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  5614. __Pyx_GOTREF(__pyx_t_4);
  5615. __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error)
  5616. __Pyx_GOTREF(__pyx_t_7);
  5617. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5618. __pyx_t_8 = 1;
  5619. #if CYTHON_UNPACK_METHODS
  5620. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  5621. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  5622. assert(__pyx_t_2);
  5623. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  5624. __Pyx_INCREF(__pyx_t_2);
  5625. __Pyx_INCREF(__pyx__function);
  5626. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  5627. __pyx_t_8 = 0;
  5628. }
  5629. #endif
  5630. {
  5631. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_7};
  5632. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (4-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  5633. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  5634. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5635. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5636. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5637. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5638. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
  5639. __Pyx_GOTREF(__pyx_t_1);
  5640. }
  5641. __pyx_r = __pyx_t_1;
  5642. __pyx_t_1 = 0;
  5643. goto __pyx_L0;
  5644. /* "fontTools/misc/bezierTools.py":237
  5645. *
  5646. *
  5647. * def approximateQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  5648. * """Calculates the arc length for a quadratic Bezier segment.
  5649. *
  5650. */
  5651. /* function exit code */
  5652. __pyx_L1_error:;
  5653. __Pyx_XDECREF(__pyx_t_1);
  5654. __Pyx_XDECREF(__pyx_t_2);
  5655. __Pyx_XDECREF(__pyx_t_3);
  5656. __Pyx_XDECREF(__pyx_t_4);
  5657. __Pyx_XDECREF(__pyx_t_5);
  5658. __Pyx_XDECREF(__pyx_t_6);
  5659. __Pyx_XDECREF(__pyx_t_7);
  5660. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateQuadraticArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5661. __pyx_r = NULL;
  5662. __pyx_L0:;
  5663. __Pyx_XGIVEREF(__pyx_r);
  5664. __Pyx_RefNannyFinishContext();
  5665. return __pyx_r;
  5666. }
  5667. /* "fontTools/misc/bezierTools.py":254
  5668. *
  5669. *
  5670. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  5671. * @cython.locals(
  5672. * pt1=cython.complex,
  5673. */
  5674. /* Python wrapper */
  5675. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_15approximateQuadraticArcLengthC(PyObject *__pyx_self,
  5676. #if CYTHON_METH_FASTCALL
  5677. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5678. #else
  5679. PyObject *__pyx_args, PyObject *__pyx_kwds
  5680. #endif
  5681. ); /*proto*/
  5682. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_14approximateQuadraticArcLengthC, "approximateQuadraticArcLengthC(double complex pt1, double complex pt2, double complex pt3)\n\nCalculates the arc length for a quadratic Bezier segment.\n\nUses Gauss-Legendre quadrature for a branch-free approximation.\nSee :func:`calcQuadraticArcLength` for a slower but more accurate result.\n\nArgs:\n pt1: Start point of the Bezier as a complex number.\n pt2: Handle point of the Bezier as a complex number.\n pt3: End point of the Bezier as a complex number.\n\nReturns:\n Approximate arc length value.");
  5683. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_15approximateQuadraticArcLengthC = {"approximateQuadraticArcLengthC", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_15approximateQuadraticArcLengthC, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_14approximateQuadraticArcLengthC};
  5684. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_15approximateQuadraticArcLengthC(PyObject *__pyx_self,
  5685. #if CYTHON_METH_FASTCALL
  5686. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5687. #else
  5688. PyObject *__pyx_args, PyObject *__pyx_kwds
  5689. #endif
  5690. ) {
  5691. __pyx_t_double_complex __pyx_v_pt1;
  5692. __pyx_t_double_complex __pyx_v_pt2;
  5693. __pyx_t_double_complex __pyx_v_pt3;
  5694. #if !CYTHON_METH_FASTCALL
  5695. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5696. #endif
  5697. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5698. PyObject* values[3] = {0,0,0};
  5699. int __pyx_lineno = 0;
  5700. const char *__pyx_filename = NULL;
  5701. int __pyx_clineno = 0;
  5702. PyObject *__pyx_r = 0;
  5703. __Pyx_RefNannyDeclarations
  5704. __Pyx_RefNannySetupContext("approximateQuadraticArcLengthC (wrapper)", 0);
  5705. #if !CYTHON_METH_FASTCALL
  5706. #if CYTHON_ASSUME_SAFE_SIZE
  5707. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5708. #else
  5709. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5710. #endif
  5711. #endif
  5712. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5713. {
  5714. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,0};
  5715. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  5716. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 254, __pyx_L3_error)
  5717. if (__pyx_kwds_len > 0) {
  5718. switch (__pyx_nargs) {
  5719. case 3:
  5720. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5721. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 254, __pyx_L3_error)
  5722. CYTHON_FALLTHROUGH;
  5723. case 2:
  5724. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5725. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 254, __pyx_L3_error)
  5726. CYTHON_FALLTHROUGH;
  5727. case 1:
  5728. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5729. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 254, __pyx_L3_error)
  5730. CYTHON_FALLTHROUGH;
  5731. case 0: break;
  5732. default: goto __pyx_L5_argtuple_error;
  5733. }
  5734. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5735. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "approximateQuadraticArcLengthC", 0) < (0)) __PYX_ERR(0, 254, __pyx_L3_error)
  5736. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  5737. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("approximateQuadraticArcLengthC", 1, 3, 3, i); __PYX_ERR(0, 254, __pyx_L3_error) }
  5738. }
  5739. } else if (unlikely(__pyx_nargs != 3)) {
  5740. goto __pyx_L5_argtuple_error;
  5741. } else {
  5742. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5743. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 254, __pyx_L3_error)
  5744. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5745. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 254, __pyx_L3_error)
  5746. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5747. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 254, __pyx_L3_error)
  5748. }
  5749. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L3_error)
  5750. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L3_error)
  5751. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L3_error)
  5752. }
  5753. goto __pyx_L6_skip;
  5754. __pyx_L5_argtuple_error:;
  5755. __Pyx_RaiseArgtupleInvalid("approximateQuadraticArcLengthC", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 254, __pyx_L3_error)
  5756. __pyx_L6_skip:;
  5757. goto __pyx_L4_argument_unpacking_done;
  5758. __pyx_L3_error:;
  5759. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5760. Py_XDECREF(values[__pyx_temp]);
  5761. }
  5762. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateQuadraticArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5763. __Pyx_RefNannyFinishContext();
  5764. return NULL;
  5765. __pyx_L4_argument_unpacking_done:;
  5766. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_14approximateQuadraticArcLengthC(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  5767. /* function exit code */
  5768. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5769. Py_XDECREF(values[__pyx_temp]);
  5770. }
  5771. __Pyx_RefNannyFinishContext();
  5772. return __pyx_r;
  5773. }
  5774. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_14approximateQuadraticArcLengthC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3) {
  5775. double __pyx_v_v0;
  5776. double __pyx_v_v1;
  5777. double __pyx_v_v2;
  5778. PyObject *__pyx_r = NULL;
  5779. __Pyx_RefNannyDeclarations
  5780. PyObject *__pyx_t_1 = NULL;
  5781. int __pyx_lineno = 0;
  5782. const char *__pyx_filename = NULL;
  5783. int __pyx_clineno = 0;
  5784. __Pyx_RefNannySetupContext("approximateQuadraticArcLengthC", 0);
  5785. /* "fontTools/misc/bezierTools.py":287
  5786. * # abs(BezierCurveC[2].diff(t).subs({t:T})) for T in sorted(.5, .5sqrt(3/5)/2),
  5787. * # weighted 5/18, 8/18, 5/18 respectively.
  5788. * v0 = abs( # <<<<<<<<<<<<<<
  5789. * -0.492943519233745 * pt1 + 0.430331482911935 * pt2 + 0.0626120363218102 * pt3
  5790. * )
  5791. */
  5792. __pyx_v_v0 = __Pyx_c_abs_double(__Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts(-0.492943519233745, 0), __pyx_v_pt1), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.430331482911935, 0), __pyx_v_pt2)), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.0626120363218102, 0), __pyx_v_pt3)));
  5793. /* "fontTools/misc/bezierTools.py":290
  5794. * -0.492943519233745 * pt1 + 0.430331482911935 * pt2 + 0.0626120363218102 * pt3
  5795. * )
  5796. * v1 = abs(pt3 - pt1) * 0.4444444444444444 # <<<<<<<<<<<<<<
  5797. * v2 = abs(
  5798. * -0.0626120363218102 * pt1 - 0.430331482911935 * pt2 + 0.492943519233745 * pt3
  5799. */
  5800. __pyx_v_v1 = (__Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_pt3, __pyx_v_pt1)) * 0.4444444444444444);
  5801. /* "fontTools/misc/bezierTools.py":291
  5802. * )
  5803. * v1 = abs(pt3 - pt1) * 0.4444444444444444
  5804. * v2 = abs( # <<<<<<<<<<<<<<
  5805. * -0.0626120363218102 * pt1 - 0.430331482911935 * pt2 + 0.492943519233745 * pt3
  5806. * )
  5807. */
  5808. __pyx_v_v2 = __Pyx_c_abs_double(__Pyx_c_sum_double(__Pyx_c_diff_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts(-0.0626120363218102, 0), __pyx_v_pt1), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.430331482911935, 0), __pyx_v_pt2)), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.492943519233745, 0), __pyx_v_pt3)));
  5809. /* "fontTools/misc/bezierTools.py":295
  5810. * )
  5811. *
  5812. * return v0 + v1 + v2 # <<<<<<<<<<<<<<
  5813. *
  5814. *
  5815. */
  5816. __Pyx_XDECREF(__pyx_r);
  5817. __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_v0 + __pyx_v_v1) + __pyx_v_v2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
  5818. __Pyx_GOTREF(__pyx_t_1);
  5819. __pyx_r = __pyx_t_1;
  5820. __pyx_t_1 = 0;
  5821. goto __pyx_L0;
  5822. /* "fontTools/misc/bezierTools.py":254
  5823. *
  5824. *
  5825. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  5826. * @cython.locals(
  5827. * pt1=cython.complex,
  5828. */
  5829. /* function exit code */
  5830. __pyx_L1_error:;
  5831. __Pyx_XDECREF(__pyx_t_1);
  5832. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateQuadraticArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5833. __pyx_r = NULL;
  5834. __pyx_L0:;
  5835. __Pyx_XGIVEREF(__pyx_r);
  5836. __Pyx_RefNannyFinishContext();
  5837. return __pyx_r;
  5838. }
  5839. /* "fontTools/misc/bezierTools.py":298
  5840. *
  5841. *
  5842. * def calcQuadraticBounds(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  5843. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  5844. *
  5845. */
  5846. /* Python wrapper */
  5847. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_17calcQuadraticBounds(PyObject *__pyx_self,
  5848. #if CYTHON_METH_FASTCALL
  5849. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5850. #else
  5851. PyObject *__pyx_args, PyObject *__pyx_kwds
  5852. #endif
  5853. ); /*proto*/
  5854. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_16calcQuadraticBounds, "calcQuadraticBounds(pt1, pt2, pt3)\n\nCalculates the bounding rectangle for a quadratic Bezier segment.\n\nArgs:\n pt1: Start point of the Bezier as a 2D tuple.\n pt2: Handle point of the Bezier as a 2D tuple.\n pt3: End point of the Bezier as a 2D tuple.\n\nReturns:\n A four-item tuple representing the bounding rectangle ``(xMin, yMin, xMax, yMax)``.\n\nExample::\n\n >>> calcQuadraticBounds((0, 0), (50, 100), (100, 0))\n (0, 0, 100, 50.0)\n >>> calcQuadraticBounds((0, 0), (100, 0), (100, 100))\n (0.0, 0.0, 100, 100)");
  5855. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_17calcQuadraticBounds = {"calcQuadraticBounds", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_17calcQuadraticBounds, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_16calcQuadraticBounds};
  5856. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_17calcQuadraticBounds(PyObject *__pyx_self,
  5857. #if CYTHON_METH_FASTCALL
  5858. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5859. #else
  5860. PyObject *__pyx_args, PyObject *__pyx_kwds
  5861. #endif
  5862. ) {
  5863. PyObject *__pyx_v_pt1 = 0;
  5864. PyObject *__pyx_v_pt2 = 0;
  5865. PyObject *__pyx_v_pt3 = 0;
  5866. #if !CYTHON_METH_FASTCALL
  5867. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5868. #endif
  5869. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5870. PyObject* values[3] = {0,0,0};
  5871. int __pyx_lineno = 0;
  5872. const char *__pyx_filename = NULL;
  5873. int __pyx_clineno = 0;
  5874. PyObject *__pyx_r = 0;
  5875. __Pyx_RefNannyDeclarations
  5876. __Pyx_RefNannySetupContext("calcQuadraticBounds (wrapper)", 0);
  5877. #if !CYTHON_METH_FASTCALL
  5878. #if CYTHON_ASSUME_SAFE_SIZE
  5879. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5880. #else
  5881. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5882. #endif
  5883. #endif
  5884. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5885. {
  5886. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,0};
  5887. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  5888. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 298, __pyx_L3_error)
  5889. if (__pyx_kwds_len > 0) {
  5890. switch (__pyx_nargs) {
  5891. case 3:
  5892. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5893. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 298, __pyx_L3_error)
  5894. CYTHON_FALLTHROUGH;
  5895. case 2:
  5896. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5897. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 298, __pyx_L3_error)
  5898. CYTHON_FALLTHROUGH;
  5899. case 1:
  5900. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5901. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 298, __pyx_L3_error)
  5902. CYTHON_FALLTHROUGH;
  5903. case 0: break;
  5904. default: goto __pyx_L5_argtuple_error;
  5905. }
  5906. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5907. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "calcQuadraticBounds", 0) < (0)) __PYX_ERR(0, 298, __pyx_L3_error)
  5908. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  5909. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcQuadraticBounds", 1, 3, 3, i); __PYX_ERR(0, 298, __pyx_L3_error) }
  5910. }
  5911. } else if (unlikely(__pyx_nargs != 3)) {
  5912. goto __pyx_L5_argtuple_error;
  5913. } else {
  5914. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5915. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 298, __pyx_L3_error)
  5916. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5917. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 298, __pyx_L3_error)
  5918. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5919. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 298, __pyx_L3_error)
  5920. }
  5921. __pyx_v_pt1 = values[0];
  5922. __pyx_v_pt2 = values[1];
  5923. __pyx_v_pt3 = values[2];
  5924. }
  5925. goto __pyx_L6_skip;
  5926. __pyx_L5_argtuple_error:;
  5927. __Pyx_RaiseArgtupleInvalid("calcQuadraticBounds", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 298, __pyx_L3_error)
  5928. __pyx_L6_skip:;
  5929. goto __pyx_L4_argument_unpacking_done;
  5930. __pyx_L3_error:;
  5931. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5932. Py_XDECREF(values[__pyx_temp]);
  5933. }
  5934. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5935. __Pyx_RefNannyFinishContext();
  5936. return NULL;
  5937. __pyx_L4_argument_unpacking_done:;
  5938. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_16calcQuadraticBounds(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  5939. /* function exit code */
  5940. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5941. Py_XDECREF(values[__pyx_temp]);
  5942. }
  5943. __Pyx_RefNannyFinishContext();
  5944. return __pyx_r;
  5945. }
  5946. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_16calcQuadraticBounds(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3) {
  5947. PyObject *__pyx_v_ax = NULL;
  5948. PyObject *__pyx_v_ay = NULL;
  5949. PyObject *__pyx_v_bx = NULL;
  5950. PyObject *__pyx_v_by = NULL;
  5951. PyObject *__pyx_v_cx = NULL;
  5952. PyObject *__pyx_v_cy = NULL;
  5953. PyObject *__pyx_v_ax2 = NULL;
  5954. PyObject *__pyx_v_ay2 = NULL;
  5955. PyObject *__pyx_v_roots = NULL;
  5956. PyObject *__pyx_v_points = NULL;
  5957. PyObject *__pyx_7genexpr__pyx_v_t = NULL;
  5958. PyObject *__pyx_r = NULL;
  5959. __Pyx_RefNannyDeclarations
  5960. PyObject *__pyx_t_1 = NULL;
  5961. PyObject *__pyx_t_2 = NULL;
  5962. PyObject *__pyx_t_3 = NULL;
  5963. size_t __pyx_t_4;
  5964. PyObject *__pyx_t_5 = NULL;
  5965. PyObject *__pyx_t_6 = NULL;
  5966. PyObject *(*__pyx_t_7)(PyObject *);
  5967. PyObject *__pyx_t_8 = NULL;
  5968. PyObject *__pyx_t_9 = NULL;
  5969. int __pyx_t_10;
  5970. int __pyx_t_11;
  5971. Py_ssize_t __pyx_t_12;
  5972. int __pyx_lineno = 0;
  5973. const char *__pyx_filename = NULL;
  5974. int __pyx_clineno = 0;
  5975. __Pyx_RefNannySetupContext("calcQuadraticBounds", 0);
  5976. /* "fontTools/misc/bezierTools.py":316
  5977. * (0.0, 0.0, 100, 100)
  5978. * """
  5979. * (ax, ay), (bx, by), (cx, cy) = calcQuadraticParameters(pt1, pt2, pt3) # <<<<<<<<<<<<<<
  5980. * ax2 = ax * 2.0
  5981. * ay2 = ay * 2.0
  5982. */
  5983. __pyx_t_2 = NULL;
  5984. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcQuadraticParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
  5985. __Pyx_GOTREF(__pyx_t_3);
  5986. __pyx_t_4 = 1;
  5987. #if CYTHON_UNPACK_METHODS
  5988. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  5989. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  5990. assert(__pyx_t_2);
  5991. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  5992. __Pyx_INCREF(__pyx_t_2);
  5993. __Pyx_INCREF(__pyx__function);
  5994. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  5995. __pyx_t_4 = 0;
  5996. }
  5997. #endif
  5998. {
  5999. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3};
  6000. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  6001. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  6002. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6003. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error)
  6004. __Pyx_GOTREF(__pyx_t_1);
  6005. }
  6006. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  6007. PyObject* sequence = __pyx_t_1;
  6008. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6009. if (unlikely(size != 3)) {
  6010. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  6011. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6012. __PYX_ERR(0, 316, __pyx_L1_error)
  6013. }
  6014. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6015. if (likely(PyTuple_CheckExact(sequence))) {
  6016. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  6017. __Pyx_INCREF(__pyx_t_3);
  6018. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  6019. __Pyx_INCREF(__pyx_t_2);
  6020. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  6021. __Pyx_INCREF(__pyx_t_5);
  6022. } else {
  6023. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  6024. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
  6025. __Pyx_XGOTREF(__pyx_t_3);
  6026. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  6027. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error)
  6028. __Pyx_XGOTREF(__pyx_t_2);
  6029. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  6030. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 316, __pyx_L1_error)
  6031. __Pyx_XGOTREF(__pyx_t_5);
  6032. }
  6033. #else
  6034. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
  6035. __Pyx_GOTREF(__pyx_t_3);
  6036. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error)
  6037. __Pyx_GOTREF(__pyx_t_2);
  6038. __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 316, __pyx_L1_error)
  6039. __Pyx_GOTREF(__pyx_t_5);
  6040. #endif
  6041. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6042. } else {
  6043. Py_ssize_t index = -1;
  6044. __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6045. __Pyx_GOTREF(__pyx_t_6);
  6046. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6047. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
  6048. index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
  6049. __Pyx_GOTREF(__pyx_t_3);
  6050. index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  6051. __Pyx_GOTREF(__pyx_t_2);
  6052. index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
  6053. __Pyx_GOTREF(__pyx_t_5);
  6054. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
  6055. __pyx_t_7 = NULL;
  6056. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6057. goto __pyx_L4_unpacking_done;
  6058. __pyx_L3_unpacking_failed:;
  6059. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6060. __pyx_t_7 = NULL;
  6061. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  6062. __PYX_ERR(0, 316, __pyx_L1_error)
  6063. __pyx_L4_unpacking_done:;
  6064. }
  6065. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  6066. PyObject* sequence = __pyx_t_3;
  6067. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6068. if (unlikely(size != 2)) {
  6069. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6070. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6071. __PYX_ERR(0, 316, __pyx_L1_error)
  6072. }
  6073. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6074. if (likely(PyTuple_CheckExact(sequence))) {
  6075. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
  6076. __Pyx_INCREF(__pyx_t_6);
  6077. __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
  6078. __Pyx_INCREF(__pyx_t_8);
  6079. } else {
  6080. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  6081. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6082. __Pyx_XGOTREF(__pyx_t_6);
  6083. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  6084. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6085. __Pyx_XGOTREF(__pyx_t_8);
  6086. }
  6087. #else
  6088. __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6089. __Pyx_GOTREF(__pyx_t_6);
  6090. __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6091. __Pyx_GOTREF(__pyx_t_8);
  6092. #endif
  6093. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6094. } else {
  6095. Py_ssize_t index = -1;
  6096. __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 316, __pyx_L1_error)
  6097. __Pyx_GOTREF(__pyx_t_9);
  6098. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6099. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
  6100. index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
  6101. __Pyx_GOTREF(__pyx_t_6);
  6102. index = 1; __pyx_t_8 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
  6103. __Pyx_GOTREF(__pyx_t_8);
  6104. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
  6105. __pyx_t_7 = NULL;
  6106. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6107. goto __pyx_L6_unpacking_done;
  6108. __pyx_L5_unpacking_failed:;
  6109. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6110. __pyx_t_7 = NULL;
  6111. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  6112. __PYX_ERR(0, 316, __pyx_L1_error)
  6113. __pyx_L6_unpacking_done:;
  6114. }
  6115. __pyx_v_ax = __pyx_t_6;
  6116. __pyx_t_6 = 0;
  6117. __pyx_v_ay = __pyx_t_8;
  6118. __pyx_t_8 = 0;
  6119. if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
  6120. PyObject* sequence = __pyx_t_2;
  6121. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6122. if (unlikely(size != 2)) {
  6123. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6124. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6125. __PYX_ERR(0, 316, __pyx_L1_error)
  6126. }
  6127. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6128. if (likely(PyTuple_CheckExact(sequence))) {
  6129. __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
  6130. __Pyx_INCREF(__pyx_t_8);
  6131. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
  6132. __Pyx_INCREF(__pyx_t_6);
  6133. } else {
  6134. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  6135. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6136. __Pyx_XGOTREF(__pyx_t_8);
  6137. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  6138. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6139. __Pyx_XGOTREF(__pyx_t_6);
  6140. }
  6141. #else
  6142. __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6143. __Pyx_GOTREF(__pyx_t_8);
  6144. __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6145. __Pyx_GOTREF(__pyx_t_6);
  6146. #endif
  6147. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6148. } else {
  6149. Py_ssize_t index = -1;
  6150. __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 316, __pyx_L1_error)
  6151. __Pyx_GOTREF(__pyx_t_9);
  6152. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6153. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
  6154. index = 0; __pyx_t_8 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed;
  6155. __Pyx_GOTREF(__pyx_t_8);
  6156. index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
  6157. __Pyx_GOTREF(__pyx_t_6);
  6158. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
  6159. __pyx_t_7 = NULL;
  6160. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6161. goto __pyx_L8_unpacking_done;
  6162. __pyx_L7_unpacking_failed:;
  6163. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6164. __pyx_t_7 = NULL;
  6165. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  6166. __PYX_ERR(0, 316, __pyx_L1_error)
  6167. __pyx_L8_unpacking_done:;
  6168. }
  6169. __pyx_v_bx = __pyx_t_8;
  6170. __pyx_t_8 = 0;
  6171. __pyx_v_by = __pyx_t_6;
  6172. __pyx_t_6 = 0;
  6173. if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
  6174. PyObject* sequence = __pyx_t_5;
  6175. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6176. if (unlikely(size != 2)) {
  6177. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6178. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6179. __PYX_ERR(0, 316, __pyx_L1_error)
  6180. }
  6181. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6182. if (likely(PyTuple_CheckExact(sequence))) {
  6183. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
  6184. __Pyx_INCREF(__pyx_t_6);
  6185. __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
  6186. __Pyx_INCREF(__pyx_t_8);
  6187. } else {
  6188. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  6189. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6190. __Pyx_XGOTREF(__pyx_t_6);
  6191. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  6192. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6193. __Pyx_XGOTREF(__pyx_t_8);
  6194. }
  6195. #else
  6196. __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6197. __Pyx_GOTREF(__pyx_t_6);
  6198. __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6199. __Pyx_GOTREF(__pyx_t_8);
  6200. #endif
  6201. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6202. } else {
  6203. Py_ssize_t index = -1;
  6204. __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 316, __pyx_L1_error)
  6205. __Pyx_GOTREF(__pyx_t_9);
  6206. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6207. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
  6208. index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L9_unpacking_failed;
  6209. __Pyx_GOTREF(__pyx_t_6);
  6210. index = 1; __pyx_t_8 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
  6211. __Pyx_GOTREF(__pyx_t_8);
  6212. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
  6213. __pyx_t_7 = NULL;
  6214. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6215. goto __pyx_L10_unpacking_done;
  6216. __pyx_L9_unpacking_failed:;
  6217. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6218. __pyx_t_7 = NULL;
  6219. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  6220. __PYX_ERR(0, 316, __pyx_L1_error)
  6221. __pyx_L10_unpacking_done:;
  6222. }
  6223. __pyx_v_cx = __pyx_t_6;
  6224. __pyx_t_6 = 0;
  6225. __pyx_v_cy = __pyx_t_8;
  6226. __pyx_t_8 = 0;
  6227. /* "fontTools/misc/bezierTools.py":317
  6228. * """
  6229. * (ax, ay), (bx, by), (cx, cy) = calcQuadraticParameters(pt1, pt2, pt3)
  6230. * ax2 = ax * 2.0 # <<<<<<<<<<<<<<
  6231. * ay2 = ay * 2.0
  6232. * roots = []
  6233. */
  6234. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ax, __pyx_mstate_global->__pyx_float_2_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
  6235. __Pyx_GOTREF(__pyx_t_1);
  6236. __pyx_v_ax2 = __pyx_t_1;
  6237. __pyx_t_1 = 0;
  6238. /* "fontTools/misc/bezierTools.py":318
  6239. * (ax, ay), (bx, by), (cx, cy) = calcQuadraticParameters(pt1, pt2, pt3)
  6240. * ax2 = ax * 2.0
  6241. * ay2 = ay * 2.0 # <<<<<<<<<<<<<<
  6242. * roots = []
  6243. * if ax2 != 0:
  6244. */
  6245. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ay, __pyx_mstate_global->__pyx_float_2_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error)
  6246. __Pyx_GOTREF(__pyx_t_1);
  6247. __pyx_v_ay2 = __pyx_t_1;
  6248. __pyx_t_1 = 0;
  6249. /* "fontTools/misc/bezierTools.py":319
  6250. * ax2 = ax * 2.0
  6251. * ay2 = ay * 2.0
  6252. * roots = [] # <<<<<<<<<<<<<<
  6253. * if ax2 != 0:
  6254. * roots.append(-bx / ax2)
  6255. */
  6256. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error)
  6257. __Pyx_GOTREF(__pyx_t_1);
  6258. __pyx_v_roots = ((PyObject*)__pyx_t_1);
  6259. __pyx_t_1 = 0;
  6260. /* "fontTools/misc/bezierTools.py":320
  6261. * ay2 = ay * 2.0
  6262. * roots = []
  6263. * if ax2 != 0: # <<<<<<<<<<<<<<
  6264. * roots.append(-bx / ax2)
  6265. * if ay2 != 0:
  6266. */
  6267. __pyx_t_10 = (__Pyx_PyLong_BoolNeObjC(__pyx_v_ax2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 320, __pyx_L1_error)
  6268. if (__pyx_t_10) {
  6269. /* "fontTools/misc/bezierTools.py":321
  6270. * roots = []
  6271. * if ax2 != 0:
  6272. * roots.append(-bx / ax2) # <<<<<<<<<<<<<<
  6273. * if ay2 != 0:
  6274. * roots.append(-by / ay2)
  6275. */
  6276. __pyx_t_1 = PyNumber_Negative(__pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
  6277. __Pyx_GOTREF(__pyx_t_1);
  6278. __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_ax2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 321, __pyx_L1_error)
  6279. __Pyx_GOTREF(__pyx_t_5);
  6280. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6281. __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_roots, __pyx_t_5); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 321, __pyx_L1_error)
  6282. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6283. /* "fontTools/misc/bezierTools.py":320
  6284. * ay2 = ay * 2.0
  6285. * roots = []
  6286. * if ax2 != 0: # <<<<<<<<<<<<<<
  6287. * roots.append(-bx / ax2)
  6288. * if ay2 != 0:
  6289. */
  6290. }
  6291. /* "fontTools/misc/bezierTools.py":322
  6292. * if ax2 != 0:
  6293. * roots.append(-bx / ax2)
  6294. * if ay2 != 0: # <<<<<<<<<<<<<<
  6295. * roots.append(-by / ay2)
  6296. * points = [
  6297. */
  6298. __pyx_t_10 = (__Pyx_PyLong_BoolNeObjC(__pyx_v_ay2, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 322, __pyx_L1_error)
  6299. if (__pyx_t_10) {
  6300. /* "fontTools/misc/bezierTools.py":323
  6301. * roots.append(-bx / ax2)
  6302. * if ay2 != 0:
  6303. * roots.append(-by / ay2) # <<<<<<<<<<<<<<
  6304. * points = [
  6305. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6306. */
  6307. __pyx_t_5 = PyNumber_Negative(__pyx_v_by); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 323, __pyx_L1_error)
  6308. __Pyx_GOTREF(__pyx_t_5);
  6309. __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_ay2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
  6310. __Pyx_GOTREF(__pyx_t_1);
  6311. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6312. __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_roots, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 323, __pyx_L1_error)
  6313. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6314. /* "fontTools/misc/bezierTools.py":322
  6315. * if ax2 != 0:
  6316. * roots.append(-bx / ax2)
  6317. * if ay2 != 0: # <<<<<<<<<<<<<<
  6318. * roots.append(-by / ay2)
  6319. * points = [
  6320. */
  6321. }
  6322. /* "fontTools/misc/bezierTools.py":328
  6323. * for t in roots
  6324. * if 0 <= t < 1
  6325. * ] + [pt1, pt3] # <<<<<<<<<<<<<<
  6326. * return calcBounds(points)
  6327. *
  6328. */
  6329. { /* enter inner scope */
  6330. /* "fontTools/misc/bezierTools.py":324
  6331. * if ay2 != 0:
  6332. * roots.append(-by / ay2)
  6333. * points = [ # <<<<<<<<<<<<<<
  6334. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6335. * for t in roots
  6336. */
  6337. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L15_error)
  6338. __Pyx_GOTREF(__pyx_t_1);
  6339. /* "fontTools/misc/bezierTools.py":326
  6340. * points = [
  6341. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6342. * for t in roots # <<<<<<<<<<<<<<
  6343. * if 0 <= t < 1
  6344. * ] + [pt1, pt3]
  6345. */
  6346. __pyx_t_5 = __pyx_v_roots; __Pyx_INCREF(__pyx_t_5);
  6347. __pyx_t_12 = 0;
  6348. for (;;) {
  6349. {
  6350. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
  6351. #if !CYTHON_ASSUME_SAFE_SIZE
  6352. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 326, __pyx_L15_error)
  6353. #endif
  6354. if (__pyx_t_12 >= __pyx_temp) break;
  6355. }
  6356. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_12, __Pyx_ReferenceSharing_OwnStrongReference);
  6357. ++__pyx_t_12;
  6358. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L15_error)
  6359. __Pyx_GOTREF(__pyx_t_2);
  6360. __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_t, __pyx_t_2);
  6361. __pyx_t_2 = 0;
  6362. /* "fontTools/misc/bezierTools.py":327
  6363. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6364. * for t in roots
  6365. * if 0 <= t < 1 # <<<<<<<<<<<<<<
  6366. * ] + [pt1, pt3]
  6367. * return calcBounds(points)
  6368. */
  6369. __pyx_t_2 = PyObject_RichCompare(__pyx_mstate_global->__pyx_int_0, __pyx_7genexpr__pyx_v_t, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L15_error)
  6370. if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
  6371. __Pyx_DECREF(__pyx_t_2);
  6372. __pyx_t_2 = PyObject_RichCompare(__pyx_7genexpr__pyx_v_t, __pyx_mstate_global->__pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L15_error)
  6373. }
  6374. __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 327, __pyx_L15_error)
  6375. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6376. if (__pyx_t_10) {
  6377. /* "fontTools/misc/bezierTools.py":325
  6378. * roots.append(-by / ay2)
  6379. * points = [
  6380. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy) # <<<<<<<<<<<<<<
  6381. * for t in roots
  6382. * if 0 <= t < 1
  6383. */
  6384. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ax, __pyx_7genexpr__pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L15_error)
  6385. __Pyx_GOTREF(__pyx_t_2);
  6386. __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_7genexpr__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L15_error)
  6387. __Pyx_GOTREF(__pyx_t_3);
  6388. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6389. __pyx_t_2 = PyNumber_Multiply(__pyx_v_bx, __pyx_7genexpr__pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L15_error)
  6390. __Pyx_GOTREF(__pyx_t_2);
  6391. __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 325, __pyx_L15_error)
  6392. __Pyx_GOTREF(__pyx_t_8);
  6393. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6394. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6395. __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L15_error)
  6396. __Pyx_GOTREF(__pyx_t_2);
  6397. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6398. __pyx_t_8 = PyNumber_Multiply(__pyx_v_ay, __pyx_7genexpr__pyx_v_t); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 325, __pyx_L15_error)
  6399. __Pyx_GOTREF(__pyx_t_8);
  6400. __pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_7genexpr__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L15_error)
  6401. __Pyx_GOTREF(__pyx_t_3);
  6402. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6403. __pyx_t_8 = PyNumber_Multiply(__pyx_v_by, __pyx_7genexpr__pyx_v_t); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 325, __pyx_L15_error)
  6404. __Pyx_GOTREF(__pyx_t_8);
  6405. __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L15_error)
  6406. __Pyx_GOTREF(__pyx_t_6);
  6407. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6408. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6409. __pyx_t_8 = PyNumber_Add(__pyx_t_6, __pyx_v_cy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 325, __pyx_L15_error)
  6410. __Pyx_GOTREF(__pyx_t_8);
  6411. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6412. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L15_error)
  6413. __Pyx_GOTREF(__pyx_t_6);
  6414. __Pyx_GIVEREF(__pyx_t_2);
  6415. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 325, __pyx_L15_error);
  6416. __Pyx_GIVEREF(__pyx_t_8);
  6417. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8) != (0)) __PYX_ERR(0, 325, __pyx_L15_error);
  6418. __pyx_t_2 = 0;
  6419. __pyx_t_8 = 0;
  6420. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 324, __pyx_L15_error)
  6421. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6422. /* "fontTools/misc/bezierTools.py":327
  6423. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6424. * for t in roots
  6425. * if 0 <= t < 1 # <<<<<<<<<<<<<<
  6426. * ] + [pt1, pt3]
  6427. * return calcBounds(points)
  6428. */
  6429. }
  6430. /* "fontTools/misc/bezierTools.py":326
  6431. * points = [
  6432. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6433. * for t in roots # <<<<<<<<<<<<<<
  6434. * if 0 <= t < 1
  6435. * ] + [pt1, pt3]
  6436. */
  6437. }
  6438. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6439. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_t); __pyx_7genexpr__pyx_v_t = 0;
  6440. goto __pyx_L20_exit_scope;
  6441. __pyx_L15_error:;
  6442. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_t); __pyx_7genexpr__pyx_v_t = 0;
  6443. goto __pyx_L1_error;
  6444. __pyx_L20_exit_scope:;
  6445. } /* exit inner scope */
  6446. /* "fontTools/misc/bezierTools.py":328
  6447. * for t in roots
  6448. * if 0 <= t < 1
  6449. * ] + [pt1, pt3] # <<<<<<<<<<<<<<
  6450. * return calcBounds(points)
  6451. *
  6452. */
  6453. __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
  6454. __Pyx_GOTREF(__pyx_t_5);
  6455. __Pyx_INCREF(__pyx_v_pt1);
  6456. __Pyx_GIVEREF(__pyx_v_pt1);
  6457. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
  6458. __Pyx_INCREF(__pyx_v_pt3);
  6459. __Pyx_GIVEREF(__pyx_v_pt3);
  6460. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 1, __pyx_v_pt3) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
  6461. __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 328, __pyx_L1_error)
  6462. __Pyx_GOTREF(__pyx_t_6);
  6463. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6464. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6465. __pyx_v_points = ((PyObject*)__pyx_t_6);
  6466. __pyx_t_6 = 0;
  6467. /* "fontTools/misc/bezierTools.py":329
  6468. * if 0 <= t < 1
  6469. * ] + [pt1, pt3]
  6470. * return calcBounds(points) # <<<<<<<<<<<<<<
  6471. *
  6472. *
  6473. */
  6474. __Pyx_XDECREF(__pyx_r);
  6475. __pyx_t_5 = NULL;
  6476. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_calcBounds); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
  6477. __Pyx_GOTREF(__pyx_t_1);
  6478. __pyx_t_4 = 1;
  6479. #if CYTHON_UNPACK_METHODS
  6480. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  6481. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
  6482. assert(__pyx_t_5);
  6483. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  6484. __Pyx_INCREF(__pyx_t_5);
  6485. __Pyx_INCREF(__pyx__function);
  6486. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  6487. __pyx_t_4 = 0;
  6488. }
  6489. #endif
  6490. {
  6491. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_points};
  6492. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  6493. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  6494. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6495. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 329, __pyx_L1_error)
  6496. __Pyx_GOTREF(__pyx_t_6);
  6497. }
  6498. __pyx_r = __pyx_t_6;
  6499. __pyx_t_6 = 0;
  6500. goto __pyx_L0;
  6501. /* "fontTools/misc/bezierTools.py":298
  6502. *
  6503. *
  6504. * def calcQuadraticBounds(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  6505. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  6506. *
  6507. */
  6508. /* function exit code */
  6509. __pyx_L1_error:;
  6510. __Pyx_XDECREF(__pyx_t_1);
  6511. __Pyx_XDECREF(__pyx_t_2);
  6512. __Pyx_XDECREF(__pyx_t_3);
  6513. __Pyx_XDECREF(__pyx_t_5);
  6514. __Pyx_XDECREF(__pyx_t_6);
  6515. __Pyx_XDECREF(__pyx_t_8);
  6516. __Pyx_XDECREF(__pyx_t_9);
  6517. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6518. __pyx_r = NULL;
  6519. __pyx_L0:;
  6520. __Pyx_XDECREF(__pyx_v_ax);
  6521. __Pyx_XDECREF(__pyx_v_ay);
  6522. __Pyx_XDECREF(__pyx_v_bx);
  6523. __Pyx_XDECREF(__pyx_v_by);
  6524. __Pyx_XDECREF(__pyx_v_cx);
  6525. __Pyx_XDECREF(__pyx_v_cy);
  6526. __Pyx_XDECREF(__pyx_v_ax2);
  6527. __Pyx_XDECREF(__pyx_v_ay2);
  6528. __Pyx_XDECREF(__pyx_v_roots);
  6529. __Pyx_XDECREF(__pyx_v_points);
  6530. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_t);
  6531. __Pyx_XGIVEREF(__pyx_r);
  6532. __Pyx_RefNannyFinishContext();
  6533. return __pyx_r;
  6534. }
  6535. /* "fontTools/misc/bezierTools.py":332
  6536. *
  6537. *
  6538. * def approximateCubicArcLength(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  6539. * """Approximates the arc length for a cubic Bezier segment.
  6540. *
  6541. */
  6542. /* Python wrapper */
  6543. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_19approximateCubicArcLength(PyObject *__pyx_self,
  6544. #if CYTHON_METH_FASTCALL
  6545. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6546. #else
  6547. PyObject *__pyx_args, PyObject *__pyx_kwds
  6548. #endif
  6549. ); /*proto*/
  6550. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_18approximateCubicArcLength, "approximateCubicArcLength(pt1, pt2, pt3, pt4)\n\nApproximates the arc length for a cubic Bezier segment.\n\nUses Gauss-Lobatto quadrature with n=5 points to approximate arc length.\nSee :func:`calcCubicArcLength` for a slower but more accurate result.\n\nArgs:\n pt1,pt2,pt3,pt4: Control points of the Bezier as 2D tuples.\n\nReturns:\n Arc length value.\n\nExample::\n\n >>> approximateCubicArcLength((0, 0), (25, 100), (75, 100), (100, 0))\n 190.04332968932817\n >>> approximateCubicArcLength((0, 0), (50, 0), (100, 50), (100, 100))\n 154.8852074945903\n >>> approximateCubicArcLength((0, 0), (50, 0), (100, 0), (150, 0)) # line; exact result should be 150.\n 149.99999999999991\n >>> approximateCubicArcLength((0, 0), (50, 0), (100, 0), (-50, 0)) # cusp; exact result should be 150.\n 136.9267662156362\n >>> approximateCubicArcLength((0, 0), (50, 0), (100, -50), (-50, 0)) # cusp\n 154.80848416537057");
  6551. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_19approximateCubicArcLength = {"approximateCubicArcLength", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_19approximateCubicArcLength, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_18approximateCubicArcLength};
  6552. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_19approximateCubicArcLength(PyObject *__pyx_self,
  6553. #if CYTHON_METH_FASTCALL
  6554. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6555. #else
  6556. PyObject *__pyx_args, PyObject *__pyx_kwds
  6557. #endif
  6558. ) {
  6559. PyObject *__pyx_v_pt1 = 0;
  6560. PyObject *__pyx_v_pt2 = 0;
  6561. PyObject *__pyx_v_pt3 = 0;
  6562. PyObject *__pyx_v_pt4 = 0;
  6563. #if !CYTHON_METH_FASTCALL
  6564. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6565. #endif
  6566. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6567. PyObject* values[4] = {0,0,0,0};
  6568. int __pyx_lineno = 0;
  6569. const char *__pyx_filename = NULL;
  6570. int __pyx_clineno = 0;
  6571. PyObject *__pyx_r = 0;
  6572. __Pyx_RefNannyDeclarations
  6573. __Pyx_RefNannySetupContext("approximateCubicArcLength (wrapper)", 0);
  6574. #if !CYTHON_METH_FASTCALL
  6575. #if CYTHON_ASSUME_SAFE_SIZE
  6576. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6577. #else
  6578. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6579. #endif
  6580. #endif
  6581. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  6582. {
  6583. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,0};
  6584. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  6585. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 332, __pyx_L3_error)
  6586. if (__pyx_kwds_len > 0) {
  6587. switch (__pyx_nargs) {
  6588. case 4:
  6589. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6590. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 332, __pyx_L3_error)
  6591. CYTHON_FALLTHROUGH;
  6592. case 3:
  6593. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6594. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 332, __pyx_L3_error)
  6595. CYTHON_FALLTHROUGH;
  6596. case 2:
  6597. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6598. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 332, __pyx_L3_error)
  6599. CYTHON_FALLTHROUGH;
  6600. case 1:
  6601. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6602. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 332, __pyx_L3_error)
  6603. CYTHON_FALLTHROUGH;
  6604. case 0: break;
  6605. default: goto __pyx_L5_argtuple_error;
  6606. }
  6607. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  6608. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "approximateCubicArcLength", 0) < (0)) __PYX_ERR(0, 332, __pyx_L3_error)
  6609. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  6610. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("approximateCubicArcLength", 1, 4, 4, i); __PYX_ERR(0, 332, __pyx_L3_error) }
  6611. }
  6612. } else if (unlikely(__pyx_nargs != 4)) {
  6613. goto __pyx_L5_argtuple_error;
  6614. } else {
  6615. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6616. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 332, __pyx_L3_error)
  6617. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6618. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 332, __pyx_L3_error)
  6619. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6620. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 332, __pyx_L3_error)
  6621. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6622. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 332, __pyx_L3_error)
  6623. }
  6624. __pyx_v_pt1 = values[0];
  6625. __pyx_v_pt2 = values[1];
  6626. __pyx_v_pt3 = values[2];
  6627. __pyx_v_pt4 = values[3];
  6628. }
  6629. goto __pyx_L6_skip;
  6630. __pyx_L5_argtuple_error:;
  6631. __Pyx_RaiseArgtupleInvalid("approximateCubicArcLength", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 332, __pyx_L3_error)
  6632. __pyx_L6_skip:;
  6633. goto __pyx_L4_argument_unpacking_done;
  6634. __pyx_L3_error:;
  6635. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6636. Py_XDECREF(values[__pyx_temp]);
  6637. }
  6638. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateCubicArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6639. __Pyx_RefNannyFinishContext();
  6640. return NULL;
  6641. __pyx_L4_argument_unpacking_done:;
  6642. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_18approximateCubicArcLength(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4);
  6643. /* function exit code */
  6644. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6645. Py_XDECREF(values[__pyx_temp]);
  6646. }
  6647. __Pyx_RefNannyFinishContext();
  6648. return __pyx_r;
  6649. }
  6650. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_18approximateCubicArcLength(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4) {
  6651. PyObject *__pyx_r = NULL;
  6652. __Pyx_RefNannyDeclarations
  6653. PyObject *__pyx_t_1 = NULL;
  6654. PyObject *__pyx_t_2 = NULL;
  6655. PyObject *__pyx_t_3 = NULL;
  6656. PyObject *__pyx_t_4 = NULL;
  6657. PyObject *__pyx_t_5 = NULL;
  6658. PyObject *__pyx_t_6 = NULL;
  6659. PyObject *__pyx_t_7 = NULL;
  6660. PyObject *__pyx_t_8 = NULL;
  6661. size_t __pyx_t_9;
  6662. int __pyx_lineno = 0;
  6663. const char *__pyx_filename = NULL;
  6664. int __pyx_clineno = 0;
  6665. __Pyx_RefNannySetupContext("approximateCubicArcLength", 0);
  6666. /* "fontTools/misc/bezierTools.py":357
  6667. * 154.80848416537057
  6668. * """
  6669. * return approximateCubicArcLengthC( # <<<<<<<<<<<<<<
  6670. * complex(*pt1), complex(*pt2), complex(*pt3), complex(*pt4)
  6671. * )
  6672. */
  6673. __Pyx_XDECREF(__pyx_r);
  6674. __pyx_t_2 = NULL;
  6675. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_approximateCubicArcLengthC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error)
  6676. __Pyx_GOTREF(__pyx_t_3);
  6677. /* "fontTools/misc/bezierTools.py":358
  6678. * """
  6679. * return approximateCubicArcLengthC(
  6680. * complex(*pt1), complex(*pt2), complex(*pt3), complex(*pt4) # <<<<<<<<<<<<<<
  6681. * )
  6682. *
  6683. */
  6684. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
  6685. __Pyx_GOTREF(__pyx_t_4);
  6686. __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L1_error)
  6687. __Pyx_GOTREF(__pyx_t_5);
  6688. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6689. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
  6690. __Pyx_GOTREF(__pyx_t_4);
  6691. __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 358, __pyx_L1_error)
  6692. __Pyx_GOTREF(__pyx_t_6);
  6693. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6694. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
  6695. __Pyx_GOTREF(__pyx_t_4);
  6696. __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 358, __pyx_L1_error)
  6697. __Pyx_GOTREF(__pyx_t_7);
  6698. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6699. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
  6700. __Pyx_GOTREF(__pyx_t_4);
  6701. __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 358, __pyx_L1_error)
  6702. __Pyx_GOTREF(__pyx_t_8);
  6703. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6704. __pyx_t_9 = 1;
  6705. #if CYTHON_UNPACK_METHODS
  6706. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  6707. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  6708. assert(__pyx_t_2);
  6709. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  6710. __Pyx_INCREF(__pyx_t_2);
  6711. __Pyx_INCREF(__pyx__function);
  6712. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  6713. __pyx_t_9 = 0;
  6714. }
  6715. #endif
  6716. {
  6717. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8};
  6718. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_9, (5-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  6719. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  6720. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6721. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6722. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6723. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6724. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6725. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
  6726. __Pyx_GOTREF(__pyx_t_1);
  6727. }
  6728. __pyx_r = __pyx_t_1;
  6729. __pyx_t_1 = 0;
  6730. goto __pyx_L0;
  6731. /* "fontTools/misc/bezierTools.py":332
  6732. *
  6733. *
  6734. * def approximateCubicArcLength(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  6735. * """Approximates the arc length for a cubic Bezier segment.
  6736. *
  6737. */
  6738. /* function exit code */
  6739. __pyx_L1_error:;
  6740. __Pyx_XDECREF(__pyx_t_1);
  6741. __Pyx_XDECREF(__pyx_t_2);
  6742. __Pyx_XDECREF(__pyx_t_3);
  6743. __Pyx_XDECREF(__pyx_t_4);
  6744. __Pyx_XDECREF(__pyx_t_5);
  6745. __Pyx_XDECREF(__pyx_t_6);
  6746. __Pyx_XDECREF(__pyx_t_7);
  6747. __Pyx_XDECREF(__pyx_t_8);
  6748. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateCubicArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6749. __pyx_r = NULL;
  6750. __pyx_L0:;
  6751. __Pyx_XGIVEREF(__pyx_r);
  6752. __Pyx_RefNannyFinishContext();
  6753. return __pyx_r;
  6754. }
  6755. /* "fontTools/misc/bezierTools.py":362
  6756. *
  6757. *
  6758. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  6759. * @cython.locals(
  6760. * pt1=cython.complex,
  6761. */
  6762. /* Python wrapper */
  6763. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_21approximateCubicArcLengthC(PyObject *__pyx_self,
  6764. #if CYTHON_METH_FASTCALL
  6765. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6766. #else
  6767. PyObject *__pyx_args, PyObject *__pyx_kwds
  6768. #endif
  6769. ); /*proto*/
  6770. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_20approximateCubicArcLengthC, "approximateCubicArcLengthC(double complex pt1, double complex pt2, double complex pt3, double complex pt4)\n\nApproximates the arc length for a cubic Bezier segment.\n\nArgs:\n pt1,pt2,pt3,pt4: Control points of the Bezier as complex numbers.\n\nReturns:\n Arc length value.");
  6771. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_21approximateCubicArcLengthC = {"approximateCubicArcLengthC", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_21approximateCubicArcLengthC, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_20approximateCubicArcLengthC};
  6772. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_21approximateCubicArcLengthC(PyObject *__pyx_self,
  6773. #if CYTHON_METH_FASTCALL
  6774. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6775. #else
  6776. PyObject *__pyx_args, PyObject *__pyx_kwds
  6777. #endif
  6778. ) {
  6779. __pyx_t_double_complex __pyx_v_pt1;
  6780. __pyx_t_double_complex __pyx_v_pt2;
  6781. __pyx_t_double_complex __pyx_v_pt3;
  6782. __pyx_t_double_complex __pyx_v_pt4;
  6783. #if !CYTHON_METH_FASTCALL
  6784. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6785. #endif
  6786. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6787. PyObject* values[4] = {0,0,0,0};
  6788. int __pyx_lineno = 0;
  6789. const char *__pyx_filename = NULL;
  6790. int __pyx_clineno = 0;
  6791. PyObject *__pyx_r = 0;
  6792. __Pyx_RefNannyDeclarations
  6793. __Pyx_RefNannySetupContext("approximateCubicArcLengthC (wrapper)", 0);
  6794. #if !CYTHON_METH_FASTCALL
  6795. #if CYTHON_ASSUME_SAFE_SIZE
  6796. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6797. #else
  6798. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6799. #endif
  6800. #endif
  6801. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  6802. {
  6803. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,0};
  6804. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  6805. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 362, __pyx_L3_error)
  6806. if (__pyx_kwds_len > 0) {
  6807. switch (__pyx_nargs) {
  6808. case 4:
  6809. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6810. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 362, __pyx_L3_error)
  6811. CYTHON_FALLTHROUGH;
  6812. case 3:
  6813. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6814. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 362, __pyx_L3_error)
  6815. CYTHON_FALLTHROUGH;
  6816. case 2:
  6817. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6818. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 362, __pyx_L3_error)
  6819. CYTHON_FALLTHROUGH;
  6820. case 1:
  6821. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6822. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 362, __pyx_L3_error)
  6823. CYTHON_FALLTHROUGH;
  6824. case 0: break;
  6825. default: goto __pyx_L5_argtuple_error;
  6826. }
  6827. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  6828. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "approximateCubicArcLengthC", 0) < (0)) __PYX_ERR(0, 362, __pyx_L3_error)
  6829. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  6830. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("approximateCubicArcLengthC", 1, 4, 4, i); __PYX_ERR(0, 362, __pyx_L3_error) }
  6831. }
  6832. } else if (unlikely(__pyx_nargs != 4)) {
  6833. goto __pyx_L5_argtuple_error;
  6834. } else {
  6835. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6836. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 362, __pyx_L3_error)
  6837. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6838. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 362, __pyx_L3_error)
  6839. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6840. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 362, __pyx_L3_error)
  6841. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6842. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 362, __pyx_L3_error)
  6843. }
  6844. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L3_error)
  6845. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L3_error)
  6846. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L3_error)
  6847. __pyx_v_pt4 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L3_error)
  6848. }
  6849. goto __pyx_L6_skip;
  6850. __pyx_L5_argtuple_error:;
  6851. __Pyx_RaiseArgtupleInvalid("approximateCubicArcLengthC", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 362, __pyx_L3_error)
  6852. __pyx_L6_skip:;
  6853. goto __pyx_L4_argument_unpacking_done;
  6854. __pyx_L3_error:;
  6855. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6856. Py_XDECREF(values[__pyx_temp]);
  6857. }
  6858. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateCubicArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6859. __Pyx_RefNannyFinishContext();
  6860. return NULL;
  6861. __pyx_L4_argument_unpacking_done:;
  6862. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_20approximateCubicArcLengthC(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4);
  6863. /* function exit code */
  6864. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6865. Py_XDECREF(values[__pyx_temp]);
  6866. }
  6867. __Pyx_RefNannyFinishContext();
  6868. return __pyx_r;
  6869. }
  6870. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_20approximateCubicArcLengthC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4) {
  6871. double __pyx_v_v0;
  6872. double __pyx_v_v1;
  6873. double __pyx_v_v2;
  6874. double __pyx_v_v3;
  6875. double __pyx_v_v4;
  6876. PyObject *__pyx_r = NULL;
  6877. __Pyx_RefNannyDeclarations
  6878. PyObject *__pyx_t_1 = NULL;
  6879. int __pyx_lineno = 0;
  6880. const char *__pyx_filename = NULL;
  6881. int __pyx_clineno = 0;
  6882. __Pyx_RefNannySetupContext("approximateCubicArcLengthC", 0);
  6883. /* "fontTools/misc/bezierTools.py":393
  6884. * # abs(BezierCurveC[3].diff(t).subs({t:T})) for T in sorted(0, .5(3/7)**.5/2, .5, 1),
  6885. * # weighted 1/20, 49/180, 32/90, 49/180, 1/20 respectively.
  6886. * v0 = abs(pt2 - pt1) * 0.15 # <<<<<<<<<<<<<<
  6887. * v1 = abs(
  6888. * -0.558983582205757 * pt1
  6889. */
  6890. __pyx_v_v0 = (__Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_pt2, __pyx_v_pt1)) * 0.15);
  6891. /* "fontTools/misc/bezierTools.py":394
  6892. * # weighted 1/20, 49/180, 32/90, 49/180, 1/20 respectively.
  6893. * v0 = abs(pt2 - pt1) * 0.15
  6894. * v1 = abs( # <<<<<<<<<<<<<<
  6895. * -0.558983582205757 * pt1
  6896. * + 0.325650248872424 * pt2
  6897. */
  6898. __pyx_v_v1 = __Pyx_c_abs_double(__Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts(-0.558983582205757, 0), __pyx_v_pt1), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.325650248872424, 0), __pyx_v_pt2)), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.208983582205757, 0), __pyx_v_pt3)), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.024349751127576, 0), __pyx_v_pt4)));
  6899. /* "fontTools/misc/bezierTools.py":400
  6900. * + 0.024349751127576 * pt4
  6901. * )
  6902. * v2 = abs(pt4 - pt1 + pt3 - pt2) * 0.26666666666666666 # <<<<<<<<<<<<<<
  6903. * v3 = abs(
  6904. * -0.024349751127576 * pt1
  6905. */
  6906. __pyx_v_v2 = (__Pyx_c_abs_double(__Pyx_c_diff_double(__Pyx_c_sum_double(__Pyx_c_diff_double(__pyx_v_pt4, __pyx_v_pt1), __pyx_v_pt3), __pyx_v_pt2)) * 0.26666666666666666);
  6907. /* "fontTools/misc/bezierTools.py":401
  6908. * )
  6909. * v2 = abs(pt4 - pt1 + pt3 - pt2) * 0.26666666666666666
  6910. * v3 = abs( # <<<<<<<<<<<<<<
  6911. * -0.024349751127576 * pt1
  6912. * - 0.208983582205757 * pt2
  6913. */
  6914. __pyx_v_v3 = __Pyx_c_abs_double(__Pyx_c_sum_double(__Pyx_c_diff_double(__Pyx_c_diff_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts(-0.024349751127576, 0), __pyx_v_pt1), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.208983582205757, 0), __pyx_v_pt2)), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.325650248872424, 0), __pyx_v_pt3)), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(0.558983582205757, 0), __pyx_v_pt4)));
  6915. /* "fontTools/misc/bezierTools.py":407
  6916. * + 0.558983582205757 * pt4
  6917. * )
  6918. * v4 = abs(pt4 - pt3) * 0.15 # <<<<<<<<<<<<<<
  6919. *
  6920. * return v0 + v1 + v2 + v3 + v4
  6921. */
  6922. __pyx_v_v4 = (__Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_pt4, __pyx_v_pt3)) * 0.15);
  6923. /* "fontTools/misc/bezierTools.py":409
  6924. * v4 = abs(pt4 - pt3) * 0.15
  6925. *
  6926. * return v0 + v1 + v2 + v3 + v4 # <<<<<<<<<<<<<<
  6927. *
  6928. *
  6929. */
  6930. __Pyx_XDECREF(__pyx_r);
  6931. __pyx_t_1 = PyFloat_FromDouble(((((__pyx_v_v0 + __pyx_v_v1) + __pyx_v_v2) + __pyx_v_v3) + __pyx_v_v4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error)
  6932. __Pyx_GOTREF(__pyx_t_1);
  6933. __pyx_r = __pyx_t_1;
  6934. __pyx_t_1 = 0;
  6935. goto __pyx_L0;
  6936. /* "fontTools/misc/bezierTools.py":362
  6937. *
  6938. *
  6939. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  6940. * @cython.locals(
  6941. * pt1=cython.complex,
  6942. */
  6943. /* function exit code */
  6944. __pyx_L1_error:;
  6945. __Pyx_XDECREF(__pyx_t_1);
  6946. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateCubicArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6947. __pyx_r = NULL;
  6948. __pyx_L0:;
  6949. __Pyx_XGIVEREF(__pyx_r);
  6950. __Pyx_RefNannyFinishContext();
  6951. return __pyx_r;
  6952. }
  6953. /* "fontTools/misc/bezierTools.py":412
  6954. *
  6955. *
  6956. * def calcCubicBounds(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  6957. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  6958. *
  6959. */
  6960. /* Python wrapper */
  6961. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_23calcCubicBounds(PyObject *__pyx_self,
  6962. #if CYTHON_METH_FASTCALL
  6963. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6964. #else
  6965. PyObject *__pyx_args, PyObject *__pyx_kwds
  6966. #endif
  6967. ); /*proto*/
  6968. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_22calcCubicBounds, "calcCubicBounds(pt1, pt2, pt3, pt4)\n\nCalculates the bounding rectangle for a quadratic Bezier segment.\n\nArgs:\n pt1,pt2,pt3,pt4: Control points of the Bezier as 2D tuples.\n\nReturns:\n A four-item tuple representing the bounding rectangle ``(xMin, yMin, xMax, yMax)``.\n\nExample::\n\n >>> calcCubicBounds((0, 0), (25, 100), (75, 100), (100, 0))\n (0, 0, 100, 75.0)\n >>> calcCubicBounds((0, 0), (50, 0), (100, 50), (100, 100))\n (0.0, 0.0, 100, 100)\n >>> print(\"%f %f %f %f\" % calcCubicBounds((50, 0), (0, 100), (100, 100), (50, 0)))\n 35.566243 0.000000 64.433757 75.000000");
  6969. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_23calcCubicBounds = {"calcCubicBounds", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_23calcCubicBounds, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_22calcCubicBounds};
  6970. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_23calcCubicBounds(PyObject *__pyx_self,
  6971. #if CYTHON_METH_FASTCALL
  6972. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6973. #else
  6974. PyObject *__pyx_args, PyObject *__pyx_kwds
  6975. #endif
  6976. ) {
  6977. PyObject *__pyx_v_pt1 = 0;
  6978. PyObject *__pyx_v_pt2 = 0;
  6979. PyObject *__pyx_v_pt3 = 0;
  6980. PyObject *__pyx_v_pt4 = 0;
  6981. #if !CYTHON_METH_FASTCALL
  6982. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6983. #endif
  6984. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6985. PyObject* values[4] = {0,0,0,0};
  6986. int __pyx_lineno = 0;
  6987. const char *__pyx_filename = NULL;
  6988. int __pyx_clineno = 0;
  6989. PyObject *__pyx_r = 0;
  6990. __Pyx_RefNannyDeclarations
  6991. __Pyx_RefNannySetupContext("calcCubicBounds (wrapper)", 0);
  6992. #if !CYTHON_METH_FASTCALL
  6993. #if CYTHON_ASSUME_SAFE_SIZE
  6994. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6995. #else
  6996. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6997. #endif
  6998. #endif
  6999. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  7000. {
  7001. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,0};
  7002. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  7003. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 412, __pyx_L3_error)
  7004. if (__pyx_kwds_len > 0) {
  7005. switch (__pyx_nargs) {
  7006. case 4:
  7007. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  7008. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 412, __pyx_L3_error)
  7009. CYTHON_FALLTHROUGH;
  7010. case 3:
  7011. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7012. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 412, __pyx_L3_error)
  7013. CYTHON_FALLTHROUGH;
  7014. case 2:
  7015. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7016. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 412, __pyx_L3_error)
  7017. CYTHON_FALLTHROUGH;
  7018. case 1:
  7019. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7020. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 412, __pyx_L3_error)
  7021. CYTHON_FALLTHROUGH;
  7022. case 0: break;
  7023. default: goto __pyx_L5_argtuple_error;
  7024. }
  7025. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7026. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "calcCubicBounds", 0) < (0)) __PYX_ERR(0, 412, __pyx_L3_error)
  7027. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  7028. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcCubicBounds", 1, 4, 4, i); __PYX_ERR(0, 412, __pyx_L3_error) }
  7029. }
  7030. } else if (unlikely(__pyx_nargs != 4)) {
  7031. goto __pyx_L5_argtuple_error;
  7032. } else {
  7033. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7034. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 412, __pyx_L3_error)
  7035. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7036. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 412, __pyx_L3_error)
  7037. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7038. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 412, __pyx_L3_error)
  7039. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  7040. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 412, __pyx_L3_error)
  7041. }
  7042. __pyx_v_pt1 = values[0];
  7043. __pyx_v_pt2 = values[1];
  7044. __pyx_v_pt3 = values[2];
  7045. __pyx_v_pt4 = values[3];
  7046. }
  7047. goto __pyx_L6_skip;
  7048. __pyx_L5_argtuple_error:;
  7049. __Pyx_RaiseArgtupleInvalid("calcCubicBounds", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 412, __pyx_L3_error)
  7050. __pyx_L6_skip:;
  7051. goto __pyx_L4_argument_unpacking_done;
  7052. __pyx_L3_error:;
  7053. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7054. Py_XDECREF(values[__pyx_temp]);
  7055. }
  7056. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7057. __Pyx_RefNannyFinishContext();
  7058. return NULL;
  7059. __pyx_L4_argument_unpacking_done:;
  7060. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_22calcCubicBounds(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4);
  7061. /* function exit code */
  7062. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7063. Py_XDECREF(values[__pyx_temp]);
  7064. }
  7065. __Pyx_RefNannyFinishContext();
  7066. return __pyx_r;
  7067. }
  7068. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_22calcCubicBounds(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4) {
  7069. PyObject *__pyx_v_ax = NULL;
  7070. PyObject *__pyx_v_ay = NULL;
  7071. PyObject *__pyx_v_bx = NULL;
  7072. PyObject *__pyx_v_by = NULL;
  7073. PyObject *__pyx_v_cx = NULL;
  7074. PyObject *__pyx_v_cy = NULL;
  7075. PyObject *__pyx_v_dx = NULL;
  7076. PyObject *__pyx_v_dy = NULL;
  7077. PyObject *__pyx_v_ax3 = NULL;
  7078. PyObject *__pyx_v_ay3 = NULL;
  7079. PyObject *__pyx_v_bx2 = NULL;
  7080. PyObject *__pyx_v_by2 = NULL;
  7081. PyObject *__pyx_v_xRoots = NULL;
  7082. PyObject *__pyx_v_yRoots = NULL;
  7083. PyObject *__pyx_v_roots = NULL;
  7084. PyObject *__pyx_v_points = NULL;
  7085. PyObject *__pyx_8genexpr1__pyx_v_t = NULL;
  7086. PyObject *__pyx_8genexpr2__pyx_v_t = NULL;
  7087. PyObject *__pyx_8genexpr3__pyx_v_t = NULL;
  7088. PyObject *__pyx_r = NULL;
  7089. __Pyx_RefNannyDeclarations
  7090. PyObject *__pyx_t_1 = NULL;
  7091. PyObject *__pyx_t_2 = NULL;
  7092. PyObject *__pyx_t_3 = NULL;
  7093. size_t __pyx_t_4;
  7094. PyObject *__pyx_t_5 = NULL;
  7095. PyObject *__pyx_t_6 = NULL;
  7096. PyObject *__pyx_t_7 = NULL;
  7097. PyObject *(*__pyx_t_8)(PyObject *);
  7098. PyObject *__pyx_t_9 = NULL;
  7099. PyObject *__pyx_t_10 = NULL;
  7100. Py_ssize_t __pyx_t_11;
  7101. PyObject *(*__pyx_t_12)(PyObject *);
  7102. int __pyx_t_13;
  7103. int __pyx_lineno = 0;
  7104. const char *__pyx_filename = NULL;
  7105. int __pyx_clineno = 0;
  7106. __Pyx_RefNannySetupContext("calcCubicBounds", 0);
  7107. /* "fontTools/misc/bezierTools.py":430
  7108. * 35.566243 0.000000 64.433757 75.000000
  7109. * """
  7110. * (ax, ay), (bx, by), (cx, cy), (dx, dy) = calcCubicParameters(pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  7111. * # calc first derivative
  7112. * ax3 = ax * 3.0
  7113. */
  7114. __pyx_t_2 = NULL;
  7115. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcCubicParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error)
  7116. __Pyx_GOTREF(__pyx_t_3);
  7117. __pyx_t_4 = 1;
  7118. #if CYTHON_UNPACK_METHODS
  7119. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  7120. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  7121. assert(__pyx_t_2);
  7122. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  7123. __Pyx_INCREF(__pyx_t_2);
  7124. __Pyx_INCREF(__pyx__function);
  7125. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  7126. __pyx_t_4 = 0;
  7127. }
  7128. #endif
  7129. {
  7130. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4};
  7131. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  7132. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  7133. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7134. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
  7135. __Pyx_GOTREF(__pyx_t_1);
  7136. }
  7137. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  7138. PyObject* sequence = __pyx_t_1;
  7139. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7140. if (unlikely(size != 4)) {
  7141. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  7142. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7143. __PYX_ERR(0, 430, __pyx_L1_error)
  7144. }
  7145. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7146. if (likely(PyTuple_CheckExact(sequence))) {
  7147. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  7148. __Pyx_INCREF(__pyx_t_3);
  7149. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  7150. __Pyx_INCREF(__pyx_t_2);
  7151. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  7152. __Pyx_INCREF(__pyx_t_5);
  7153. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
  7154. __Pyx_INCREF(__pyx_t_6);
  7155. } else {
  7156. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  7157. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error)
  7158. __Pyx_XGOTREF(__pyx_t_3);
  7159. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  7160. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error)
  7161. __Pyx_XGOTREF(__pyx_t_2);
  7162. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  7163. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error)
  7164. __Pyx_XGOTREF(__pyx_t_5);
  7165. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  7166. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
  7167. __Pyx_XGOTREF(__pyx_t_6);
  7168. }
  7169. #else
  7170. {
  7171. Py_ssize_t i;
  7172. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  7173. for (i=0; i < 4; i++) {
  7174. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 430, __pyx_L1_error)
  7175. __Pyx_GOTREF(item);
  7176. *(temps[i]) = item;
  7177. }
  7178. }
  7179. #endif
  7180. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7181. } else {
  7182. Py_ssize_t index = -1;
  7183. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  7184. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7185. __Pyx_GOTREF(__pyx_t_7);
  7186. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7187. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  7188. for (index=0; index < 4; index++) {
  7189. PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
  7190. __Pyx_GOTREF(item);
  7191. *(temps[index]) = item;
  7192. }
  7193. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < (0)) __PYX_ERR(0, 430, __pyx_L1_error)
  7194. __pyx_t_8 = NULL;
  7195. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7196. goto __pyx_L4_unpacking_done;
  7197. __pyx_L3_unpacking_failed:;
  7198. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7199. __pyx_t_8 = NULL;
  7200. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7201. __PYX_ERR(0, 430, __pyx_L1_error)
  7202. __pyx_L4_unpacking_done:;
  7203. }
  7204. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  7205. PyObject* sequence = __pyx_t_3;
  7206. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7207. if (unlikely(size != 2)) {
  7208. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  7209. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7210. __PYX_ERR(0, 430, __pyx_L1_error)
  7211. }
  7212. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7213. if (likely(PyTuple_CheckExact(sequence))) {
  7214. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
  7215. __Pyx_INCREF(__pyx_t_7);
  7216. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
  7217. __Pyx_INCREF(__pyx_t_9);
  7218. } else {
  7219. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  7220. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7221. __Pyx_XGOTREF(__pyx_t_7);
  7222. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  7223. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7224. __Pyx_XGOTREF(__pyx_t_9);
  7225. }
  7226. #else
  7227. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7228. __Pyx_GOTREF(__pyx_t_7);
  7229. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7230. __Pyx_GOTREF(__pyx_t_9);
  7231. #endif
  7232. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7233. } else {
  7234. Py_ssize_t index = -1;
  7235. __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L1_error)
  7236. __Pyx_GOTREF(__pyx_t_10);
  7237. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7238. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  7239. index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
  7240. __Pyx_GOTREF(__pyx_t_7);
  7241. index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed;
  7242. __Pyx_GOTREF(__pyx_t_9);
  7243. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 430, __pyx_L1_error)
  7244. __pyx_t_8 = NULL;
  7245. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7246. goto __pyx_L6_unpacking_done;
  7247. __pyx_L5_unpacking_failed:;
  7248. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7249. __pyx_t_8 = NULL;
  7250. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7251. __PYX_ERR(0, 430, __pyx_L1_error)
  7252. __pyx_L6_unpacking_done:;
  7253. }
  7254. __pyx_v_ax = __pyx_t_7;
  7255. __pyx_t_7 = 0;
  7256. __pyx_v_ay = __pyx_t_9;
  7257. __pyx_t_9 = 0;
  7258. if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
  7259. PyObject* sequence = __pyx_t_2;
  7260. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7261. if (unlikely(size != 2)) {
  7262. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  7263. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7264. __PYX_ERR(0, 430, __pyx_L1_error)
  7265. }
  7266. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7267. if (likely(PyTuple_CheckExact(sequence))) {
  7268. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
  7269. __Pyx_INCREF(__pyx_t_9);
  7270. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
  7271. __Pyx_INCREF(__pyx_t_7);
  7272. } else {
  7273. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  7274. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7275. __Pyx_XGOTREF(__pyx_t_9);
  7276. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  7277. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7278. __Pyx_XGOTREF(__pyx_t_7);
  7279. }
  7280. #else
  7281. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7282. __Pyx_GOTREF(__pyx_t_9);
  7283. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7284. __Pyx_GOTREF(__pyx_t_7);
  7285. #endif
  7286. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7287. } else {
  7288. Py_ssize_t index = -1;
  7289. __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L1_error)
  7290. __Pyx_GOTREF(__pyx_t_10);
  7291. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7292. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  7293. index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed;
  7294. __Pyx_GOTREF(__pyx_t_9);
  7295. index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
  7296. __Pyx_GOTREF(__pyx_t_7);
  7297. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 430, __pyx_L1_error)
  7298. __pyx_t_8 = NULL;
  7299. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7300. goto __pyx_L8_unpacking_done;
  7301. __pyx_L7_unpacking_failed:;
  7302. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7303. __pyx_t_8 = NULL;
  7304. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7305. __PYX_ERR(0, 430, __pyx_L1_error)
  7306. __pyx_L8_unpacking_done:;
  7307. }
  7308. __pyx_v_bx = __pyx_t_9;
  7309. __pyx_t_9 = 0;
  7310. __pyx_v_by = __pyx_t_7;
  7311. __pyx_t_7 = 0;
  7312. if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
  7313. PyObject* sequence = __pyx_t_5;
  7314. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7315. if (unlikely(size != 2)) {
  7316. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  7317. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7318. __PYX_ERR(0, 430, __pyx_L1_error)
  7319. }
  7320. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7321. if (likely(PyTuple_CheckExact(sequence))) {
  7322. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
  7323. __Pyx_INCREF(__pyx_t_7);
  7324. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
  7325. __Pyx_INCREF(__pyx_t_9);
  7326. } else {
  7327. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  7328. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7329. __Pyx_XGOTREF(__pyx_t_7);
  7330. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  7331. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7332. __Pyx_XGOTREF(__pyx_t_9);
  7333. }
  7334. #else
  7335. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7336. __Pyx_GOTREF(__pyx_t_7);
  7337. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7338. __Pyx_GOTREF(__pyx_t_9);
  7339. #endif
  7340. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7341. } else {
  7342. Py_ssize_t index = -1;
  7343. __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L1_error)
  7344. __Pyx_GOTREF(__pyx_t_10);
  7345. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7346. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  7347. index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L9_unpacking_failed;
  7348. __Pyx_GOTREF(__pyx_t_7);
  7349. index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed;
  7350. __Pyx_GOTREF(__pyx_t_9);
  7351. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 430, __pyx_L1_error)
  7352. __pyx_t_8 = NULL;
  7353. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7354. goto __pyx_L10_unpacking_done;
  7355. __pyx_L9_unpacking_failed:;
  7356. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7357. __pyx_t_8 = NULL;
  7358. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7359. __PYX_ERR(0, 430, __pyx_L1_error)
  7360. __pyx_L10_unpacking_done:;
  7361. }
  7362. __pyx_v_cx = __pyx_t_7;
  7363. __pyx_t_7 = 0;
  7364. __pyx_v_cy = __pyx_t_9;
  7365. __pyx_t_9 = 0;
  7366. if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
  7367. PyObject* sequence = __pyx_t_6;
  7368. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7369. if (unlikely(size != 2)) {
  7370. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  7371. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7372. __PYX_ERR(0, 430, __pyx_L1_error)
  7373. }
  7374. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7375. if (likely(PyTuple_CheckExact(sequence))) {
  7376. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
  7377. __Pyx_INCREF(__pyx_t_9);
  7378. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
  7379. __Pyx_INCREF(__pyx_t_7);
  7380. } else {
  7381. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  7382. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7383. __Pyx_XGOTREF(__pyx_t_9);
  7384. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  7385. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7386. __Pyx_XGOTREF(__pyx_t_7);
  7387. }
  7388. #else
  7389. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7390. __Pyx_GOTREF(__pyx_t_9);
  7391. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7392. __Pyx_GOTREF(__pyx_t_7);
  7393. #endif
  7394. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7395. } else {
  7396. Py_ssize_t index = -1;
  7397. __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L1_error)
  7398. __Pyx_GOTREF(__pyx_t_10);
  7399. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7400. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  7401. index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
  7402. __Pyx_GOTREF(__pyx_t_9);
  7403. index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
  7404. __Pyx_GOTREF(__pyx_t_7);
  7405. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 430, __pyx_L1_error)
  7406. __pyx_t_8 = NULL;
  7407. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7408. goto __pyx_L12_unpacking_done;
  7409. __pyx_L11_unpacking_failed:;
  7410. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7411. __pyx_t_8 = NULL;
  7412. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7413. __PYX_ERR(0, 430, __pyx_L1_error)
  7414. __pyx_L12_unpacking_done:;
  7415. }
  7416. __pyx_v_dx = __pyx_t_9;
  7417. __pyx_t_9 = 0;
  7418. __pyx_v_dy = __pyx_t_7;
  7419. __pyx_t_7 = 0;
  7420. /* "fontTools/misc/bezierTools.py":432
  7421. * (ax, ay), (bx, by), (cx, cy), (dx, dy) = calcCubicParameters(pt1, pt2, pt3, pt4)
  7422. * # calc first derivative
  7423. * ax3 = ax * 3.0 # <<<<<<<<<<<<<<
  7424. * ay3 = ay * 3.0
  7425. * bx2 = bx * 2.0
  7426. */
  7427. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ax, __pyx_mstate_global->__pyx_float_3_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
  7428. __Pyx_GOTREF(__pyx_t_1);
  7429. __pyx_v_ax3 = __pyx_t_1;
  7430. __pyx_t_1 = 0;
  7431. /* "fontTools/misc/bezierTools.py":433
  7432. * # calc first derivative
  7433. * ax3 = ax * 3.0
  7434. * ay3 = ay * 3.0 # <<<<<<<<<<<<<<
  7435. * bx2 = bx * 2.0
  7436. * by2 = by * 2.0
  7437. */
  7438. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ay, __pyx_mstate_global->__pyx_float_3_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error)
  7439. __Pyx_GOTREF(__pyx_t_1);
  7440. __pyx_v_ay3 = __pyx_t_1;
  7441. __pyx_t_1 = 0;
  7442. /* "fontTools/misc/bezierTools.py":434
  7443. * ax3 = ax * 3.0
  7444. * ay3 = ay * 3.0
  7445. * bx2 = bx * 2.0 # <<<<<<<<<<<<<<
  7446. * by2 = by * 2.0
  7447. * xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1]
  7448. */
  7449. __pyx_t_1 = PyNumber_Multiply(__pyx_v_bx, __pyx_mstate_global->__pyx_float_2_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error)
  7450. __Pyx_GOTREF(__pyx_t_1);
  7451. __pyx_v_bx2 = __pyx_t_1;
  7452. __pyx_t_1 = 0;
  7453. /* "fontTools/misc/bezierTools.py":435
  7454. * ay3 = ay * 3.0
  7455. * bx2 = bx * 2.0
  7456. * by2 = by * 2.0 # <<<<<<<<<<<<<<
  7457. * xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1]
  7458. * yRoots = [t for t in solveQuadratic(ay3, by2, cy) if 0 <= t < 1]
  7459. */
  7460. __pyx_t_1 = PyNumber_Multiply(__pyx_v_by, __pyx_mstate_global->__pyx_float_2_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error)
  7461. __Pyx_GOTREF(__pyx_t_1);
  7462. __pyx_v_by2 = __pyx_t_1;
  7463. __pyx_t_1 = 0;
  7464. /* "fontTools/misc/bezierTools.py":436
  7465. * bx2 = bx * 2.0
  7466. * by2 = by * 2.0
  7467. * xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1] # <<<<<<<<<<<<<<
  7468. * yRoots = [t for t in solveQuadratic(ay3, by2, cy) if 0 <= t < 1]
  7469. * roots = xRoots + yRoots
  7470. */
  7471. { /* enter inner scope */
  7472. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L15_error)
  7473. __Pyx_GOTREF(__pyx_t_1);
  7474. __pyx_t_5 = NULL;
  7475. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_solveQuadratic); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L15_error)
  7476. __Pyx_GOTREF(__pyx_t_2);
  7477. __pyx_t_4 = 1;
  7478. #if CYTHON_UNPACK_METHODS
  7479. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  7480. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  7481. assert(__pyx_t_5);
  7482. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  7483. __Pyx_INCREF(__pyx_t_5);
  7484. __Pyx_INCREF(__pyx__function);
  7485. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  7486. __pyx_t_4 = 0;
  7487. }
  7488. #endif
  7489. {
  7490. PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_ax3, __pyx_v_bx2, __pyx_v_cx};
  7491. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  7492. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7493. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7494. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L15_error)
  7495. __Pyx_GOTREF(__pyx_t_6);
  7496. }
  7497. if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
  7498. __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2);
  7499. __pyx_t_11 = 0;
  7500. __pyx_t_12 = NULL;
  7501. } else {
  7502. __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L15_error)
  7503. __Pyx_GOTREF(__pyx_t_2);
  7504. __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 436, __pyx_L15_error)
  7505. }
  7506. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7507. for (;;) {
  7508. if (likely(!__pyx_t_12)) {
  7509. if (likely(PyList_CheckExact(__pyx_t_2))) {
  7510. {
  7511. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
  7512. #if !CYTHON_ASSUME_SAFE_SIZE
  7513. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 436, __pyx_L15_error)
  7514. #endif
  7515. if (__pyx_t_11 >= __pyx_temp) break;
  7516. }
  7517. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference);
  7518. ++__pyx_t_11;
  7519. } else {
  7520. {
  7521. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
  7522. #if !CYTHON_ASSUME_SAFE_SIZE
  7523. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 436, __pyx_L15_error)
  7524. #endif
  7525. if (__pyx_t_11 >= __pyx_temp) break;
  7526. }
  7527. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7528. __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11));
  7529. #else
  7530. __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_11);
  7531. #endif
  7532. ++__pyx_t_11;
  7533. }
  7534. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L15_error)
  7535. } else {
  7536. __pyx_t_6 = __pyx_t_12(__pyx_t_2);
  7537. if (unlikely(!__pyx_t_6)) {
  7538. PyObject* exc_type = PyErr_Occurred();
  7539. if (exc_type) {
  7540. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 436, __pyx_L15_error)
  7541. PyErr_Clear();
  7542. }
  7543. break;
  7544. }
  7545. }
  7546. __Pyx_GOTREF(__pyx_t_6);
  7547. __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_t, __pyx_t_6);
  7548. __pyx_t_6 = 0;
  7549. __pyx_t_6 = PyObject_RichCompare(__pyx_mstate_global->__pyx_int_0, __pyx_8genexpr1__pyx_v_t, Py_LE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L15_error)
  7550. if (__Pyx_PyObject_IsTrue(__pyx_t_6)) {
  7551. __Pyx_DECREF(__pyx_t_6);
  7552. __pyx_t_6 = PyObject_RichCompare(__pyx_8genexpr1__pyx_v_t, __pyx_mstate_global->__pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L15_error)
  7553. }
  7554. __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 436, __pyx_L15_error)
  7555. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7556. if (__pyx_t_13) {
  7557. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr1__pyx_v_t))) __PYX_ERR(0, 436, __pyx_L15_error)
  7558. }
  7559. }
  7560. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7561. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_t); __pyx_8genexpr1__pyx_v_t = 0;
  7562. goto __pyx_L20_exit_scope;
  7563. __pyx_L15_error:;
  7564. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_t); __pyx_8genexpr1__pyx_v_t = 0;
  7565. goto __pyx_L1_error;
  7566. __pyx_L20_exit_scope:;
  7567. } /* exit inner scope */
  7568. __pyx_v_xRoots = ((PyObject*)__pyx_t_1);
  7569. __pyx_t_1 = 0;
  7570. /* "fontTools/misc/bezierTools.py":437
  7571. * by2 = by * 2.0
  7572. * xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1]
  7573. * yRoots = [t for t in solveQuadratic(ay3, by2, cy) if 0 <= t < 1] # <<<<<<<<<<<<<<
  7574. * roots = xRoots + yRoots
  7575. *
  7576. */
  7577. { /* enter inner scope */
  7578. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L23_error)
  7579. __Pyx_GOTREF(__pyx_t_1);
  7580. __pyx_t_6 = NULL;
  7581. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_solveQuadratic); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L23_error)
  7582. __Pyx_GOTREF(__pyx_t_5);
  7583. __pyx_t_4 = 1;
  7584. #if CYTHON_UNPACK_METHODS
  7585. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  7586. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
  7587. assert(__pyx_t_6);
  7588. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  7589. __Pyx_INCREF(__pyx_t_6);
  7590. __Pyx_INCREF(__pyx__function);
  7591. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  7592. __pyx_t_4 = 0;
  7593. }
  7594. #endif
  7595. {
  7596. PyObject *__pyx_callargs[4] = {__pyx_t_6, __pyx_v_ay3, __pyx_v_by2, __pyx_v_cy};
  7597. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  7598. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  7599. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7600. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L23_error)
  7601. __Pyx_GOTREF(__pyx_t_2);
  7602. }
  7603. if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
  7604. __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5);
  7605. __pyx_t_11 = 0;
  7606. __pyx_t_12 = NULL;
  7607. } else {
  7608. __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L23_error)
  7609. __Pyx_GOTREF(__pyx_t_5);
  7610. __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 437, __pyx_L23_error)
  7611. }
  7612. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7613. for (;;) {
  7614. if (likely(!__pyx_t_12)) {
  7615. if (likely(PyList_CheckExact(__pyx_t_5))) {
  7616. {
  7617. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
  7618. #if !CYTHON_ASSUME_SAFE_SIZE
  7619. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 437, __pyx_L23_error)
  7620. #endif
  7621. if (__pyx_t_11 >= __pyx_temp) break;
  7622. }
  7623. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference);
  7624. ++__pyx_t_11;
  7625. } else {
  7626. {
  7627. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
  7628. #if !CYTHON_ASSUME_SAFE_SIZE
  7629. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 437, __pyx_L23_error)
  7630. #endif
  7631. if (__pyx_t_11 >= __pyx_temp) break;
  7632. }
  7633. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7634. __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11));
  7635. #else
  7636. __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_11);
  7637. #endif
  7638. ++__pyx_t_11;
  7639. }
  7640. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L23_error)
  7641. } else {
  7642. __pyx_t_2 = __pyx_t_12(__pyx_t_5);
  7643. if (unlikely(!__pyx_t_2)) {
  7644. PyObject* exc_type = PyErr_Occurred();
  7645. if (exc_type) {
  7646. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 437, __pyx_L23_error)
  7647. PyErr_Clear();
  7648. }
  7649. break;
  7650. }
  7651. }
  7652. __Pyx_GOTREF(__pyx_t_2);
  7653. __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_t, __pyx_t_2);
  7654. __pyx_t_2 = 0;
  7655. __pyx_t_2 = PyObject_RichCompare(__pyx_mstate_global->__pyx_int_0, __pyx_8genexpr2__pyx_v_t, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L23_error)
  7656. if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
  7657. __Pyx_DECREF(__pyx_t_2);
  7658. __pyx_t_2 = PyObject_RichCompare(__pyx_8genexpr2__pyx_v_t, __pyx_mstate_global->__pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L23_error)
  7659. }
  7660. __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 437, __pyx_L23_error)
  7661. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7662. if (__pyx_t_13) {
  7663. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr2__pyx_v_t))) __PYX_ERR(0, 437, __pyx_L23_error)
  7664. }
  7665. }
  7666. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7667. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_t); __pyx_8genexpr2__pyx_v_t = 0;
  7668. goto __pyx_L28_exit_scope;
  7669. __pyx_L23_error:;
  7670. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_t); __pyx_8genexpr2__pyx_v_t = 0;
  7671. goto __pyx_L1_error;
  7672. __pyx_L28_exit_scope:;
  7673. } /* exit inner scope */
  7674. __pyx_v_yRoots = ((PyObject*)__pyx_t_1);
  7675. __pyx_t_1 = 0;
  7676. /* "fontTools/misc/bezierTools.py":438
  7677. * xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1]
  7678. * yRoots = [t for t in solveQuadratic(ay3, by2, cy) if 0 <= t < 1]
  7679. * roots = xRoots + yRoots # <<<<<<<<<<<<<<
  7680. *
  7681. * points = [
  7682. */
  7683. __pyx_t_1 = PyNumber_Add(__pyx_v_xRoots, __pyx_v_yRoots); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error)
  7684. __Pyx_GOTREF(__pyx_t_1);
  7685. __pyx_v_roots = ((PyObject*)__pyx_t_1);
  7686. __pyx_t_1 = 0;
  7687. /* "fontTools/misc/bezierTools.py":446
  7688. * )
  7689. * for t in roots
  7690. * ] + [pt1, pt4] # <<<<<<<<<<<<<<
  7691. * return calcBounds(points)
  7692. *
  7693. */
  7694. { /* enter inner scope */
  7695. /* "fontTools/misc/bezierTools.py":440
  7696. * roots = xRoots + yRoots
  7697. *
  7698. * points = [ # <<<<<<<<<<<<<<
  7699. * (
  7700. * ax * t * t * t + bx * t * t + cx * t + dx,
  7701. */
  7702. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L31_error)
  7703. __Pyx_GOTREF(__pyx_t_1);
  7704. /* "fontTools/misc/bezierTools.py":445
  7705. * ay * t * t * t + by * t * t + cy * t + dy,
  7706. * )
  7707. * for t in roots # <<<<<<<<<<<<<<
  7708. * ] + [pt1, pt4]
  7709. * return calcBounds(points)
  7710. */
  7711. __pyx_t_5 = __pyx_v_roots; __Pyx_INCREF(__pyx_t_5);
  7712. __pyx_t_11 = 0;
  7713. for (;;) {
  7714. {
  7715. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
  7716. #if !CYTHON_ASSUME_SAFE_SIZE
  7717. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 445, __pyx_L31_error)
  7718. #endif
  7719. if (__pyx_t_11 >= __pyx_temp) break;
  7720. }
  7721. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference);
  7722. ++__pyx_t_11;
  7723. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L31_error)
  7724. __Pyx_GOTREF(__pyx_t_2);
  7725. __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_t, __pyx_t_2);
  7726. __pyx_t_2 = 0;
  7727. /* "fontTools/misc/bezierTools.py":442
  7728. * points = [
  7729. * (
  7730. * ax * t * t * t + bx * t * t + cx * t + dx, # <<<<<<<<<<<<<<
  7731. * ay * t * t * t + by * t * t + cy * t + dy,
  7732. * )
  7733. */
  7734. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ax, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L31_error)
  7735. __Pyx_GOTREF(__pyx_t_2);
  7736. __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 442, __pyx_L31_error)
  7737. __Pyx_GOTREF(__pyx_t_6);
  7738. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7739. __pyx_t_2 = PyNumber_Multiply(__pyx_t_6, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L31_error)
  7740. __Pyx_GOTREF(__pyx_t_2);
  7741. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7742. __pyx_t_6 = PyNumber_Multiply(__pyx_v_bx, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 442, __pyx_L31_error)
  7743. __Pyx_GOTREF(__pyx_t_6);
  7744. __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L31_error)
  7745. __Pyx_GOTREF(__pyx_t_3);
  7746. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7747. __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 442, __pyx_L31_error)
  7748. __Pyx_GOTREF(__pyx_t_6);
  7749. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7750. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7751. __pyx_t_3 = PyNumber_Multiply(__pyx_v_cx, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L31_error)
  7752. __Pyx_GOTREF(__pyx_t_3);
  7753. __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L31_error)
  7754. __Pyx_GOTREF(__pyx_t_2);
  7755. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7756. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7757. __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_dx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L31_error)
  7758. __Pyx_GOTREF(__pyx_t_3);
  7759. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7760. /* "fontTools/misc/bezierTools.py":443
  7761. * (
  7762. * ax * t * t * t + bx * t * t + cx * t + dx,
  7763. * ay * t * t * t + by * t * t + cy * t + dy, # <<<<<<<<<<<<<<
  7764. * )
  7765. * for t in roots
  7766. */
  7767. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ay, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L31_error)
  7768. __Pyx_GOTREF(__pyx_t_2);
  7769. __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L31_error)
  7770. __Pyx_GOTREF(__pyx_t_6);
  7771. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7772. __pyx_t_2 = PyNumber_Multiply(__pyx_t_6, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L31_error)
  7773. __Pyx_GOTREF(__pyx_t_2);
  7774. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7775. __pyx_t_6 = PyNumber_Multiply(__pyx_v_by, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L31_error)
  7776. __Pyx_GOTREF(__pyx_t_6);
  7777. __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 443, __pyx_L31_error)
  7778. __Pyx_GOTREF(__pyx_t_7);
  7779. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7780. __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L31_error)
  7781. __Pyx_GOTREF(__pyx_t_6);
  7782. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7783. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7784. __pyx_t_7 = PyNumber_Multiply(__pyx_v_cy, __pyx_8genexpr3__pyx_v_t); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 443, __pyx_L31_error)
  7785. __Pyx_GOTREF(__pyx_t_7);
  7786. __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L31_error)
  7787. __Pyx_GOTREF(__pyx_t_2);
  7788. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7789. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7790. __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_v_dy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 443, __pyx_L31_error)
  7791. __Pyx_GOTREF(__pyx_t_7);
  7792. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7793. /* "fontTools/misc/bezierTools.py":442
  7794. * points = [
  7795. * (
  7796. * ax * t * t * t + bx * t * t + cx * t + dx, # <<<<<<<<<<<<<<
  7797. * ay * t * t * t + by * t * t + cy * t + dy,
  7798. * )
  7799. */
  7800. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L31_error)
  7801. __Pyx_GOTREF(__pyx_t_2);
  7802. __Pyx_GIVEREF(__pyx_t_3);
  7803. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 442, __pyx_L31_error);
  7804. __Pyx_GIVEREF(__pyx_t_7);
  7805. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 442, __pyx_L31_error);
  7806. __pyx_t_3 = 0;
  7807. __pyx_t_7 = 0;
  7808. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 440, __pyx_L31_error)
  7809. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7810. /* "fontTools/misc/bezierTools.py":445
  7811. * ay * t * t * t + by * t * t + cy * t + dy,
  7812. * )
  7813. * for t in roots # <<<<<<<<<<<<<<
  7814. * ] + [pt1, pt4]
  7815. * return calcBounds(points)
  7816. */
  7817. }
  7818. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7819. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_t); __pyx_8genexpr3__pyx_v_t = 0;
  7820. goto __pyx_L35_exit_scope;
  7821. __pyx_L31_error:;
  7822. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_t); __pyx_8genexpr3__pyx_v_t = 0;
  7823. goto __pyx_L1_error;
  7824. __pyx_L35_exit_scope:;
  7825. } /* exit inner scope */
  7826. /* "fontTools/misc/bezierTools.py":446
  7827. * )
  7828. * for t in roots
  7829. * ] + [pt1, pt4] # <<<<<<<<<<<<<<
  7830. * return calcBounds(points)
  7831. *
  7832. */
  7833. __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
  7834. __Pyx_GOTREF(__pyx_t_5);
  7835. __Pyx_INCREF(__pyx_v_pt1);
  7836. __Pyx_GIVEREF(__pyx_v_pt1);
  7837. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 446, __pyx_L1_error);
  7838. __Pyx_INCREF(__pyx_v_pt4);
  7839. __Pyx_GIVEREF(__pyx_v_pt4);
  7840. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 1, __pyx_v_pt4) != (0)) __PYX_ERR(0, 446, __pyx_L1_error);
  7841. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
  7842. __Pyx_GOTREF(__pyx_t_2);
  7843. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7844. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7845. __pyx_v_points = ((PyObject*)__pyx_t_2);
  7846. __pyx_t_2 = 0;
  7847. /* "fontTools/misc/bezierTools.py":447
  7848. * for t in roots
  7849. * ] + [pt1, pt4]
  7850. * return calcBounds(points) # <<<<<<<<<<<<<<
  7851. *
  7852. *
  7853. */
  7854. __Pyx_XDECREF(__pyx_r);
  7855. __pyx_t_5 = NULL;
  7856. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_calcBounds); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
  7857. __Pyx_GOTREF(__pyx_t_1);
  7858. __pyx_t_4 = 1;
  7859. #if CYTHON_UNPACK_METHODS
  7860. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  7861. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
  7862. assert(__pyx_t_5);
  7863. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  7864. __Pyx_INCREF(__pyx_t_5);
  7865. __Pyx_INCREF(__pyx__function);
  7866. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  7867. __pyx_t_4 = 0;
  7868. }
  7869. #endif
  7870. {
  7871. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_points};
  7872. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  7873. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7874. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7875. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
  7876. __Pyx_GOTREF(__pyx_t_2);
  7877. }
  7878. __pyx_r = __pyx_t_2;
  7879. __pyx_t_2 = 0;
  7880. goto __pyx_L0;
  7881. /* "fontTools/misc/bezierTools.py":412
  7882. *
  7883. *
  7884. * def calcCubicBounds(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  7885. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  7886. *
  7887. */
  7888. /* function exit code */
  7889. __pyx_L1_error:;
  7890. __Pyx_XDECREF(__pyx_t_1);
  7891. __Pyx_XDECREF(__pyx_t_2);
  7892. __Pyx_XDECREF(__pyx_t_3);
  7893. __Pyx_XDECREF(__pyx_t_5);
  7894. __Pyx_XDECREF(__pyx_t_6);
  7895. __Pyx_XDECREF(__pyx_t_7);
  7896. __Pyx_XDECREF(__pyx_t_9);
  7897. __Pyx_XDECREF(__pyx_t_10);
  7898. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7899. __pyx_r = NULL;
  7900. __pyx_L0:;
  7901. __Pyx_XDECREF(__pyx_v_ax);
  7902. __Pyx_XDECREF(__pyx_v_ay);
  7903. __Pyx_XDECREF(__pyx_v_bx);
  7904. __Pyx_XDECREF(__pyx_v_by);
  7905. __Pyx_XDECREF(__pyx_v_cx);
  7906. __Pyx_XDECREF(__pyx_v_cy);
  7907. __Pyx_XDECREF(__pyx_v_dx);
  7908. __Pyx_XDECREF(__pyx_v_dy);
  7909. __Pyx_XDECREF(__pyx_v_ax3);
  7910. __Pyx_XDECREF(__pyx_v_ay3);
  7911. __Pyx_XDECREF(__pyx_v_bx2);
  7912. __Pyx_XDECREF(__pyx_v_by2);
  7913. __Pyx_XDECREF(__pyx_v_xRoots);
  7914. __Pyx_XDECREF(__pyx_v_yRoots);
  7915. __Pyx_XDECREF(__pyx_v_roots);
  7916. __Pyx_XDECREF(__pyx_v_points);
  7917. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_t);
  7918. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_t);
  7919. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_t);
  7920. __Pyx_XGIVEREF(__pyx_r);
  7921. __Pyx_RefNannyFinishContext();
  7922. return __pyx_r;
  7923. }
  7924. /* "fontTools/misc/bezierTools.py":450
  7925. *
  7926. *
  7927. * def splitLine(pt1, pt2, where, isHorizontal): # <<<<<<<<<<<<<<
  7928. * """Split a line at a given coordinate.
  7929. *
  7930. */
  7931. /* Python wrapper */
  7932. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_25splitLine(PyObject *__pyx_self,
  7933. #if CYTHON_METH_FASTCALL
  7934. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7935. #else
  7936. PyObject *__pyx_args, PyObject *__pyx_kwds
  7937. #endif
  7938. ); /*proto*/
  7939. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_24splitLine, "splitLine(pt1, pt2, where, isHorizontal)\n\nSplit a line at a given coordinate.\n\nArgs:\n pt1: Start point of line as 2D tuple.\n pt2: End point of line as 2D tuple.\n where: Position at which to split the line.\n isHorizontal: Direction of the ray splitting the line. If true,\n ``where`` is interpreted as a Y coordinate; if false, then\n ``where`` is interpreted as an X coordinate.\n\nReturns:\n A list of two line segments (each line segment being two 2D tuples)\n if the line was successfully split, or a list containing the original\n line.\n\nExample::\n\n >>> printSegments(splitLine((0, 0), (100, 100), 50, True))\n ((0, 0), (50, 50))\n ((50, 50), (100, 100))\n >>> printSegments(splitLine((0, 0), (100, 100), 100, True))\n ((0, 0), (100, 100))\n >>> printSegments(splitLine((0, 0), (100, 100), 0, True))\n ((0, 0), (0, 0))\n ((0, 0), (100, 100))\n >>> printSegments(splitLine((0, 0), (100, 100), 0, False))\n ((0, 0), (0, 0))\n ((0, 0), (100, 100))\n >>> printSegments(splitLine((100, 0), (0, 0), 50, False))\n ((100, 0), (50, 0))\n ((50, 0), (0, 0))\n >>> printSegments(splitLine((0, 100), (0, 0), 50, True))\n ((0, 100), (0, 50))\n ((0, 50), (0, 0))");
  7940. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_25splitLine = {"splitLine", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_25splitLine, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_24splitLine};
  7941. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_25splitLine(PyObject *__pyx_self,
  7942. #if CYTHON_METH_FASTCALL
  7943. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7944. #else
  7945. PyObject *__pyx_args, PyObject *__pyx_kwds
  7946. #endif
  7947. ) {
  7948. PyObject *__pyx_v_pt1 = 0;
  7949. PyObject *__pyx_v_pt2 = 0;
  7950. PyObject *__pyx_v_where = 0;
  7951. PyObject *__pyx_v_isHorizontal = 0;
  7952. #if !CYTHON_METH_FASTCALL
  7953. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  7954. #endif
  7955. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  7956. PyObject* values[4] = {0,0,0,0};
  7957. int __pyx_lineno = 0;
  7958. const char *__pyx_filename = NULL;
  7959. int __pyx_clineno = 0;
  7960. PyObject *__pyx_r = 0;
  7961. __Pyx_RefNannyDeclarations
  7962. __Pyx_RefNannySetupContext("splitLine (wrapper)", 0);
  7963. #if !CYTHON_METH_FASTCALL
  7964. #if CYTHON_ASSUME_SAFE_SIZE
  7965. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  7966. #else
  7967. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  7968. #endif
  7969. #endif
  7970. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  7971. {
  7972. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_where,&__pyx_mstate_global->__pyx_n_u_isHorizontal,0};
  7973. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  7974. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 450, __pyx_L3_error)
  7975. if (__pyx_kwds_len > 0) {
  7976. switch (__pyx_nargs) {
  7977. case 4:
  7978. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  7979. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 450, __pyx_L3_error)
  7980. CYTHON_FALLTHROUGH;
  7981. case 3:
  7982. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7983. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 450, __pyx_L3_error)
  7984. CYTHON_FALLTHROUGH;
  7985. case 2:
  7986. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7987. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 450, __pyx_L3_error)
  7988. CYTHON_FALLTHROUGH;
  7989. case 1:
  7990. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7991. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 450, __pyx_L3_error)
  7992. CYTHON_FALLTHROUGH;
  7993. case 0: break;
  7994. default: goto __pyx_L5_argtuple_error;
  7995. }
  7996. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7997. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "splitLine", 0) < (0)) __PYX_ERR(0, 450, __pyx_L3_error)
  7998. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  7999. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitLine", 1, 4, 4, i); __PYX_ERR(0, 450, __pyx_L3_error) }
  8000. }
  8001. } else if (unlikely(__pyx_nargs != 4)) {
  8002. goto __pyx_L5_argtuple_error;
  8003. } else {
  8004. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  8005. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 450, __pyx_L3_error)
  8006. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  8007. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 450, __pyx_L3_error)
  8008. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  8009. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 450, __pyx_L3_error)
  8010. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  8011. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 450, __pyx_L3_error)
  8012. }
  8013. __pyx_v_pt1 = values[0];
  8014. __pyx_v_pt2 = values[1];
  8015. __pyx_v_where = values[2];
  8016. __pyx_v_isHorizontal = values[3];
  8017. }
  8018. goto __pyx_L6_skip;
  8019. __pyx_L5_argtuple_error:;
  8020. __Pyx_RaiseArgtupleInvalid("splitLine", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 450, __pyx_L3_error)
  8021. __pyx_L6_skip:;
  8022. goto __pyx_L4_argument_unpacking_done;
  8023. __pyx_L3_error:;
  8024. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  8025. Py_XDECREF(values[__pyx_temp]);
  8026. }
  8027. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitLine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8028. __Pyx_RefNannyFinishContext();
  8029. return NULL;
  8030. __pyx_L4_argument_unpacking_done:;
  8031. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_24splitLine(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_where, __pyx_v_isHorizontal);
  8032. /* function exit code */
  8033. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  8034. Py_XDECREF(values[__pyx_temp]);
  8035. }
  8036. __Pyx_RefNannyFinishContext();
  8037. return __pyx_r;
  8038. }
  8039. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_24splitLine(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_where, PyObject *__pyx_v_isHorizontal) {
  8040. PyObject *__pyx_v_pt1x = NULL;
  8041. PyObject *__pyx_v_pt1y = NULL;
  8042. PyObject *__pyx_v_pt2x = NULL;
  8043. PyObject *__pyx_v_pt2y = NULL;
  8044. PyObject *__pyx_v_ax = NULL;
  8045. PyObject *__pyx_v_ay = NULL;
  8046. PyObject *__pyx_v_bx = NULL;
  8047. PyObject *__pyx_v_by = NULL;
  8048. PyObject *__pyx_v_a = NULL;
  8049. PyObject *__pyx_v_t = NULL;
  8050. PyObject *__pyx_v_midPt = NULL;
  8051. PyObject *__pyx_r = NULL;
  8052. __Pyx_RefNannyDeclarations
  8053. PyObject *__pyx_t_1 = NULL;
  8054. PyObject *__pyx_t_2 = NULL;
  8055. PyObject *__pyx_t_3 = NULL;
  8056. PyObject *(*__pyx_t_4)(PyObject *);
  8057. int __pyx_t_5;
  8058. int __pyx_lineno = 0;
  8059. const char *__pyx_filename = NULL;
  8060. int __pyx_clineno = 0;
  8061. __Pyx_RefNannySetupContext("splitLine", 0);
  8062. /* "fontTools/misc/bezierTools.py":486
  8063. * ((0, 50), (0, 0))
  8064. * """
  8065. * pt1x, pt1y = pt1 # <<<<<<<<<<<<<<
  8066. * pt2x, pt2y = pt2
  8067. *
  8068. */
  8069. if ((likely(PyTuple_CheckExact(__pyx_v_pt1))) || (PyList_CheckExact(__pyx_v_pt1))) {
  8070. PyObject* sequence = __pyx_v_pt1;
  8071. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8072. if (unlikely(size != 2)) {
  8073. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8074. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8075. __PYX_ERR(0, 486, __pyx_L1_error)
  8076. }
  8077. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8078. if (likely(PyTuple_CheckExact(sequence))) {
  8079. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  8080. __Pyx_INCREF(__pyx_t_1);
  8081. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  8082. __Pyx_INCREF(__pyx_t_2);
  8083. } else {
  8084. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  8085. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
  8086. __Pyx_XGOTREF(__pyx_t_1);
  8087. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  8088. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error)
  8089. __Pyx_XGOTREF(__pyx_t_2);
  8090. }
  8091. #else
  8092. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
  8093. __Pyx_GOTREF(__pyx_t_1);
  8094. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error)
  8095. __Pyx_GOTREF(__pyx_t_2);
  8096. #endif
  8097. } else {
  8098. Py_ssize_t index = -1;
  8099. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error)
  8100. __Pyx_GOTREF(__pyx_t_3);
  8101. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  8102. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  8103. __Pyx_GOTREF(__pyx_t_1);
  8104. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  8105. __Pyx_GOTREF(__pyx_t_2);
  8106. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 486, __pyx_L1_error)
  8107. __pyx_t_4 = NULL;
  8108. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8109. goto __pyx_L4_unpacking_done;
  8110. __pyx_L3_unpacking_failed:;
  8111. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8112. __pyx_t_4 = NULL;
  8113. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8114. __PYX_ERR(0, 486, __pyx_L1_error)
  8115. __pyx_L4_unpacking_done:;
  8116. }
  8117. __pyx_v_pt1x = __pyx_t_1;
  8118. __pyx_t_1 = 0;
  8119. __pyx_v_pt1y = __pyx_t_2;
  8120. __pyx_t_2 = 0;
  8121. /* "fontTools/misc/bezierTools.py":487
  8122. * """
  8123. * pt1x, pt1y = pt1
  8124. * pt2x, pt2y = pt2 # <<<<<<<<<<<<<<
  8125. *
  8126. * ax = pt2x - pt1x
  8127. */
  8128. if ((likely(PyTuple_CheckExact(__pyx_v_pt2))) || (PyList_CheckExact(__pyx_v_pt2))) {
  8129. PyObject* sequence = __pyx_v_pt2;
  8130. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8131. if (unlikely(size != 2)) {
  8132. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8133. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8134. __PYX_ERR(0, 487, __pyx_L1_error)
  8135. }
  8136. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8137. if (likely(PyTuple_CheckExact(sequence))) {
  8138. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  8139. __Pyx_INCREF(__pyx_t_2);
  8140. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  8141. __Pyx_INCREF(__pyx_t_1);
  8142. } else {
  8143. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  8144. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
  8145. __Pyx_XGOTREF(__pyx_t_2);
  8146. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  8147. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error)
  8148. __Pyx_XGOTREF(__pyx_t_1);
  8149. }
  8150. #else
  8151. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
  8152. __Pyx_GOTREF(__pyx_t_2);
  8153. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error)
  8154. __Pyx_GOTREF(__pyx_t_1);
  8155. #endif
  8156. } else {
  8157. Py_ssize_t index = -1;
  8158. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error)
  8159. __Pyx_GOTREF(__pyx_t_3);
  8160. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  8161. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  8162. __Pyx_GOTREF(__pyx_t_2);
  8163. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  8164. __Pyx_GOTREF(__pyx_t_1);
  8165. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 487, __pyx_L1_error)
  8166. __pyx_t_4 = NULL;
  8167. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8168. goto __pyx_L6_unpacking_done;
  8169. __pyx_L5_unpacking_failed:;
  8170. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8171. __pyx_t_4 = NULL;
  8172. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8173. __PYX_ERR(0, 487, __pyx_L1_error)
  8174. __pyx_L6_unpacking_done:;
  8175. }
  8176. __pyx_v_pt2x = __pyx_t_2;
  8177. __pyx_t_2 = 0;
  8178. __pyx_v_pt2y = __pyx_t_1;
  8179. __pyx_t_1 = 0;
  8180. /* "fontTools/misc/bezierTools.py":489
  8181. * pt2x, pt2y = pt2
  8182. *
  8183. * ax = pt2x - pt1x # <<<<<<<<<<<<<<
  8184. * ay = pt2y - pt1y
  8185. *
  8186. */
  8187. __pyx_t_1 = PyNumber_Subtract(__pyx_v_pt2x, __pyx_v_pt1x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error)
  8188. __Pyx_GOTREF(__pyx_t_1);
  8189. __pyx_v_ax = __pyx_t_1;
  8190. __pyx_t_1 = 0;
  8191. /* "fontTools/misc/bezierTools.py":490
  8192. *
  8193. * ax = pt2x - pt1x
  8194. * ay = pt2y - pt1y # <<<<<<<<<<<<<<
  8195. *
  8196. * bx = pt1x
  8197. */
  8198. __pyx_t_1 = PyNumber_Subtract(__pyx_v_pt2y, __pyx_v_pt1y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
  8199. __Pyx_GOTREF(__pyx_t_1);
  8200. __pyx_v_ay = __pyx_t_1;
  8201. __pyx_t_1 = 0;
  8202. /* "fontTools/misc/bezierTools.py":492
  8203. * ay = pt2y - pt1y
  8204. *
  8205. * bx = pt1x # <<<<<<<<<<<<<<
  8206. * by = pt1y
  8207. *
  8208. */
  8209. __Pyx_INCREF(__pyx_v_pt1x);
  8210. __pyx_v_bx = __pyx_v_pt1x;
  8211. /* "fontTools/misc/bezierTools.py":493
  8212. *
  8213. * bx = pt1x
  8214. * by = pt1y # <<<<<<<<<<<<<<
  8215. *
  8216. * a = (ax, ay)[isHorizontal]
  8217. */
  8218. __Pyx_INCREF(__pyx_v_pt1y);
  8219. __pyx_v_by = __pyx_v_pt1y;
  8220. /* "fontTools/misc/bezierTools.py":495
  8221. * by = pt1y
  8222. *
  8223. * a = (ax, ay)[isHorizontal] # <<<<<<<<<<<<<<
  8224. *
  8225. * if a == 0:
  8226. */
  8227. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error)
  8228. __Pyx_GOTREF(__pyx_t_1);
  8229. __Pyx_INCREF(__pyx_v_ax);
  8230. __Pyx_GIVEREF(__pyx_v_ax);
  8231. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ax) != (0)) __PYX_ERR(0, 495, __pyx_L1_error);
  8232. __Pyx_INCREF(__pyx_v_ay);
  8233. __Pyx_GIVEREF(__pyx_v_ay);
  8234. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ay) != (0)) __PYX_ERR(0, 495, __pyx_L1_error);
  8235. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
  8236. __Pyx_GOTREF(__pyx_t_2);
  8237. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8238. __pyx_v_a = __pyx_t_2;
  8239. __pyx_t_2 = 0;
  8240. /* "fontTools/misc/bezierTools.py":497
  8241. * a = (ax, ay)[isHorizontal]
  8242. *
  8243. * if a == 0: # <<<<<<<<<<<<<<
  8244. * return [(pt1, pt2)]
  8245. * t = (where - (bx, by)[isHorizontal]) / a
  8246. */
  8247. __pyx_t_5 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_a, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 497, __pyx_L1_error)
  8248. if (__pyx_t_5) {
  8249. /* "fontTools/misc/bezierTools.py":498
  8250. *
  8251. * if a == 0:
  8252. * return [(pt1, pt2)] # <<<<<<<<<<<<<<
  8253. * t = (where - (bx, by)[isHorizontal]) / a
  8254. * if 0 <= t < 1:
  8255. */
  8256. __Pyx_XDECREF(__pyx_r);
  8257. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L1_error)
  8258. __Pyx_GOTREF(__pyx_t_2);
  8259. __Pyx_INCREF(__pyx_v_pt1);
  8260. __Pyx_GIVEREF(__pyx_v_pt1);
  8261. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 498, __pyx_L1_error);
  8262. __Pyx_INCREF(__pyx_v_pt2);
  8263. __Pyx_GIVEREF(__pyx_v_pt2);
  8264. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 498, __pyx_L1_error);
  8265. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error)
  8266. __Pyx_GOTREF(__pyx_t_1);
  8267. __Pyx_GIVEREF(__pyx_t_2);
  8268. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 498, __pyx_L1_error);
  8269. __pyx_t_2 = 0;
  8270. __pyx_r = __pyx_t_1;
  8271. __pyx_t_1 = 0;
  8272. goto __pyx_L0;
  8273. /* "fontTools/misc/bezierTools.py":497
  8274. * a = (ax, ay)[isHorizontal]
  8275. *
  8276. * if a == 0: # <<<<<<<<<<<<<<
  8277. * return [(pt1, pt2)]
  8278. * t = (where - (bx, by)[isHorizontal]) / a
  8279. */
  8280. }
  8281. /* "fontTools/misc/bezierTools.py":499
  8282. * if a == 0:
  8283. * return [(pt1, pt2)]
  8284. * t = (where - (bx, by)[isHorizontal]) / a # <<<<<<<<<<<<<<
  8285. * if 0 <= t < 1:
  8286. * midPt = ax * t + bx, ay * t + by
  8287. */
  8288. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)
  8289. __Pyx_GOTREF(__pyx_t_1);
  8290. __Pyx_INCREF(__pyx_v_bx);
  8291. __Pyx_GIVEREF(__pyx_v_bx);
  8292. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bx) != (0)) __PYX_ERR(0, 499, __pyx_L1_error);
  8293. __Pyx_INCREF(__pyx_v_by);
  8294. __Pyx_GIVEREF(__pyx_v_by);
  8295. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_by) != (0)) __PYX_ERR(0, 499, __pyx_L1_error);
  8296. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
  8297. __Pyx_GOTREF(__pyx_t_2);
  8298. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8299. __pyx_t_1 = PyNumber_Subtract(__pyx_v_where, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)
  8300. __Pyx_GOTREF(__pyx_t_1);
  8301. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8302. __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_a); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
  8303. __Pyx_GOTREF(__pyx_t_2);
  8304. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8305. __pyx_v_t = __pyx_t_2;
  8306. __pyx_t_2 = 0;
  8307. /* "fontTools/misc/bezierTools.py":500
  8308. * return [(pt1, pt2)]
  8309. * t = (where - (bx, by)[isHorizontal]) / a
  8310. * if 0 <= t < 1: # <<<<<<<<<<<<<<
  8311. * midPt = ax * t + bx, ay * t + by
  8312. * return [(pt1, midPt), (midPt, pt2)]
  8313. */
  8314. __pyx_t_2 = PyObject_RichCompare(__pyx_mstate_global->__pyx_int_0, __pyx_v_t, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error)
  8315. if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
  8316. __Pyx_DECREF(__pyx_t_2);
  8317. __pyx_t_2 = PyObject_RichCompare(__pyx_v_t, __pyx_mstate_global->__pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error)
  8318. }
  8319. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 500, __pyx_L1_error)
  8320. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8321. if (__pyx_t_5) {
  8322. /* "fontTools/misc/bezierTools.py":501
  8323. * t = (where - (bx, by)[isHorizontal]) / a
  8324. * if 0 <= t < 1:
  8325. * midPt = ax * t + bx, ay * t + by # <<<<<<<<<<<<<<
  8326. * return [(pt1, midPt), (midPt, pt2)]
  8327. * else:
  8328. */
  8329. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ax, __pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
  8330. __Pyx_GOTREF(__pyx_t_2);
  8331. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error)
  8332. __Pyx_GOTREF(__pyx_t_1);
  8333. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8334. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ay, __pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
  8335. __Pyx_GOTREF(__pyx_t_2);
  8336. __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_by); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error)
  8337. __Pyx_GOTREF(__pyx_t_3);
  8338. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8339. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
  8340. __Pyx_GOTREF(__pyx_t_2);
  8341. __Pyx_GIVEREF(__pyx_t_1);
  8342. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 501, __pyx_L1_error);
  8343. __Pyx_GIVEREF(__pyx_t_3);
  8344. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 501, __pyx_L1_error);
  8345. __pyx_t_1 = 0;
  8346. __pyx_t_3 = 0;
  8347. __pyx_v_midPt = ((PyObject*)__pyx_t_2);
  8348. __pyx_t_2 = 0;
  8349. /* "fontTools/misc/bezierTools.py":502
  8350. * if 0 <= t < 1:
  8351. * midPt = ax * t + bx, ay * t + by
  8352. * return [(pt1, midPt), (midPt, pt2)] # <<<<<<<<<<<<<<
  8353. * else:
  8354. * return [(pt1, pt2)]
  8355. */
  8356. __Pyx_XDECREF(__pyx_r);
  8357. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 502, __pyx_L1_error)
  8358. __Pyx_GOTREF(__pyx_t_2);
  8359. __Pyx_INCREF(__pyx_v_pt1);
  8360. __Pyx_GIVEREF(__pyx_v_pt1);
  8361. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8362. __Pyx_INCREF(__pyx_v_midPt);
  8363. __Pyx_GIVEREF(__pyx_v_midPt);
  8364. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_midPt) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8365. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error)
  8366. __Pyx_GOTREF(__pyx_t_3);
  8367. __Pyx_INCREF(__pyx_v_midPt);
  8368. __Pyx_GIVEREF(__pyx_v_midPt);
  8369. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_midPt) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8370. __Pyx_INCREF(__pyx_v_pt2);
  8371. __Pyx_GIVEREF(__pyx_v_pt2);
  8372. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8373. __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error)
  8374. __Pyx_GOTREF(__pyx_t_1);
  8375. __Pyx_GIVEREF(__pyx_t_2);
  8376. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8377. __Pyx_GIVEREF(__pyx_t_3);
  8378. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8379. __pyx_t_2 = 0;
  8380. __pyx_t_3 = 0;
  8381. __pyx_r = __pyx_t_1;
  8382. __pyx_t_1 = 0;
  8383. goto __pyx_L0;
  8384. /* "fontTools/misc/bezierTools.py":500
  8385. * return [(pt1, pt2)]
  8386. * t = (where - (bx, by)[isHorizontal]) / a
  8387. * if 0 <= t < 1: # <<<<<<<<<<<<<<
  8388. * midPt = ax * t + bx, ay * t + by
  8389. * return [(pt1, midPt), (midPt, pt2)]
  8390. */
  8391. }
  8392. /* "fontTools/misc/bezierTools.py":504
  8393. * return [(pt1, midPt), (midPt, pt2)]
  8394. * else:
  8395. * return [(pt1, pt2)] # <<<<<<<<<<<<<<
  8396. *
  8397. *
  8398. */
  8399. /*else*/ {
  8400. __Pyx_XDECREF(__pyx_r);
  8401. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error)
  8402. __Pyx_GOTREF(__pyx_t_1);
  8403. __Pyx_INCREF(__pyx_v_pt1);
  8404. __Pyx_GIVEREF(__pyx_v_pt1);
  8405. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 504, __pyx_L1_error);
  8406. __Pyx_INCREF(__pyx_v_pt2);
  8407. __Pyx_GIVEREF(__pyx_v_pt2);
  8408. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 504, __pyx_L1_error);
  8409. __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error)
  8410. __Pyx_GOTREF(__pyx_t_3);
  8411. __Pyx_GIVEREF(__pyx_t_1);
  8412. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 504, __pyx_L1_error);
  8413. __pyx_t_1 = 0;
  8414. __pyx_r = __pyx_t_3;
  8415. __pyx_t_3 = 0;
  8416. goto __pyx_L0;
  8417. }
  8418. /* "fontTools/misc/bezierTools.py":450
  8419. *
  8420. *
  8421. * def splitLine(pt1, pt2, where, isHorizontal): # <<<<<<<<<<<<<<
  8422. * """Split a line at a given coordinate.
  8423. *
  8424. */
  8425. /* function exit code */
  8426. __pyx_L1_error:;
  8427. __Pyx_XDECREF(__pyx_t_1);
  8428. __Pyx_XDECREF(__pyx_t_2);
  8429. __Pyx_XDECREF(__pyx_t_3);
  8430. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitLine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8431. __pyx_r = NULL;
  8432. __pyx_L0:;
  8433. __Pyx_XDECREF(__pyx_v_pt1x);
  8434. __Pyx_XDECREF(__pyx_v_pt1y);
  8435. __Pyx_XDECREF(__pyx_v_pt2x);
  8436. __Pyx_XDECREF(__pyx_v_pt2y);
  8437. __Pyx_XDECREF(__pyx_v_ax);
  8438. __Pyx_XDECREF(__pyx_v_ay);
  8439. __Pyx_XDECREF(__pyx_v_bx);
  8440. __Pyx_XDECREF(__pyx_v_by);
  8441. __Pyx_XDECREF(__pyx_v_a);
  8442. __Pyx_XDECREF(__pyx_v_t);
  8443. __Pyx_XDECREF(__pyx_v_midPt);
  8444. __Pyx_XGIVEREF(__pyx_r);
  8445. __Pyx_RefNannyFinishContext();
  8446. return __pyx_r;
  8447. }
  8448. /* "fontTools/misc/bezierTools.py":507
  8449. *
  8450. *
  8451. * def splitQuadratic(pt1, pt2, pt3, where, isHorizontal): # <<<<<<<<<<<<<<
  8452. * """Split a quadratic Bezier curve at a given coordinate.
  8453. *
  8454. */
  8455. /* Python wrapper */
  8456. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_27splitQuadratic(PyObject *__pyx_self,
  8457. #if CYTHON_METH_FASTCALL
  8458. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  8459. #else
  8460. PyObject *__pyx_args, PyObject *__pyx_kwds
  8461. #endif
  8462. ); /*proto*/
  8463. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_26splitQuadratic, "splitQuadratic(pt1, pt2, pt3, where, isHorizontal)\n\nSplit a quadratic Bezier curve at a given coordinate.\n\nArgs:\n pt1,pt2,pt3: Control points of the Bezier as 2D tuples.\n where: Position at which to split the curve.\n isHorizontal: Direction of the ray splitting the curve. If true,\n ``where`` is interpreted as a Y coordinate; if false, then\n ``where`` is interpreted as an X coordinate.\n\nReturns:\n A list of two curve segments (each curve segment being three 2D tuples)\n if the curve was successfully split, or a list containing the original\n curve.\n\nExample::\n\n >>> printSegments(splitQuadratic((0, 0), (50, 100), (100, 0), 150, False))\n ((0, 0), (50, 100), (100, 0))\n >>> printSegments(splitQuadratic((0, 0), (50, 100), (100, 0), 50, False))\n ((0, 0), (25, 50), (50, 50))\n ((50, 50), (75, 50), (100, 0))\n >>> printSegments(splitQuadratic((0, 0), (50, 100), (100, 0), 25, False))\n ((0, 0), (12.5, 25), (25, 37.5))\n ((25, 37.5), (62.5, 75), (100, 0))\n >>> printSegments(splitQuadratic((0, 0), (50, 100), (100, 0), 25, True))\n ((0, 0), (7.32233, 14.6447), (14.6447, 25))\n ((14.6447, 25), (50, 75), (85.3553, 25))\n ((85.3553, 25), (92.6777, 14.6447), (100, -7.10543e-15))\n >>> # XXX I'm not at all sure if the following behavior is desirable:\n >>> printSegments(splitQuadratic((0, 0), (50, 100), (100, 0), 50, True))\n ((0, 0), (25, 50), (50, 50))\n ((50, 50), (50, 50), (50, 50))\n ((50, 50), (75, 50), (100, 0))");
  8464. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_27splitQuadratic = {"splitQuadratic", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_27splitQuadratic, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_26splitQuadratic};
  8465. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_27splitQuadratic(PyObject *__pyx_self,
  8466. #if CYTHON_METH_FASTCALL
  8467. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  8468. #else
  8469. PyObject *__pyx_args, PyObject *__pyx_kwds
  8470. #endif
  8471. ) {
  8472. PyObject *__pyx_v_pt1 = 0;
  8473. PyObject *__pyx_v_pt2 = 0;
  8474. PyObject *__pyx_v_pt3 = 0;
  8475. PyObject *__pyx_v_where = 0;
  8476. PyObject *__pyx_v_isHorizontal = 0;
  8477. #if !CYTHON_METH_FASTCALL
  8478. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  8479. #endif
  8480. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  8481. PyObject* values[5] = {0,0,0,0,0};
  8482. int __pyx_lineno = 0;
  8483. const char *__pyx_filename = NULL;
  8484. int __pyx_clineno = 0;
  8485. PyObject *__pyx_r = 0;
  8486. __Pyx_RefNannyDeclarations
  8487. __Pyx_RefNannySetupContext("splitQuadratic (wrapper)", 0);
  8488. #if !CYTHON_METH_FASTCALL
  8489. #if CYTHON_ASSUME_SAFE_SIZE
  8490. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  8491. #else
  8492. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  8493. #endif
  8494. #endif
  8495. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  8496. {
  8497. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_where,&__pyx_mstate_global->__pyx_n_u_isHorizontal,0};
  8498. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  8499. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 507, __pyx_L3_error)
  8500. if (__pyx_kwds_len > 0) {
  8501. switch (__pyx_nargs) {
  8502. case 5:
  8503. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  8504. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 507, __pyx_L3_error)
  8505. CYTHON_FALLTHROUGH;
  8506. case 4:
  8507. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  8508. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 507, __pyx_L3_error)
  8509. CYTHON_FALLTHROUGH;
  8510. case 3:
  8511. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  8512. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 507, __pyx_L3_error)
  8513. CYTHON_FALLTHROUGH;
  8514. case 2:
  8515. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  8516. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 507, __pyx_L3_error)
  8517. CYTHON_FALLTHROUGH;
  8518. case 1:
  8519. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  8520. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 507, __pyx_L3_error)
  8521. CYTHON_FALLTHROUGH;
  8522. case 0: break;
  8523. default: goto __pyx_L5_argtuple_error;
  8524. }
  8525. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  8526. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "splitQuadratic", 0) < (0)) __PYX_ERR(0, 507, __pyx_L3_error)
  8527. for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
  8528. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitQuadratic", 1, 5, 5, i); __PYX_ERR(0, 507, __pyx_L3_error) }
  8529. }
  8530. } else if (unlikely(__pyx_nargs != 5)) {
  8531. goto __pyx_L5_argtuple_error;
  8532. } else {
  8533. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  8534. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 507, __pyx_L3_error)
  8535. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  8536. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 507, __pyx_L3_error)
  8537. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  8538. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 507, __pyx_L3_error)
  8539. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  8540. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 507, __pyx_L3_error)
  8541. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  8542. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 507, __pyx_L3_error)
  8543. }
  8544. __pyx_v_pt1 = values[0];
  8545. __pyx_v_pt2 = values[1];
  8546. __pyx_v_pt3 = values[2];
  8547. __pyx_v_where = values[3];
  8548. __pyx_v_isHorizontal = values[4];
  8549. }
  8550. goto __pyx_L6_skip;
  8551. __pyx_L5_argtuple_error:;
  8552. __Pyx_RaiseArgtupleInvalid("splitQuadratic", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 507, __pyx_L3_error)
  8553. __pyx_L6_skip:;
  8554. goto __pyx_L4_argument_unpacking_done;
  8555. __pyx_L3_error:;
  8556. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  8557. Py_XDECREF(values[__pyx_temp]);
  8558. }
  8559. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitQuadratic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8560. __Pyx_RefNannyFinishContext();
  8561. return NULL;
  8562. __pyx_L4_argument_unpacking_done:;
  8563. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_26splitQuadratic(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_where, __pyx_v_isHorizontal);
  8564. /* function exit code */
  8565. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  8566. Py_XDECREF(values[__pyx_temp]);
  8567. }
  8568. __Pyx_RefNannyFinishContext();
  8569. return __pyx_r;
  8570. }
  8571. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_14splitQuadratic_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  8572. /* "fontTools/misc/bezierTools.py":546
  8573. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where
  8574. * )
  8575. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  8576. * if not solutions:
  8577. * return [(pt1, pt2, pt3)]
  8578. */
  8579. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_14splitQuadratic_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  8580. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *__pyx_cur_scope;
  8581. PyObject *__pyx_r = NULL;
  8582. __Pyx_RefNannyDeclarations
  8583. int __pyx_lineno = 0;
  8584. const char *__pyx_filename = NULL;
  8585. int __pyx_clineno = 0;
  8586. __Pyx_RefNannySetupContext("genexpr", 0);
  8587. __pyx_cur_scope = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr(__pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  8588. if (unlikely(!__pyx_cur_scope)) {
  8589. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *)Py_None);
  8590. __Pyx_INCREF(Py_None);
  8591. __PYX_ERR(0, 546, __pyx_L1_error)
  8592. } else {
  8593. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  8594. }
  8595. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  8596. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  8597. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  8598. {
  8599. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_4misc_11bezierTools_14splitQuadratic_2generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_splitQuadratic_locals_genexpr, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools); if (unlikely(!gen)) __PYX_ERR(0, 546, __pyx_L1_error)
  8600. __Pyx_DECREF(__pyx_cur_scope);
  8601. __Pyx_RefNannyFinishContext();
  8602. return (PyObject *) gen;
  8603. }
  8604. /* function exit code */
  8605. __pyx_L1_error:;
  8606. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitQuadratic.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8607. __pyx_r = NULL;
  8608. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  8609. __Pyx_XGIVEREF(__pyx_r);
  8610. __Pyx_RefNannyFinishContext();
  8611. return __pyx_r;
  8612. }
  8613. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_14splitQuadratic_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  8614. {
  8615. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *)__pyx_generator->closure);
  8616. PyObject *__pyx_r = NULL;
  8617. PyObject *__pyx_t_1 = NULL;
  8618. Py_ssize_t __pyx_t_2;
  8619. PyObject *(*__pyx_t_3)(PyObject *);
  8620. PyObject *__pyx_t_4 = NULL;
  8621. int __pyx_t_5;
  8622. int __pyx_lineno = 0;
  8623. const char *__pyx_filename = NULL;
  8624. int __pyx_clineno = 0;
  8625. __Pyx_RefNannyDeclarations
  8626. __Pyx_RefNannySetupContext("genexpr", 0);
  8627. switch (__pyx_generator->resume_label) {
  8628. case 0: goto __pyx_L3_first_run;
  8629. default: /* CPython raises the right error here */
  8630. __Pyx_RefNannyFinishContext();
  8631. return NULL;
  8632. }
  8633. __pyx_L3_first_run:;
  8634. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 546, __pyx_L1_error)
  8635. __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 546, __pyx_L1_error)
  8636. __Pyx_GOTREF(__pyx_r);
  8637. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 546, __pyx_L1_error) }
  8638. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  8639. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  8640. __pyx_t_2 = 0;
  8641. __pyx_t_3 = NULL;
  8642. } else {
  8643. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error)
  8644. __Pyx_GOTREF(__pyx_t_1);
  8645. __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 546, __pyx_L1_error)
  8646. }
  8647. for (;;) {
  8648. if (likely(!__pyx_t_3)) {
  8649. if (likely(PyList_CheckExact(__pyx_t_1))) {
  8650. {
  8651. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  8652. #if !CYTHON_ASSUME_SAFE_SIZE
  8653. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 546, __pyx_L1_error)
  8654. #endif
  8655. if (__pyx_t_2 >= __pyx_temp) break;
  8656. }
  8657. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  8658. ++__pyx_t_2;
  8659. } else {
  8660. {
  8661. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  8662. #if !CYTHON_ASSUME_SAFE_SIZE
  8663. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 546, __pyx_L1_error)
  8664. #endif
  8665. if (__pyx_t_2 >= __pyx_temp) break;
  8666. }
  8667. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8668. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  8669. #else
  8670. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  8671. #endif
  8672. ++__pyx_t_2;
  8673. }
  8674. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
  8675. } else {
  8676. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  8677. if (unlikely(!__pyx_t_4)) {
  8678. PyObject* exc_type = PyErr_Occurred();
  8679. if (exc_type) {
  8680. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 546, __pyx_L1_error)
  8681. PyErr_Clear();
  8682. }
  8683. break;
  8684. }
  8685. }
  8686. __Pyx_GOTREF(__pyx_t_4);
  8687. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
  8688. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_4);
  8689. __Pyx_GIVEREF(__pyx_t_4);
  8690. __pyx_t_4 = 0;
  8691. __pyx_t_4 = PyObject_RichCompare(__pyx_mstate_global->__pyx_int_0, __pyx_cur_scope->__pyx_v_t, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
  8692. if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
  8693. __Pyx_DECREF(__pyx_t_4);
  8694. __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_t, __pyx_mstate_global->__pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
  8695. }
  8696. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 546, __pyx_L1_error)
  8697. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  8698. if (__pyx_t_5) {
  8699. if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_t))) __PYX_ERR(0, 546, __pyx_L1_error)
  8700. }
  8701. }
  8702. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8703. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  8704. /* function exit code */
  8705. goto __pyx_L0;
  8706. __pyx_L1_error:;
  8707. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  8708. __Pyx_XDECREF(__pyx_t_1);
  8709. __Pyx_XDECREF(__pyx_t_4);
  8710. if (__Pyx_PyErr_Occurred()) {
  8711. __Pyx_Generator_Replace_StopIteration(0);
  8712. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8713. }
  8714. __pyx_L0:;
  8715. __Pyx_XGIVEREF(__pyx_r);
  8716. #if !CYTHON_USE_EXC_INFO_STACK
  8717. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  8718. #endif
  8719. __pyx_generator->resume_label = -1;
  8720. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  8721. __Pyx_RefNannyFinishContext();
  8722. return __pyx_r;
  8723. }
  8724. /* "fontTools/misc/bezierTools.py":507
  8725. *
  8726. *
  8727. * def splitQuadratic(pt1, pt2, pt3, where, isHorizontal): # <<<<<<<<<<<<<<
  8728. * """Split a quadratic Bezier curve at a given coordinate.
  8729. *
  8730. */
  8731. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_26splitQuadratic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_where, PyObject *__pyx_v_isHorizontal) {
  8732. PyObject *__pyx_v_a = NULL;
  8733. PyObject *__pyx_v_b = NULL;
  8734. PyObject *__pyx_v_c = NULL;
  8735. PyObject *__pyx_v_solutions = NULL;
  8736. PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_14splitQuadratic_2generator2 = 0;
  8737. PyObject *__pyx_r = NULL;
  8738. __Pyx_RefNannyDeclarations
  8739. PyObject *__pyx_t_1 = NULL;
  8740. PyObject *__pyx_t_2 = NULL;
  8741. PyObject *__pyx_t_3 = NULL;
  8742. size_t __pyx_t_4;
  8743. PyObject *__pyx_t_5 = NULL;
  8744. PyObject *__pyx_t_6 = NULL;
  8745. PyObject *(*__pyx_t_7)(PyObject *);
  8746. PyObject *__pyx_t_8 = NULL;
  8747. PyObject *__pyx_t_9 = NULL;
  8748. int __pyx_t_10;
  8749. int __pyx_t_11;
  8750. int __pyx_lineno = 0;
  8751. const char *__pyx_filename = NULL;
  8752. int __pyx_clineno = 0;
  8753. __Pyx_RefNannySetupContext("splitQuadratic", 0);
  8754. /* "fontTools/misc/bezierTools.py":542
  8755. * ((50, 50), (75, 50), (100, 0))
  8756. * """
  8757. * a, b, c = calcQuadraticParameters(pt1, pt2, pt3) # <<<<<<<<<<<<<<
  8758. * solutions = solveQuadratic(
  8759. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where
  8760. */
  8761. __pyx_t_2 = NULL;
  8762. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcQuadraticParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error)
  8763. __Pyx_GOTREF(__pyx_t_3);
  8764. __pyx_t_4 = 1;
  8765. #if CYTHON_UNPACK_METHODS
  8766. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  8767. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  8768. assert(__pyx_t_2);
  8769. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  8770. __Pyx_INCREF(__pyx_t_2);
  8771. __Pyx_INCREF(__pyx__function);
  8772. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  8773. __pyx_t_4 = 0;
  8774. }
  8775. #endif
  8776. {
  8777. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3};
  8778. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8779. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8780. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8781. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
  8782. __Pyx_GOTREF(__pyx_t_1);
  8783. }
  8784. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  8785. PyObject* sequence = __pyx_t_1;
  8786. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8787. if (unlikely(size != 3)) {
  8788. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  8789. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8790. __PYX_ERR(0, 542, __pyx_L1_error)
  8791. }
  8792. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8793. if (likely(PyTuple_CheckExact(sequence))) {
  8794. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  8795. __Pyx_INCREF(__pyx_t_3);
  8796. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  8797. __Pyx_INCREF(__pyx_t_2);
  8798. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  8799. __Pyx_INCREF(__pyx_t_5);
  8800. } else {
  8801. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  8802. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error)
  8803. __Pyx_XGOTREF(__pyx_t_3);
  8804. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  8805. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error)
  8806. __Pyx_XGOTREF(__pyx_t_2);
  8807. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  8808. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L1_error)
  8809. __Pyx_XGOTREF(__pyx_t_5);
  8810. }
  8811. #else
  8812. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error)
  8813. __Pyx_GOTREF(__pyx_t_3);
  8814. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error)
  8815. __Pyx_GOTREF(__pyx_t_2);
  8816. __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L1_error)
  8817. __Pyx_GOTREF(__pyx_t_5);
  8818. #endif
  8819. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8820. } else {
  8821. Py_ssize_t index = -1;
  8822. __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 542, __pyx_L1_error)
  8823. __Pyx_GOTREF(__pyx_t_6);
  8824. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8825. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
  8826. index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
  8827. __Pyx_GOTREF(__pyx_t_3);
  8828. index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  8829. __Pyx_GOTREF(__pyx_t_2);
  8830. index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
  8831. __Pyx_GOTREF(__pyx_t_5);
  8832. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < (0)) __PYX_ERR(0, 542, __pyx_L1_error)
  8833. __pyx_t_7 = NULL;
  8834. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8835. goto __pyx_L4_unpacking_done;
  8836. __pyx_L3_unpacking_failed:;
  8837. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8838. __pyx_t_7 = NULL;
  8839. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8840. __PYX_ERR(0, 542, __pyx_L1_error)
  8841. __pyx_L4_unpacking_done:;
  8842. }
  8843. __pyx_v_a = __pyx_t_3;
  8844. __pyx_t_3 = 0;
  8845. __pyx_v_b = __pyx_t_2;
  8846. __pyx_t_2 = 0;
  8847. __pyx_v_c = __pyx_t_5;
  8848. __pyx_t_5 = 0;
  8849. /* "fontTools/misc/bezierTools.py":543
  8850. * """
  8851. * a, b, c = calcQuadraticParameters(pt1, pt2, pt3)
  8852. * solutions = solveQuadratic( # <<<<<<<<<<<<<<
  8853. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where
  8854. * )
  8855. */
  8856. __pyx_t_5 = NULL;
  8857. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_solveQuadratic); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
  8858. __Pyx_GOTREF(__pyx_t_2);
  8859. /* "fontTools/misc/bezierTools.py":544
  8860. * a, b, c = calcQuadraticParameters(pt1, pt2, pt3)
  8861. * solutions = solveQuadratic(
  8862. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where # <<<<<<<<<<<<<<
  8863. * )
  8864. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  8865. */
  8866. __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L1_error)
  8867. __Pyx_GOTREF(__pyx_t_3);
  8868. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_b, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 544, __pyx_L1_error)
  8869. __Pyx_GOTREF(__pyx_t_6);
  8870. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_c, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 544, __pyx_L1_error)
  8871. __Pyx_GOTREF(__pyx_t_8);
  8872. __pyx_t_9 = PyNumber_Subtract(__pyx_t_8, __pyx_v_where); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 544, __pyx_L1_error)
  8873. __Pyx_GOTREF(__pyx_t_9);
  8874. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  8875. __pyx_t_4 = 1;
  8876. #if CYTHON_UNPACK_METHODS
  8877. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  8878. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  8879. assert(__pyx_t_5);
  8880. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  8881. __Pyx_INCREF(__pyx_t_5);
  8882. __Pyx_INCREF(__pyx__function);
  8883. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  8884. __pyx_t_4 = 0;
  8885. }
  8886. #endif
  8887. {
  8888. PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_6, __pyx_t_9};
  8889. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  8890. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  8891. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8892. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8893. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  8894. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8895. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
  8896. __Pyx_GOTREF(__pyx_t_1);
  8897. }
  8898. __pyx_v_solutions = __pyx_t_1;
  8899. __pyx_t_1 = 0;
  8900. /* "fontTools/misc/bezierTools.py":546
  8901. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where
  8902. * )
  8903. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  8904. * if not solutions:
  8905. * return [(pt1, pt2, pt3)]
  8906. */
  8907. __pyx_t_1 = __pyx_pf_9fontTools_4misc_11bezierTools_14splitQuadratic_genexpr(NULL, __pyx_v_solutions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error)
  8908. __Pyx_GOTREF(__pyx_t_1);
  8909. __pyx_t_2 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error)
  8910. __Pyx_GOTREF(__pyx_t_2);
  8911. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8912. if (unlikely((PyList_Sort(__pyx_t_2) < 0))) __PYX_ERR(0, 546, __pyx_L1_error)
  8913. __Pyx_DECREF_SET(__pyx_v_solutions, __pyx_t_2);
  8914. __pyx_t_2 = 0;
  8915. /* "fontTools/misc/bezierTools.py":547
  8916. * )
  8917. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  8918. * if not solutions: # <<<<<<<<<<<<<<
  8919. * return [(pt1, pt2, pt3)]
  8920. * return _splitQuadraticAtT(a, b, c, *solutions)
  8921. */
  8922. __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_solutions); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 547, __pyx_L1_error)
  8923. __pyx_t_11 = (!__pyx_t_10);
  8924. if (__pyx_t_11) {
  8925. /* "fontTools/misc/bezierTools.py":548
  8926. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  8927. * if not solutions:
  8928. * return [(pt1, pt2, pt3)] # <<<<<<<<<<<<<<
  8929. * return _splitQuadraticAtT(a, b, c, *solutions)
  8930. *
  8931. */
  8932. __Pyx_XDECREF(__pyx_r);
  8933. __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error)
  8934. __Pyx_GOTREF(__pyx_t_2);
  8935. __Pyx_INCREF(__pyx_v_pt1);
  8936. __Pyx_GIVEREF(__pyx_v_pt1);
  8937. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 548, __pyx_L1_error);
  8938. __Pyx_INCREF(__pyx_v_pt2);
  8939. __Pyx_GIVEREF(__pyx_v_pt2);
  8940. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 548, __pyx_L1_error);
  8941. __Pyx_INCREF(__pyx_v_pt3);
  8942. __Pyx_GIVEREF(__pyx_v_pt3);
  8943. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_pt3) != (0)) __PYX_ERR(0, 548, __pyx_L1_error);
  8944. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
  8945. __Pyx_GOTREF(__pyx_t_1);
  8946. __Pyx_GIVEREF(__pyx_t_2);
  8947. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 548, __pyx_L1_error);
  8948. __pyx_t_2 = 0;
  8949. __pyx_r = __pyx_t_1;
  8950. __pyx_t_1 = 0;
  8951. goto __pyx_L0;
  8952. /* "fontTools/misc/bezierTools.py":547
  8953. * )
  8954. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  8955. * if not solutions: # <<<<<<<<<<<<<<
  8956. * return [(pt1, pt2, pt3)]
  8957. * return _splitQuadraticAtT(a, b, c, *solutions)
  8958. */
  8959. }
  8960. /* "fontTools/misc/bezierTools.py":549
  8961. * if not solutions:
  8962. * return [(pt1, pt2, pt3)]
  8963. * return _splitQuadraticAtT(a, b, c, *solutions) # <<<<<<<<<<<<<<
  8964. *
  8965. *
  8966. */
  8967. __Pyx_XDECREF(__pyx_r);
  8968. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_splitQuadraticAtT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
  8969. __Pyx_GOTREF(__pyx_t_1);
  8970. __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error)
  8971. __Pyx_GOTREF(__pyx_t_2);
  8972. __Pyx_INCREF(__pyx_v_a);
  8973. __Pyx_GIVEREF(__pyx_v_a);
  8974. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_a) != (0)) __PYX_ERR(0, 549, __pyx_L1_error);
  8975. __Pyx_INCREF(__pyx_v_b);
  8976. __Pyx_GIVEREF(__pyx_v_b);
  8977. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_b) != (0)) __PYX_ERR(0, 549, __pyx_L1_error);
  8978. __Pyx_INCREF(__pyx_v_c);
  8979. __Pyx_GIVEREF(__pyx_v_c);
  8980. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_c) != (0)) __PYX_ERR(0, 549, __pyx_L1_error);
  8981. __pyx_t_9 = __Pyx_PySequence_Tuple(__pyx_v_solutions); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error)
  8982. __Pyx_GOTREF(__pyx_t_9);
  8983. __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 549, __pyx_L1_error)
  8984. __Pyx_GOTREF(__pyx_t_6);
  8985. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8986. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  8987. __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error)
  8988. __Pyx_GOTREF(__pyx_t_9);
  8989. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8990. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8991. __pyx_r = __pyx_t_9;
  8992. __pyx_t_9 = 0;
  8993. goto __pyx_L0;
  8994. /* "fontTools/misc/bezierTools.py":507
  8995. *
  8996. *
  8997. * def splitQuadratic(pt1, pt2, pt3, where, isHorizontal): # <<<<<<<<<<<<<<
  8998. * """Split a quadratic Bezier curve at a given coordinate.
  8999. *
  9000. */
  9001. /* function exit code */
  9002. __pyx_L1_error:;
  9003. __Pyx_XDECREF(__pyx_t_1);
  9004. __Pyx_XDECREF(__pyx_t_2);
  9005. __Pyx_XDECREF(__pyx_t_3);
  9006. __Pyx_XDECREF(__pyx_t_5);
  9007. __Pyx_XDECREF(__pyx_t_6);
  9008. __Pyx_XDECREF(__pyx_t_8);
  9009. __Pyx_XDECREF(__pyx_t_9);
  9010. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitQuadratic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9011. __pyx_r = NULL;
  9012. __pyx_L0:;
  9013. __Pyx_XDECREF(__pyx_v_a);
  9014. __Pyx_XDECREF(__pyx_v_b);
  9015. __Pyx_XDECREF(__pyx_v_c);
  9016. __Pyx_XDECREF(__pyx_v_solutions);
  9017. __Pyx_XDECREF(__pyx_gb_9fontTools_4misc_11bezierTools_14splitQuadratic_2generator2);
  9018. __Pyx_XGIVEREF(__pyx_r);
  9019. __Pyx_RefNannyFinishContext();
  9020. return __pyx_r;
  9021. }
  9022. /* "fontTools/misc/bezierTools.py":552
  9023. *
  9024. *
  9025. * def splitCubic(pt1, pt2, pt3, pt4, where, isHorizontal): # <<<<<<<<<<<<<<
  9026. * """Split a cubic Bezier curve at a given coordinate.
  9027. *
  9028. */
  9029. /* Python wrapper */
  9030. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_29splitCubic(PyObject *__pyx_self,
  9031. #if CYTHON_METH_FASTCALL
  9032. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9033. #else
  9034. PyObject *__pyx_args, PyObject *__pyx_kwds
  9035. #endif
  9036. ); /*proto*/
  9037. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_28splitCubic, "splitCubic(pt1, pt2, pt3, pt4, where, isHorizontal)\n\nSplit a cubic Bezier curve at a given coordinate.\n\nArgs:\n pt1,pt2,pt3,pt4: Control points of the Bezier as 2D tuples.\n where: Position at which to split the curve.\n isHorizontal: Direction of the ray splitting the curve. If true,\n ``where`` is interpreted as a Y coordinate; if false, then\n ``where`` is interpreted as an X coordinate.\n\nReturns:\n A list of two curve segments (each curve segment being four 2D tuples)\n if the curve was successfully split, or a list containing the original\n curve.\n\nExample::\n\n >>> printSegments(splitCubic((0, 0), (25, 100), (75, 100), (100, 0), 150, False))\n ((0, 0), (25, 100), (75, 100), (100, 0))\n >>> printSegments(splitCubic((0, 0), (25, 100), (75, 100), (100, 0), 50, False))\n ((0, 0), (12.5, 50), (31.25, 75), (50, 75))\n ((50, 75), (68.75, 75), (87.5, 50), (100, 0))\n >>> printSegments(splitCubic((0, 0), (25, 100), (75, 100), (100, 0), 25, True))\n ((0, 0), (2.29379, 9.17517), (4.79804, 17.5085), (7.47414, 25))\n ((7.47414, 25), (31.2886, 91.6667), (68.7114, 91.6667), (92.5259, 25))\n ((92.5259, 25), (95.202, 17.5085), (97.7062, 9.17517), (100, 1.77636e-15))");
  9038. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_29splitCubic = {"splitCubic", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_29splitCubic, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_28splitCubic};
  9039. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_29splitCubic(PyObject *__pyx_self,
  9040. #if CYTHON_METH_FASTCALL
  9041. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9042. #else
  9043. PyObject *__pyx_args, PyObject *__pyx_kwds
  9044. #endif
  9045. ) {
  9046. PyObject *__pyx_v_pt1 = 0;
  9047. PyObject *__pyx_v_pt2 = 0;
  9048. PyObject *__pyx_v_pt3 = 0;
  9049. PyObject *__pyx_v_pt4 = 0;
  9050. PyObject *__pyx_v_where = 0;
  9051. PyObject *__pyx_v_isHorizontal = 0;
  9052. #if !CYTHON_METH_FASTCALL
  9053. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  9054. #endif
  9055. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  9056. PyObject* values[6] = {0,0,0,0,0,0};
  9057. int __pyx_lineno = 0;
  9058. const char *__pyx_filename = NULL;
  9059. int __pyx_clineno = 0;
  9060. PyObject *__pyx_r = 0;
  9061. __Pyx_RefNannyDeclarations
  9062. __Pyx_RefNannySetupContext("splitCubic (wrapper)", 0);
  9063. #if !CYTHON_METH_FASTCALL
  9064. #if CYTHON_ASSUME_SAFE_SIZE
  9065. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  9066. #else
  9067. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  9068. #endif
  9069. #endif
  9070. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  9071. {
  9072. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,&__pyx_mstate_global->__pyx_n_u_where,&__pyx_mstate_global->__pyx_n_u_isHorizontal,0};
  9073. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  9074. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 552, __pyx_L3_error)
  9075. if (__pyx_kwds_len > 0) {
  9076. switch (__pyx_nargs) {
  9077. case 6:
  9078. values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
  9079. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 552, __pyx_L3_error)
  9080. CYTHON_FALLTHROUGH;
  9081. case 5:
  9082. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  9083. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 552, __pyx_L3_error)
  9084. CYTHON_FALLTHROUGH;
  9085. case 4:
  9086. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  9087. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 552, __pyx_L3_error)
  9088. CYTHON_FALLTHROUGH;
  9089. case 3:
  9090. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9091. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 552, __pyx_L3_error)
  9092. CYTHON_FALLTHROUGH;
  9093. case 2:
  9094. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9095. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 552, __pyx_L3_error)
  9096. CYTHON_FALLTHROUGH;
  9097. case 1:
  9098. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9099. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 552, __pyx_L3_error)
  9100. CYTHON_FALLTHROUGH;
  9101. case 0: break;
  9102. default: goto __pyx_L5_argtuple_error;
  9103. }
  9104. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  9105. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "splitCubic", 0) < (0)) __PYX_ERR(0, 552, __pyx_L3_error)
  9106. for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
  9107. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitCubic", 1, 6, 6, i); __PYX_ERR(0, 552, __pyx_L3_error) }
  9108. }
  9109. } else if (unlikely(__pyx_nargs != 6)) {
  9110. goto __pyx_L5_argtuple_error;
  9111. } else {
  9112. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9113. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 552, __pyx_L3_error)
  9114. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9115. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 552, __pyx_L3_error)
  9116. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9117. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 552, __pyx_L3_error)
  9118. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  9119. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 552, __pyx_L3_error)
  9120. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  9121. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 552, __pyx_L3_error)
  9122. values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
  9123. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 552, __pyx_L3_error)
  9124. }
  9125. __pyx_v_pt1 = values[0];
  9126. __pyx_v_pt2 = values[1];
  9127. __pyx_v_pt3 = values[2];
  9128. __pyx_v_pt4 = values[3];
  9129. __pyx_v_where = values[4];
  9130. __pyx_v_isHorizontal = values[5];
  9131. }
  9132. goto __pyx_L6_skip;
  9133. __pyx_L5_argtuple_error:;
  9134. __Pyx_RaiseArgtupleInvalid("splitCubic", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 552, __pyx_L3_error)
  9135. __pyx_L6_skip:;
  9136. goto __pyx_L4_argument_unpacking_done;
  9137. __pyx_L3_error:;
  9138. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  9139. Py_XDECREF(values[__pyx_temp]);
  9140. }
  9141. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9142. __Pyx_RefNannyFinishContext();
  9143. return NULL;
  9144. __pyx_L4_argument_unpacking_done:;
  9145. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_28splitCubic(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4, __pyx_v_where, __pyx_v_isHorizontal);
  9146. /* function exit code */
  9147. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  9148. Py_XDECREF(values[__pyx_temp]);
  9149. }
  9150. __Pyx_RefNannyFinishContext();
  9151. return __pyx_r;
  9152. }
  9153. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_10splitCubic_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  9154. /* "fontTools/misc/bezierTools.py":583
  9155. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where
  9156. * )
  9157. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  9158. * if not solutions:
  9159. * return [(pt1, pt2, pt3, pt4)]
  9160. */
  9161. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_10splitCubic_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  9162. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  9163. PyObject *__pyx_r = NULL;
  9164. __Pyx_RefNannyDeclarations
  9165. int __pyx_lineno = 0;
  9166. const char *__pyx_filename = NULL;
  9167. int __pyx_clineno = 0;
  9168. __Pyx_RefNannySetupContext("genexpr", 0);
  9169. __pyx_cur_scope = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr(__pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  9170. if (unlikely(!__pyx_cur_scope)) {
  9171. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *)Py_None);
  9172. __Pyx_INCREF(Py_None);
  9173. __PYX_ERR(0, 583, __pyx_L1_error)
  9174. } else {
  9175. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  9176. }
  9177. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  9178. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  9179. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  9180. {
  9181. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_4misc_11bezierTools_10splitCubic_2generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_splitCubic_locals_genexpr, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools); if (unlikely(!gen)) __PYX_ERR(0, 583, __pyx_L1_error)
  9182. __Pyx_DECREF(__pyx_cur_scope);
  9183. __Pyx_RefNannyFinishContext();
  9184. return (PyObject *) gen;
  9185. }
  9186. /* function exit code */
  9187. __pyx_L1_error:;
  9188. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubic.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9189. __pyx_r = NULL;
  9190. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  9191. __Pyx_XGIVEREF(__pyx_r);
  9192. __Pyx_RefNannyFinishContext();
  9193. return __pyx_r;
  9194. }
  9195. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_10splitCubic_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  9196. {
  9197. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  9198. PyObject *__pyx_r = NULL;
  9199. PyObject *__pyx_t_1 = NULL;
  9200. Py_ssize_t __pyx_t_2;
  9201. PyObject *(*__pyx_t_3)(PyObject *);
  9202. PyObject *__pyx_t_4 = NULL;
  9203. int __pyx_t_5;
  9204. int __pyx_lineno = 0;
  9205. const char *__pyx_filename = NULL;
  9206. int __pyx_clineno = 0;
  9207. __Pyx_RefNannyDeclarations
  9208. __Pyx_RefNannySetupContext("genexpr", 0);
  9209. switch (__pyx_generator->resume_label) {
  9210. case 0: goto __pyx_L3_first_run;
  9211. default: /* CPython raises the right error here */
  9212. __Pyx_RefNannyFinishContext();
  9213. return NULL;
  9214. }
  9215. __pyx_L3_first_run:;
  9216. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 583, __pyx_L1_error)
  9217. __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 583, __pyx_L1_error)
  9218. __Pyx_GOTREF(__pyx_r);
  9219. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 583, __pyx_L1_error) }
  9220. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  9221. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  9222. __pyx_t_2 = 0;
  9223. __pyx_t_3 = NULL;
  9224. } else {
  9225. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
  9226. __Pyx_GOTREF(__pyx_t_1);
  9227. __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error)
  9228. }
  9229. for (;;) {
  9230. if (likely(!__pyx_t_3)) {
  9231. if (likely(PyList_CheckExact(__pyx_t_1))) {
  9232. {
  9233. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  9234. #if !CYTHON_ASSUME_SAFE_SIZE
  9235. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 583, __pyx_L1_error)
  9236. #endif
  9237. if (__pyx_t_2 >= __pyx_temp) break;
  9238. }
  9239. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  9240. ++__pyx_t_2;
  9241. } else {
  9242. {
  9243. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  9244. #if !CYTHON_ASSUME_SAFE_SIZE
  9245. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 583, __pyx_L1_error)
  9246. #endif
  9247. if (__pyx_t_2 >= __pyx_temp) break;
  9248. }
  9249. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9250. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  9251. #else
  9252. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  9253. #endif
  9254. ++__pyx_t_2;
  9255. }
  9256. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 583, __pyx_L1_error)
  9257. } else {
  9258. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  9259. if (unlikely(!__pyx_t_4)) {
  9260. PyObject* exc_type = PyErr_Occurred();
  9261. if (exc_type) {
  9262. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 583, __pyx_L1_error)
  9263. PyErr_Clear();
  9264. }
  9265. break;
  9266. }
  9267. }
  9268. __Pyx_GOTREF(__pyx_t_4);
  9269. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
  9270. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_4);
  9271. __Pyx_GIVEREF(__pyx_t_4);
  9272. __pyx_t_4 = 0;
  9273. __pyx_t_4 = PyObject_RichCompare(__pyx_mstate_global->__pyx_int_0, __pyx_cur_scope->__pyx_v_t, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 583, __pyx_L1_error)
  9274. if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
  9275. __Pyx_DECREF(__pyx_t_4);
  9276. __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_t, __pyx_mstate_global->__pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 583, __pyx_L1_error)
  9277. }
  9278. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 583, __pyx_L1_error)
  9279. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9280. if (__pyx_t_5) {
  9281. if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_t))) __PYX_ERR(0, 583, __pyx_L1_error)
  9282. }
  9283. }
  9284. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9285. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  9286. /* function exit code */
  9287. goto __pyx_L0;
  9288. __pyx_L1_error:;
  9289. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  9290. __Pyx_XDECREF(__pyx_t_1);
  9291. __Pyx_XDECREF(__pyx_t_4);
  9292. if (__Pyx_PyErr_Occurred()) {
  9293. __Pyx_Generator_Replace_StopIteration(0);
  9294. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9295. }
  9296. __pyx_L0:;
  9297. __Pyx_XGIVEREF(__pyx_r);
  9298. #if !CYTHON_USE_EXC_INFO_STACK
  9299. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  9300. #endif
  9301. __pyx_generator->resume_label = -1;
  9302. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  9303. __Pyx_RefNannyFinishContext();
  9304. return __pyx_r;
  9305. }
  9306. /* "fontTools/misc/bezierTools.py":552
  9307. *
  9308. *
  9309. * def splitCubic(pt1, pt2, pt3, pt4, where, isHorizontal): # <<<<<<<<<<<<<<
  9310. * """Split a cubic Bezier curve at a given coordinate.
  9311. *
  9312. */
  9313. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_28splitCubic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4, PyObject *__pyx_v_where, PyObject *__pyx_v_isHorizontal) {
  9314. PyObject *__pyx_v_a = NULL;
  9315. PyObject *__pyx_v_b = NULL;
  9316. PyObject *__pyx_v_c = NULL;
  9317. PyObject *__pyx_v_d = NULL;
  9318. PyObject *__pyx_v_solutions = NULL;
  9319. PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_10splitCubic_2generator3 = 0;
  9320. PyObject *__pyx_r = NULL;
  9321. __Pyx_RefNannyDeclarations
  9322. PyObject *__pyx_t_1 = NULL;
  9323. PyObject *__pyx_t_2 = NULL;
  9324. PyObject *__pyx_t_3 = NULL;
  9325. size_t __pyx_t_4;
  9326. PyObject *__pyx_t_5 = NULL;
  9327. PyObject *__pyx_t_6 = NULL;
  9328. PyObject *__pyx_t_7 = NULL;
  9329. PyObject *(*__pyx_t_8)(PyObject *);
  9330. PyObject *__pyx_t_9 = NULL;
  9331. PyObject *__pyx_t_10 = NULL;
  9332. int __pyx_t_11;
  9333. int __pyx_t_12;
  9334. int __pyx_lineno = 0;
  9335. const char *__pyx_filename = NULL;
  9336. int __pyx_clineno = 0;
  9337. __Pyx_RefNannySetupContext("splitCubic", 0);
  9338. /* "fontTools/misc/bezierTools.py":579
  9339. * ((92.5259, 25), (95.202, 17.5085), (97.7062, 9.17517), (100, 1.77636e-15))
  9340. * """
  9341. * a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  9342. * solutions = solveCubic(
  9343. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where
  9344. */
  9345. __pyx_t_2 = NULL;
  9346. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcCubicParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
  9347. __Pyx_GOTREF(__pyx_t_3);
  9348. __pyx_t_4 = 1;
  9349. #if CYTHON_UNPACK_METHODS
  9350. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  9351. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  9352. assert(__pyx_t_2);
  9353. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  9354. __Pyx_INCREF(__pyx_t_2);
  9355. __Pyx_INCREF(__pyx__function);
  9356. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  9357. __pyx_t_4 = 0;
  9358. }
  9359. #endif
  9360. {
  9361. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4};
  9362. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  9363. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  9364. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9365. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error)
  9366. __Pyx_GOTREF(__pyx_t_1);
  9367. }
  9368. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  9369. PyObject* sequence = __pyx_t_1;
  9370. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  9371. if (unlikely(size != 4)) {
  9372. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  9373. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  9374. __PYX_ERR(0, 579, __pyx_L1_error)
  9375. }
  9376. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9377. if (likely(PyTuple_CheckExact(sequence))) {
  9378. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  9379. __Pyx_INCREF(__pyx_t_3);
  9380. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  9381. __Pyx_INCREF(__pyx_t_2);
  9382. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  9383. __Pyx_INCREF(__pyx_t_5);
  9384. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
  9385. __Pyx_INCREF(__pyx_t_6);
  9386. } else {
  9387. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  9388. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
  9389. __Pyx_XGOTREF(__pyx_t_3);
  9390. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  9391. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
  9392. __Pyx_XGOTREF(__pyx_t_2);
  9393. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  9394. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L1_error)
  9395. __Pyx_XGOTREF(__pyx_t_5);
  9396. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  9397. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 579, __pyx_L1_error)
  9398. __Pyx_XGOTREF(__pyx_t_6);
  9399. }
  9400. #else
  9401. {
  9402. Py_ssize_t i;
  9403. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  9404. for (i=0; i < 4; i++) {
  9405. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 579, __pyx_L1_error)
  9406. __Pyx_GOTREF(item);
  9407. *(temps[i]) = item;
  9408. }
  9409. }
  9410. #endif
  9411. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9412. } else {
  9413. Py_ssize_t index = -1;
  9414. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  9415. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 579, __pyx_L1_error)
  9416. __Pyx_GOTREF(__pyx_t_7);
  9417. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9418. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  9419. for (index=0; index < 4; index++) {
  9420. PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
  9421. __Pyx_GOTREF(item);
  9422. *(temps[index]) = item;
  9423. }
  9424. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < (0)) __PYX_ERR(0, 579, __pyx_L1_error)
  9425. __pyx_t_8 = NULL;
  9426. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9427. goto __pyx_L4_unpacking_done;
  9428. __pyx_L3_unpacking_failed:;
  9429. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9430. __pyx_t_8 = NULL;
  9431. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  9432. __PYX_ERR(0, 579, __pyx_L1_error)
  9433. __pyx_L4_unpacking_done:;
  9434. }
  9435. __pyx_v_a = __pyx_t_3;
  9436. __pyx_t_3 = 0;
  9437. __pyx_v_b = __pyx_t_2;
  9438. __pyx_t_2 = 0;
  9439. __pyx_v_c = __pyx_t_5;
  9440. __pyx_t_5 = 0;
  9441. __pyx_v_d = __pyx_t_6;
  9442. __pyx_t_6 = 0;
  9443. /* "fontTools/misc/bezierTools.py":580
  9444. * """
  9445. * a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4)
  9446. * solutions = solveCubic( # <<<<<<<<<<<<<<
  9447. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where
  9448. * )
  9449. */
  9450. __pyx_t_6 = NULL;
  9451. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_solveCubic); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 580, __pyx_L1_error)
  9452. __Pyx_GOTREF(__pyx_t_5);
  9453. /* "fontTools/misc/bezierTools.py":581
  9454. * a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4)
  9455. * solutions = solveCubic(
  9456. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where # <<<<<<<<<<<<<<
  9457. * )
  9458. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  9459. */
  9460. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
  9461. __Pyx_GOTREF(__pyx_t_2);
  9462. __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_b, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
  9463. __Pyx_GOTREF(__pyx_t_3);
  9464. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_c, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 581, __pyx_L1_error)
  9465. __Pyx_GOTREF(__pyx_t_7);
  9466. __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_d, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 581, __pyx_L1_error)
  9467. __Pyx_GOTREF(__pyx_t_9);
  9468. __pyx_t_10 = PyNumber_Subtract(__pyx_t_9, __pyx_v_where); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 581, __pyx_L1_error)
  9469. __Pyx_GOTREF(__pyx_t_10);
  9470. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9471. __pyx_t_4 = 1;
  9472. #if CYTHON_UNPACK_METHODS
  9473. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  9474. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
  9475. assert(__pyx_t_6);
  9476. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  9477. __Pyx_INCREF(__pyx_t_6);
  9478. __Pyx_INCREF(__pyx__function);
  9479. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  9480. __pyx_t_4 = 0;
  9481. }
  9482. #endif
  9483. {
  9484. PyObject *__pyx_callargs[5] = {__pyx_t_6, __pyx_t_2, __pyx_t_3, __pyx_t_7, __pyx_t_10};
  9485. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  9486. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  9487. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9488. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9489. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9490. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  9491. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9492. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error)
  9493. __Pyx_GOTREF(__pyx_t_1);
  9494. }
  9495. __pyx_v_solutions = __pyx_t_1;
  9496. __pyx_t_1 = 0;
  9497. /* "fontTools/misc/bezierTools.py":583
  9498. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where
  9499. * )
  9500. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  9501. * if not solutions:
  9502. * return [(pt1, pt2, pt3, pt4)]
  9503. */
  9504. __pyx_t_1 = __pyx_pf_9fontTools_4misc_11bezierTools_10splitCubic_genexpr(NULL, __pyx_v_solutions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
  9505. __Pyx_GOTREF(__pyx_t_1);
  9506. __pyx_t_5 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 583, __pyx_L1_error)
  9507. __Pyx_GOTREF(__pyx_t_5);
  9508. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9509. if (unlikely((PyList_Sort(__pyx_t_5) < 0))) __PYX_ERR(0, 583, __pyx_L1_error)
  9510. __Pyx_DECREF_SET(__pyx_v_solutions, __pyx_t_5);
  9511. __pyx_t_5 = 0;
  9512. /* "fontTools/misc/bezierTools.py":584
  9513. * )
  9514. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  9515. * if not solutions: # <<<<<<<<<<<<<<
  9516. * return [(pt1, pt2, pt3, pt4)]
  9517. * return _splitCubicAtT(a, b, c, d, *solutions)
  9518. */
  9519. __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_solutions); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 584, __pyx_L1_error)
  9520. __pyx_t_12 = (!__pyx_t_11);
  9521. if (__pyx_t_12) {
  9522. /* "fontTools/misc/bezierTools.py":585
  9523. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  9524. * if not solutions:
  9525. * return [(pt1, pt2, pt3, pt4)] # <<<<<<<<<<<<<<
  9526. * return _splitCubicAtT(a, b, c, d, *solutions)
  9527. *
  9528. */
  9529. __Pyx_XDECREF(__pyx_r);
  9530. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 585, __pyx_L1_error)
  9531. __Pyx_GOTREF(__pyx_t_5);
  9532. __Pyx_INCREF(__pyx_v_pt1);
  9533. __Pyx_GIVEREF(__pyx_v_pt1);
  9534. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 585, __pyx_L1_error);
  9535. __Pyx_INCREF(__pyx_v_pt2);
  9536. __Pyx_GIVEREF(__pyx_v_pt2);
  9537. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 585, __pyx_L1_error);
  9538. __Pyx_INCREF(__pyx_v_pt3);
  9539. __Pyx_GIVEREF(__pyx_v_pt3);
  9540. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_pt3) != (0)) __PYX_ERR(0, 585, __pyx_L1_error);
  9541. __Pyx_INCREF(__pyx_v_pt4);
  9542. __Pyx_GIVEREF(__pyx_v_pt4);
  9543. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_pt4) != (0)) __PYX_ERR(0, 585, __pyx_L1_error);
  9544. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 585, __pyx_L1_error)
  9545. __Pyx_GOTREF(__pyx_t_1);
  9546. __Pyx_GIVEREF(__pyx_t_5);
  9547. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 585, __pyx_L1_error);
  9548. __pyx_t_5 = 0;
  9549. __pyx_r = __pyx_t_1;
  9550. __pyx_t_1 = 0;
  9551. goto __pyx_L0;
  9552. /* "fontTools/misc/bezierTools.py":584
  9553. * )
  9554. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  9555. * if not solutions: # <<<<<<<<<<<<<<
  9556. * return [(pt1, pt2, pt3, pt4)]
  9557. * return _splitCubicAtT(a, b, c, d, *solutions)
  9558. */
  9559. }
  9560. /* "fontTools/misc/bezierTools.py":586
  9561. * if not solutions:
  9562. * return [(pt1, pt2, pt3, pt4)]
  9563. * return _splitCubicAtT(a, b, c, d, *solutions) # <<<<<<<<<<<<<<
  9564. *
  9565. *
  9566. */
  9567. __Pyx_XDECREF(__pyx_r);
  9568. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_splitCubicAtT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error)
  9569. __Pyx_GOTREF(__pyx_t_1);
  9570. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 586, __pyx_L1_error)
  9571. __Pyx_GOTREF(__pyx_t_5);
  9572. __Pyx_INCREF(__pyx_v_a);
  9573. __Pyx_GIVEREF(__pyx_v_a);
  9574. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_a) != (0)) __PYX_ERR(0, 586, __pyx_L1_error);
  9575. __Pyx_INCREF(__pyx_v_b);
  9576. __Pyx_GIVEREF(__pyx_v_b);
  9577. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_b) != (0)) __PYX_ERR(0, 586, __pyx_L1_error);
  9578. __Pyx_INCREF(__pyx_v_c);
  9579. __Pyx_GIVEREF(__pyx_v_c);
  9580. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_c) != (0)) __PYX_ERR(0, 586, __pyx_L1_error);
  9581. __Pyx_INCREF(__pyx_v_d);
  9582. __Pyx_GIVEREF(__pyx_v_d);
  9583. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_d) != (0)) __PYX_ERR(0, 586, __pyx_L1_error);
  9584. __pyx_t_10 = __Pyx_PySequence_Tuple(__pyx_v_solutions); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 586, __pyx_L1_error)
  9585. __Pyx_GOTREF(__pyx_t_10);
  9586. __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 586, __pyx_L1_error)
  9587. __Pyx_GOTREF(__pyx_t_7);
  9588. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9589. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  9590. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 586, __pyx_L1_error)
  9591. __Pyx_GOTREF(__pyx_t_10);
  9592. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9593. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9594. __pyx_r = __pyx_t_10;
  9595. __pyx_t_10 = 0;
  9596. goto __pyx_L0;
  9597. /* "fontTools/misc/bezierTools.py":552
  9598. *
  9599. *
  9600. * def splitCubic(pt1, pt2, pt3, pt4, where, isHorizontal): # <<<<<<<<<<<<<<
  9601. * """Split a cubic Bezier curve at a given coordinate.
  9602. *
  9603. */
  9604. /* function exit code */
  9605. __pyx_L1_error:;
  9606. __Pyx_XDECREF(__pyx_t_1);
  9607. __Pyx_XDECREF(__pyx_t_2);
  9608. __Pyx_XDECREF(__pyx_t_3);
  9609. __Pyx_XDECREF(__pyx_t_5);
  9610. __Pyx_XDECREF(__pyx_t_6);
  9611. __Pyx_XDECREF(__pyx_t_7);
  9612. __Pyx_XDECREF(__pyx_t_9);
  9613. __Pyx_XDECREF(__pyx_t_10);
  9614. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9615. __pyx_r = NULL;
  9616. __pyx_L0:;
  9617. __Pyx_XDECREF(__pyx_v_a);
  9618. __Pyx_XDECREF(__pyx_v_b);
  9619. __Pyx_XDECREF(__pyx_v_c);
  9620. __Pyx_XDECREF(__pyx_v_d);
  9621. __Pyx_XDECREF(__pyx_v_solutions);
  9622. __Pyx_XDECREF(__pyx_gb_9fontTools_4misc_11bezierTools_10splitCubic_2generator3);
  9623. __Pyx_XGIVEREF(__pyx_r);
  9624. __Pyx_RefNannyFinishContext();
  9625. return __pyx_r;
  9626. }
  9627. /* "fontTools/misc/bezierTools.py":589
  9628. *
  9629. *
  9630. * def splitQuadraticAtT(pt1, pt2, pt3, *ts): # <<<<<<<<<<<<<<
  9631. * """Split a quadratic Bezier curve at one or more values of t.
  9632. *
  9633. */
  9634. /* Python wrapper */
  9635. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_31splitQuadraticAtT(PyObject *__pyx_self,
  9636. #if CYTHON_METH_FASTCALL
  9637. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9638. #else
  9639. PyObject *__pyx_args, PyObject *__pyx_kwds
  9640. #endif
  9641. ); /*proto*/
  9642. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_30splitQuadraticAtT, "splitQuadraticAtT(pt1, pt2, pt3, *ts)\n\nSplit a quadratic Bezier curve at one or more values of t.\n\nArgs:\n pt1,pt2,pt3: Control points of the Bezier as 2D tuples.\n *ts: Positions at which to split the curve.\n\nReturns:\n A list of curve segments (each curve segment being three 2D tuples).\n\nExamples::\n\n >>> printSegments(splitQuadraticAtT((0, 0), (50, 100), (100, 0), 0.5))\n ((0, 0), (25, 50), (50, 50))\n ((50, 50), (75, 50), (100, 0))\n >>> printSegments(splitQuadraticAtT((0, 0), (50, 100), (100, 0), 0.5, 0.75))\n ((0, 0), (25, 50), (50, 50))\n ((50, 50), (62.5, 50), (75, 37.5))\n ((75, 37.5), (87.5, 25), (100, 0))");
  9643. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_31splitQuadraticAtT = {"splitQuadraticAtT", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_31splitQuadraticAtT, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_30splitQuadraticAtT};
  9644. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_31splitQuadraticAtT(PyObject *__pyx_self,
  9645. #if CYTHON_METH_FASTCALL
  9646. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9647. #else
  9648. PyObject *__pyx_args, PyObject *__pyx_kwds
  9649. #endif
  9650. ) {
  9651. PyObject *__pyx_v_pt1 = 0;
  9652. PyObject *__pyx_v_pt2 = 0;
  9653. PyObject *__pyx_v_pt3 = 0;
  9654. PyObject *__pyx_v_ts = 0;
  9655. #if !CYTHON_METH_FASTCALL
  9656. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  9657. #endif
  9658. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  9659. PyObject* values[3] = {0,0,0};
  9660. int __pyx_lineno = 0;
  9661. const char *__pyx_filename = NULL;
  9662. int __pyx_clineno = 0;
  9663. PyObject *__pyx_r = 0;
  9664. __Pyx_RefNannyDeclarations
  9665. __Pyx_RefNannySetupContext("splitQuadraticAtT (wrapper)", 0);
  9666. #if !CYTHON_METH_FASTCALL
  9667. #if CYTHON_ASSUME_SAFE_SIZE
  9668. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  9669. #else
  9670. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  9671. #endif
  9672. #endif
  9673. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  9674. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 3, __pyx_nargs);
  9675. if (unlikely(!__pyx_v_ts)) {
  9676. __Pyx_RefNannyFinishContext();
  9677. return NULL;
  9678. }
  9679. __Pyx_GOTREF(__pyx_v_ts);
  9680. {
  9681. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,0};
  9682. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  9683. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 589, __pyx_L3_error)
  9684. if (__pyx_kwds_len > 0) {
  9685. switch (__pyx_nargs) {
  9686. default:
  9687. case 3:
  9688. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9689. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 589, __pyx_L3_error)
  9690. CYTHON_FALLTHROUGH;
  9691. case 2:
  9692. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9693. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 589, __pyx_L3_error)
  9694. CYTHON_FALLTHROUGH;
  9695. case 1:
  9696. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9697. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 589, __pyx_L3_error)
  9698. CYTHON_FALLTHROUGH;
  9699. case 0: break;
  9700. }
  9701. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  9702. const Py_ssize_t used_pos_args = (kwd_pos_args < 3) ? kwd_pos_args : 3;
  9703. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "splitQuadraticAtT", 0) < (0)) __PYX_ERR(0, 589, __pyx_L3_error)
  9704. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  9705. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitQuadraticAtT", 0, 3, 3, i); __PYX_ERR(0, 589, __pyx_L3_error) }
  9706. }
  9707. } else if (unlikely(__pyx_nargs < 3)) {
  9708. goto __pyx_L5_argtuple_error;
  9709. } else {
  9710. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9711. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 589, __pyx_L3_error)
  9712. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9713. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 589, __pyx_L3_error)
  9714. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9715. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 589, __pyx_L3_error)
  9716. }
  9717. __pyx_v_pt1 = values[0];
  9718. __pyx_v_pt2 = values[1];
  9719. __pyx_v_pt3 = values[2];
  9720. }
  9721. goto __pyx_L6_skip;
  9722. __pyx_L5_argtuple_error:;
  9723. __Pyx_RaiseArgtupleInvalid("splitQuadraticAtT", 0, 3, 3, __pyx_nargs); __PYX_ERR(0, 589, __pyx_L3_error)
  9724. __pyx_L6_skip:;
  9725. goto __pyx_L4_argument_unpacking_done;
  9726. __pyx_L3_error:;
  9727. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  9728. Py_XDECREF(values[__pyx_temp]);
  9729. }
  9730. __Pyx_DECREF(__pyx_v_ts); __pyx_v_ts = 0;
  9731. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitQuadraticAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9732. __Pyx_RefNannyFinishContext();
  9733. return NULL;
  9734. __pyx_L4_argument_unpacking_done:;
  9735. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_30splitQuadraticAtT(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_ts);
  9736. /* function exit code */
  9737. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  9738. Py_XDECREF(values[__pyx_temp]);
  9739. }
  9740. __Pyx_DECREF(__pyx_v_ts);
  9741. __Pyx_RefNannyFinishContext();
  9742. return __pyx_r;
  9743. }
  9744. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_30splitQuadraticAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_ts) {
  9745. PyObject *__pyx_v_a = NULL;
  9746. PyObject *__pyx_v_b = NULL;
  9747. PyObject *__pyx_v_c = NULL;
  9748. PyObject *__pyx_r = NULL;
  9749. __Pyx_RefNannyDeclarations
  9750. PyObject *__pyx_t_1 = NULL;
  9751. PyObject *__pyx_t_2 = NULL;
  9752. PyObject *__pyx_t_3 = NULL;
  9753. size_t __pyx_t_4;
  9754. PyObject *__pyx_t_5 = NULL;
  9755. PyObject *__pyx_t_6 = NULL;
  9756. PyObject *(*__pyx_t_7)(PyObject *);
  9757. int __pyx_lineno = 0;
  9758. const char *__pyx_filename = NULL;
  9759. int __pyx_clineno = 0;
  9760. __Pyx_RefNannySetupContext("splitQuadraticAtT", 0);
  9761. /* "fontTools/misc/bezierTools.py":609
  9762. * ((75, 37.5), (87.5, 25), (100, 0))
  9763. * """
  9764. * a, b, c = calcQuadraticParameters(pt1, pt2, pt3) # <<<<<<<<<<<<<<
  9765. * return _splitQuadraticAtT(a, b, c, *ts)
  9766. *
  9767. */
  9768. __pyx_t_2 = NULL;
  9769. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcQuadraticParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error)
  9770. __Pyx_GOTREF(__pyx_t_3);
  9771. __pyx_t_4 = 1;
  9772. #if CYTHON_UNPACK_METHODS
  9773. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  9774. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  9775. assert(__pyx_t_2);
  9776. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  9777. __Pyx_INCREF(__pyx_t_2);
  9778. __Pyx_INCREF(__pyx__function);
  9779. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  9780. __pyx_t_4 = 0;
  9781. }
  9782. #endif
  9783. {
  9784. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3};
  9785. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  9786. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  9787. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9788. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error)
  9789. __Pyx_GOTREF(__pyx_t_1);
  9790. }
  9791. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  9792. PyObject* sequence = __pyx_t_1;
  9793. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  9794. if (unlikely(size != 3)) {
  9795. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  9796. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  9797. __PYX_ERR(0, 609, __pyx_L1_error)
  9798. }
  9799. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9800. if (likely(PyTuple_CheckExact(sequence))) {
  9801. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  9802. __Pyx_INCREF(__pyx_t_3);
  9803. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  9804. __Pyx_INCREF(__pyx_t_2);
  9805. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  9806. __Pyx_INCREF(__pyx_t_5);
  9807. } else {
  9808. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  9809. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error)
  9810. __Pyx_XGOTREF(__pyx_t_3);
  9811. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  9812. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error)
  9813. __Pyx_XGOTREF(__pyx_t_2);
  9814. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  9815. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 609, __pyx_L1_error)
  9816. __Pyx_XGOTREF(__pyx_t_5);
  9817. }
  9818. #else
  9819. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error)
  9820. __Pyx_GOTREF(__pyx_t_3);
  9821. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error)
  9822. __Pyx_GOTREF(__pyx_t_2);
  9823. __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 609, __pyx_L1_error)
  9824. __Pyx_GOTREF(__pyx_t_5);
  9825. #endif
  9826. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9827. } else {
  9828. Py_ssize_t index = -1;
  9829. __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 609, __pyx_L1_error)
  9830. __Pyx_GOTREF(__pyx_t_6);
  9831. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9832. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
  9833. index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
  9834. __Pyx_GOTREF(__pyx_t_3);
  9835. index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  9836. __Pyx_GOTREF(__pyx_t_2);
  9837. index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
  9838. __Pyx_GOTREF(__pyx_t_5);
  9839. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < (0)) __PYX_ERR(0, 609, __pyx_L1_error)
  9840. __pyx_t_7 = NULL;
  9841. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9842. goto __pyx_L4_unpacking_done;
  9843. __pyx_L3_unpacking_failed:;
  9844. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9845. __pyx_t_7 = NULL;
  9846. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  9847. __PYX_ERR(0, 609, __pyx_L1_error)
  9848. __pyx_L4_unpacking_done:;
  9849. }
  9850. __pyx_v_a = __pyx_t_3;
  9851. __pyx_t_3 = 0;
  9852. __pyx_v_b = __pyx_t_2;
  9853. __pyx_t_2 = 0;
  9854. __pyx_v_c = __pyx_t_5;
  9855. __pyx_t_5 = 0;
  9856. /* "fontTools/misc/bezierTools.py":610
  9857. * """
  9858. * a, b, c = calcQuadraticParameters(pt1, pt2, pt3)
  9859. * return _splitQuadraticAtT(a, b, c, *ts) # <<<<<<<<<<<<<<
  9860. *
  9861. *
  9862. */
  9863. __Pyx_XDECREF(__pyx_r);
  9864. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_splitQuadraticAtT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
  9865. __Pyx_GOTREF(__pyx_t_1);
  9866. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 610, __pyx_L1_error)
  9867. __Pyx_GOTREF(__pyx_t_5);
  9868. __Pyx_INCREF(__pyx_v_a);
  9869. __Pyx_GIVEREF(__pyx_v_a);
  9870. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_a) != (0)) __PYX_ERR(0, 610, __pyx_L1_error);
  9871. __Pyx_INCREF(__pyx_v_b);
  9872. __Pyx_GIVEREF(__pyx_v_b);
  9873. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_b) != (0)) __PYX_ERR(0, 610, __pyx_L1_error);
  9874. __Pyx_INCREF(__pyx_v_c);
  9875. __Pyx_GIVEREF(__pyx_v_c);
  9876. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_c) != (0)) __PYX_ERR(0, 610, __pyx_L1_error);
  9877. __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_v_ts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
  9878. __Pyx_GOTREF(__pyx_t_2);
  9879. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9880. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 610, __pyx_L1_error)
  9881. __Pyx_GOTREF(__pyx_t_5);
  9882. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9883. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9884. __pyx_r = __pyx_t_5;
  9885. __pyx_t_5 = 0;
  9886. goto __pyx_L0;
  9887. /* "fontTools/misc/bezierTools.py":589
  9888. *
  9889. *
  9890. * def splitQuadraticAtT(pt1, pt2, pt3, *ts): # <<<<<<<<<<<<<<
  9891. * """Split a quadratic Bezier curve at one or more values of t.
  9892. *
  9893. */
  9894. /* function exit code */
  9895. __pyx_L1_error:;
  9896. __Pyx_XDECREF(__pyx_t_1);
  9897. __Pyx_XDECREF(__pyx_t_2);
  9898. __Pyx_XDECREF(__pyx_t_3);
  9899. __Pyx_XDECREF(__pyx_t_5);
  9900. __Pyx_XDECREF(__pyx_t_6);
  9901. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitQuadraticAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9902. __pyx_r = NULL;
  9903. __pyx_L0:;
  9904. __Pyx_XDECREF(__pyx_v_a);
  9905. __Pyx_XDECREF(__pyx_v_b);
  9906. __Pyx_XDECREF(__pyx_v_c);
  9907. __Pyx_XGIVEREF(__pyx_r);
  9908. __Pyx_RefNannyFinishContext();
  9909. return __pyx_r;
  9910. }
  9911. /* "fontTools/misc/bezierTools.py":613
  9912. *
  9913. *
  9914. * def splitCubicAtT(pt1, pt2, pt3, pt4, *ts): # <<<<<<<<<<<<<<
  9915. * """Split a cubic Bezier curve at one or more values of t.
  9916. *
  9917. */
  9918. /* Python wrapper */
  9919. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_33splitCubicAtT(PyObject *__pyx_self,
  9920. #if CYTHON_METH_FASTCALL
  9921. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9922. #else
  9923. PyObject *__pyx_args, PyObject *__pyx_kwds
  9924. #endif
  9925. ); /*proto*/
  9926. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_32splitCubicAtT, "splitCubicAtT(pt1, pt2, pt3, pt4, *ts)\n\nSplit a cubic Bezier curve at one or more values of t.\n\nArgs:\n pt1,pt2,pt3,pt4: Control points of the Bezier as 2D tuples.\n *ts: Positions at which to split the curve.\n\nReturns:\n A list of curve segments (each curve segment being four 2D tuples).\n\nExamples::\n\n >>> printSegments(splitCubicAtT((0, 0), (25, 100), (75, 100), (100, 0), 0.5))\n ((0, 0), (12.5, 50), (31.25, 75), (50, 75))\n ((50, 75), (68.75, 75), (87.5, 50), (100, 0))\n >>> printSegments(splitCubicAtT((0, 0), (25, 100), (75, 100), (100, 0), 0.5, 0.75))\n ((0, 0), (12.5, 50), (31.25, 75), (50, 75))\n ((50, 75), (59.375, 75), (68.75, 68.75), (77.3438, 56.25))\n ((77.3438, 56.25), (85.9375, 43.75), (93.75, 25), (100, 0))");
  9927. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_33splitCubicAtT = {"splitCubicAtT", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_33splitCubicAtT, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_32splitCubicAtT};
  9928. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_33splitCubicAtT(PyObject *__pyx_self,
  9929. #if CYTHON_METH_FASTCALL
  9930. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9931. #else
  9932. PyObject *__pyx_args, PyObject *__pyx_kwds
  9933. #endif
  9934. ) {
  9935. PyObject *__pyx_v_pt1 = 0;
  9936. PyObject *__pyx_v_pt2 = 0;
  9937. PyObject *__pyx_v_pt3 = 0;
  9938. PyObject *__pyx_v_pt4 = 0;
  9939. PyObject *__pyx_v_ts = 0;
  9940. #if !CYTHON_METH_FASTCALL
  9941. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  9942. #endif
  9943. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  9944. PyObject* values[4] = {0,0,0,0};
  9945. int __pyx_lineno = 0;
  9946. const char *__pyx_filename = NULL;
  9947. int __pyx_clineno = 0;
  9948. PyObject *__pyx_r = 0;
  9949. __Pyx_RefNannyDeclarations
  9950. __Pyx_RefNannySetupContext("splitCubicAtT (wrapper)", 0);
  9951. #if !CYTHON_METH_FASTCALL
  9952. #if CYTHON_ASSUME_SAFE_SIZE
  9953. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  9954. #else
  9955. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  9956. #endif
  9957. #endif
  9958. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  9959. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 4, __pyx_nargs);
  9960. if (unlikely(!__pyx_v_ts)) {
  9961. __Pyx_RefNannyFinishContext();
  9962. return NULL;
  9963. }
  9964. __Pyx_GOTREF(__pyx_v_ts);
  9965. {
  9966. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,0};
  9967. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  9968. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 613, __pyx_L3_error)
  9969. if (__pyx_kwds_len > 0) {
  9970. switch (__pyx_nargs) {
  9971. default:
  9972. case 4:
  9973. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  9974. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 613, __pyx_L3_error)
  9975. CYTHON_FALLTHROUGH;
  9976. case 3:
  9977. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9978. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 613, __pyx_L3_error)
  9979. CYTHON_FALLTHROUGH;
  9980. case 2:
  9981. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9982. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 613, __pyx_L3_error)
  9983. CYTHON_FALLTHROUGH;
  9984. case 1:
  9985. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9986. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 613, __pyx_L3_error)
  9987. CYTHON_FALLTHROUGH;
  9988. case 0: break;
  9989. }
  9990. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  9991. const Py_ssize_t used_pos_args = (kwd_pos_args < 4) ? kwd_pos_args : 4;
  9992. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "splitCubicAtT", 0) < (0)) __PYX_ERR(0, 613, __pyx_L3_error)
  9993. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  9994. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitCubicAtT", 0, 4, 4, i); __PYX_ERR(0, 613, __pyx_L3_error) }
  9995. }
  9996. } else if (unlikely(__pyx_nargs < 4)) {
  9997. goto __pyx_L5_argtuple_error;
  9998. } else {
  9999. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  10000. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 613, __pyx_L3_error)
  10001. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  10002. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 613, __pyx_L3_error)
  10003. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  10004. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 613, __pyx_L3_error)
  10005. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  10006. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 613, __pyx_L3_error)
  10007. }
  10008. __pyx_v_pt1 = values[0];
  10009. __pyx_v_pt2 = values[1];
  10010. __pyx_v_pt3 = values[2];
  10011. __pyx_v_pt4 = values[3];
  10012. }
  10013. goto __pyx_L6_skip;
  10014. __pyx_L5_argtuple_error:;
  10015. __Pyx_RaiseArgtupleInvalid("splitCubicAtT", 0, 4, 4, __pyx_nargs); __PYX_ERR(0, 613, __pyx_L3_error)
  10016. __pyx_L6_skip:;
  10017. goto __pyx_L4_argument_unpacking_done;
  10018. __pyx_L3_error:;
  10019. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10020. Py_XDECREF(values[__pyx_temp]);
  10021. }
  10022. __Pyx_DECREF(__pyx_v_ts); __pyx_v_ts = 0;
  10023. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10024. __Pyx_RefNannyFinishContext();
  10025. return NULL;
  10026. __pyx_L4_argument_unpacking_done:;
  10027. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_32splitCubicAtT(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4, __pyx_v_ts);
  10028. /* function exit code */
  10029. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10030. Py_XDECREF(values[__pyx_temp]);
  10031. }
  10032. __Pyx_DECREF(__pyx_v_ts);
  10033. __Pyx_RefNannyFinishContext();
  10034. return __pyx_r;
  10035. }
  10036. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_32splitCubicAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4, PyObject *__pyx_v_ts) {
  10037. PyObject *__pyx_v_a = NULL;
  10038. PyObject *__pyx_v_b = NULL;
  10039. PyObject *__pyx_v_c = NULL;
  10040. PyObject *__pyx_v_d = NULL;
  10041. PyObject *__pyx_v_split = NULL;
  10042. PyObject *__pyx_r = NULL;
  10043. __Pyx_RefNannyDeclarations
  10044. PyObject *__pyx_t_1 = NULL;
  10045. PyObject *__pyx_t_2 = NULL;
  10046. PyObject *__pyx_t_3 = NULL;
  10047. size_t __pyx_t_4;
  10048. PyObject *__pyx_t_5 = NULL;
  10049. PyObject *__pyx_t_6 = NULL;
  10050. PyObject *__pyx_t_7 = NULL;
  10051. PyObject *(*__pyx_t_8)(PyObject *);
  10052. int __pyx_lineno = 0;
  10053. const char *__pyx_filename = NULL;
  10054. int __pyx_clineno = 0;
  10055. __Pyx_RefNannySetupContext("splitCubicAtT", 0);
  10056. /* "fontTools/misc/bezierTools.py":633
  10057. * ((77.3438, 56.25), (85.9375, 43.75), (93.75, 25), (100, 0))
  10058. * """
  10059. * a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  10060. * split = _splitCubicAtT(a, b, c, d, *ts)
  10061. *
  10062. */
  10063. __pyx_t_2 = NULL;
  10064. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcCubicParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error)
  10065. __Pyx_GOTREF(__pyx_t_3);
  10066. __pyx_t_4 = 1;
  10067. #if CYTHON_UNPACK_METHODS
  10068. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  10069. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  10070. assert(__pyx_t_2);
  10071. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  10072. __Pyx_INCREF(__pyx_t_2);
  10073. __Pyx_INCREF(__pyx__function);
  10074. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  10075. __pyx_t_4 = 0;
  10076. }
  10077. #endif
  10078. {
  10079. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4};
  10080. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  10081. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  10082. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  10083. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error)
  10084. __Pyx_GOTREF(__pyx_t_1);
  10085. }
  10086. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  10087. PyObject* sequence = __pyx_t_1;
  10088. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  10089. if (unlikely(size != 4)) {
  10090. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  10091. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  10092. __PYX_ERR(0, 633, __pyx_L1_error)
  10093. }
  10094. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  10095. if (likely(PyTuple_CheckExact(sequence))) {
  10096. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  10097. __Pyx_INCREF(__pyx_t_3);
  10098. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  10099. __Pyx_INCREF(__pyx_t_2);
  10100. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  10101. __Pyx_INCREF(__pyx_t_5);
  10102. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
  10103. __Pyx_INCREF(__pyx_t_6);
  10104. } else {
  10105. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  10106. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error)
  10107. __Pyx_XGOTREF(__pyx_t_3);
  10108. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  10109. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error)
  10110. __Pyx_XGOTREF(__pyx_t_2);
  10111. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  10112. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 633, __pyx_L1_error)
  10113. __Pyx_XGOTREF(__pyx_t_5);
  10114. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  10115. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 633, __pyx_L1_error)
  10116. __Pyx_XGOTREF(__pyx_t_6);
  10117. }
  10118. #else
  10119. {
  10120. Py_ssize_t i;
  10121. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  10122. for (i=0; i < 4; i++) {
  10123. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 633, __pyx_L1_error)
  10124. __Pyx_GOTREF(item);
  10125. *(temps[i]) = item;
  10126. }
  10127. }
  10128. #endif
  10129. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10130. } else {
  10131. Py_ssize_t index = -1;
  10132. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  10133. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 633, __pyx_L1_error)
  10134. __Pyx_GOTREF(__pyx_t_7);
  10135. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10136. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  10137. for (index=0; index < 4; index++) {
  10138. PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
  10139. __Pyx_GOTREF(item);
  10140. *(temps[index]) = item;
  10141. }
  10142. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < (0)) __PYX_ERR(0, 633, __pyx_L1_error)
  10143. __pyx_t_8 = NULL;
  10144. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10145. goto __pyx_L4_unpacking_done;
  10146. __pyx_L3_unpacking_failed:;
  10147. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10148. __pyx_t_8 = NULL;
  10149. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  10150. __PYX_ERR(0, 633, __pyx_L1_error)
  10151. __pyx_L4_unpacking_done:;
  10152. }
  10153. __pyx_v_a = __pyx_t_3;
  10154. __pyx_t_3 = 0;
  10155. __pyx_v_b = __pyx_t_2;
  10156. __pyx_t_2 = 0;
  10157. __pyx_v_c = __pyx_t_5;
  10158. __pyx_t_5 = 0;
  10159. __pyx_v_d = __pyx_t_6;
  10160. __pyx_t_6 = 0;
  10161. /* "fontTools/misc/bezierTools.py":634
  10162. * """
  10163. * a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4)
  10164. * split = _splitCubicAtT(a, b, c, d, *ts) # <<<<<<<<<<<<<<
  10165. *
  10166. * # the split impl can introduce floating point errors; we know the first
  10167. */
  10168. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_splitCubicAtT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
  10169. __Pyx_GOTREF(__pyx_t_1);
  10170. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 634, __pyx_L1_error)
  10171. __Pyx_GOTREF(__pyx_t_6);
  10172. __Pyx_INCREF(__pyx_v_a);
  10173. __Pyx_GIVEREF(__pyx_v_a);
  10174. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_a) != (0)) __PYX_ERR(0, 634, __pyx_L1_error);
  10175. __Pyx_INCREF(__pyx_v_b);
  10176. __Pyx_GIVEREF(__pyx_v_b);
  10177. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_b) != (0)) __PYX_ERR(0, 634, __pyx_L1_error);
  10178. __Pyx_INCREF(__pyx_v_c);
  10179. __Pyx_GIVEREF(__pyx_v_c);
  10180. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_c) != (0)) __PYX_ERR(0, 634, __pyx_L1_error);
  10181. __Pyx_INCREF(__pyx_v_d);
  10182. __Pyx_GIVEREF(__pyx_v_d);
  10183. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_d) != (0)) __PYX_ERR(0, 634, __pyx_L1_error);
  10184. __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v_ts); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error)
  10185. __Pyx_GOTREF(__pyx_t_5);
  10186. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10187. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 634, __pyx_L1_error)
  10188. __Pyx_GOTREF(__pyx_t_6);
  10189. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10190. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10191. __pyx_v_split = __pyx_t_6;
  10192. __pyx_t_6 = 0;
  10193. /* "fontTools/misc/bezierTools.py":639
  10194. * # segment should always start at pt1 and the last segment should end at pt4,
  10195. * # so we set those values directly before returning.
  10196. * split[0] = (pt1, *split[0][1:]) # <<<<<<<<<<<<<<
  10197. * split[-1] = (*split[-1][:-1], pt4)
  10198. * return split
  10199. */
  10200. __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 639, __pyx_L1_error)
  10201. __Pyx_GOTREF(__pyx_t_5);
  10202. __Pyx_INCREF(__pyx_v_pt1);
  10203. __Pyx_GIVEREF(__pyx_v_pt1);
  10204. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 639, __pyx_L1_error);
  10205. __pyx_t_6 = __pyx_t_5;
  10206. __pyx_t_5 = 0;
  10207. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_split, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 639, __pyx_L1_error)
  10208. __Pyx_GOTREF(__pyx_t_5);
  10209. __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_5, 1, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[0], 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
  10210. __Pyx_GOTREF(__pyx_t_1);
  10211. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10212. if (__Pyx_PyList_Extend(__pyx_t_6, __pyx_t_1) < (0)) __PYX_ERR(0, 639, __pyx_L1_error)
  10213. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10214. {
  10215. PyObject *__pyx_temp = PyList_AsTuple(__pyx_t_6);
  10216. __Pyx_DECREF(__pyx_t_6);
  10217. __pyx_t_6 = __pyx_temp; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 639, __pyx_L1_error)
  10218. __Pyx_GOTREF(__pyx_t_6);
  10219. }
  10220. if (unlikely((__Pyx_SetItemInt(__pyx_v_split, 0, __pyx_t_6, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 639, __pyx_L1_error)
  10221. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10222. /* "fontTools/misc/bezierTools.py":640
  10223. * # so we set those values directly before returning.
  10224. * split[0] = (pt1, *split[0][1:])
  10225. * split[-1] = (*split[-1][:-1], pt4) # <<<<<<<<<<<<<<
  10226. * return split
  10227. *
  10228. */
  10229. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_split, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error)
  10230. __Pyx_GOTREF(__pyx_t_1);
  10231. __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, -1L, NULL, NULL, &__pyx_mstate_global->__pyx_slice[1], 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L1_error)
  10232. __Pyx_GOTREF(__pyx_t_5);
  10233. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10234. __pyx_t_6 = __Pyx_PySequence_ListKeepNew(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 640, __pyx_L1_error)
  10235. __Pyx_GOTREF(__pyx_t_6);
  10236. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10237. if (__Pyx_ListComp_Append(__pyx_t_6, __pyx_v_pt4) < (0)) __PYX_ERR(0, 640, __pyx_L1_error)
  10238. {
  10239. PyObject *__pyx_temp = PyList_AsTuple(__pyx_t_6);
  10240. __Pyx_DECREF(__pyx_t_6);
  10241. __pyx_t_6 = __pyx_temp; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 640, __pyx_L1_error)
  10242. __Pyx_GOTREF(__pyx_t_6);
  10243. }
  10244. if (unlikely((__Pyx_SetItemInt(__pyx_v_split, -1L, __pyx_t_6, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference) < 0))) __PYX_ERR(0, 640, __pyx_L1_error)
  10245. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10246. /* "fontTools/misc/bezierTools.py":641
  10247. * split[0] = (pt1, *split[0][1:])
  10248. * split[-1] = (*split[-1][:-1], pt4)
  10249. * return split # <<<<<<<<<<<<<<
  10250. *
  10251. *
  10252. */
  10253. __Pyx_XDECREF(__pyx_r);
  10254. __Pyx_INCREF(__pyx_v_split);
  10255. __pyx_r = __pyx_v_split;
  10256. goto __pyx_L0;
  10257. /* "fontTools/misc/bezierTools.py":613
  10258. *
  10259. *
  10260. * def splitCubicAtT(pt1, pt2, pt3, pt4, *ts): # <<<<<<<<<<<<<<
  10261. * """Split a cubic Bezier curve at one or more values of t.
  10262. *
  10263. */
  10264. /* function exit code */
  10265. __pyx_L1_error:;
  10266. __Pyx_XDECREF(__pyx_t_1);
  10267. __Pyx_XDECREF(__pyx_t_2);
  10268. __Pyx_XDECREF(__pyx_t_3);
  10269. __Pyx_XDECREF(__pyx_t_5);
  10270. __Pyx_XDECREF(__pyx_t_6);
  10271. __Pyx_XDECREF(__pyx_t_7);
  10272. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10273. __pyx_r = NULL;
  10274. __pyx_L0:;
  10275. __Pyx_XDECREF(__pyx_v_a);
  10276. __Pyx_XDECREF(__pyx_v_b);
  10277. __Pyx_XDECREF(__pyx_v_c);
  10278. __Pyx_XDECREF(__pyx_v_d);
  10279. __Pyx_XDECREF(__pyx_v_split);
  10280. __Pyx_XGIVEREF(__pyx_r);
  10281. __Pyx_RefNannyFinishContext();
  10282. return __pyx_r;
  10283. }
  10284. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_36generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  10285. /* "fontTools/misc/bezierTools.py":644
  10286. *
  10287. *
  10288. * @cython.locals( # <<<<<<<<<<<<<<
  10289. * pt1=cython.complex,
  10290. * pt2=cython.complex,
  10291. */
  10292. /* Python wrapper */
  10293. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_35splitCubicAtTC(PyObject *__pyx_self,
  10294. #if CYTHON_METH_FASTCALL
  10295. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  10296. #else
  10297. PyObject *__pyx_args, PyObject *__pyx_kwds
  10298. #endif
  10299. ); /*proto*/
  10300. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_34splitCubicAtTC, "splitCubicAtTC(double complex pt1, double complex pt2, double complex pt3, double complex pt4, *ts)\n\nSplit a cubic Bezier curve at one or more values of t.\n\nArgs:\n pt1,pt2,pt3,pt4: Control points of the Bezier as complex numbers..\n *ts: Positions at which to split the curve.\n\nYields:\n Curve segments (each curve segment being four complex numbers).");
  10301. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_35splitCubicAtTC = {"splitCubicAtTC", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_35splitCubicAtTC, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_34splitCubicAtTC};
  10302. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_35splitCubicAtTC(PyObject *__pyx_self,
  10303. #if CYTHON_METH_FASTCALL
  10304. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  10305. #else
  10306. PyObject *__pyx_args, PyObject *__pyx_kwds
  10307. #endif
  10308. ) {
  10309. __pyx_t_double_complex __pyx_v_pt1;
  10310. __pyx_t_double_complex __pyx_v_pt2;
  10311. __pyx_t_double_complex __pyx_v_pt3;
  10312. __pyx_t_double_complex __pyx_v_pt4;
  10313. PyObject *__pyx_v_ts = 0;
  10314. #if !CYTHON_METH_FASTCALL
  10315. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  10316. #endif
  10317. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  10318. PyObject* values[4] = {0,0,0,0};
  10319. int __pyx_lineno = 0;
  10320. const char *__pyx_filename = NULL;
  10321. int __pyx_clineno = 0;
  10322. PyObject *__pyx_r = 0;
  10323. __Pyx_RefNannyDeclarations
  10324. __Pyx_RefNannySetupContext("splitCubicAtTC (wrapper)", 0);
  10325. #if !CYTHON_METH_FASTCALL
  10326. #if CYTHON_ASSUME_SAFE_SIZE
  10327. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  10328. #else
  10329. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  10330. #endif
  10331. #endif
  10332. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  10333. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 4, __pyx_nargs);
  10334. if (unlikely(!__pyx_v_ts)) {
  10335. __Pyx_RefNannyFinishContext();
  10336. return NULL;
  10337. }
  10338. __Pyx_GOTREF(__pyx_v_ts);
  10339. {
  10340. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,0};
  10341. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  10342. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 644, __pyx_L3_error)
  10343. if (__pyx_kwds_len > 0) {
  10344. switch (__pyx_nargs) {
  10345. default:
  10346. case 4:
  10347. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  10348. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 644, __pyx_L3_error)
  10349. CYTHON_FALLTHROUGH;
  10350. case 3:
  10351. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  10352. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 644, __pyx_L3_error)
  10353. CYTHON_FALLTHROUGH;
  10354. case 2:
  10355. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  10356. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 644, __pyx_L3_error)
  10357. CYTHON_FALLTHROUGH;
  10358. case 1:
  10359. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  10360. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 644, __pyx_L3_error)
  10361. CYTHON_FALLTHROUGH;
  10362. case 0: break;
  10363. }
  10364. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  10365. const Py_ssize_t used_pos_args = (kwd_pos_args < 4) ? kwd_pos_args : 4;
  10366. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "splitCubicAtTC", 0) < (0)) __PYX_ERR(0, 644, __pyx_L3_error)
  10367. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  10368. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitCubicAtTC", 0, 4, 4, i); __PYX_ERR(0, 644, __pyx_L3_error) }
  10369. }
  10370. } else if (unlikely(__pyx_nargs < 4)) {
  10371. goto __pyx_L5_argtuple_error;
  10372. } else {
  10373. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  10374. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 644, __pyx_L3_error)
  10375. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  10376. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 644, __pyx_L3_error)
  10377. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  10378. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 644, __pyx_L3_error)
  10379. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  10380. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 644, __pyx_L3_error)
  10381. }
  10382. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 654, __pyx_L3_error)
  10383. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 654, __pyx_L3_error)
  10384. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 654, __pyx_L3_error)
  10385. __pyx_v_pt4 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 654, __pyx_L3_error)
  10386. }
  10387. goto __pyx_L6_skip;
  10388. __pyx_L5_argtuple_error:;
  10389. __Pyx_RaiseArgtupleInvalid("splitCubicAtTC", 0, 4, 4, __pyx_nargs); __PYX_ERR(0, 644, __pyx_L3_error)
  10390. __pyx_L6_skip:;
  10391. goto __pyx_L4_argument_unpacking_done;
  10392. __pyx_L3_error:;
  10393. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10394. Py_XDECREF(values[__pyx_temp]);
  10395. }
  10396. __Pyx_CLEAR(__pyx_v_ts);
  10397. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10398. __Pyx_RefNannyFinishContext();
  10399. return NULL;
  10400. __pyx_L4_argument_unpacking_done:;
  10401. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_34splitCubicAtTC(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4, __pyx_v_ts);
  10402. /* function exit code */
  10403. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10404. Py_XDECREF(values[__pyx_temp]);
  10405. }
  10406. __Pyx_DECREF(__pyx_v_ts);
  10407. __Pyx_RefNannyFinishContext();
  10408. return __pyx_r;
  10409. }
  10410. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_34splitCubicAtTC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4, PyObject *__pyx_v_ts) {
  10411. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *__pyx_cur_scope;
  10412. PyObject *__pyx_r = NULL;
  10413. __Pyx_RefNannyDeclarations
  10414. int __pyx_lineno = 0;
  10415. const char *__pyx_filename = NULL;
  10416. int __pyx_clineno = 0;
  10417. __Pyx_RefNannySetupContext("splitCubicAtTC", 0);
  10418. __pyx_cur_scope = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC(__pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  10419. if (unlikely(!__pyx_cur_scope)) {
  10420. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *)Py_None);
  10421. __Pyx_INCREF(Py_None);
  10422. __PYX_ERR(0, 644, __pyx_L1_error)
  10423. } else {
  10424. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  10425. }
  10426. __pyx_cur_scope->__pyx_v_pt1 = __pyx_v_pt1;
  10427. __pyx_cur_scope->__pyx_v_pt2 = __pyx_v_pt2;
  10428. __pyx_cur_scope->__pyx_v_pt3 = __pyx_v_pt3;
  10429. __pyx_cur_scope->__pyx_v_pt4 = __pyx_v_pt4;
  10430. __pyx_cur_scope->__pyx_v_ts = __pyx_v_ts;
  10431. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ts);
  10432. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ts);
  10433. {
  10434. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_4misc_11bezierTools_36generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_splitCubicAtTC, __pyx_mstate_global->__pyx_n_u_splitCubicAtTC, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools); if (unlikely(!gen)) __PYX_ERR(0, 644, __pyx_L1_error)
  10435. __Pyx_DECREF(__pyx_cur_scope);
  10436. __Pyx_RefNannyFinishContext();
  10437. return (PyObject *) gen;
  10438. }
  10439. /* function exit code */
  10440. __pyx_L1_error:;
  10441. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10442. __pyx_r = NULL;
  10443. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  10444. __Pyx_XGIVEREF(__pyx_r);
  10445. __Pyx_RefNannyFinishContext();
  10446. return __pyx_r;
  10447. }
  10448. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_36generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  10449. {
  10450. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *)__pyx_generator->closure);
  10451. PyObject *__pyx_r = NULL;
  10452. PyObject *__pyx_t_1 = NULL;
  10453. PyObject *__pyx_t_2 = NULL;
  10454. PyObject *__pyx_t_3 = NULL;
  10455. PyObject *__pyx_t_4 = NULL;
  10456. PyObject *__pyx_t_5 = NULL;
  10457. PyObject *__pyx_t_6 = NULL;
  10458. PyObject *(*__pyx_t_7)(PyObject *);
  10459. __pyx_t_double_complex __pyx_t_8;
  10460. __pyx_t_double_complex __pyx_t_9;
  10461. __pyx_t_double_complex __pyx_t_10;
  10462. __pyx_t_double_complex __pyx_t_11;
  10463. __Pyx_PySendResult __pyx_t_12;
  10464. int __pyx_lineno = 0;
  10465. const char *__pyx_filename = NULL;
  10466. int __pyx_clineno = 0;
  10467. __Pyx_RefNannyDeclarations
  10468. __Pyx_RefNannySetupContext("splitCubicAtTC", 0);
  10469. switch (__pyx_generator->resume_label) {
  10470. case 0: goto __pyx_L3_first_run;
  10471. case 1: goto __pyx_L6_resume_from_yield_from;
  10472. default: /* CPython raises the right error here */
  10473. __Pyx_RefNannyFinishContext();
  10474. return NULL;
  10475. }
  10476. __pyx_L3_first_run:;
  10477. if (unlikely(__pyx_sent_value != Py_None)) {
  10478. if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
  10479. __PYX_ERR(0, 644, __pyx_L1_error)
  10480. }
  10481. /* "fontTools/misc/bezierTools.py":664
  10482. * Curve segments (each curve segment being four complex numbers).
  10483. * """
  10484. * a, b, c, d = calcCubicParametersC(pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  10485. * yield from _splitCubicAtTC(a, b, c, d, *ts)
  10486. *
  10487. */
  10488. __pyx_t_1 = __pyx_f_9fontTools_4misc_11bezierTools_calcCubicParametersC(__pyx_cur_scope->__pyx_v_pt1, __pyx_cur_scope->__pyx_v_pt2, __pyx_cur_scope->__pyx_v_pt3, __pyx_cur_scope->__pyx_v_pt4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error)
  10489. __Pyx_GOTREF(__pyx_t_1);
  10490. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  10491. PyObject* sequence = __pyx_t_1;
  10492. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  10493. if (unlikely(size != 4)) {
  10494. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  10495. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  10496. __PYX_ERR(0, 664, __pyx_L1_error)
  10497. }
  10498. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  10499. if (likely(PyTuple_CheckExact(sequence))) {
  10500. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  10501. __Pyx_INCREF(__pyx_t_2);
  10502. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
  10503. __Pyx_INCREF(__pyx_t_3);
  10504. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
  10505. __Pyx_INCREF(__pyx_t_4);
  10506. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
  10507. __Pyx_INCREF(__pyx_t_5);
  10508. } else {
  10509. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  10510. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 664, __pyx_L1_error)
  10511. __Pyx_XGOTREF(__pyx_t_2);
  10512. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  10513. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 664, __pyx_L1_error)
  10514. __Pyx_XGOTREF(__pyx_t_3);
  10515. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  10516. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error)
  10517. __Pyx_XGOTREF(__pyx_t_4);
  10518. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  10519. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 664, __pyx_L1_error)
  10520. __Pyx_XGOTREF(__pyx_t_5);
  10521. }
  10522. #else
  10523. {
  10524. Py_ssize_t i;
  10525. PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5};
  10526. for (i=0; i < 4; i++) {
  10527. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 664, __pyx_L1_error)
  10528. __Pyx_GOTREF(item);
  10529. *(temps[i]) = item;
  10530. }
  10531. }
  10532. #endif
  10533. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10534. } else {
  10535. Py_ssize_t index = -1;
  10536. PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5};
  10537. __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 664, __pyx_L1_error)
  10538. __Pyx_GOTREF(__pyx_t_6);
  10539. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10540. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
  10541. for (index=0; index < 4; index++) {
  10542. PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
  10543. __Pyx_GOTREF(item);
  10544. *(temps[index]) = item;
  10545. }
  10546. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < (0)) __PYX_ERR(0, 664, __pyx_L1_error)
  10547. __pyx_t_7 = NULL;
  10548. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10549. goto __pyx_L5_unpacking_done;
  10550. __pyx_L4_unpacking_failed:;
  10551. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10552. __pyx_t_7 = NULL;
  10553. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  10554. __PYX_ERR(0, 664, __pyx_L1_error)
  10555. __pyx_L5_unpacking_done:;
  10556. }
  10557. __pyx_t_8 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
  10558. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  10559. __pyx_t_9 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
  10560. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  10561. __pyx_t_10 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
  10562. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10563. __pyx_t_11 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
  10564. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10565. __pyx_cur_scope->__pyx_v_a = __pyx_t_8;
  10566. __pyx_cur_scope->__pyx_v_b = __pyx_t_9;
  10567. __pyx_cur_scope->__pyx_v_c = __pyx_t_10;
  10568. __pyx_cur_scope->__pyx_v_d = __pyx_t_11;
  10569. /* "fontTools/misc/bezierTools.py":665
  10570. * """
  10571. * a, b, c, d = calcCubicParametersC(pt1, pt2, pt3, pt4)
  10572. * yield from _splitCubicAtTC(a, b, c, d, *ts) # <<<<<<<<<<<<<<
  10573. *
  10574. *
  10575. */
  10576. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_splitCubicAtTC_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error)
  10577. __Pyx_GOTREF(__pyx_t_1);
  10578. __pyx_t_5 = __pyx_PyComplex_FromComplex(__pyx_cur_scope->__pyx_v_a); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 665, __pyx_L1_error)
  10579. __Pyx_GOTREF(__pyx_t_5);
  10580. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_cur_scope->__pyx_v_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 665, __pyx_L1_error)
  10581. __Pyx_GOTREF(__pyx_t_4);
  10582. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_cur_scope->__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 665, __pyx_L1_error)
  10583. __Pyx_GOTREF(__pyx_t_3);
  10584. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_cur_scope->__pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 665, __pyx_L1_error)
  10585. __Pyx_GOTREF(__pyx_t_2);
  10586. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 665, __pyx_L1_error)
  10587. __Pyx_GOTREF(__pyx_t_6);
  10588. __Pyx_GIVEREF(__pyx_t_5);
  10589. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 665, __pyx_L1_error);
  10590. __Pyx_GIVEREF(__pyx_t_4);
  10591. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 665, __pyx_L1_error);
  10592. __Pyx_GIVEREF(__pyx_t_3);
  10593. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 665, __pyx_L1_error);
  10594. __Pyx_GIVEREF(__pyx_t_2);
  10595. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2) != (0)) __PYX_ERR(0, 665, __pyx_L1_error);
  10596. __pyx_t_5 = 0;
  10597. __pyx_t_4 = 0;
  10598. __pyx_t_3 = 0;
  10599. __pyx_t_2 = 0;
  10600. __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_cur_scope->__pyx_v_ts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 665, __pyx_L1_error)
  10601. __Pyx_GOTREF(__pyx_t_2);
  10602. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10603. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 665, __pyx_L1_error)
  10604. __Pyx_GOTREF(__pyx_t_6);
  10605. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10606. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  10607. __pyx_t_12 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_t_6, &__pyx_r);
  10608. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10609. if (likely(__pyx_t_12 == PYGEN_NEXT)) {
  10610. __Pyx_GOTREF(__pyx_r);
  10611. __Pyx_XGIVEREF(__pyx_r);
  10612. __Pyx_RefNannyFinishContext();
  10613. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  10614. /* return from generator, yielding value */
  10615. __pyx_generator->resume_label = 1;
  10616. return __pyx_r;
  10617. __pyx_L6_resume_from_yield_from:;
  10618. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 665, __pyx_L1_error)
  10619. } else if (likely(__pyx_t_12 == PYGEN_RETURN)) {
  10620. __Pyx_GOTREF(__pyx_r);
  10621. __Pyx_DECREF(__pyx_r); __pyx_r = 0;
  10622. } else {
  10623. __Pyx_XGOTREF(__pyx_r);
  10624. __PYX_ERR(0, 665, __pyx_L1_error)
  10625. }
  10626. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  10627. /* "fontTools/misc/bezierTools.py":644
  10628. *
  10629. *
  10630. * @cython.locals( # <<<<<<<<<<<<<<
  10631. * pt1=cython.complex,
  10632. * pt2=cython.complex,
  10633. */
  10634. /* function exit code */
  10635. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  10636. goto __pyx_L0;
  10637. __pyx_L1_error:;
  10638. __Pyx_XDECREF(__pyx_t_1);
  10639. __Pyx_XDECREF(__pyx_t_2);
  10640. __Pyx_XDECREF(__pyx_t_3);
  10641. __Pyx_XDECREF(__pyx_t_4);
  10642. __Pyx_XDECREF(__pyx_t_5);
  10643. __Pyx_XDECREF(__pyx_t_6);
  10644. if (__Pyx_PyErr_Occurred()) {
  10645. __Pyx_Generator_Replace_StopIteration(0);
  10646. __Pyx_AddTraceback("splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10647. }
  10648. __pyx_L0:;
  10649. __Pyx_XGIVEREF(__pyx_r);
  10650. #if !CYTHON_USE_EXC_INFO_STACK
  10651. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  10652. #endif
  10653. __pyx_generator->resume_label = -1;
  10654. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  10655. __Pyx_RefNannyFinishContext();
  10656. return __pyx_r;
  10657. }
  10658. /* "fontTools/misc/bezierTools.py":668
  10659. *
  10660. *
  10661. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  10662. * @cython.locals(
  10663. * t=cython.double,
  10664. */
  10665. /* Python wrapper */
  10666. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_38splitCubicIntoTwoAtTC(PyObject *__pyx_self,
  10667. #if CYTHON_METH_FASTCALL
  10668. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  10669. #else
  10670. PyObject *__pyx_args, PyObject *__pyx_kwds
  10671. #endif
  10672. ); /*proto*/
  10673. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_37splitCubicIntoTwoAtTC, "splitCubicIntoTwoAtTC(double complex pt1, double complex pt2, double complex pt3, double complex pt4, double t)\n\nSplit a cubic Bezier curve at t.\n\nArgs:\n pt1,pt2,pt3,pt4: Control points of the Bezier as complex numbers.\n t: Position at which to split the curve.\n\nReturns:\n A tuple of two curve segments (each curve segment being four complex numbers).");
  10674. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_38splitCubicIntoTwoAtTC = {"splitCubicIntoTwoAtTC", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_38splitCubicIntoTwoAtTC, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_37splitCubicIntoTwoAtTC};
  10675. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_38splitCubicIntoTwoAtTC(PyObject *__pyx_self,
  10676. #if CYTHON_METH_FASTCALL
  10677. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  10678. #else
  10679. PyObject *__pyx_args, PyObject *__pyx_kwds
  10680. #endif
  10681. ) {
  10682. __pyx_t_double_complex __pyx_v_pt1;
  10683. __pyx_t_double_complex __pyx_v_pt2;
  10684. __pyx_t_double_complex __pyx_v_pt3;
  10685. __pyx_t_double_complex __pyx_v_pt4;
  10686. double __pyx_v_t;
  10687. #if !CYTHON_METH_FASTCALL
  10688. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  10689. #endif
  10690. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  10691. PyObject* values[5] = {0,0,0,0,0};
  10692. int __pyx_lineno = 0;
  10693. const char *__pyx_filename = NULL;
  10694. int __pyx_clineno = 0;
  10695. PyObject *__pyx_r = 0;
  10696. __Pyx_RefNannyDeclarations
  10697. __Pyx_RefNannySetupContext("splitCubicIntoTwoAtTC (wrapper)", 0);
  10698. #if !CYTHON_METH_FASTCALL
  10699. #if CYTHON_ASSUME_SAFE_SIZE
  10700. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  10701. #else
  10702. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  10703. #endif
  10704. #endif
  10705. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  10706. {
  10707. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,&__pyx_mstate_global->__pyx_n_u_t,0};
  10708. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  10709. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 668, __pyx_L3_error)
  10710. if (__pyx_kwds_len > 0) {
  10711. switch (__pyx_nargs) {
  10712. case 5:
  10713. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  10714. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 668, __pyx_L3_error)
  10715. CYTHON_FALLTHROUGH;
  10716. case 4:
  10717. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  10718. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 668, __pyx_L3_error)
  10719. CYTHON_FALLTHROUGH;
  10720. case 3:
  10721. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  10722. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 668, __pyx_L3_error)
  10723. CYTHON_FALLTHROUGH;
  10724. case 2:
  10725. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  10726. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 668, __pyx_L3_error)
  10727. CYTHON_FALLTHROUGH;
  10728. case 1:
  10729. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  10730. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 668, __pyx_L3_error)
  10731. CYTHON_FALLTHROUGH;
  10732. case 0: break;
  10733. default: goto __pyx_L5_argtuple_error;
  10734. }
  10735. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  10736. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "splitCubicIntoTwoAtTC", 0) < (0)) __PYX_ERR(0, 668, __pyx_L3_error)
  10737. for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
  10738. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitCubicIntoTwoAtTC", 1, 5, 5, i); __PYX_ERR(0, 668, __pyx_L3_error) }
  10739. }
  10740. } else if (unlikely(__pyx_nargs != 5)) {
  10741. goto __pyx_L5_argtuple_error;
  10742. } else {
  10743. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  10744. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 668, __pyx_L3_error)
  10745. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  10746. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 668, __pyx_L3_error)
  10747. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  10748. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 668, __pyx_L3_error)
  10749. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  10750. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 668, __pyx_L3_error)
  10751. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  10752. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 668, __pyx_L3_error)
  10753. }
  10754. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error)
  10755. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error)
  10756. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error)
  10757. __pyx_v_pt4 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error)
  10758. __pyx_v_t = __Pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error)
  10759. }
  10760. goto __pyx_L6_skip;
  10761. __pyx_L5_argtuple_error:;
  10762. __Pyx_RaiseArgtupleInvalid("splitCubicIntoTwoAtTC", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 668, __pyx_L3_error)
  10763. __pyx_L6_skip:;
  10764. goto __pyx_L4_argument_unpacking_done;
  10765. __pyx_L3_error:;
  10766. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10767. Py_XDECREF(values[__pyx_temp]);
  10768. }
  10769. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicIntoTwoAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10770. __Pyx_RefNannyFinishContext();
  10771. return NULL;
  10772. __pyx_L4_argument_unpacking_done:;
  10773. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_37splitCubicIntoTwoAtTC(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4, __pyx_v_t);
  10774. /* function exit code */
  10775. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10776. Py_XDECREF(values[__pyx_temp]);
  10777. }
  10778. __Pyx_RefNannyFinishContext();
  10779. return __pyx_r;
  10780. }
  10781. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_37splitCubicIntoTwoAtTC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4, double __pyx_v_t) {
  10782. double __pyx_v_t2;
  10783. double __pyx_v__1_t;
  10784. double __pyx_v__1_t_2;
  10785. double __pyx_v__2_t_1_t;
  10786. __pyx_t_double_complex __pyx_v_pointAtT;
  10787. __pyx_t_double_complex __pyx_v_off1;
  10788. __pyx_t_double_complex __pyx_v_off2;
  10789. PyObject *__pyx_r = NULL;
  10790. __Pyx_RefNannyDeclarations
  10791. PyObject *__pyx_t_1 = NULL;
  10792. PyObject *__pyx_t_2 = NULL;
  10793. PyObject *__pyx_t_3 = NULL;
  10794. PyObject *__pyx_t_4 = NULL;
  10795. PyObject *__pyx_t_5 = NULL;
  10796. PyObject *__pyx_t_6 = NULL;
  10797. int __pyx_lineno = 0;
  10798. const char *__pyx_filename = NULL;
  10799. int __pyx_clineno = 0;
  10800. __Pyx_RefNannySetupContext("splitCubicIntoTwoAtTC", 0);
  10801. /* "fontTools/misc/bezierTools.py":692
  10802. * A tuple of two curve segments (each curve segment being four complex numbers).
  10803. * """
  10804. * t2 = t * t # <<<<<<<<<<<<<<
  10805. * _1_t = 1 - t
  10806. * _1_t_2 = _1_t * _1_t
  10807. */
  10808. __pyx_v_t2 = (__pyx_v_t * __pyx_v_t);
  10809. /* "fontTools/misc/bezierTools.py":693
  10810. * """
  10811. * t2 = t * t
  10812. * _1_t = 1 - t # <<<<<<<<<<<<<<
  10813. * _1_t_2 = _1_t * _1_t
  10814. * _2_t_1_t = 2 * t * _1_t
  10815. */
  10816. __pyx_v__1_t = (1.0 - __pyx_v_t);
  10817. /* "fontTools/misc/bezierTools.py":694
  10818. * t2 = t * t
  10819. * _1_t = 1 - t
  10820. * _1_t_2 = _1_t * _1_t # <<<<<<<<<<<<<<
  10821. * _2_t_1_t = 2 * t * _1_t
  10822. * pointAtT = (
  10823. */
  10824. __pyx_v__1_t_2 = (__pyx_v__1_t * __pyx_v__1_t);
  10825. /* "fontTools/misc/bezierTools.py":695
  10826. * _1_t = 1 - t
  10827. * _1_t_2 = _1_t * _1_t
  10828. * _2_t_1_t = 2 * t * _1_t # <<<<<<<<<<<<<<
  10829. * pointAtT = (
  10830. * _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4
  10831. */
  10832. __pyx_v__2_t_1_t = ((2.0 * __pyx_v_t) * __pyx_v__1_t);
  10833. /* "fontTools/misc/bezierTools.py":697
  10834. * _2_t_1_t = 2 * t * _1_t
  10835. * pointAtT = (
  10836. * _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4 # <<<<<<<<<<<<<<
  10837. * )
  10838. * off1 = _1_t_2 * pt1 + _2_t_1_t * pt2 + t2 * pt3
  10839. */
  10840. __pyx_v_pointAtT = __Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts((__pyx_v__1_t_2 * __pyx_v__1_t), 0), __pyx_v_pt1), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(3, 0), __Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts((__pyx_v__1_t_2 * __pyx_v_t), 0), __pyx_v_pt2), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts((__pyx_v__1_t * __pyx_v_t2), 0), __pyx_v_pt3)))), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts((__pyx_v_t2 * __pyx_v_t), 0), __pyx_v_pt4));
  10841. /* "fontTools/misc/bezierTools.py":699
  10842. * _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4
  10843. * )
  10844. * off1 = _1_t_2 * pt1 + _2_t_1_t * pt2 + t2 * pt3 # <<<<<<<<<<<<<<
  10845. * off2 = _1_t_2 * pt2 + _2_t_1_t * pt3 + t2 * pt4
  10846. *
  10847. */
  10848. __pyx_v_off1 = __Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts(__pyx_v__1_t_2, 0), __pyx_v_pt1), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(__pyx_v__2_t_1_t, 0), __pyx_v_pt2)), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(__pyx_v_t2, 0), __pyx_v_pt3));
  10849. /* "fontTools/misc/bezierTools.py":700
  10850. * )
  10851. * off1 = _1_t_2 * pt1 + _2_t_1_t * pt2 + t2 * pt3
  10852. * off2 = _1_t_2 * pt2 + _2_t_1_t * pt3 + t2 * pt4 # <<<<<<<<<<<<<<
  10853. *
  10854. * pt2 = pt1 + (pt2 - pt1) * t
  10855. */
  10856. __pyx_v_off2 = __Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts(__pyx_v__1_t_2, 0), __pyx_v_pt2), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(__pyx_v__2_t_1_t, 0), __pyx_v_pt3)), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(__pyx_v_t2, 0), __pyx_v_pt4));
  10857. /* "fontTools/misc/bezierTools.py":702
  10858. * off2 = _1_t_2 * pt2 + _2_t_1_t * pt3 + t2 * pt4
  10859. *
  10860. * pt2 = pt1 + (pt2 - pt1) * t # <<<<<<<<<<<<<<
  10861. * pt3 = pt4 + (pt3 - pt4) * _1_t
  10862. *
  10863. */
  10864. __pyx_v_pt2 = __Pyx_c_sum_double(__pyx_v_pt1, __Pyx_c_prod_double(__Pyx_c_diff_double(__pyx_v_pt2, __pyx_v_pt1), __pyx_t_double_complex_from_parts(__pyx_v_t, 0)));
  10865. /* "fontTools/misc/bezierTools.py":703
  10866. *
  10867. * pt2 = pt1 + (pt2 - pt1) * t
  10868. * pt3 = pt4 + (pt3 - pt4) * _1_t # <<<<<<<<<<<<<<
  10869. *
  10870. * return ((pt1, pt2, off1, pointAtT), (pointAtT, off2, pt3, pt4))
  10871. */
  10872. __pyx_v_pt3 = __Pyx_c_sum_double(__pyx_v_pt4, __Pyx_c_prod_double(__Pyx_c_diff_double(__pyx_v_pt3, __pyx_v_pt4), __pyx_t_double_complex_from_parts(__pyx_v__1_t, 0)));
  10873. /* "fontTools/misc/bezierTools.py":705
  10874. * pt3 = pt4 + (pt3 - pt4) * _1_t
  10875. *
  10876. * return ((pt1, pt2, off1, pointAtT), (pointAtT, off2, pt3, pt4)) # <<<<<<<<<<<<<<
  10877. *
  10878. *
  10879. */
  10880. __Pyx_XDECREF(__pyx_r);
  10881. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_pt1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
  10882. __Pyx_GOTREF(__pyx_t_1);
  10883. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_v_pt2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error)
  10884. __Pyx_GOTREF(__pyx_t_2);
  10885. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_v_off1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error)
  10886. __Pyx_GOTREF(__pyx_t_3);
  10887. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_v_pointAtT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 705, __pyx_L1_error)
  10888. __Pyx_GOTREF(__pyx_t_4);
  10889. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 705, __pyx_L1_error)
  10890. __Pyx_GOTREF(__pyx_t_5);
  10891. __Pyx_GIVEREF(__pyx_t_1);
  10892. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10893. __Pyx_GIVEREF(__pyx_t_2);
  10894. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10895. __Pyx_GIVEREF(__pyx_t_3);
  10896. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10897. __Pyx_GIVEREF(__pyx_t_4);
  10898. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10899. __pyx_t_1 = 0;
  10900. __pyx_t_2 = 0;
  10901. __pyx_t_3 = 0;
  10902. __pyx_t_4 = 0;
  10903. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_v_pointAtT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 705, __pyx_L1_error)
  10904. __Pyx_GOTREF(__pyx_t_4);
  10905. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_v_off2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error)
  10906. __Pyx_GOTREF(__pyx_t_3);
  10907. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_v_pt3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error)
  10908. __Pyx_GOTREF(__pyx_t_2);
  10909. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_pt4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
  10910. __Pyx_GOTREF(__pyx_t_1);
  10911. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 705, __pyx_L1_error)
  10912. __Pyx_GOTREF(__pyx_t_6);
  10913. __Pyx_GIVEREF(__pyx_t_4);
  10914. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10915. __Pyx_GIVEREF(__pyx_t_3);
  10916. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10917. __Pyx_GIVEREF(__pyx_t_2);
  10918. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10919. __Pyx_GIVEREF(__pyx_t_1);
  10920. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_1) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10921. __pyx_t_4 = 0;
  10922. __pyx_t_3 = 0;
  10923. __pyx_t_2 = 0;
  10924. __pyx_t_1 = 0;
  10925. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
  10926. __Pyx_GOTREF(__pyx_t_1);
  10927. __Pyx_GIVEREF(__pyx_t_5);
  10928. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10929. __Pyx_GIVEREF(__pyx_t_6);
  10930. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10931. __pyx_t_5 = 0;
  10932. __pyx_t_6 = 0;
  10933. __pyx_r = __pyx_t_1;
  10934. __pyx_t_1 = 0;
  10935. goto __pyx_L0;
  10936. /* "fontTools/misc/bezierTools.py":668
  10937. *
  10938. *
  10939. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  10940. * @cython.locals(
  10941. * t=cython.double,
  10942. */
  10943. /* function exit code */
  10944. __pyx_L1_error:;
  10945. __Pyx_XDECREF(__pyx_t_1);
  10946. __Pyx_XDECREF(__pyx_t_2);
  10947. __Pyx_XDECREF(__pyx_t_3);
  10948. __Pyx_XDECREF(__pyx_t_4);
  10949. __Pyx_XDECREF(__pyx_t_5);
  10950. __Pyx_XDECREF(__pyx_t_6);
  10951. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicIntoTwoAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10952. __pyx_r = NULL;
  10953. __pyx_L0:;
  10954. __Pyx_XGIVEREF(__pyx_r);
  10955. __Pyx_RefNannyFinishContext();
  10956. return __pyx_r;
  10957. }
  10958. /* "fontTools/misc/bezierTools.py":708
  10959. *
  10960. *
  10961. * def _splitQuadraticAtT(a, b, c, *ts): # <<<<<<<<<<<<<<
  10962. * ts = list(ts)
  10963. * segments = []
  10964. */
  10965. /* Python wrapper */
  10966. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_40_splitQuadraticAtT(PyObject *__pyx_self,
  10967. #if CYTHON_METH_FASTCALL
  10968. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  10969. #else
  10970. PyObject *__pyx_args, PyObject *__pyx_kwds
  10971. #endif
  10972. ); /*proto*/
  10973. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_39_splitQuadraticAtT, "_splitQuadraticAtT(a, b, c, *ts)");
  10974. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_40_splitQuadraticAtT = {"_splitQuadraticAtT", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_40_splitQuadraticAtT, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_39_splitQuadraticAtT};
  10975. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_40_splitQuadraticAtT(PyObject *__pyx_self,
  10976. #if CYTHON_METH_FASTCALL
  10977. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  10978. #else
  10979. PyObject *__pyx_args, PyObject *__pyx_kwds
  10980. #endif
  10981. ) {
  10982. PyObject *__pyx_v_a = 0;
  10983. PyObject *__pyx_v_b = 0;
  10984. PyObject *__pyx_v_c = 0;
  10985. PyObject *__pyx_v_ts = 0;
  10986. #if !CYTHON_METH_FASTCALL
  10987. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  10988. #endif
  10989. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  10990. PyObject* values[3] = {0,0,0};
  10991. int __pyx_lineno = 0;
  10992. const char *__pyx_filename = NULL;
  10993. int __pyx_clineno = 0;
  10994. PyObject *__pyx_r = 0;
  10995. __Pyx_RefNannyDeclarations
  10996. __Pyx_RefNannySetupContext("_splitQuadraticAtT (wrapper)", 0);
  10997. #if !CYTHON_METH_FASTCALL
  10998. #if CYTHON_ASSUME_SAFE_SIZE
  10999. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  11000. #else
  11001. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  11002. #endif
  11003. #endif
  11004. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  11005. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 3, __pyx_nargs);
  11006. if (unlikely(!__pyx_v_ts)) {
  11007. __Pyx_RefNannyFinishContext();
  11008. return NULL;
  11009. }
  11010. __Pyx_GOTREF(__pyx_v_ts);
  11011. {
  11012. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_a,&__pyx_mstate_global->__pyx_n_u_b,&__pyx_mstate_global->__pyx_n_u_c,0};
  11013. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  11014. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 708, __pyx_L3_error)
  11015. if (__pyx_kwds_len > 0) {
  11016. switch (__pyx_nargs) {
  11017. default:
  11018. case 3:
  11019. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  11020. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 708, __pyx_L3_error)
  11021. CYTHON_FALLTHROUGH;
  11022. case 2:
  11023. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  11024. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 708, __pyx_L3_error)
  11025. CYTHON_FALLTHROUGH;
  11026. case 1:
  11027. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  11028. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 708, __pyx_L3_error)
  11029. CYTHON_FALLTHROUGH;
  11030. case 0: break;
  11031. }
  11032. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  11033. const Py_ssize_t used_pos_args = (kwd_pos_args < 3) ? kwd_pos_args : 3;
  11034. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "_splitQuadraticAtT", 0) < (0)) __PYX_ERR(0, 708, __pyx_L3_error)
  11035. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  11036. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_splitQuadraticAtT", 0, 3, 3, i); __PYX_ERR(0, 708, __pyx_L3_error) }
  11037. }
  11038. } else if (unlikely(__pyx_nargs < 3)) {
  11039. goto __pyx_L5_argtuple_error;
  11040. } else {
  11041. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  11042. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 708, __pyx_L3_error)
  11043. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  11044. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 708, __pyx_L3_error)
  11045. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  11046. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 708, __pyx_L3_error)
  11047. }
  11048. __pyx_v_a = values[0];
  11049. __pyx_v_b = values[1];
  11050. __pyx_v_c = values[2];
  11051. }
  11052. goto __pyx_L6_skip;
  11053. __pyx_L5_argtuple_error:;
  11054. __Pyx_RaiseArgtupleInvalid("_splitQuadraticAtT", 0, 3, 3, __pyx_nargs); __PYX_ERR(0, 708, __pyx_L3_error)
  11055. __pyx_L6_skip:;
  11056. goto __pyx_L4_argument_unpacking_done;
  11057. __pyx_L3_error:;
  11058. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  11059. Py_XDECREF(values[__pyx_temp]);
  11060. }
  11061. __Pyx_DECREF(__pyx_v_ts); __pyx_v_ts = 0;
  11062. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitQuadraticAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11063. __Pyx_RefNannyFinishContext();
  11064. return NULL;
  11065. __pyx_L4_argument_unpacking_done:;
  11066. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_39_splitQuadraticAtT(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_ts);
  11067. /* function exit code */
  11068. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  11069. Py_XDECREF(values[__pyx_temp]);
  11070. }
  11071. __Pyx_DECREF(__pyx_v_ts);
  11072. __Pyx_RefNannyFinishContext();
  11073. return __pyx_r;
  11074. }
  11075. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_39_splitQuadraticAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_ts) {
  11076. PyObject *__pyx_v_segments = NULL;
  11077. PyObject *__pyx_v_ax = NULL;
  11078. PyObject *__pyx_v_ay = NULL;
  11079. PyObject *__pyx_v_bx = NULL;
  11080. PyObject *__pyx_v_by = NULL;
  11081. PyObject *__pyx_v_cx = NULL;
  11082. PyObject *__pyx_v_cy = NULL;
  11083. PyObject *__pyx_v_i = NULL;
  11084. PyObject *__pyx_v_t1 = NULL;
  11085. PyObject *__pyx_v_t2 = NULL;
  11086. PyObject *__pyx_v_delta = NULL;
  11087. PyObject *__pyx_v_delta_2 = NULL;
  11088. PyObject *__pyx_v_a1x = NULL;
  11089. PyObject *__pyx_v_a1y = NULL;
  11090. PyObject *__pyx_v_b1x = NULL;
  11091. PyObject *__pyx_v_b1y = NULL;
  11092. PyObject *__pyx_v_t1_2 = NULL;
  11093. PyObject *__pyx_v_c1x = NULL;
  11094. PyObject *__pyx_v_c1y = NULL;
  11095. PyObject *__pyx_v_pt1 = NULL;
  11096. PyObject *__pyx_v_pt2 = NULL;
  11097. PyObject *__pyx_v_pt3 = NULL;
  11098. PyObject *__pyx_r = NULL;
  11099. __Pyx_RefNannyDeclarations
  11100. PyObject *__pyx_t_1 = NULL;
  11101. PyObject *__pyx_t_2 = NULL;
  11102. int __pyx_t_3;
  11103. PyObject *__pyx_t_4 = NULL;
  11104. PyObject *(*__pyx_t_5)(PyObject *);
  11105. Py_ssize_t __pyx_t_6;
  11106. size_t __pyx_t_7;
  11107. PyObject *(*__pyx_t_8)(PyObject *);
  11108. PyObject *__pyx_t_9 = NULL;
  11109. PyObject *__pyx_t_10 = NULL;
  11110. PyObject *__pyx_t_11 = NULL;
  11111. PyObject *__pyx_t_12 = NULL;
  11112. int __pyx_lineno = 0;
  11113. const char *__pyx_filename = NULL;
  11114. int __pyx_clineno = 0;
  11115. __Pyx_RefNannySetupContext("_splitQuadraticAtT", 0);
  11116. __Pyx_INCREF(__pyx_v_ts);
  11117. /* "fontTools/misc/bezierTools.py":709
  11118. *
  11119. * def _splitQuadraticAtT(a, b, c, *ts):
  11120. * ts = list(ts) # <<<<<<<<<<<<<<
  11121. * segments = []
  11122. * ts.insert(0, 0.0)
  11123. */
  11124. __pyx_t_1 = PySequence_List(__pyx_v_ts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error)
  11125. __Pyx_GOTREF(__pyx_t_1);
  11126. __Pyx_DECREF_SET(__pyx_v_ts, __pyx_t_1);
  11127. __pyx_t_1 = 0;
  11128. /* "fontTools/misc/bezierTools.py":710
  11129. * def _splitQuadraticAtT(a, b, c, *ts):
  11130. * ts = list(ts)
  11131. * segments = [] # <<<<<<<<<<<<<<
  11132. * ts.insert(0, 0.0)
  11133. * ts.append(1.0)
  11134. */
  11135. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 710, __pyx_L1_error)
  11136. __Pyx_GOTREF(__pyx_t_1);
  11137. __pyx_v_segments = ((PyObject*)__pyx_t_1);
  11138. __pyx_t_1 = 0;
  11139. /* "fontTools/misc/bezierTools.py":711
  11140. * ts = list(ts)
  11141. * segments = []
  11142. * ts.insert(0, 0.0) # <<<<<<<<<<<<<<
  11143. * ts.append(1.0)
  11144. * ax, ay = a
  11145. */
  11146. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ts, __pyx_mstate_global->__pyx_n_u_insert); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error)
  11147. __Pyx_GOTREF(__pyx_t_1);
  11148. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error)
  11149. __Pyx_GOTREF(__pyx_t_2);
  11150. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11151. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11152. /* "fontTools/misc/bezierTools.py":712
  11153. * segments = []
  11154. * ts.insert(0, 0.0)
  11155. * ts.append(1.0) # <<<<<<<<<<<<<<
  11156. * ax, ay = a
  11157. * bx, by = b
  11158. */
  11159. __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_ts, __pyx_mstate_global->__pyx_float_1_0); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 712, __pyx_L1_error)
  11160. /* "fontTools/misc/bezierTools.py":713
  11161. * ts.insert(0, 0.0)
  11162. * ts.append(1.0)
  11163. * ax, ay = a # <<<<<<<<<<<<<<
  11164. * bx, by = b
  11165. * cx, cy = c
  11166. */
  11167. if ((likely(PyTuple_CheckExact(__pyx_v_a))) || (PyList_CheckExact(__pyx_v_a))) {
  11168. PyObject* sequence = __pyx_v_a;
  11169. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11170. if (unlikely(size != 2)) {
  11171. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  11172. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11173. __PYX_ERR(0, 713, __pyx_L1_error)
  11174. }
  11175. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11176. if (likely(PyTuple_CheckExact(sequence))) {
  11177. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  11178. __Pyx_INCREF(__pyx_t_2);
  11179. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  11180. __Pyx_INCREF(__pyx_t_1);
  11181. } else {
  11182. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  11183. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
  11184. __Pyx_XGOTREF(__pyx_t_2);
  11185. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  11186. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error)
  11187. __Pyx_XGOTREF(__pyx_t_1);
  11188. }
  11189. #else
  11190. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
  11191. __Pyx_GOTREF(__pyx_t_2);
  11192. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error)
  11193. __Pyx_GOTREF(__pyx_t_1);
  11194. #endif
  11195. } else {
  11196. Py_ssize_t index = -1;
  11197. __pyx_t_4 = PyObject_GetIter(__pyx_v_a); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L1_error)
  11198. __Pyx_GOTREF(__pyx_t_4);
  11199. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  11200. index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  11201. __Pyx_GOTREF(__pyx_t_2);
  11202. index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  11203. __Pyx_GOTREF(__pyx_t_1);
  11204. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 713, __pyx_L1_error)
  11205. __pyx_t_5 = NULL;
  11206. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11207. goto __pyx_L4_unpacking_done;
  11208. __pyx_L3_unpacking_failed:;
  11209. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11210. __pyx_t_5 = NULL;
  11211. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  11212. __PYX_ERR(0, 713, __pyx_L1_error)
  11213. __pyx_L4_unpacking_done:;
  11214. }
  11215. __pyx_v_ax = __pyx_t_2;
  11216. __pyx_t_2 = 0;
  11217. __pyx_v_ay = __pyx_t_1;
  11218. __pyx_t_1 = 0;
  11219. /* "fontTools/misc/bezierTools.py":714
  11220. * ts.append(1.0)
  11221. * ax, ay = a
  11222. * bx, by = b # <<<<<<<<<<<<<<
  11223. * cx, cy = c
  11224. * for i in range(len(ts) - 1):
  11225. */
  11226. if ((likely(PyTuple_CheckExact(__pyx_v_b))) || (PyList_CheckExact(__pyx_v_b))) {
  11227. PyObject* sequence = __pyx_v_b;
  11228. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11229. if (unlikely(size != 2)) {
  11230. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  11231. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11232. __PYX_ERR(0, 714, __pyx_L1_error)
  11233. }
  11234. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11235. if (likely(PyTuple_CheckExact(sequence))) {
  11236. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  11237. __Pyx_INCREF(__pyx_t_1);
  11238. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  11239. __Pyx_INCREF(__pyx_t_2);
  11240. } else {
  11241. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  11242. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error)
  11243. __Pyx_XGOTREF(__pyx_t_1);
  11244. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  11245. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error)
  11246. __Pyx_XGOTREF(__pyx_t_2);
  11247. }
  11248. #else
  11249. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error)
  11250. __Pyx_GOTREF(__pyx_t_1);
  11251. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error)
  11252. __Pyx_GOTREF(__pyx_t_2);
  11253. #endif
  11254. } else {
  11255. Py_ssize_t index = -1;
  11256. __pyx_t_4 = PyObject_GetIter(__pyx_v_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 714, __pyx_L1_error)
  11257. __Pyx_GOTREF(__pyx_t_4);
  11258. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  11259. index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  11260. __Pyx_GOTREF(__pyx_t_1);
  11261. index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  11262. __Pyx_GOTREF(__pyx_t_2);
  11263. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 714, __pyx_L1_error)
  11264. __pyx_t_5 = NULL;
  11265. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11266. goto __pyx_L6_unpacking_done;
  11267. __pyx_L5_unpacking_failed:;
  11268. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11269. __pyx_t_5 = NULL;
  11270. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  11271. __PYX_ERR(0, 714, __pyx_L1_error)
  11272. __pyx_L6_unpacking_done:;
  11273. }
  11274. __pyx_v_bx = __pyx_t_1;
  11275. __pyx_t_1 = 0;
  11276. __pyx_v_by = __pyx_t_2;
  11277. __pyx_t_2 = 0;
  11278. /* "fontTools/misc/bezierTools.py":715
  11279. * ax, ay = a
  11280. * bx, by = b
  11281. * cx, cy = c # <<<<<<<<<<<<<<
  11282. * for i in range(len(ts) - 1):
  11283. * t1 = ts[i]
  11284. */
  11285. if ((likely(PyTuple_CheckExact(__pyx_v_c))) || (PyList_CheckExact(__pyx_v_c))) {
  11286. PyObject* sequence = __pyx_v_c;
  11287. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11288. if (unlikely(size != 2)) {
  11289. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  11290. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11291. __PYX_ERR(0, 715, __pyx_L1_error)
  11292. }
  11293. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11294. if (likely(PyTuple_CheckExact(sequence))) {
  11295. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  11296. __Pyx_INCREF(__pyx_t_2);
  11297. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  11298. __Pyx_INCREF(__pyx_t_1);
  11299. } else {
  11300. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  11301. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error)
  11302. __Pyx_XGOTREF(__pyx_t_2);
  11303. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  11304. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error)
  11305. __Pyx_XGOTREF(__pyx_t_1);
  11306. }
  11307. #else
  11308. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error)
  11309. __Pyx_GOTREF(__pyx_t_2);
  11310. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error)
  11311. __Pyx_GOTREF(__pyx_t_1);
  11312. #endif
  11313. } else {
  11314. Py_ssize_t index = -1;
  11315. __pyx_t_4 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 715, __pyx_L1_error)
  11316. __Pyx_GOTREF(__pyx_t_4);
  11317. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  11318. index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  11319. __Pyx_GOTREF(__pyx_t_2);
  11320. index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  11321. __Pyx_GOTREF(__pyx_t_1);
  11322. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 715, __pyx_L1_error)
  11323. __pyx_t_5 = NULL;
  11324. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11325. goto __pyx_L8_unpacking_done;
  11326. __pyx_L7_unpacking_failed:;
  11327. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11328. __pyx_t_5 = NULL;
  11329. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  11330. __PYX_ERR(0, 715, __pyx_L1_error)
  11331. __pyx_L8_unpacking_done:;
  11332. }
  11333. __pyx_v_cx = __pyx_t_2;
  11334. __pyx_t_2 = 0;
  11335. __pyx_v_cy = __pyx_t_1;
  11336. __pyx_t_1 = 0;
  11337. /* "fontTools/misc/bezierTools.py":716
  11338. * bx, by = b
  11339. * cx, cy = c
  11340. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  11341. * t1 = ts[i]
  11342. * t2 = ts[i + 1]
  11343. */
  11344. __pyx_t_2 = NULL;
  11345. __pyx_t_6 = PyObject_Length(__pyx_v_ts); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 716, __pyx_L1_error)
  11346. __pyx_t_4 = PyLong_FromSsize_t((__pyx_t_6 - 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error)
  11347. __Pyx_GOTREF(__pyx_t_4);
  11348. __pyx_t_7 = 1;
  11349. {
  11350. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
  11351. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  11352. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  11353. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11354. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error)
  11355. __Pyx_GOTREF(__pyx_t_1);
  11356. }
  11357. __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error)
  11358. __Pyx_GOTREF(__pyx_t_4);
  11359. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 716, __pyx_L1_error)
  11360. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11361. for (;;) {
  11362. {
  11363. __pyx_t_1 = __pyx_t_8(__pyx_t_4);
  11364. if (unlikely(!__pyx_t_1)) {
  11365. PyObject* exc_type = PyErr_Occurred();
  11366. if (exc_type) {
  11367. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 716, __pyx_L1_error)
  11368. PyErr_Clear();
  11369. }
  11370. break;
  11371. }
  11372. }
  11373. __Pyx_GOTREF(__pyx_t_1);
  11374. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
  11375. __pyx_t_1 = 0;
  11376. /* "fontTools/misc/bezierTools.py":717
  11377. * cx, cy = c
  11378. * for i in range(len(ts) - 1):
  11379. * t1 = ts[i] # <<<<<<<<<<<<<<
  11380. * t2 = ts[i + 1]
  11381. * delta = t2 - t1
  11382. */
  11383. __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_ts, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
  11384. __Pyx_GOTREF(__pyx_t_1);
  11385. __Pyx_XDECREF_SET(__pyx_v_t1, __pyx_t_1);
  11386. __pyx_t_1 = 0;
  11387. /* "fontTools/misc/bezierTools.py":718
  11388. * for i in range(len(ts) - 1):
  11389. * t1 = ts[i]
  11390. * t2 = ts[i + 1] # <<<<<<<<<<<<<<
  11391. * delta = t2 - t1
  11392. * # calc new a, b and c
  11393. */
  11394. __pyx_t_1 = __Pyx_PyLong_AddObjC(__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
  11395. __Pyx_GOTREF(__pyx_t_1);
  11396. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_ts, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error)
  11397. __Pyx_GOTREF(__pyx_t_2);
  11398. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11399. __Pyx_XDECREF_SET(__pyx_v_t2, __pyx_t_2);
  11400. __pyx_t_2 = 0;
  11401. /* "fontTools/misc/bezierTools.py":719
  11402. * t1 = ts[i]
  11403. * t2 = ts[i + 1]
  11404. * delta = t2 - t1 # <<<<<<<<<<<<<<
  11405. * # calc new a, b and c
  11406. * delta_2 = delta * delta
  11407. */
  11408. __pyx_t_2 = PyNumber_Subtract(__pyx_v_t2, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error)
  11409. __Pyx_GOTREF(__pyx_t_2);
  11410. __Pyx_XDECREF_SET(__pyx_v_delta, __pyx_t_2);
  11411. __pyx_t_2 = 0;
  11412. /* "fontTools/misc/bezierTools.py":721
  11413. * delta = t2 - t1
  11414. * # calc new a, b and c
  11415. * delta_2 = delta * delta # <<<<<<<<<<<<<<
  11416. * a1x = ax * delta_2
  11417. * a1y = ay * delta_2
  11418. */
  11419. __pyx_t_2 = PyNumber_Multiply(__pyx_v_delta, __pyx_v_delta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error)
  11420. __Pyx_GOTREF(__pyx_t_2);
  11421. __Pyx_XDECREF_SET(__pyx_v_delta_2, __pyx_t_2);
  11422. __pyx_t_2 = 0;
  11423. /* "fontTools/misc/bezierTools.py":722
  11424. * # calc new a, b and c
  11425. * delta_2 = delta * delta
  11426. * a1x = ax * delta_2 # <<<<<<<<<<<<<<
  11427. * a1y = ay * delta_2
  11428. * b1x = (2 * ax * t1 + bx) * delta
  11429. */
  11430. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ax, __pyx_v_delta_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L1_error)
  11431. __Pyx_GOTREF(__pyx_t_2);
  11432. __Pyx_XDECREF_SET(__pyx_v_a1x, __pyx_t_2);
  11433. __pyx_t_2 = 0;
  11434. /* "fontTools/misc/bezierTools.py":723
  11435. * delta_2 = delta * delta
  11436. * a1x = ax * delta_2
  11437. * a1y = ay * delta_2 # <<<<<<<<<<<<<<
  11438. * b1x = (2 * ax * t1 + bx) * delta
  11439. * b1y = (2 * ay * t1 + by) * delta
  11440. */
  11441. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ay, __pyx_v_delta_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
  11442. __Pyx_GOTREF(__pyx_t_2);
  11443. __Pyx_XDECREF_SET(__pyx_v_a1y, __pyx_t_2);
  11444. __pyx_t_2 = 0;
  11445. /* "fontTools/misc/bezierTools.py":724
  11446. * a1x = ax * delta_2
  11447. * a1y = ay * delta_2
  11448. * b1x = (2 * ax * t1 + bx) * delta # <<<<<<<<<<<<<<
  11449. * b1y = (2 * ay * t1 + by) * delta
  11450. * t1_2 = t1 * t1
  11451. */
  11452. __pyx_t_2 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_v_ax, 2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
  11453. __Pyx_GOTREF(__pyx_t_2);
  11454. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
  11455. __Pyx_GOTREF(__pyx_t_1);
  11456. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11457. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_bx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
  11458. __Pyx_GOTREF(__pyx_t_2);
  11459. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11460. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_delta); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
  11461. __Pyx_GOTREF(__pyx_t_1);
  11462. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11463. __Pyx_XDECREF_SET(__pyx_v_b1x, __pyx_t_1);
  11464. __pyx_t_1 = 0;
  11465. /* "fontTools/misc/bezierTools.py":725
  11466. * a1y = ay * delta_2
  11467. * b1x = (2 * ax * t1 + bx) * delta
  11468. * b1y = (2 * ay * t1 + by) * delta # <<<<<<<<<<<<<<
  11469. * t1_2 = t1 * t1
  11470. * c1x = ax * t1_2 + bx * t1 + cx
  11471. */
  11472. __pyx_t_1 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_v_ay, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
  11473. __Pyx_GOTREF(__pyx_t_1);
  11474. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
  11475. __Pyx_GOTREF(__pyx_t_2);
  11476. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11477. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_by); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
  11478. __Pyx_GOTREF(__pyx_t_1);
  11479. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11480. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_delta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
  11481. __Pyx_GOTREF(__pyx_t_2);
  11482. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11483. __Pyx_XDECREF_SET(__pyx_v_b1y, __pyx_t_2);
  11484. __pyx_t_2 = 0;
  11485. /* "fontTools/misc/bezierTools.py":726
  11486. * b1x = (2 * ax * t1 + bx) * delta
  11487. * b1y = (2 * ay * t1 + by) * delta
  11488. * t1_2 = t1 * t1 # <<<<<<<<<<<<<<
  11489. * c1x = ax * t1_2 + bx * t1 + cx
  11490. * c1y = ay * t1_2 + by * t1 + cy
  11491. */
  11492. __pyx_t_2 = PyNumber_Multiply(__pyx_v_t1, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error)
  11493. __Pyx_GOTREF(__pyx_t_2);
  11494. __Pyx_XDECREF_SET(__pyx_v_t1_2, __pyx_t_2);
  11495. __pyx_t_2 = 0;
  11496. /* "fontTools/misc/bezierTools.py":727
  11497. * b1y = (2 * ay * t1 + by) * delta
  11498. * t1_2 = t1 * t1
  11499. * c1x = ax * t1_2 + bx * t1 + cx # <<<<<<<<<<<<<<
  11500. * c1y = ay * t1_2 + by * t1 + cy
  11501. *
  11502. */
  11503. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ax, __pyx_v_t1_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L1_error)
  11504. __Pyx_GOTREF(__pyx_t_2);
  11505. __pyx_t_1 = PyNumber_Multiply(__pyx_v_bx, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
  11506. __Pyx_GOTREF(__pyx_t_1);
  11507. __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 727, __pyx_L1_error)
  11508. __Pyx_GOTREF(__pyx_t_9);
  11509. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11510. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11511. __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
  11512. __Pyx_GOTREF(__pyx_t_1);
  11513. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11514. __Pyx_XDECREF_SET(__pyx_v_c1x, __pyx_t_1);
  11515. __pyx_t_1 = 0;
  11516. /* "fontTools/misc/bezierTools.py":728
  11517. * t1_2 = t1 * t1
  11518. * c1x = ax * t1_2 + bx * t1 + cx
  11519. * c1y = ay * t1_2 + by * t1 + cy # <<<<<<<<<<<<<<
  11520. *
  11521. * pt1, pt2, pt3 = calcQuadraticPoints((a1x, a1y), (b1x, b1y), (c1x, c1y))
  11522. */
  11523. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ay, __pyx_v_t1_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L1_error)
  11524. __Pyx_GOTREF(__pyx_t_1);
  11525. __pyx_t_9 = PyNumber_Multiply(__pyx_v_by, __pyx_v_t1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 728, __pyx_L1_error)
  11526. __Pyx_GOTREF(__pyx_t_9);
  11527. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __pyx_L1_error)
  11528. __Pyx_GOTREF(__pyx_t_2);
  11529. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11530. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11531. __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_v_cy); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 728, __pyx_L1_error)
  11532. __Pyx_GOTREF(__pyx_t_9);
  11533. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11534. __Pyx_XDECREF_SET(__pyx_v_c1y, __pyx_t_9);
  11535. __pyx_t_9 = 0;
  11536. /* "fontTools/misc/bezierTools.py":730
  11537. * c1y = ay * t1_2 + by * t1 + cy
  11538. *
  11539. * pt1, pt2, pt3 = calcQuadraticPoints((a1x, a1y), (b1x, b1y), (c1x, c1y)) # <<<<<<<<<<<<<<
  11540. * segments.append((pt1, pt2, pt3))
  11541. * return segments
  11542. */
  11543. __pyx_t_2 = NULL;
  11544. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_calcQuadraticPoints); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error)
  11545. __Pyx_GOTREF(__pyx_t_1);
  11546. __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 730, __pyx_L1_error)
  11547. __Pyx_GOTREF(__pyx_t_10);
  11548. __Pyx_INCREF(__pyx_v_a1x);
  11549. __Pyx_GIVEREF(__pyx_v_a1x);
  11550. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_a1x) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11551. __Pyx_INCREF(__pyx_v_a1y);
  11552. __Pyx_GIVEREF(__pyx_v_a1y);
  11553. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_a1y) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11554. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 730, __pyx_L1_error)
  11555. __Pyx_GOTREF(__pyx_t_11);
  11556. __Pyx_INCREF(__pyx_v_b1x);
  11557. __Pyx_GIVEREF(__pyx_v_b1x);
  11558. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_b1x) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11559. __Pyx_INCREF(__pyx_v_b1y);
  11560. __Pyx_GIVEREF(__pyx_v_b1y);
  11561. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_b1y) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11562. __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 730, __pyx_L1_error)
  11563. __Pyx_GOTREF(__pyx_t_12);
  11564. __Pyx_INCREF(__pyx_v_c1x);
  11565. __Pyx_GIVEREF(__pyx_v_c1x);
  11566. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_c1x) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11567. __Pyx_INCREF(__pyx_v_c1y);
  11568. __Pyx_GIVEREF(__pyx_v_c1y);
  11569. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_c1y) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11570. __pyx_t_7 = 1;
  11571. #if CYTHON_UNPACK_METHODS
  11572. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  11573. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  11574. assert(__pyx_t_2);
  11575. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  11576. __Pyx_INCREF(__pyx_t_2);
  11577. __Pyx_INCREF(__pyx__function);
  11578. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  11579. __pyx_t_7 = 0;
  11580. }
  11581. #endif
  11582. {
  11583. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_t_10, __pyx_t_11, __pyx_t_12};
  11584. __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  11585. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  11586. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  11587. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  11588. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  11589. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11590. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 730, __pyx_L1_error)
  11591. __Pyx_GOTREF(__pyx_t_9);
  11592. }
  11593. if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
  11594. PyObject* sequence = __pyx_t_9;
  11595. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11596. if (unlikely(size != 3)) {
  11597. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  11598. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11599. __PYX_ERR(0, 730, __pyx_L1_error)
  11600. }
  11601. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11602. if (likely(PyTuple_CheckExact(sequence))) {
  11603. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  11604. __Pyx_INCREF(__pyx_t_1);
  11605. __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
  11606. __Pyx_INCREF(__pyx_t_12);
  11607. __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
  11608. __Pyx_INCREF(__pyx_t_11);
  11609. } else {
  11610. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  11611. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error)
  11612. __Pyx_XGOTREF(__pyx_t_1);
  11613. __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  11614. if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 730, __pyx_L1_error)
  11615. __Pyx_XGOTREF(__pyx_t_12);
  11616. __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  11617. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 730, __pyx_L1_error)
  11618. __Pyx_XGOTREF(__pyx_t_11);
  11619. }
  11620. #else
  11621. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error)
  11622. __Pyx_GOTREF(__pyx_t_1);
  11623. __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 730, __pyx_L1_error)
  11624. __Pyx_GOTREF(__pyx_t_12);
  11625. __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 730, __pyx_L1_error)
  11626. __Pyx_GOTREF(__pyx_t_11);
  11627. #endif
  11628. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11629. } else {
  11630. Py_ssize_t index = -1;
  11631. __pyx_t_10 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 730, __pyx_L1_error)
  11632. __Pyx_GOTREF(__pyx_t_10);
  11633. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11634. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  11635. index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
  11636. __Pyx_GOTREF(__pyx_t_1);
  11637. index = 1; __pyx_t_12 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_12)) goto __pyx_L11_unpacking_failed;
  11638. __Pyx_GOTREF(__pyx_t_12);
  11639. index = 2; __pyx_t_11 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_11)) goto __pyx_L11_unpacking_failed;
  11640. __Pyx_GOTREF(__pyx_t_11);
  11641. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_10), 3) < (0)) __PYX_ERR(0, 730, __pyx_L1_error)
  11642. __pyx_t_5 = NULL;
  11643. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  11644. goto __pyx_L12_unpacking_done;
  11645. __pyx_L11_unpacking_failed:;
  11646. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  11647. __pyx_t_5 = NULL;
  11648. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  11649. __PYX_ERR(0, 730, __pyx_L1_error)
  11650. __pyx_L12_unpacking_done:;
  11651. }
  11652. __Pyx_XDECREF_SET(__pyx_v_pt1, __pyx_t_1);
  11653. __pyx_t_1 = 0;
  11654. __Pyx_XDECREF_SET(__pyx_v_pt2, __pyx_t_12);
  11655. __pyx_t_12 = 0;
  11656. __Pyx_XDECREF_SET(__pyx_v_pt3, __pyx_t_11);
  11657. __pyx_t_11 = 0;
  11658. /* "fontTools/misc/bezierTools.py":731
  11659. *
  11660. * pt1, pt2, pt3 = calcQuadraticPoints((a1x, a1y), (b1x, b1y), (c1x, c1y))
  11661. * segments.append((pt1, pt2, pt3)) # <<<<<<<<<<<<<<
  11662. * return segments
  11663. *
  11664. */
  11665. __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 731, __pyx_L1_error)
  11666. __Pyx_GOTREF(__pyx_t_9);
  11667. __Pyx_INCREF(__pyx_v_pt1);
  11668. __Pyx_GIVEREF(__pyx_v_pt1);
  11669. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 731, __pyx_L1_error);
  11670. __Pyx_INCREF(__pyx_v_pt2);
  11671. __Pyx_GIVEREF(__pyx_v_pt2);
  11672. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 731, __pyx_L1_error);
  11673. __Pyx_INCREF(__pyx_v_pt3);
  11674. __Pyx_GIVEREF(__pyx_v_pt3);
  11675. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_pt3) != (0)) __PYX_ERR(0, 731, __pyx_L1_error);
  11676. __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_segments, __pyx_t_9); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 731, __pyx_L1_error)
  11677. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11678. /* "fontTools/misc/bezierTools.py":716
  11679. * bx, by = b
  11680. * cx, cy = c
  11681. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  11682. * t1 = ts[i]
  11683. * t2 = ts[i + 1]
  11684. */
  11685. }
  11686. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11687. /* "fontTools/misc/bezierTools.py":732
  11688. * pt1, pt2, pt3 = calcQuadraticPoints((a1x, a1y), (b1x, b1y), (c1x, c1y))
  11689. * segments.append((pt1, pt2, pt3))
  11690. * return segments # <<<<<<<<<<<<<<
  11691. *
  11692. *
  11693. */
  11694. __Pyx_XDECREF(__pyx_r);
  11695. __Pyx_INCREF(__pyx_v_segments);
  11696. __pyx_r = __pyx_v_segments;
  11697. goto __pyx_L0;
  11698. /* "fontTools/misc/bezierTools.py":708
  11699. *
  11700. *
  11701. * def _splitQuadraticAtT(a, b, c, *ts): # <<<<<<<<<<<<<<
  11702. * ts = list(ts)
  11703. * segments = []
  11704. */
  11705. /* function exit code */
  11706. __pyx_L1_error:;
  11707. __Pyx_XDECREF(__pyx_t_1);
  11708. __Pyx_XDECREF(__pyx_t_2);
  11709. __Pyx_XDECREF(__pyx_t_4);
  11710. __Pyx_XDECREF(__pyx_t_9);
  11711. __Pyx_XDECREF(__pyx_t_10);
  11712. __Pyx_XDECREF(__pyx_t_11);
  11713. __Pyx_XDECREF(__pyx_t_12);
  11714. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitQuadraticAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11715. __pyx_r = NULL;
  11716. __pyx_L0:;
  11717. __Pyx_XDECREF(__pyx_v_ts);
  11718. __Pyx_XDECREF(__pyx_v_segments);
  11719. __Pyx_XDECREF(__pyx_v_ax);
  11720. __Pyx_XDECREF(__pyx_v_ay);
  11721. __Pyx_XDECREF(__pyx_v_bx);
  11722. __Pyx_XDECREF(__pyx_v_by);
  11723. __Pyx_XDECREF(__pyx_v_cx);
  11724. __Pyx_XDECREF(__pyx_v_cy);
  11725. __Pyx_XDECREF(__pyx_v_i);
  11726. __Pyx_XDECREF(__pyx_v_t1);
  11727. __Pyx_XDECREF(__pyx_v_t2);
  11728. __Pyx_XDECREF(__pyx_v_delta);
  11729. __Pyx_XDECREF(__pyx_v_delta_2);
  11730. __Pyx_XDECREF(__pyx_v_a1x);
  11731. __Pyx_XDECREF(__pyx_v_a1y);
  11732. __Pyx_XDECREF(__pyx_v_b1x);
  11733. __Pyx_XDECREF(__pyx_v_b1y);
  11734. __Pyx_XDECREF(__pyx_v_t1_2);
  11735. __Pyx_XDECREF(__pyx_v_c1x);
  11736. __Pyx_XDECREF(__pyx_v_c1y);
  11737. __Pyx_XDECREF(__pyx_v_pt1);
  11738. __Pyx_XDECREF(__pyx_v_pt2);
  11739. __Pyx_XDECREF(__pyx_v_pt3);
  11740. __Pyx_XGIVEREF(__pyx_r);
  11741. __Pyx_RefNannyFinishContext();
  11742. return __pyx_r;
  11743. }
  11744. /* "fontTools/misc/bezierTools.py":735
  11745. *
  11746. *
  11747. * def _splitCubicAtT(a, b, c, d, *ts): # <<<<<<<<<<<<<<
  11748. * ts = list(ts)
  11749. * ts.insert(0, 0.0)
  11750. */
  11751. /* Python wrapper */
  11752. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_42_splitCubicAtT(PyObject *__pyx_self,
  11753. #if CYTHON_METH_FASTCALL
  11754. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  11755. #else
  11756. PyObject *__pyx_args, PyObject *__pyx_kwds
  11757. #endif
  11758. ); /*proto*/
  11759. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_41_splitCubicAtT, "_splitCubicAtT(a, b, c, d, *ts)");
  11760. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_42_splitCubicAtT = {"_splitCubicAtT", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_42_splitCubicAtT, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_41_splitCubicAtT};
  11761. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_42_splitCubicAtT(PyObject *__pyx_self,
  11762. #if CYTHON_METH_FASTCALL
  11763. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  11764. #else
  11765. PyObject *__pyx_args, PyObject *__pyx_kwds
  11766. #endif
  11767. ) {
  11768. PyObject *__pyx_v_a = 0;
  11769. PyObject *__pyx_v_b = 0;
  11770. PyObject *__pyx_v_c = 0;
  11771. PyObject *__pyx_v_d = 0;
  11772. PyObject *__pyx_v_ts = 0;
  11773. #if !CYTHON_METH_FASTCALL
  11774. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  11775. #endif
  11776. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  11777. PyObject* values[4] = {0,0,0,0};
  11778. int __pyx_lineno = 0;
  11779. const char *__pyx_filename = NULL;
  11780. int __pyx_clineno = 0;
  11781. PyObject *__pyx_r = 0;
  11782. __Pyx_RefNannyDeclarations
  11783. __Pyx_RefNannySetupContext("_splitCubicAtT (wrapper)", 0);
  11784. #if !CYTHON_METH_FASTCALL
  11785. #if CYTHON_ASSUME_SAFE_SIZE
  11786. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  11787. #else
  11788. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  11789. #endif
  11790. #endif
  11791. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  11792. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 4, __pyx_nargs);
  11793. if (unlikely(!__pyx_v_ts)) {
  11794. __Pyx_RefNannyFinishContext();
  11795. return NULL;
  11796. }
  11797. __Pyx_GOTREF(__pyx_v_ts);
  11798. {
  11799. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_a,&__pyx_mstate_global->__pyx_n_u_b,&__pyx_mstate_global->__pyx_n_u_c,&__pyx_mstate_global->__pyx_n_u_d,0};
  11800. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  11801. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 735, __pyx_L3_error)
  11802. if (__pyx_kwds_len > 0) {
  11803. switch (__pyx_nargs) {
  11804. default:
  11805. case 4:
  11806. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  11807. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 735, __pyx_L3_error)
  11808. CYTHON_FALLTHROUGH;
  11809. case 3:
  11810. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  11811. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 735, __pyx_L3_error)
  11812. CYTHON_FALLTHROUGH;
  11813. case 2:
  11814. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  11815. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 735, __pyx_L3_error)
  11816. CYTHON_FALLTHROUGH;
  11817. case 1:
  11818. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  11819. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 735, __pyx_L3_error)
  11820. CYTHON_FALLTHROUGH;
  11821. case 0: break;
  11822. }
  11823. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  11824. const Py_ssize_t used_pos_args = (kwd_pos_args < 4) ? kwd_pos_args : 4;
  11825. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "_splitCubicAtT", 0) < (0)) __PYX_ERR(0, 735, __pyx_L3_error)
  11826. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  11827. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_splitCubicAtT", 0, 4, 4, i); __PYX_ERR(0, 735, __pyx_L3_error) }
  11828. }
  11829. } else if (unlikely(__pyx_nargs < 4)) {
  11830. goto __pyx_L5_argtuple_error;
  11831. } else {
  11832. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  11833. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 735, __pyx_L3_error)
  11834. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  11835. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 735, __pyx_L3_error)
  11836. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  11837. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 735, __pyx_L3_error)
  11838. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  11839. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 735, __pyx_L3_error)
  11840. }
  11841. __pyx_v_a = values[0];
  11842. __pyx_v_b = values[1];
  11843. __pyx_v_c = values[2];
  11844. __pyx_v_d = values[3];
  11845. }
  11846. goto __pyx_L6_skip;
  11847. __pyx_L5_argtuple_error:;
  11848. __Pyx_RaiseArgtupleInvalid("_splitCubicAtT", 0, 4, 4, __pyx_nargs); __PYX_ERR(0, 735, __pyx_L3_error)
  11849. __pyx_L6_skip:;
  11850. goto __pyx_L4_argument_unpacking_done;
  11851. __pyx_L3_error:;
  11852. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  11853. Py_XDECREF(values[__pyx_temp]);
  11854. }
  11855. __Pyx_DECREF(__pyx_v_ts); __pyx_v_ts = 0;
  11856. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitCubicAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11857. __Pyx_RefNannyFinishContext();
  11858. return NULL;
  11859. __pyx_L4_argument_unpacking_done:;
  11860. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_41_splitCubicAtT(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_d, __pyx_v_ts);
  11861. /* function exit code */
  11862. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  11863. Py_XDECREF(values[__pyx_temp]);
  11864. }
  11865. __Pyx_DECREF(__pyx_v_ts);
  11866. __Pyx_RefNannyFinishContext();
  11867. return __pyx_r;
  11868. }
  11869. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_41_splitCubicAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_ts) {
  11870. PyObject *__pyx_v_segments = NULL;
  11871. PyObject *__pyx_v_ax = NULL;
  11872. PyObject *__pyx_v_ay = NULL;
  11873. PyObject *__pyx_v_bx = NULL;
  11874. PyObject *__pyx_v_by = NULL;
  11875. PyObject *__pyx_v_cx = NULL;
  11876. PyObject *__pyx_v_cy = NULL;
  11877. PyObject *__pyx_v_dx = NULL;
  11878. PyObject *__pyx_v_dy = NULL;
  11879. PyObject *__pyx_v_i = NULL;
  11880. PyObject *__pyx_v_t1 = NULL;
  11881. PyObject *__pyx_v_t2 = NULL;
  11882. PyObject *__pyx_v_delta = NULL;
  11883. PyObject *__pyx_v_delta_2 = NULL;
  11884. PyObject *__pyx_v_delta_3 = NULL;
  11885. PyObject *__pyx_v_t1_2 = NULL;
  11886. PyObject *__pyx_v_t1_3 = NULL;
  11887. PyObject *__pyx_v_a1x = NULL;
  11888. PyObject *__pyx_v_a1y = NULL;
  11889. PyObject *__pyx_v_b1x = NULL;
  11890. PyObject *__pyx_v_b1y = NULL;
  11891. PyObject *__pyx_v_c1x = NULL;
  11892. PyObject *__pyx_v_c1y = NULL;
  11893. PyObject *__pyx_v_d1x = NULL;
  11894. PyObject *__pyx_v_d1y = NULL;
  11895. PyObject *__pyx_v_pt1 = NULL;
  11896. PyObject *__pyx_v_pt2 = NULL;
  11897. PyObject *__pyx_v_pt3 = NULL;
  11898. PyObject *__pyx_v_pt4 = NULL;
  11899. PyObject *__pyx_r = NULL;
  11900. __Pyx_RefNannyDeclarations
  11901. PyObject *__pyx_t_1 = NULL;
  11902. PyObject *__pyx_t_2 = NULL;
  11903. int __pyx_t_3;
  11904. PyObject *__pyx_t_4 = NULL;
  11905. PyObject *(*__pyx_t_5)(PyObject *);
  11906. Py_ssize_t __pyx_t_6;
  11907. size_t __pyx_t_7;
  11908. PyObject *(*__pyx_t_8)(PyObject *);
  11909. PyObject *__pyx_t_9 = NULL;
  11910. PyObject *__pyx_t_10 = NULL;
  11911. PyObject *__pyx_t_11 = NULL;
  11912. PyObject *__pyx_t_12 = NULL;
  11913. PyObject *__pyx_t_13 = NULL;
  11914. int __pyx_lineno = 0;
  11915. const char *__pyx_filename = NULL;
  11916. int __pyx_clineno = 0;
  11917. __Pyx_RefNannySetupContext("_splitCubicAtT", 0);
  11918. __Pyx_INCREF(__pyx_v_ts);
  11919. /* "fontTools/misc/bezierTools.py":736
  11920. *
  11921. * def _splitCubicAtT(a, b, c, d, *ts):
  11922. * ts = list(ts) # <<<<<<<<<<<<<<
  11923. * ts.insert(0, 0.0)
  11924. * ts.append(1.0)
  11925. */
  11926. __pyx_t_1 = PySequence_List(__pyx_v_ts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error)
  11927. __Pyx_GOTREF(__pyx_t_1);
  11928. __Pyx_DECREF_SET(__pyx_v_ts, __pyx_t_1);
  11929. __pyx_t_1 = 0;
  11930. /* "fontTools/misc/bezierTools.py":737
  11931. * def _splitCubicAtT(a, b, c, d, *ts):
  11932. * ts = list(ts)
  11933. * ts.insert(0, 0.0) # <<<<<<<<<<<<<<
  11934. * ts.append(1.0)
  11935. * segments = []
  11936. */
  11937. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ts, __pyx_mstate_global->__pyx_n_u_insert); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 737, __pyx_L1_error)
  11938. __Pyx_GOTREF(__pyx_t_1);
  11939. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 737, __pyx_L1_error)
  11940. __Pyx_GOTREF(__pyx_t_2);
  11941. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11942. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11943. /* "fontTools/misc/bezierTools.py":738
  11944. * ts = list(ts)
  11945. * ts.insert(0, 0.0)
  11946. * ts.append(1.0) # <<<<<<<<<<<<<<
  11947. * segments = []
  11948. * ax, ay = a
  11949. */
  11950. __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_ts, __pyx_mstate_global->__pyx_float_1_0); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 738, __pyx_L1_error)
  11951. /* "fontTools/misc/bezierTools.py":739
  11952. * ts.insert(0, 0.0)
  11953. * ts.append(1.0)
  11954. * segments = [] # <<<<<<<<<<<<<<
  11955. * ax, ay = a
  11956. * bx, by = b
  11957. */
  11958. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L1_error)
  11959. __Pyx_GOTREF(__pyx_t_2);
  11960. __pyx_v_segments = ((PyObject*)__pyx_t_2);
  11961. __pyx_t_2 = 0;
  11962. /* "fontTools/misc/bezierTools.py":740
  11963. * ts.append(1.0)
  11964. * segments = []
  11965. * ax, ay = a # <<<<<<<<<<<<<<
  11966. * bx, by = b
  11967. * cx, cy = c
  11968. */
  11969. if ((likely(PyTuple_CheckExact(__pyx_v_a))) || (PyList_CheckExact(__pyx_v_a))) {
  11970. PyObject* sequence = __pyx_v_a;
  11971. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11972. if (unlikely(size != 2)) {
  11973. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  11974. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11975. __PYX_ERR(0, 740, __pyx_L1_error)
  11976. }
  11977. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11978. if (likely(PyTuple_CheckExact(sequence))) {
  11979. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  11980. __Pyx_INCREF(__pyx_t_2);
  11981. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  11982. __Pyx_INCREF(__pyx_t_1);
  11983. } else {
  11984. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  11985. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
  11986. __Pyx_XGOTREF(__pyx_t_2);
  11987. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  11988. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
  11989. __Pyx_XGOTREF(__pyx_t_1);
  11990. }
  11991. #else
  11992. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
  11993. __Pyx_GOTREF(__pyx_t_2);
  11994. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
  11995. __Pyx_GOTREF(__pyx_t_1);
  11996. #endif
  11997. } else {
  11998. Py_ssize_t index = -1;
  11999. __pyx_t_4 = PyObject_GetIter(__pyx_v_a); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 740, __pyx_L1_error)
  12000. __Pyx_GOTREF(__pyx_t_4);
  12001. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  12002. index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  12003. __Pyx_GOTREF(__pyx_t_2);
  12004. index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  12005. __Pyx_GOTREF(__pyx_t_1);
  12006. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 740, __pyx_L1_error)
  12007. __pyx_t_5 = NULL;
  12008. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12009. goto __pyx_L4_unpacking_done;
  12010. __pyx_L3_unpacking_failed:;
  12011. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12012. __pyx_t_5 = NULL;
  12013. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  12014. __PYX_ERR(0, 740, __pyx_L1_error)
  12015. __pyx_L4_unpacking_done:;
  12016. }
  12017. __pyx_v_ax = __pyx_t_2;
  12018. __pyx_t_2 = 0;
  12019. __pyx_v_ay = __pyx_t_1;
  12020. __pyx_t_1 = 0;
  12021. /* "fontTools/misc/bezierTools.py":741
  12022. * segments = []
  12023. * ax, ay = a
  12024. * bx, by = b # <<<<<<<<<<<<<<
  12025. * cx, cy = c
  12026. * dx, dy = d
  12027. */
  12028. if ((likely(PyTuple_CheckExact(__pyx_v_b))) || (PyList_CheckExact(__pyx_v_b))) {
  12029. PyObject* sequence = __pyx_v_b;
  12030. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  12031. if (unlikely(size != 2)) {
  12032. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  12033. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  12034. __PYX_ERR(0, 741, __pyx_L1_error)
  12035. }
  12036. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12037. if (likely(PyTuple_CheckExact(sequence))) {
  12038. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  12039. __Pyx_INCREF(__pyx_t_1);
  12040. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  12041. __Pyx_INCREF(__pyx_t_2);
  12042. } else {
  12043. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  12044. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error)
  12045. __Pyx_XGOTREF(__pyx_t_1);
  12046. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  12047. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error)
  12048. __Pyx_XGOTREF(__pyx_t_2);
  12049. }
  12050. #else
  12051. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error)
  12052. __Pyx_GOTREF(__pyx_t_1);
  12053. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error)
  12054. __Pyx_GOTREF(__pyx_t_2);
  12055. #endif
  12056. } else {
  12057. Py_ssize_t index = -1;
  12058. __pyx_t_4 = PyObject_GetIter(__pyx_v_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 741, __pyx_L1_error)
  12059. __Pyx_GOTREF(__pyx_t_4);
  12060. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  12061. index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  12062. __Pyx_GOTREF(__pyx_t_1);
  12063. index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  12064. __Pyx_GOTREF(__pyx_t_2);
  12065. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 741, __pyx_L1_error)
  12066. __pyx_t_5 = NULL;
  12067. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12068. goto __pyx_L6_unpacking_done;
  12069. __pyx_L5_unpacking_failed:;
  12070. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12071. __pyx_t_5 = NULL;
  12072. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  12073. __PYX_ERR(0, 741, __pyx_L1_error)
  12074. __pyx_L6_unpacking_done:;
  12075. }
  12076. __pyx_v_bx = __pyx_t_1;
  12077. __pyx_t_1 = 0;
  12078. __pyx_v_by = __pyx_t_2;
  12079. __pyx_t_2 = 0;
  12080. /* "fontTools/misc/bezierTools.py":742
  12081. * ax, ay = a
  12082. * bx, by = b
  12083. * cx, cy = c # <<<<<<<<<<<<<<
  12084. * dx, dy = d
  12085. * for i in range(len(ts) - 1):
  12086. */
  12087. if ((likely(PyTuple_CheckExact(__pyx_v_c))) || (PyList_CheckExact(__pyx_v_c))) {
  12088. PyObject* sequence = __pyx_v_c;
  12089. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  12090. if (unlikely(size != 2)) {
  12091. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  12092. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  12093. __PYX_ERR(0, 742, __pyx_L1_error)
  12094. }
  12095. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12096. if (likely(PyTuple_CheckExact(sequence))) {
  12097. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  12098. __Pyx_INCREF(__pyx_t_2);
  12099. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  12100. __Pyx_INCREF(__pyx_t_1);
  12101. } else {
  12102. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  12103. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error)
  12104. __Pyx_XGOTREF(__pyx_t_2);
  12105. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  12106. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error)
  12107. __Pyx_XGOTREF(__pyx_t_1);
  12108. }
  12109. #else
  12110. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error)
  12111. __Pyx_GOTREF(__pyx_t_2);
  12112. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error)
  12113. __Pyx_GOTREF(__pyx_t_1);
  12114. #endif
  12115. } else {
  12116. Py_ssize_t index = -1;
  12117. __pyx_t_4 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error)
  12118. __Pyx_GOTREF(__pyx_t_4);
  12119. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  12120. index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  12121. __Pyx_GOTREF(__pyx_t_2);
  12122. index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  12123. __Pyx_GOTREF(__pyx_t_1);
  12124. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 742, __pyx_L1_error)
  12125. __pyx_t_5 = NULL;
  12126. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12127. goto __pyx_L8_unpacking_done;
  12128. __pyx_L7_unpacking_failed:;
  12129. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12130. __pyx_t_5 = NULL;
  12131. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  12132. __PYX_ERR(0, 742, __pyx_L1_error)
  12133. __pyx_L8_unpacking_done:;
  12134. }
  12135. __pyx_v_cx = __pyx_t_2;
  12136. __pyx_t_2 = 0;
  12137. __pyx_v_cy = __pyx_t_1;
  12138. __pyx_t_1 = 0;
  12139. /* "fontTools/misc/bezierTools.py":743
  12140. * bx, by = b
  12141. * cx, cy = c
  12142. * dx, dy = d # <<<<<<<<<<<<<<
  12143. * for i in range(len(ts) - 1):
  12144. * t1 = ts[i]
  12145. */
  12146. if ((likely(PyTuple_CheckExact(__pyx_v_d))) || (PyList_CheckExact(__pyx_v_d))) {
  12147. PyObject* sequence = __pyx_v_d;
  12148. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  12149. if (unlikely(size != 2)) {
  12150. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  12151. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  12152. __PYX_ERR(0, 743, __pyx_L1_error)
  12153. }
  12154. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12155. if (likely(PyTuple_CheckExact(sequence))) {
  12156. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  12157. __Pyx_INCREF(__pyx_t_1);
  12158. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  12159. __Pyx_INCREF(__pyx_t_2);
  12160. } else {
  12161. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  12162. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
  12163. __Pyx_XGOTREF(__pyx_t_1);
  12164. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  12165. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error)
  12166. __Pyx_XGOTREF(__pyx_t_2);
  12167. }
  12168. #else
  12169. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
  12170. __Pyx_GOTREF(__pyx_t_1);
  12171. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error)
  12172. __Pyx_GOTREF(__pyx_t_2);
  12173. #endif
  12174. } else {
  12175. Py_ssize_t index = -1;
  12176. __pyx_t_4 = PyObject_GetIter(__pyx_v_d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 743, __pyx_L1_error)
  12177. __Pyx_GOTREF(__pyx_t_4);
  12178. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  12179. index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
  12180. __Pyx_GOTREF(__pyx_t_1);
  12181. index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
  12182. __Pyx_GOTREF(__pyx_t_2);
  12183. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 743, __pyx_L1_error)
  12184. __pyx_t_5 = NULL;
  12185. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12186. goto __pyx_L10_unpacking_done;
  12187. __pyx_L9_unpacking_failed:;
  12188. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12189. __pyx_t_5 = NULL;
  12190. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  12191. __PYX_ERR(0, 743, __pyx_L1_error)
  12192. __pyx_L10_unpacking_done:;
  12193. }
  12194. __pyx_v_dx = __pyx_t_1;
  12195. __pyx_t_1 = 0;
  12196. __pyx_v_dy = __pyx_t_2;
  12197. __pyx_t_2 = 0;
  12198. /* "fontTools/misc/bezierTools.py":744
  12199. * cx, cy = c
  12200. * dx, dy = d
  12201. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  12202. * t1 = ts[i]
  12203. * t2 = ts[i + 1]
  12204. */
  12205. __pyx_t_1 = NULL;
  12206. __pyx_t_6 = PyObject_Length(__pyx_v_ts); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 744, __pyx_L1_error)
  12207. __pyx_t_4 = PyLong_FromSsize_t((__pyx_t_6 - 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 744, __pyx_L1_error)
  12208. __Pyx_GOTREF(__pyx_t_4);
  12209. __pyx_t_7 = 1;
  12210. {
  12211. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4};
  12212. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  12213. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  12214. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12215. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 744, __pyx_L1_error)
  12216. __Pyx_GOTREF(__pyx_t_2);
  12217. }
  12218. __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 744, __pyx_L1_error)
  12219. __Pyx_GOTREF(__pyx_t_4);
  12220. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 744, __pyx_L1_error)
  12221. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12222. for (;;) {
  12223. {
  12224. __pyx_t_2 = __pyx_t_8(__pyx_t_4);
  12225. if (unlikely(!__pyx_t_2)) {
  12226. PyObject* exc_type = PyErr_Occurred();
  12227. if (exc_type) {
  12228. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 744, __pyx_L1_error)
  12229. PyErr_Clear();
  12230. }
  12231. break;
  12232. }
  12233. }
  12234. __Pyx_GOTREF(__pyx_t_2);
  12235. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
  12236. __pyx_t_2 = 0;
  12237. /* "fontTools/misc/bezierTools.py":745
  12238. * dx, dy = d
  12239. * for i in range(len(ts) - 1):
  12240. * t1 = ts[i] # <<<<<<<<<<<<<<
  12241. * t2 = ts[i + 1]
  12242. * delta = t2 - t1
  12243. */
  12244. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_ts, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error)
  12245. __Pyx_GOTREF(__pyx_t_2);
  12246. __Pyx_XDECREF_SET(__pyx_v_t1, __pyx_t_2);
  12247. __pyx_t_2 = 0;
  12248. /* "fontTools/misc/bezierTools.py":746
  12249. * for i in range(len(ts) - 1):
  12250. * t1 = ts[i]
  12251. * t2 = ts[i + 1] # <<<<<<<<<<<<<<
  12252. * delta = t2 - t1
  12253. *
  12254. */
  12255. __pyx_t_2 = __Pyx_PyLong_AddObjC(__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
  12256. __Pyx_GOTREF(__pyx_t_2);
  12257. __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_ts, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 746, __pyx_L1_error)
  12258. __Pyx_GOTREF(__pyx_t_1);
  12259. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12260. __Pyx_XDECREF_SET(__pyx_v_t2, __pyx_t_1);
  12261. __pyx_t_1 = 0;
  12262. /* "fontTools/misc/bezierTools.py":747
  12263. * t1 = ts[i]
  12264. * t2 = ts[i + 1]
  12265. * delta = t2 - t1 # <<<<<<<<<<<<<<
  12266. *
  12267. * delta_2 = delta * delta
  12268. */
  12269. __pyx_t_1 = PyNumber_Subtract(__pyx_v_t2, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error)
  12270. __Pyx_GOTREF(__pyx_t_1);
  12271. __Pyx_XDECREF_SET(__pyx_v_delta, __pyx_t_1);
  12272. __pyx_t_1 = 0;
  12273. /* "fontTools/misc/bezierTools.py":749
  12274. * delta = t2 - t1
  12275. *
  12276. * delta_2 = delta * delta # <<<<<<<<<<<<<<
  12277. * delta_3 = delta * delta_2
  12278. * t1_2 = t1 * t1
  12279. */
  12280. __pyx_t_1 = PyNumber_Multiply(__pyx_v_delta, __pyx_v_delta); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __pyx_L1_error)
  12281. __Pyx_GOTREF(__pyx_t_1);
  12282. __Pyx_XDECREF_SET(__pyx_v_delta_2, __pyx_t_1);
  12283. __pyx_t_1 = 0;
  12284. /* "fontTools/misc/bezierTools.py":750
  12285. *
  12286. * delta_2 = delta * delta
  12287. * delta_3 = delta * delta_2 # <<<<<<<<<<<<<<
  12288. * t1_2 = t1 * t1
  12289. * t1_3 = t1 * t1_2
  12290. */
  12291. __pyx_t_1 = PyNumber_Multiply(__pyx_v_delta, __pyx_v_delta_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error)
  12292. __Pyx_GOTREF(__pyx_t_1);
  12293. __Pyx_XDECREF_SET(__pyx_v_delta_3, __pyx_t_1);
  12294. __pyx_t_1 = 0;
  12295. /* "fontTools/misc/bezierTools.py":751
  12296. * delta_2 = delta * delta
  12297. * delta_3 = delta * delta_2
  12298. * t1_2 = t1 * t1 # <<<<<<<<<<<<<<
  12299. * t1_3 = t1 * t1_2
  12300. *
  12301. */
  12302. __pyx_t_1 = PyNumber_Multiply(__pyx_v_t1, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 751, __pyx_L1_error)
  12303. __Pyx_GOTREF(__pyx_t_1);
  12304. __Pyx_XDECREF_SET(__pyx_v_t1_2, __pyx_t_1);
  12305. __pyx_t_1 = 0;
  12306. /* "fontTools/misc/bezierTools.py":752
  12307. * delta_3 = delta * delta_2
  12308. * t1_2 = t1 * t1
  12309. * t1_3 = t1 * t1_2 # <<<<<<<<<<<<<<
  12310. *
  12311. * # calc new a, b, c and d
  12312. */
  12313. __pyx_t_1 = PyNumber_Multiply(__pyx_v_t1, __pyx_v_t1_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error)
  12314. __Pyx_GOTREF(__pyx_t_1);
  12315. __Pyx_XDECREF_SET(__pyx_v_t1_3, __pyx_t_1);
  12316. __pyx_t_1 = 0;
  12317. /* "fontTools/misc/bezierTools.py":755
  12318. *
  12319. * # calc new a, b, c and d
  12320. * a1x = ax * delta_3 # <<<<<<<<<<<<<<
  12321. * a1y = ay * delta_3
  12322. * b1x = (3 * ax * t1 + bx) * delta_2
  12323. */
  12324. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ax, __pyx_v_delta_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error)
  12325. __Pyx_GOTREF(__pyx_t_1);
  12326. __Pyx_XDECREF_SET(__pyx_v_a1x, __pyx_t_1);
  12327. __pyx_t_1 = 0;
  12328. /* "fontTools/misc/bezierTools.py":756
  12329. * # calc new a, b, c and d
  12330. * a1x = ax * delta_3
  12331. * a1y = ay * delta_3 # <<<<<<<<<<<<<<
  12332. * b1x = (3 * ax * t1 + bx) * delta_2
  12333. * b1y = (3 * ay * t1 + by) * delta_2
  12334. */
  12335. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ay, __pyx_v_delta_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
  12336. __Pyx_GOTREF(__pyx_t_1);
  12337. __Pyx_XDECREF_SET(__pyx_v_a1y, __pyx_t_1);
  12338. __pyx_t_1 = 0;
  12339. /* "fontTools/misc/bezierTools.py":757
  12340. * a1x = ax * delta_3
  12341. * a1y = ay * delta_3
  12342. * b1x = (3 * ax * t1 + bx) * delta_2 # <<<<<<<<<<<<<<
  12343. * b1y = (3 * ay * t1 + by) * delta_2
  12344. * c1x = (2 * bx * t1 + cx + 3 * ax * t1_2) * delta
  12345. */
  12346. __pyx_t_1 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_3, __pyx_v_ax, 3, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 757, __pyx_L1_error)
  12347. __Pyx_GOTREF(__pyx_t_1);
  12348. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L1_error)
  12349. __Pyx_GOTREF(__pyx_t_2);
  12350. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12351. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 757, __pyx_L1_error)
  12352. __Pyx_GOTREF(__pyx_t_1);
  12353. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12354. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_delta_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L1_error)
  12355. __Pyx_GOTREF(__pyx_t_2);
  12356. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12357. __Pyx_XDECREF_SET(__pyx_v_b1x, __pyx_t_2);
  12358. __pyx_t_2 = 0;
  12359. /* "fontTools/misc/bezierTools.py":758
  12360. * a1y = ay * delta_3
  12361. * b1x = (3 * ax * t1 + bx) * delta_2
  12362. * b1y = (3 * ay * t1 + by) * delta_2 # <<<<<<<<<<<<<<
  12363. * c1x = (2 * bx * t1 + cx + 3 * ax * t1_2) * delta
  12364. * c1y = (2 * by * t1 + cy + 3 * ay * t1_2) * delta
  12365. */
  12366. __pyx_t_2 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_3, __pyx_v_ay, 3, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error)
  12367. __Pyx_GOTREF(__pyx_t_2);
  12368. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error)
  12369. __Pyx_GOTREF(__pyx_t_1);
  12370. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12371. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_by); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error)
  12372. __Pyx_GOTREF(__pyx_t_2);
  12373. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12374. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_delta_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error)
  12375. __Pyx_GOTREF(__pyx_t_1);
  12376. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12377. __Pyx_XDECREF_SET(__pyx_v_b1y, __pyx_t_1);
  12378. __pyx_t_1 = 0;
  12379. /* "fontTools/misc/bezierTools.py":759
  12380. * b1x = (3 * ax * t1 + bx) * delta_2
  12381. * b1y = (3 * ay * t1 + by) * delta_2
  12382. * c1x = (2 * bx * t1 + cx + 3 * ax * t1_2) * delta # <<<<<<<<<<<<<<
  12383. * c1y = (2 * by * t1 + cy + 3 * ay * t1_2) * delta
  12384. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx
  12385. */
  12386. __pyx_t_1 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_v_bx, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error)
  12387. __Pyx_GOTREF(__pyx_t_1);
  12388. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error)
  12389. __Pyx_GOTREF(__pyx_t_2);
  12390. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12391. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error)
  12392. __Pyx_GOTREF(__pyx_t_1);
  12393. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12394. __pyx_t_2 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_3, __pyx_v_ax, 3, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error)
  12395. __Pyx_GOTREF(__pyx_t_2);
  12396. __pyx_t_9 = PyNumber_Multiply(__pyx_t_2, __pyx_v_t1_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 759, __pyx_L1_error)
  12397. __Pyx_GOTREF(__pyx_t_9);
  12398. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12399. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error)
  12400. __Pyx_GOTREF(__pyx_t_2);
  12401. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12402. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12403. __pyx_t_9 = PyNumber_Multiply(__pyx_t_2, __pyx_v_delta); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 759, __pyx_L1_error)
  12404. __Pyx_GOTREF(__pyx_t_9);
  12405. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12406. __Pyx_XDECREF_SET(__pyx_v_c1x, __pyx_t_9);
  12407. __pyx_t_9 = 0;
  12408. /* "fontTools/misc/bezierTools.py":760
  12409. * b1y = (3 * ay * t1 + by) * delta_2
  12410. * c1x = (2 * bx * t1 + cx + 3 * ax * t1_2) * delta
  12411. * c1y = (2 * by * t1 + cy + 3 * ay * t1_2) * delta # <<<<<<<<<<<<<<
  12412. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx
  12413. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy
  12414. */
  12415. __pyx_t_9 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_v_by, 2, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 760, __pyx_L1_error)
  12416. __Pyx_GOTREF(__pyx_t_9);
  12417. __pyx_t_2 = PyNumber_Multiply(__pyx_t_9, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __pyx_L1_error)
  12418. __Pyx_GOTREF(__pyx_t_2);
  12419. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12420. __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_v_cy); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 760, __pyx_L1_error)
  12421. __Pyx_GOTREF(__pyx_t_9);
  12422. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12423. __pyx_t_2 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_3, __pyx_v_ay, 3, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __pyx_L1_error)
  12424. __Pyx_GOTREF(__pyx_t_2);
  12425. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_t1_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error)
  12426. __Pyx_GOTREF(__pyx_t_1);
  12427. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12428. __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __pyx_L1_error)
  12429. __Pyx_GOTREF(__pyx_t_2);
  12430. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12431. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12432. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_delta); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error)
  12433. __Pyx_GOTREF(__pyx_t_1);
  12434. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12435. __Pyx_XDECREF_SET(__pyx_v_c1y, __pyx_t_1);
  12436. __pyx_t_1 = 0;
  12437. /* "fontTools/misc/bezierTools.py":761
  12438. * c1x = (2 * bx * t1 + cx + 3 * ax * t1_2) * delta
  12439. * c1y = (2 * by * t1 + cy + 3 * ay * t1_2) * delta
  12440. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx # <<<<<<<<<<<<<<
  12441. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy
  12442. * pt1, pt2, pt3, pt4 = calcCubicPoints(
  12443. */
  12444. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ax, __pyx_v_t1_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error)
  12445. __Pyx_GOTREF(__pyx_t_1);
  12446. __pyx_t_2 = PyNumber_Multiply(__pyx_v_bx, __pyx_v_t1_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
  12447. __Pyx_GOTREF(__pyx_t_2);
  12448. __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 761, __pyx_L1_error)
  12449. __Pyx_GOTREF(__pyx_t_9);
  12450. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12451. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12452. __pyx_t_2 = PyNumber_Multiply(__pyx_v_cx, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
  12453. __Pyx_GOTREF(__pyx_t_2);
  12454. __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error)
  12455. __Pyx_GOTREF(__pyx_t_1);
  12456. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12457. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12458. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_dx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
  12459. __Pyx_GOTREF(__pyx_t_2);
  12460. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12461. __Pyx_XDECREF_SET(__pyx_v_d1x, __pyx_t_2);
  12462. __pyx_t_2 = 0;
  12463. /* "fontTools/misc/bezierTools.py":762
  12464. * c1y = (2 * by * t1 + cy + 3 * ay * t1_2) * delta
  12465. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx
  12466. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy # <<<<<<<<<<<<<<
  12467. * pt1, pt2, pt3, pt4 = calcCubicPoints(
  12468. * (a1x, a1y), (b1x, b1y), (c1x, c1y), (d1x, d1y)
  12469. */
  12470. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ay, __pyx_v_t1_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
  12471. __Pyx_GOTREF(__pyx_t_2);
  12472. __pyx_t_1 = PyNumber_Multiply(__pyx_v_by, __pyx_v_t1_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
  12473. __Pyx_GOTREF(__pyx_t_1);
  12474. __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 762, __pyx_L1_error)
  12475. __Pyx_GOTREF(__pyx_t_9);
  12476. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12477. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12478. __pyx_t_1 = PyNumber_Multiply(__pyx_v_cy, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
  12479. __Pyx_GOTREF(__pyx_t_1);
  12480. __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
  12481. __Pyx_GOTREF(__pyx_t_2);
  12482. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12483. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12484. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_dy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
  12485. __Pyx_GOTREF(__pyx_t_1);
  12486. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12487. __Pyx_XDECREF_SET(__pyx_v_d1y, __pyx_t_1);
  12488. __pyx_t_1 = 0;
  12489. /* "fontTools/misc/bezierTools.py":763
  12490. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx
  12491. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy
  12492. * pt1, pt2, pt3, pt4 = calcCubicPoints( # <<<<<<<<<<<<<<
  12493. * (a1x, a1y), (b1x, b1y), (c1x, c1y), (d1x, d1y)
  12494. * )
  12495. */
  12496. __pyx_t_2 = NULL;
  12497. __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_calcCubicPoints); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 763, __pyx_L1_error)
  12498. __Pyx_GOTREF(__pyx_t_9);
  12499. /* "fontTools/misc/bezierTools.py":764
  12500. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy
  12501. * pt1, pt2, pt3, pt4 = calcCubicPoints(
  12502. * (a1x, a1y), (b1x, b1y), (c1x, c1y), (d1x, d1y) # <<<<<<<<<<<<<<
  12503. * )
  12504. * segments.append((pt1, pt2, pt3, pt4))
  12505. */
  12506. __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 764, __pyx_L1_error)
  12507. __Pyx_GOTREF(__pyx_t_10);
  12508. __Pyx_INCREF(__pyx_v_a1x);
  12509. __Pyx_GIVEREF(__pyx_v_a1x);
  12510. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_a1x) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12511. __Pyx_INCREF(__pyx_v_a1y);
  12512. __Pyx_GIVEREF(__pyx_v_a1y);
  12513. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_a1y) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12514. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 764, __pyx_L1_error)
  12515. __Pyx_GOTREF(__pyx_t_11);
  12516. __Pyx_INCREF(__pyx_v_b1x);
  12517. __Pyx_GIVEREF(__pyx_v_b1x);
  12518. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_b1x) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12519. __Pyx_INCREF(__pyx_v_b1y);
  12520. __Pyx_GIVEREF(__pyx_v_b1y);
  12521. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_b1y) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12522. __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 764, __pyx_L1_error)
  12523. __Pyx_GOTREF(__pyx_t_12);
  12524. __Pyx_INCREF(__pyx_v_c1x);
  12525. __Pyx_GIVEREF(__pyx_v_c1x);
  12526. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_c1x) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12527. __Pyx_INCREF(__pyx_v_c1y);
  12528. __Pyx_GIVEREF(__pyx_v_c1y);
  12529. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_c1y) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12530. __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 764, __pyx_L1_error)
  12531. __Pyx_GOTREF(__pyx_t_13);
  12532. __Pyx_INCREF(__pyx_v_d1x);
  12533. __Pyx_GIVEREF(__pyx_v_d1x);
  12534. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_d1x) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12535. __Pyx_INCREF(__pyx_v_d1y);
  12536. __Pyx_GIVEREF(__pyx_v_d1y);
  12537. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_d1y) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12538. __pyx_t_7 = 1;
  12539. #if CYTHON_UNPACK_METHODS
  12540. if (unlikely(PyMethod_Check(__pyx_t_9))) {
  12541. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
  12542. assert(__pyx_t_2);
  12543. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
  12544. __Pyx_INCREF(__pyx_t_2);
  12545. __Pyx_INCREF(__pyx__function);
  12546. __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
  12547. __pyx_t_7 = 0;
  12548. }
  12549. #endif
  12550. {
  12551. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13};
  12552. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_7, (5-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  12553. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  12554. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  12555. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  12556. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  12557. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  12558. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12559. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error)
  12560. __Pyx_GOTREF(__pyx_t_1);
  12561. }
  12562. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  12563. PyObject* sequence = __pyx_t_1;
  12564. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  12565. if (unlikely(size != 4)) {
  12566. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  12567. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  12568. __PYX_ERR(0, 763, __pyx_L1_error)
  12569. }
  12570. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12571. if (likely(PyTuple_CheckExact(sequence))) {
  12572. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
  12573. __Pyx_INCREF(__pyx_t_9);
  12574. __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
  12575. __Pyx_INCREF(__pyx_t_13);
  12576. __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2);
  12577. __Pyx_INCREF(__pyx_t_12);
  12578. __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3);
  12579. __Pyx_INCREF(__pyx_t_11);
  12580. } else {
  12581. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  12582. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 763, __pyx_L1_error)
  12583. __Pyx_XGOTREF(__pyx_t_9);
  12584. __pyx_t_13 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  12585. if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 763, __pyx_L1_error)
  12586. __Pyx_XGOTREF(__pyx_t_13);
  12587. __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  12588. if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 763, __pyx_L1_error)
  12589. __Pyx_XGOTREF(__pyx_t_12);
  12590. __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  12591. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 763, __pyx_L1_error)
  12592. __Pyx_XGOTREF(__pyx_t_11);
  12593. }
  12594. #else
  12595. {
  12596. Py_ssize_t i;
  12597. PyObject** temps[4] = {&__pyx_t_9,&__pyx_t_13,&__pyx_t_12,&__pyx_t_11};
  12598. for (i=0; i < 4; i++) {
  12599. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 763, __pyx_L1_error)
  12600. __Pyx_GOTREF(item);
  12601. *(temps[i]) = item;
  12602. }
  12603. }
  12604. #endif
  12605. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12606. } else {
  12607. Py_ssize_t index = -1;
  12608. PyObject** temps[4] = {&__pyx_t_9,&__pyx_t_13,&__pyx_t_12,&__pyx_t_11};
  12609. __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 763, __pyx_L1_error)
  12610. __Pyx_GOTREF(__pyx_t_10);
  12611. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12612. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  12613. for (index=0; index < 4; index++) {
  12614. PyObject* item = __pyx_t_5(__pyx_t_10); if (unlikely(!item)) goto __pyx_L13_unpacking_failed;
  12615. __Pyx_GOTREF(item);
  12616. *(temps[index]) = item;
  12617. }
  12618. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_10), 4) < (0)) __PYX_ERR(0, 763, __pyx_L1_error)
  12619. __pyx_t_5 = NULL;
  12620. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  12621. goto __pyx_L14_unpacking_done;
  12622. __pyx_L13_unpacking_failed:;
  12623. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  12624. __pyx_t_5 = NULL;
  12625. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  12626. __PYX_ERR(0, 763, __pyx_L1_error)
  12627. __pyx_L14_unpacking_done:;
  12628. }
  12629. /* "fontTools/misc/bezierTools.py":763
  12630. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx
  12631. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy
  12632. * pt1, pt2, pt3, pt4 = calcCubicPoints( # <<<<<<<<<<<<<<
  12633. * (a1x, a1y), (b1x, b1y), (c1x, c1y), (d1x, d1y)
  12634. * )
  12635. */
  12636. __Pyx_XDECREF_SET(__pyx_v_pt1, __pyx_t_9);
  12637. __pyx_t_9 = 0;
  12638. __Pyx_XDECREF_SET(__pyx_v_pt2, __pyx_t_13);
  12639. __pyx_t_13 = 0;
  12640. __Pyx_XDECREF_SET(__pyx_v_pt3, __pyx_t_12);
  12641. __pyx_t_12 = 0;
  12642. __Pyx_XDECREF_SET(__pyx_v_pt4, __pyx_t_11);
  12643. __pyx_t_11 = 0;
  12644. /* "fontTools/misc/bezierTools.py":766
  12645. * (a1x, a1y), (b1x, b1y), (c1x, c1y), (d1x, d1y)
  12646. * )
  12647. * segments.append((pt1, pt2, pt3, pt4)) # <<<<<<<<<<<<<<
  12648. * return segments
  12649. *
  12650. */
  12651. __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error)
  12652. __Pyx_GOTREF(__pyx_t_1);
  12653. __Pyx_INCREF(__pyx_v_pt1);
  12654. __Pyx_GIVEREF(__pyx_v_pt1);
  12655. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 766, __pyx_L1_error);
  12656. __Pyx_INCREF(__pyx_v_pt2);
  12657. __Pyx_GIVEREF(__pyx_v_pt2);
  12658. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 766, __pyx_L1_error);
  12659. __Pyx_INCREF(__pyx_v_pt3);
  12660. __Pyx_GIVEREF(__pyx_v_pt3);
  12661. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_pt3) != (0)) __PYX_ERR(0, 766, __pyx_L1_error);
  12662. __Pyx_INCREF(__pyx_v_pt4);
  12663. __Pyx_GIVEREF(__pyx_v_pt4);
  12664. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_pt4) != (0)) __PYX_ERR(0, 766, __pyx_L1_error);
  12665. __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_segments, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 766, __pyx_L1_error)
  12666. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12667. /* "fontTools/misc/bezierTools.py":744
  12668. * cx, cy = c
  12669. * dx, dy = d
  12670. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  12671. * t1 = ts[i]
  12672. * t2 = ts[i + 1]
  12673. */
  12674. }
  12675. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12676. /* "fontTools/misc/bezierTools.py":767
  12677. * )
  12678. * segments.append((pt1, pt2, pt3, pt4))
  12679. * return segments # <<<<<<<<<<<<<<
  12680. *
  12681. *
  12682. */
  12683. __Pyx_XDECREF(__pyx_r);
  12684. __Pyx_INCREF(__pyx_v_segments);
  12685. __pyx_r = __pyx_v_segments;
  12686. goto __pyx_L0;
  12687. /* "fontTools/misc/bezierTools.py":735
  12688. *
  12689. *
  12690. * def _splitCubicAtT(a, b, c, d, *ts): # <<<<<<<<<<<<<<
  12691. * ts = list(ts)
  12692. * ts.insert(0, 0.0)
  12693. */
  12694. /* function exit code */
  12695. __pyx_L1_error:;
  12696. __Pyx_XDECREF(__pyx_t_1);
  12697. __Pyx_XDECREF(__pyx_t_2);
  12698. __Pyx_XDECREF(__pyx_t_4);
  12699. __Pyx_XDECREF(__pyx_t_9);
  12700. __Pyx_XDECREF(__pyx_t_10);
  12701. __Pyx_XDECREF(__pyx_t_11);
  12702. __Pyx_XDECREF(__pyx_t_12);
  12703. __Pyx_XDECREF(__pyx_t_13);
  12704. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitCubicAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12705. __pyx_r = NULL;
  12706. __pyx_L0:;
  12707. __Pyx_XDECREF(__pyx_v_ts);
  12708. __Pyx_XDECREF(__pyx_v_segments);
  12709. __Pyx_XDECREF(__pyx_v_ax);
  12710. __Pyx_XDECREF(__pyx_v_ay);
  12711. __Pyx_XDECREF(__pyx_v_bx);
  12712. __Pyx_XDECREF(__pyx_v_by);
  12713. __Pyx_XDECREF(__pyx_v_cx);
  12714. __Pyx_XDECREF(__pyx_v_cy);
  12715. __Pyx_XDECREF(__pyx_v_dx);
  12716. __Pyx_XDECREF(__pyx_v_dy);
  12717. __Pyx_XDECREF(__pyx_v_i);
  12718. __Pyx_XDECREF(__pyx_v_t1);
  12719. __Pyx_XDECREF(__pyx_v_t2);
  12720. __Pyx_XDECREF(__pyx_v_delta);
  12721. __Pyx_XDECREF(__pyx_v_delta_2);
  12722. __Pyx_XDECREF(__pyx_v_delta_3);
  12723. __Pyx_XDECREF(__pyx_v_t1_2);
  12724. __Pyx_XDECREF(__pyx_v_t1_3);
  12725. __Pyx_XDECREF(__pyx_v_a1x);
  12726. __Pyx_XDECREF(__pyx_v_a1y);
  12727. __Pyx_XDECREF(__pyx_v_b1x);
  12728. __Pyx_XDECREF(__pyx_v_b1y);
  12729. __Pyx_XDECREF(__pyx_v_c1x);
  12730. __Pyx_XDECREF(__pyx_v_c1y);
  12731. __Pyx_XDECREF(__pyx_v_d1x);
  12732. __Pyx_XDECREF(__pyx_v_d1y);
  12733. __Pyx_XDECREF(__pyx_v_pt1);
  12734. __Pyx_XDECREF(__pyx_v_pt2);
  12735. __Pyx_XDECREF(__pyx_v_pt3);
  12736. __Pyx_XDECREF(__pyx_v_pt4);
  12737. __Pyx_XGIVEREF(__pyx_r);
  12738. __Pyx_RefNannyFinishContext();
  12739. return __pyx_r;
  12740. }
  12741. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_45generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  12742. /* "fontTools/misc/bezierTools.py":770
  12743. *
  12744. *
  12745. * @cython.locals( # <<<<<<<<<<<<<<
  12746. * a=cython.complex,
  12747. * b=cython.complex,
  12748. */
  12749. /* Python wrapper */
  12750. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_44_splitCubicAtTC(PyObject *__pyx_self,
  12751. #if CYTHON_METH_FASTCALL
  12752. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  12753. #else
  12754. PyObject *__pyx_args, PyObject *__pyx_kwds
  12755. #endif
  12756. ); /*proto*/
  12757. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_43_splitCubicAtTC, "_splitCubicAtTC(double complex a, double complex b, double complex c, double complex d, *ts)");
  12758. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_44_splitCubicAtTC = {"_splitCubicAtTC", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_44_splitCubicAtTC, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_43_splitCubicAtTC};
  12759. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_44_splitCubicAtTC(PyObject *__pyx_self,
  12760. #if CYTHON_METH_FASTCALL
  12761. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  12762. #else
  12763. PyObject *__pyx_args, PyObject *__pyx_kwds
  12764. #endif
  12765. ) {
  12766. __pyx_t_double_complex __pyx_v_a;
  12767. __pyx_t_double_complex __pyx_v_b;
  12768. __pyx_t_double_complex __pyx_v_c;
  12769. __pyx_t_double_complex __pyx_v_d;
  12770. PyObject *__pyx_v_ts = 0;
  12771. #if !CYTHON_METH_FASTCALL
  12772. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  12773. #endif
  12774. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  12775. PyObject* values[4] = {0,0,0,0};
  12776. int __pyx_lineno = 0;
  12777. const char *__pyx_filename = NULL;
  12778. int __pyx_clineno = 0;
  12779. PyObject *__pyx_r = 0;
  12780. __Pyx_RefNannyDeclarations
  12781. __Pyx_RefNannySetupContext("_splitCubicAtTC (wrapper)", 0);
  12782. #if !CYTHON_METH_FASTCALL
  12783. #if CYTHON_ASSUME_SAFE_SIZE
  12784. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  12785. #else
  12786. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  12787. #endif
  12788. #endif
  12789. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  12790. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 4, __pyx_nargs);
  12791. if (unlikely(!__pyx_v_ts)) {
  12792. __Pyx_RefNannyFinishContext();
  12793. return NULL;
  12794. }
  12795. __Pyx_GOTREF(__pyx_v_ts);
  12796. {
  12797. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_a,&__pyx_mstate_global->__pyx_n_u_b,&__pyx_mstate_global->__pyx_n_u_c,&__pyx_mstate_global->__pyx_n_u_d,0};
  12798. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  12799. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 770, __pyx_L3_error)
  12800. if (__pyx_kwds_len > 0) {
  12801. switch (__pyx_nargs) {
  12802. default:
  12803. case 4:
  12804. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  12805. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 770, __pyx_L3_error)
  12806. CYTHON_FALLTHROUGH;
  12807. case 3:
  12808. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  12809. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 770, __pyx_L3_error)
  12810. CYTHON_FALLTHROUGH;
  12811. case 2:
  12812. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  12813. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 770, __pyx_L3_error)
  12814. CYTHON_FALLTHROUGH;
  12815. case 1:
  12816. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  12817. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 770, __pyx_L3_error)
  12818. CYTHON_FALLTHROUGH;
  12819. case 0: break;
  12820. }
  12821. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  12822. const Py_ssize_t used_pos_args = (kwd_pos_args < 4) ? kwd_pos_args : 4;
  12823. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "_splitCubicAtTC", 0) < (0)) __PYX_ERR(0, 770, __pyx_L3_error)
  12824. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  12825. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_splitCubicAtTC", 0, 4, 4, i); __PYX_ERR(0, 770, __pyx_L3_error) }
  12826. }
  12827. } else if (unlikely(__pyx_nargs < 4)) {
  12828. goto __pyx_L5_argtuple_error;
  12829. } else {
  12830. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  12831. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 770, __pyx_L3_error)
  12832. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  12833. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 770, __pyx_L3_error)
  12834. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  12835. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 770, __pyx_L3_error)
  12836. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  12837. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 770, __pyx_L3_error)
  12838. }
  12839. __pyx_v_a = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L3_error)
  12840. __pyx_v_b = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L3_error)
  12841. __pyx_v_c = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L3_error)
  12842. __pyx_v_d = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L3_error)
  12843. }
  12844. goto __pyx_L6_skip;
  12845. __pyx_L5_argtuple_error:;
  12846. __Pyx_RaiseArgtupleInvalid("_splitCubicAtTC", 0, 4, 4, __pyx_nargs); __PYX_ERR(0, 770, __pyx_L3_error)
  12847. __pyx_L6_skip:;
  12848. goto __pyx_L4_argument_unpacking_done;
  12849. __pyx_L3_error:;
  12850. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  12851. Py_XDECREF(values[__pyx_temp]);
  12852. }
  12853. __Pyx_CLEAR(__pyx_v_ts);
  12854. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12855. __Pyx_RefNannyFinishContext();
  12856. return NULL;
  12857. __pyx_L4_argument_unpacking_done:;
  12858. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_43_splitCubicAtTC(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_d, __pyx_v_ts);
  12859. /* function exit code */
  12860. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  12861. Py_XDECREF(values[__pyx_temp]);
  12862. }
  12863. __Pyx_DECREF(__pyx_v_ts);
  12864. __Pyx_RefNannyFinishContext();
  12865. return __pyx_r;
  12866. }
  12867. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_43_splitCubicAtTC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_a, __pyx_t_double_complex __pyx_v_b, __pyx_t_double_complex __pyx_v_c, __pyx_t_double_complex __pyx_v_d, PyObject *__pyx_v_ts) {
  12868. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *__pyx_cur_scope;
  12869. PyObject *__pyx_r = NULL;
  12870. __Pyx_RefNannyDeclarations
  12871. int __pyx_lineno = 0;
  12872. const char *__pyx_filename = NULL;
  12873. int __pyx_clineno = 0;
  12874. __Pyx_RefNannySetupContext("_splitCubicAtTC", 0);
  12875. __pyx_cur_scope = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC(__pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  12876. if (unlikely(!__pyx_cur_scope)) {
  12877. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *)Py_None);
  12878. __Pyx_INCREF(Py_None);
  12879. __PYX_ERR(0, 770, __pyx_L1_error)
  12880. } else {
  12881. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  12882. }
  12883. __pyx_cur_scope->__pyx_v_a = __pyx_v_a;
  12884. __pyx_cur_scope->__pyx_v_b = __pyx_v_b;
  12885. __pyx_cur_scope->__pyx_v_c = __pyx_v_c;
  12886. __pyx_cur_scope->__pyx_v_d = __pyx_v_d;
  12887. __pyx_cur_scope->__pyx_v_ts = __pyx_v_ts;
  12888. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ts);
  12889. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ts);
  12890. {
  12891. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_4misc_11bezierTools_45generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_splitCubicAtTC_2, __pyx_mstate_global->__pyx_n_u_splitCubicAtTC_2, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools); if (unlikely(!gen)) __PYX_ERR(0, 770, __pyx_L1_error)
  12892. __Pyx_DECREF(__pyx_cur_scope);
  12893. __Pyx_RefNannyFinishContext();
  12894. return (PyObject *) gen;
  12895. }
  12896. /* function exit code */
  12897. __pyx_L1_error:;
  12898. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12899. __pyx_r = NULL;
  12900. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  12901. __Pyx_XGIVEREF(__pyx_r);
  12902. __Pyx_RefNannyFinishContext();
  12903. return __pyx_r;
  12904. }
  12905. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_45generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  12906. {
  12907. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *)__pyx_generator->closure);
  12908. PyObject *__pyx_r = NULL;
  12909. PyObject *__pyx_t_1 = NULL;
  12910. PyObject *__pyx_t_2 = NULL;
  12911. int __pyx_t_3;
  12912. Py_ssize_t __pyx_t_4;
  12913. PyObject *__pyx_t_5 = NULL;
  12914. size_t __pyx_t_6;
  12915. PyObject *(*__pyx_t_7)(PyObject *);
  12916. double __pyx_t_8;
  12917. PyObject *__pyx_t_9 = NULL;
  12918. PyObject *__pyx_t_10 = NULL;
  12919. PyObject *__pyx_t_11 = NULL;
  12920. PyObject *__pyx_t_12 = NULL;
  12921. PyObject *(*__pyx_t_13)(PyObject *);
  12922. int __pyx_lineno = 0;
  12923. const char *__pyx_filename = NULL;
  12924. int __pyx_clineno = 0;
  12925. __Pyx_RefNannyDeclarations
  12926. __Pyx_RefNannySetupContext("_splitCubicAtTC", 0);
  12927. switch (__pyx_generator->resume_label) {
  12928. case 0: goto __pyx_L3_first_run;
  12929. case 1: goto __pyx_L8_resume_from_yield;
  12930. default: /* CPython raises the right error here */
  12931. __Pyx_RefNannyFinishContext();
  12932. return NULL;
  12933. }
  12934. __pyx_L3_first_run:;
  12935. if (unlikely(__pyx_sent_value != Py_None)) {
  12936. if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
  12937. __PYX_ERR(0, 770, __pyx_L1_error)
  12938. }
  12939. /* "fontTools/misc/bezierTools.py":786
  12940. * )
  12941. * def _splitCubicAtTC(a, b, c, d, *ts):
  12942. * ts = list(ts) # <<<<<<<<<<<<<<
  12943. * ts.insert(0, 0.0)
  12944. * ts.append(1.0)
  12945. */
  12946. __pyx_t_1 = PySequence_List(__pyx_cur_scope->__pyx_v_ts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error)
  12947. __Pyx_GOTREF(__pyx_t_1);
  12948. __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ts);
  12949. __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_ts, __pyx_t_1);
  12950. __Pyx_GIVEREF(__pyx_t_1);
  12951. __pyx_t_1 = 0;
  12952. /* "fontTools/misc/bezierTools.py":787
  12953. * def _splitCubicAtTC(a, b, c, d, *ts):
  12954. * ts = list(ts)
  12955. * ts.insert(0, 0.0) # <<<<<<<<<<<<<<
  12956. * ts.append(1.0)
  12957. * for i in range(len(ts) - 1):
  12958. */
  12959. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_ts, __pyx_mstate_global->__pyx_n_u_insert); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L1_error)
  12960. __Pyx_GOTREF(__pyx_t_1);
  12961. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[0], NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 787, __pyx_L1_error)
  12962. __Pyx_GOTREF(__pyx_t_2);
  12963. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12964. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12965. /* "fontTools/misc/bezierTools.py":788
  12966. * ts = list(ts)
  12967. * ts.insert(0, 0.0)
  12968. * ts.append(1.0) # <<<<<<<<<<<<<<
  12969. * for i in range(len(ts) - 1):
  12970. * t1 = ts[i]
  12971. */
  12972. __pyx_t_3 = __Pyx_PyObject_Append(__pyx_cur_scope->__pyx_v_ts, __pyx_mstate_global->__pyx_float_1_0); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 788, __pyx_L1_error)
  12973. /* "fontTools/misc/bezierTools.py":789
  12974. * ts.insert(0, 0.0)
  12975. * ts.append(1.0)
  12976. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  12977. * t1 = ts[i]
  12978. * t2 = ts[i + 1]
  12979. */
  12980. __pyx_t_1 = NULL;
  12981. __pyx_t_4 = PyObject_Length(__pyx_cur_scope->__pyx_v_ts); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 789, __pyx_L1_error)
  12982. __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 789, __pyx_L1_error)
  12983. __Pyx_GOTREF(__pyx_t_5);
  12984. __pyx_t_6 = 1;
  12985. {
  12986. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5};
  12987. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  12988. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  12989. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  12990. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __pyx_L1_error)
  12991. __Pyx_GOTREF(__pyx_t_2);
  12992. }
  12993. __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 789, __pyx_L1_error)
  12994. __Pyx_GOTREF(__pyx_t_5);
  12995. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 789, __pyx_L1_error)
  12996. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12997. for (;;) {
  12998. {
  12999. __pyx_t_2 = __pyx_t_7(__pyx_t_5);
  13000. if (unlikely(!__pyx_t_2)) {
  13001. PyObject* exc_type = PyErr_Occurred();
  13002. if (exc_type) {
  13003. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 789, __pyx_L1_error)
  13004. PyErr_Clear();
  13005. }
  13006. break;
  13007. }
  13008. }
  13009. __Pyx_GOTREF(__pyx_t_2);
  13010. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
  13011. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_2);
  13012. __Pyx_GIVEREF(__pyx_t_2);
  13013. __pyx_t_2 = 0;
  13014. /* "fontTools/misc/bezierTools.py":790
  13015. * ts.append(1.0)
  13016. * for i in range(len(ts) - 1):
  13017. * t1 = ts[i] # <<<<<<<<<<<<<<
  13018. * t2 = ts[i + 1]
  13019. * delta = t2 - t1
  13020. */
  13021. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_ts, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 790, __pyx_L1_error)
  13022. __Pyx_GOTREF(__pyx_t_2);
  13023. __pyx_t_8 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 790, __pyx_L1_error)
  13024. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13025. __pyx_cur_scope->__pyx_v_t1 = __pyx_t_8;
  13026. /* "fontTools/misc/bezierTools.py":791
  13027. * for i in range(len(ts) - 1):
  13028. * t1 = ts[i]
  13029. * t2 = ts[i + 1] # <<<<<<<<<<<<<<
  13030. * delta = t2 - t1
  13031. *
  13032. */
  13033. __pyx_t_2 = __Pyx_PyLong_AddObjC(__pyx_cur_scope->__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 791, __pyx_L1_error)
  13034. __Pyx_GOTREF(__pyx_t_2);
  13035. __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_ts, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error)
  13036. __Pyx_GOTREF(__pyx_t_1);
  13037. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13038. __pyx_t_8 = __Pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 791, __pyx_L1_error)
  13039. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13040. __pyx_cur_scope->__pyx_v_t2 = __pyx_t_8;
  13041. /* "fontTools/misc/bezierTools.py":792
  13042. * t1 = ts[i]
  13043. * t2 = ts[i + 1]
  13044. * delta = t2 - t1 # <<<<<<<<<<<<<<
  13045. *
  13046. * delta_2 = delta * delta
  13047. */
  13048. __pyx_cur_scope->__pyx_v_delta = (__pyx_cur_scope->__pyx_v_t2 - __pyx_cur_scope->__pyx_v_t1);
  13049. /* "fontTools/misc/bezierTools.py":794
  13050. * delta = t2 - t1
  13051. *
  13052. * delta_2 = delta * delta # <<<<<<<<<<<<<<
  13053. * delta_3 = delta * delta_2
  13054. * t1_2 = t1 * t1
  13055. */
  13056. __pyx_cur_scope->__pyx_v_delta_2 = (__pyx_cur_scope->__pyx_v_delta * __pyx_cur_scope->__pyx_v_delta);
  13057. /* "fontTools/misc/bezierTools.py":795
  13058. *
  13059. * delta_2 = delta * delta
  13060. * delta_3 = delta * delta_2 # <<<<<<<<<<<<<<
  13061. * t1_2 = t1 * t1
  13062. * t1_3 = t1 * t1_2
  13063. */
  13064. __pyx_cur_scope->__pyx_v_delta_3 = (__pyx_cur_scope->__pyx_v_delta * __pyx_cur_scope->__pyx_v_delta_2);
  13065. /* "fontTools/misc/bezierTools.py":796
  13066. * delta_2 = delta * delta
  13067. * delta_3 = delta * delta_2
  13068. * t1_2 = t1 * t1 # <<<<<<<<<<<<<<
  13069. * t1_3 = t1 * t1_2
  13070. *
  13071. */
  13072. __pyx_cur_scope->__pyx_v_t1_2 = (__pyx_cur_scope->__pyx_v_t1 * __pyx_cur_scope->__pyx_v_t1);
  13073. /* "fontTools/misc/bezierTools.py":797
  13074. * delta_3 = delta * delta_2
  13075. * t1_2 = t1 * t1
  13076. * t1_3 = t1 * t1_2 # <<<<<<<<<<<<<<
  13077. *
  13078. * # calc new a, b, c and d
  13079. */
  13080. __pyx_cur_scope->__pyx_v_t1_3 = (__pyx_cur_scope->__pyx_v_t1 * __pyx_cur_scope->__pyx_v_t1_2);
  13081. /* "fontTools/misc/bezierTools.py":800
  13082. *
  13083. * # calc new a, b, c and d
  13084. * a1 = a * delta_3 # <<<<<<<<<<<<<<
  13085. * b1 = (3 * a * t1 + b) * delta_2
  13086. * c1 = (2 * b * t1 + c + 3 * a * t1_2) * delta
  13087. */
  13088. __pyx_cur_scope->__pyx_v_a1 = __Pyx_c_prod_double(__pyx_cur_scope->__pyx_v_a, __pyx_t_double_complex_from_parts(__pyx_cur_scope->__pyx_v_delta_3, 0));
  13089. /* "fontTools/misc/bezierTools.py":801
  13090. * # calc new a, b, c and d
  13091. * a1 = a * delta_3
  13092. * b1 = (3 * a * t1 + b) * delta_2 # <<<<<<<<<<<<<<
  13093. * c1 = (2 * b * t1 + c + 3 * a * t1_2) * delta
  13094. * d1 = a * t1_3 + b * t1_2 + c * t1 + d
  13095. */
  13096. __pyx_cur_scope->__pyx_v_b1 = __Pyx_c_prod_double(__Pyx_c_sum_double(__Pyx_c_prod_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts(3, 0), __pyx_cur_scope->__pyx_v_a), __pyx_t_double_complex_from_parts(__pyx_cur_scope->__pyx_v_t1, 0)), __pyx_cur_scope->__pyx_v_b), __pyx_t_double_complex_from_parts(__pyx_cur_scope->__pyx_v_delta_2, 0));
  13097. /* "fontTools/misc/bezierTools.py":802
  13098. * a1 = a * delta_3
  13099. * b1 = (3 * a * t1 + b) * delta_2
  13100. * c1 = (2 * b * t1 + c + 3 * a * t1_2) * delta # <<<<<<<<<<<<<<
  13101. * d1 = a * t1_3 + b * t1_2 + c * t1 + d
  13102. * pt1, pt2, pt3, pt4 = calcCubicPointsC(a1, b1, c1, d1)
  13103. */
  13104. __pyx_cur_scope->__pyx_v_c1 = __Pyx_c_prod_double(__Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_prod_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts(2, 0), __pyx_cur_scope->__pyx_v_b), __pyx_t_double_complex_from_parts(__pyx_cur_scope->__pyx_v_t1, 0)), __pyx_cur_scope->__pyx_v_c), __Pyx_c_prod_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts(3, 0), __pyx_cur_scope->__pyx_v_a), __pyx_t_double_complex_from_parts(__pyx_cur_scope->__pyx_v_t1_2, 0))), __pyx_t_double_complex_from_parts(__pyx_cur_scope->__pyx_v_delta, 0));
  13105. /* "fontTools/misc/bezierTools.py":803
  13106. * b1 = (3 * a * t1 + b) * delta_2
  13107. * c1 = (2 * b * t1 + c + 3 * a * t1_2) * delta
  13108. * d1 = a * t1_3 + b * t1_2 + c * t1 + d # <<<<<<<<<<<<<<
  13109. * pt1, pt2, pt3, pt4 = calcCubicPointsC(a1, b1, c1, d1)
  13110. * yield (pt1, pt2, pt3, pt4)
  13111. */
  13112. __pyx_cur_scope->__pyx_v_d1 = __Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_cur_scope->__pyx_v_a, __pyx_t_double_complex_from_parts(__pyx_cur_scope->__pyx_v_t1_3, 0)), __Pyx_c_prod_double(__pyx_cur_scope->__pyx_v_b, __pyx_t_double_complex_from_parts(__pyx_cur_scope->__pyx_v_t1_2, 0))), __Pyx_c_prod_double(__pyx_cur_scope->__pyx_v_c, __pyx_t_double_complex_from_parts(__pyx_cur_scope->__pyx_v_t1, 0))), __pyx_cur_scope->__pyx_v_d);
  13113. /* "fontTools/misc/bezierTools.py":804
  13114. * c1 = (2 * b * t1 + c + 3 * a * t1_2) * delta
  13115. * d1 = a * t1_3 + b * t1_2 + c * t1 + d
  13116. * pt1, pt2, pt3, pt4 = calcCubicPointsC(a1, b1, c1, d1) # <<<<<<<<<<<<<<
  13117. * yield (pt1, pt2, pt3, pt4)
  13118. *
  13119. */
  13120. __pyx_t_1 = __pyx_f_9fontTools_4misc_11bezierTools_calcCubicPointsC(__pyx_cur_scope->__pyx_v_a1, __pyx_cur_scope->__pyx_v_b1, __pyx_cur_scope->__pyx_v_c1, __pyx_cur_scope->__pyx_v_d1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error)
  13121. __Pyx_GOTREF(__pyx_t_1);
  13122. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  13123. PyObject* sequence = __pyx_t_1;
  13124. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  13125. if (unlikely(size != 4)) {
  13126. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  13127. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  13128. __PYX_ERR(0, 804, __pyx_L1_error)
  13129. }
  13130. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  13131. if (likely(PyTuple_CheckExact(sequence))) {
  13132. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  13133. __Pyx_INCREF(__pyx_t_2);
  13134. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
  13135. __Pyx_INCREF(__pyx_t_9);
  13136. __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2);
  13137. __Pyx_INCREF(__pyx_t_10);
  13138. __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3);
  13139. __Pyx_INCREF(__pyx_t_11);
  13140. } else {
  13141. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  13142. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 804, __pyx_L1_error)
  13143. __Pyx_XGOTREF(__pyx_t_2);
  13144. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  13145. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 804, __pyx_L1_error)
  13146. __Pyx_XGOTREF(__pyx_t_9);
  13147. __pyx_t_10 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  13148. if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 804, __pyx_L1_error)
  13149. __Pyx_XGOTREF(__pyx_t_10);
  13150. __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  13151. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 804, __pyx_L1_error)
  13152. __Pyx_XGOTREF(__pyx_t_11);
  13153. }
  13154. #else
  13155. {
  13156. Py_ssize_t i;
  13157. PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
  13158. for (i=0; i < 4; i++) {
  13159. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 804, __pyx_L1_error)
  13160. __Pyx_GOTREF(item);
  13161. *(temps[i]) = item;
  13162. }
  13163. }
  13164. #endif
  13165. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13166. } else {
  13167. Py_ssize_t index = -1;
  13168. PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
  13169. __pyx_t_12 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 804, __pyx_L1_error)
  13170. __Pyx_GOTREF(__pyx_t_12);
  13171. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13172. __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_12);
  13173. for (index=0; index < 4; index++) {
  13174. PyObject* item = __pyx_t_13(__pyx_t_12); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
  13175. __Pyx_GOTREF(item);
  13176. *(temps[index]) = item;
  13177. }
  13178. if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 4) < (0)) __PYX_ERR(0, 804, __pyx_L1_error)
  13179. __pyx_t_13 = NULL;
  13180. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  13181. goto __pyx_L7_unpacking_done;
  13182. __pyx_L6_unpacking_failed:;
  13183. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  13184. __pyx_t_13 = NULL;
  13185. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  13186. __PYX_ERR(0, 804, __pyx_L1_error)
  13187. __pyx_L7_unpacking_done:;
  13188. }
  13189. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pt1);
  13190. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pt1, __pyx_t_2);
  13191. __Pyx_GIVEREF(__pyx_t_2);
  13192. __pyx_t_2 = 0;
  13193. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pt2);
  13194. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pt2, __pyx_t_9);
  13195. __Pyx_GIVEREF(__pyx_t_9);
  13196. __pyx_t_9 = 0;
  13197. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pt3);
  13198. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pt3, __pyx_t_10);
  13199. __Pyx_GIVEREF(__pyx_t_10);
  13200. __pyx_t_10 = 0;
  13201. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pt4);
  13202. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pt4, __pyx_t_11);
  13203. __Pyx_GIVEREF(__pyx_t_11);
  13204. __pyx_t_11 = 0;
  13205. /* "fontTools/misc/bezierTools.py":805
  13206. * d1 = a * t1_3 + b * t1_2 + c * t1 + d
  13207. * pt1, pt2, pt3, pt4 = calcCubicPointsC(a1, b1, c1, d1)
  13208. * yield (pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  13209. *
  13210. *
  13211. */
  13212. __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error)
  13213. __Pyx_GOTREF(__pyx_t_1);
  13214. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pt1);
  13215. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pt1);
  13216. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_pt1) != (0)) __PYX_ERR(0, 805, __pyx_L1_error);
  13217. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pt2);
  13218. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pt2);
  13219. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_pt2) != (0)) __PYX_ERR(0, 805, __pyx_L1_error);
  13220. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pt3);
  13221. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pt3);
  13222. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_cur_scope->__pyx_v_pt3) != (0)) __PYX_ERR(0, 805, __pyx_L1_error);
  13223. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pt4);
  13224. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pt4);
  13225. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_cur_scope->__pyx_v_pt4) != (0)) __PYX_ERR(0, 805, __pyx_L1_error);
  13226. __pyx_r = __pyx_t_1;
  13227. __pyx_t_1 = 0;
  13228. __Pyx_XGIVEREF(__pyx_t_5);
  13229. __pyx_cur_scope->__pyx_t_0 = __pyx_t_5;
  13230. __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
  13231. __Pyx_XGIVEREF(__pyx_r);
  13232. __Pyx_RefNannyFinishContext();
  13233. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  13234. /* return from generator, yielding value */
  13235. __pyx_generator->resume_label = 1;
  13236. return __pyx_r;
  13237. __pyx_L8_resume_from_yield:;
  13238. __pyx_t_5 = __pyx_cur_scope->__pyx_t_0;
  13239. __pyx_cur_scope->__pyx_t_0 = 0;
  13240. __Pyx_XGOTREF(__pyx_t_5);
  13241. __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
  13242. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 805, __pyx_L1_error)
  13243. /* "fontTools/misc/bezierTools.py":789
  13244. * ts.insert(0, 0.0)
  13245. * ts.append(1.0)
  13246. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  13247. * t1 = ts[i]
  13248. * t2 = ts[i + 1]
  13249. */
  13250. }
  13251. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  13252. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  13253. /* "fontTools/misc/bezierTools.py":770
  13254. *
  13255. *
  13256. * @cython.locals( # <<<<<<<<<<<<<<
  13257. * a=cython.complex,
  13258. * b=cython.complex,
  13259. */
  13260. /* function exit code */
  13261. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  13262. goto __pyx_L0;
  13263. __pyx_L1_error:;
  13264. __Pyx_XDECREF(__pyx_t_1);
  13265. __Pyx_XDECREF(__pyx_t_2);
  13266. __Pyx_XDECREF(__pyx_t_5);
  13267. __Pyx_XDECREF(__pyx_t_9);
  13268. __Pyx_XDECREF(__pyx_t_10);
  13269. __Pyx_XDECREF(__pyx_t_11);
  13270. __Pyx_XDECREF(__pyx_t_12);
  13271. if (__Pyx_PyErr_Occurred()) {
  13272. __Pyx_Generator_Replace_StopIteration(0);
  13273. __Pyx_AddTraceback("_splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13274. }
  13275. __pyx_L0:;
  13276. __Pyx_XGIVEREF(__pyx_r);
  13277. #if !CYTHON_USE_EXC_INFO_STACK
  13278. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  13279. #endif
  13280. __pyx_generator->resume_label = -1;
  13281. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  13282. __Pyx_RefNannyFinishContext();
  13283. return __pyx_r;
  13284. }
  13285. /* "fontTools/misc/bezierTools.py":815
  13286. *
  13287. *
  13288. * def solveQuadratic(a, b, c, sqrt=sqrt): # <<<<<<<<<<<<<<
  13289. * """Solve a quadratic equation.
  13290. *
  13291. */
  13292. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_96__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  13293. PyObject *__pyx_r = NULL;
  13294. __Pyx_RefNannyDeclarations
  13295. PyObject *__pyx_t_1 = NULL;
  13296. PyObject *__pyx_t_2 = NULL;
  13297. int __pyx_lineno = 0;
  13298. const char *__pyx_filename = NULL;
  13299. int __pyx_clineno = 0;
  13300. __Pyx_RefNannySetupContext("__defaults__", 0);
  13301. __Pyx_XDECREF(__pyx_r);
  13302. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
  13303. __Pyx_GOTREF(__pyx_t_1);
  13304. __Pyx_INCREF(__Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0);
  13305. __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0);
  13306. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0) != (0)) __PYX_ERR(0, 815, __pyx_L1_error);
  13307. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 815, __pyx_L1_error)
  13308. __Pyx_GOTREF(__pyx_t_2);
  13309. __Pyx_GIVEREF(__pyx_t_1);
  13310. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 815, __pyx_L1_error);
  13311. __Pyx_INCREF(Py_None);
  13312. __Pyx_GIVEREF(Py_None);
  13313. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None) != (0)) __PYX_ERR(0, 815, __pyx_L1_error);
  13314. __pyx_t_1 = 0;
  13315. __pyx_r = __pyx_t_2;
  13316. __pyx_t_2 = 0;
  13317. goto __pyx_L0;
  13318. /* function exit code */
  13319. __pyx_L1_error:;
  13320. __Pyx_XDECREF(__pyx_t_1);
  13321. __Pyx_XDECREF(__pyx_t_2);
  13322. __Pyx_AddTraceback("fontTools.misc.bezierTools.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13323. __pyx_r = NULL;
  13324. __pyx_L0:;
  13325. __Pyx_XGIVEREF(__pyx_r);
  13326. __Pyx_RefNannyFinishContext();
  13327. return __pyx_r;
  13328. }
  13329. /* Python wrapper */
  13330. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_47solveQuadratic(PyObject *__pyx_self,
  13331. #if CYTHON_METH_FASTCALL
  13332. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  13333. #else
  13334. PyObject *__pyx_args, PyObject *__pyx_kwds
  13335. #endif
  13336. ); /*proto*/
  13337. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_46solveQuadratic, "solveQuadratic(a, b, c, sqrt=sqrt)\n\nSolve a quadratic equation.\n\nSolves *a*x*x + b*x + c = 0* where a, b and c are real.\n\nArgs:\n a: coefficient of *x\302\262*\n b: coefficient of *x*\n c: constant term\n\nReturns:\n A list of roots. Note that the returned list is neither guaranteed to\n be sorted nor to contain unique values!");
  13338. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_47solveQuadratic = {"solveQuadratic", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_47solveQuadratic, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_46solveQuadratic};
  13339. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_47solveQuadratic(PyObject *__pyx_self,
  13340. #if CYTHON_METH_FASTCALL
  13341. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  13342. #else
  13343. PyObject *__pyx_args, PyObject *__pyx_kwds
  13344. #endif
  13345. ) {
  13346. PyObject *__pyx_v_a = 0;
  13347. PyObject *__pyx_v_b = 0;
  13348. PyObject *__pyx_v_c = 0;
  13349. PyObject *__pyx_v_sqrt = 0;
  13350. #if !CYTHON_METH_FASTCALL
  13351. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  13352. #endif
  13353. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  13354. PyObject* values[4] = {0,0,0,0};
  13355. int __pyx_lineno = 0;
  13356. const char *__pyx_filename = NULL;
  13357. int __pyx_clineno = 0;
  13358. PyObject *__pyx_r = 0;
  13359. __Pyx_RefNannyDeclarations
  13360. __Pyx_RefNannySetupContext("solveQuadratic (wrapper)", 0);
  13361. #if !CYTHON_METH_FASTCALL
  13362. #if CYTHON_ASSUME_SAFE_SIZE
  13363. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  13364. #else
  13365. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  13366. #endif
  13367. #endif
  13368. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  13369. {
  13370. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_a,&__pyx_mstate_global->__pyx_n_u_b,&__pyx_mstate_global->__pyx_n_u_c,&__pyx_mstate_global->__pyx_n_u_sqrt,0};
  13371. struct __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self);
  13372. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  13373. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 815, __pyx_L3_error)
  13374. if (__pyx_kwds_len > 0) {
  13375. switch (__pyx_nargs) {
  13376. case 4:
  13377. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  13378. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 815, __pyx_L3_error)
  13379. CYTHON_FALLTHROUGH;
  13380. case 3:
  13381. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  13382. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 815, __pyx_L3_error)
  13383. CYTHON_FALLTHROUGH;
  13384. case 2:
  13385. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  13386. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 815, __pyx_L3_error)
  13387. CYTHON_FALLTHROUGH;
  13388. case 1:
  13389. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  13390. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 815, __pyx_L3_error)
  13391. CYTHON_FALLTHROUGH;
  13392. case 0: break;
  13393. default: goto __pyx_L5_argtuple_error;
  13394. }
  13395. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  13396. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "solveQuadratic", 0) < (0)) __PYX_ERR(0, 815, __pyx_L3_error)
  13397. if (!values[3]) values[3] = __Pyx_NewRef(__pyx_dynamic_args->arg0);
  13398. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  13399. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("solveQuadratic", 0, 3, 4, i); __PYX_ERR(0, 815, __pyx_L3_error) }
  13400. }
  13401. } else {
  13402. switch (__pyx_nargs) {
  13403. case 4:
  13404. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  13405. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 815, __pyx_L3_error)
  13406. CYTHON_FALLTHROUGH;
  13407. case 3:
  13408. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  13409. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 815, __pyx_L3_error)
  13410. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  13411. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 815, __pyx_L3_error)
  13412. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  13413. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 815, __pyx_L3_error)
  13414. break;
  13415. default: goto __pyx_L5_argtuple_error;
  13416. }
  13417. if (!values[3]) values[3] = __Pyx_NewRef(__pyx_dynamic_args->arg0);
  13418. }
  13419. __pyx_v_a = values[0];
  13420. __pyx_v_b = values[1];
  13421. __pyx_v_c = values[2];
  13422. __pyx_v_sqrt = values[3];
  13423. }
  13424. goto __pyx_L6_skip;
  13425. __pyx_L5_argtuple_error:;
  13426. __Pyx_RaiseArgtupleInvalid("solveQuadratic", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 815, __pyx_L3_error)
  13427. __pyx_L6_skip:;
  13428. goto __pyx_L4_argument_unpacking_done;
  13429. __pyx_L3_error:;
  13430. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  13431. Py_XDECREF(values[__pyx_temp]);
  13432. }
  13433. __Pyx_AddTraceback("fontTools.misc.bezierTools.solveQuadratic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13434. __Pyx_RefNannyFinishContext();
  13435. return NULL;
  13436. __pyx_L4_argument_unpacking_done:;
  13437. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_46solveQuadratic(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_sqrt);
  13438. /* function exit code */
  13439. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  13440. Py_XDECREF(values[__pyx_temp]);
  13441. }
  13442. __Pyx_RefNannyFinishContext();
  13443. return __pyx_r;
  13444. }
  13445. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_46solveQuadratic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_sqrt) {
  13446. PyObject *__pyx_v_roots = NULL;
  13447. PyObject *__pyx_v_DD = NULL;
  13448. PyObject *__pyx_v_rDD = NULL;
  13449. PyObject *__pyx_r = NULL;
  13450. __Pyx_RefNannyDeclarations
  13451. PyObject *__pyx_t_1 = NULL;
  13452. PyObject *__pyx_t_2 = NULL;
  13453. PyObject *__pyx_t_3 = NULL;
  13454. int __pyx_t_4;
  13455. size_t __pyx_t_5;
  13456. int __pyx_lineno = 0;
  13457. const char *__pyx_filename = NULL;
  13458. int __pyx_clineno = 0;
  13459. __Pyx_RefNannySetupContext("solveQuadratic", 0);
  13460. /* "fontTools/misc/bezierTools.py":829
  13461. * be sorted nor to contain unique values!
  13462. * """
  13463. * if abs(a) < epsilon: # <<<<<<<<<<<<<<
  13464. * if abs(b) < epsilon:
  13465. * # We have a non-equation; therefore, we have no valid solution
  13466. */
  13467. __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L1_error)
  13468. __Pyx_GOTREF(__pyx_t_1);
  13469. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error)
  13470. __Pyx_GOTREF(__pyx_t_2);
  13471. __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 829, __pyx_L1_error)
  13472. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13473. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13474. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 829, __pyx_L1_error)
  13475. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13476. if (__pyx_t_4) {
  13477. /* "fontTools/misc/bezierTools.py":830
  13478. * """
  13479. * if abs(a) < epsilon:
  13480. * if abs(b) < epsilon: # <<<<<<<<<<<<<<
  13481. * # We have a non-equation; therefore, we have no valid solution
  13482. * roots = []
  13483. */
  13484. __pyx_t_3 = __Pyx_PyNumber_Absolute(__pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L1_error)
  13485. __Pyx_GOTREF(__pyx_t_3);
  13486. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error)
  13487. __Pyx_GOTREF(__pyx_t_2);
  13488. __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 830, __pyx_L1_error)
  13489. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13490. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13491. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 830, __pyx_L1_error)
  13492. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13493. if (__pyx_t_4) {
  13494. /* "fontTools/misc/bezierTools.py":832
  13495. * if abs(b) < epsilon:
  13496. * # We have a non-equation; therefore, we have no valid solution
  13497. * roots = [] # <<<<<<<<<<<<<<
  13498. * else:
  13499. * # We have a linear equation with 1 root.
  13500. */
  13501. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error)
  13502. __Pyx_GOTREF(__pyx_t_1);
  13503. __pyx_v_roots = ((PyObject*)__pyx_t_1);
  13504. __pyx_t_1 = 0;
  13505. /* "fontTools/misc/bezierTools.py":830
  13506. * """
  13507. * if abs(a) < epsilon:
  13508. * if abs(b) < epsilon: # <<<<<<<<<<<<<<
  13509. * # We have a non-equation; therefore, we have no valid solution
  13510. * roots = []
  13511. */
  13512. goto __pyx_L4;
  13513. }
  13514. /* "fontTools/misc/bezierTools.py":835
  13515. * else:
  13516. * # We have a linear equation with 1 root.
  13517. * roots = [-c / b] # <<<<<<<<<<<<<<
  13518. * else:
  13519. * # We have a true quadratic equation. Apply the quadratic formula to find two roots.
  13520. */
  13521. /*else*/ {
  13522. __pyx_t_1 = PyNumber_Negative(__pyx_v_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __pyx_L1_error)
  13523. __Pyx_GOTREF(__pyx_t_1);
  13524. __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 835, __pyx_L1_error)
  13525. __Pyx_GOTREF(__pyx_t_2);
  13526. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13527. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __pyx_L1_error)
  13528. __Pyx_GOTREF(__pyx_t_1);
  13529. __Pyx_GIVEREF(__pyx_t_2);
  13530. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 835, __pyx_L1_error);
  13531. __pyx_t_2 = 0;
  13532. __pyx_v_roots = ((PyObject*)__pyx_t_1);
  13533. __pyx_t_1 = 0;
  13534. }
  13535. __pyx_L4:;
  13536. /* "fontTools/misc/bezierTools.py":829
  13537. * be sorted nor to contain unique values!
  13538. * """
  13539. * if abs(a) < epsilon: # <<<<<<<<<<<<<<
  13540. * if abs(b) < epsilon:
  13541. * # We have a non-equation; therefore, we have no valid solution
  13542. */
  13543. goto __pyx_L3;
  13544. }
  13545. /* "fontTools/misc/bezierTools.py":838
  13546. * else:
  13547. * # We have a true quadratic equation. Apply the quadratic formula to find two roots.
  13548. * DD = b * b - 4.0 * a * c # <<<<<<<<<<<<<<
  13549. * if DD >= 0.0:
  13550. * rDD = sqrt(DD)
  13551. */
  13552. /*else*/ {
  13553. __pyx_t_1 = PyNumber_Multiply(__pyx_v_b, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 838, __pyx_L1_error)
  13554. __Pyx_GOTREF(__pyx_t_1);
  13555. __pyx_t_2 = PyNumber_Multiply(__pyx_mstate_global->__pyx_float_4_0, __pyx_v_a); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 838, __pyx_L1_error)
  13556. __Pyx_GOTREF(__pyx_t_2);
  13557. __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 838, __pyx_L1_error)
  13558. __Pyx_GOTREF(__pyx_t_3);
  13559. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13560. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 838, __pyx_L1_error)
  13561. __Pyx_GOTREF(__pyx_t_2);
  13562. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13563. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13564. __pyx_v_DD = __pyx_t_2;
  13565. __pyx_t_2 = 0;
  13566. /* "fontTools/misc/bezierTools.py":839
  13567. * # We have a true quadratic equation. Apply the quadratic formula to find two roots.
  13568. * DD = b * b - 4.0 * a * c
  13569. * if DD >= 0.0: # <<<<<<<<<<<<<<
  13570. * rDD = sqrt(DD)
  13571. * roots = [(-b + rDD) / 2.0 / a, (-b - rDD) / 2.0 / a]
  13572. */
  13573. __pyx_t_2 = PyObject_RichCompare(__pyx_v_DD, __pyx_mstate_global->__pyx_float_0_0, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 839, __pyx_L1_error)
  13574. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 839, __pyx_L1_error)
  13575. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13576. if (__pyx_t_4) {
  13577. /* "fontTools/misc/bezierTools.py":840
  13578. * DD = b * b - 4.0 * a * c
  13579. * if DD >= 0.0:
  13580. * rDD = sqrt(DD) # <<<<<<<<<<<<<<
  13581. * roots = [(-b + rDD) / 2.0 / a, (-b - rDD) / 2.0 / a]
  13582. * else:
  13583. */
  13584. __pyx_t_3 = NULL;
  13585. __Pyx_INCREF(__pyx_v_sqrt);
  13586. __pyx_t_1 = __pyx_v_sqrt;
  13587. __pyx_t_5 = 1;
  13588. #if CYTHON_UNPACK_METHODS
  13589. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  13590. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
  13591. assert(__pyx_t_3);
  13592. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  13593. __Pyx_INCREF(__pyx_t_3);
  13594. __Pyx_INCREF(__pyx__function);
  13595. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  13596. __pyx_t_5 = 0;
  13597. }
  13598. #endif
  13599. {
  13600. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_DD};
  13601. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  13602. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  13603. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13604. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error)
  13605. __Pyx_GOTREF(__pyx_t_2);
  13606. }
  13607. __pyx_v_rDD = __pyx_t_2;
  13608. __pyx_t_2 = 0;
  13609. /* "fontTools/misc/bezierTools.py":841
  13610. * if DD >= 0.0:
  13611. * rDD = sqrt(DD)
  13612. * roots = [(-b + rDD) / 2.0 / a, (-b - rDD) / 2.0 / a] # <<<<<<<<<<<<<<
  13613. * else:
  13614. * # complex roots, ignore
  13615. */
  13616. __pyx_t_2 = PyNumber_Negative(__pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
  13617. __Pyx_GOTREF(__pyx_t_2);
  13618. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_rDD); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error)
  13619. __Pyx_GOTREF(__pyx_t_1);
  13620. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13621. __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_mstate_global->__pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
  13622. __Pyx_GOTREF(__pyx_t_2);
  13623. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13624. __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error)
  13625. __Pyx_GOTREF(__pyx_t_1);
  13626. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13627. __pyx_t_2 = PyNumber_Negative(__pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
  13628. __Pyx_GOTREF(__pyx_t_2);
  13629. __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_v_rDD); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 841, __pyx_L1_error)
  13630. __Pyx_GOTREF(__pyx_t_3);
  13631. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13632. __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_3, __pyx_mstate_global->__pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
  13633. __Pyx_GOTREF(__pyx_t_2);
  13634. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13635. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 841, __pyx_L1_error)
  13636. __Pyx_GOTREF(__pyx_t_3);
  13637. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13638. __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
  13639. __Pyx_GOTREF(__pyx_t_2);
  13640. __Pyx_GIVEREF(__pyx_t_1);
  13641. if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 841, __pyx_L1_error);
  13642. __Pyx_GIVEREF(__pyx_t_3);
  13643. if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 841, __pyx_L1_error);
  13644. __pyx_t_1 = 0;
  13645. __pyx_t_3 = 0;
  13646. __pyx_v_roots = ((PyObject*)__pyx_t_2);
  13647. __pyx_t_2 = 0;
  13648. /* "fontTools/misc/bezierTools.py":839
  13649. * # We have a true quadratic equation. Apply the quadratic formula to find two roots.
  13650. * DD = b * b - 4.0 * a * c
  13651. * if DD >= 0.0: # <<<<<<<<<<<<<<
  13652. * rDD = sqrt(DD)
  13653. * roots = [(-b + rDD) / 2.0 / a, (-b - rDD) / 2.0 / a]
  13654. */
  13655. goto __pyx_L5;
  13656. }
  13657. /* "fontTools/misc/bezierTools.py":844
  13658. * else:
  13659. * # complex roots, ignore
  13660. * roots = [] # <<<<<<<<<<<<<<
  13661. * return roots
  13662. *
  13663. */
  13664. /*else*/ {
  13665. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error)
  13666. __Pyx_GOTREF(__pyx_t_2);
  13667. __pyx_v_roots = ((PyObject*)__pyx_t_2);
  13668. __pyx_t_2 = 0;
  13669. }
  13670. __pyx_L5:;
  13671. }
  13672. __pyx_L3:;
  13673. /* "fontTools/misc/bezierTools.py":845
  13674. * # complex roots, ignore
  13675. * roots = []
  13676. * return roots # <<<<<<<<<<<<<<
  13677. *
  13678. *
  13679. */
  13680. __Pyx_XDECREF(__pyx_r);
  13681. __Pyx_INCREF(__pyx_v_roots);
  13682. __pyx_r = __pyx_v_roots;
  13683. goto __pyx_L0;
  13684. /* "fontTools/misc/bezierTools.py":815
  13685. *
  13686. *
  13687. * def solveQuadratic(a, b, c, sqrt=sqrt): # <<<<<<<<<<<<<<
  13688. * """Solve a quadratic equation.
  13689. *
  13690. */
  13691. /* function exit code */
  13692. __pyx_L1_error:;
  13693. __Pyx_XDECREF(__pyx_t_1);
  13694. __Pyx_XDECREF(__pyx_t_2);
  13695. __Pyx_XDECREF(__pyx_t_3);
  13696. __Pyx_AddTraceback("fontTools.misc.bezierTools.solveQuadratic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13697. __pyx_r = NULL;
  13698. __pyx_L0:;
  13699. __Pyx_XDECREF(__pyx_v_roots);
  13700. __Pyx_XDECREF(__pyx_v_DD);
  13701. __Pyx_XDECREF(__pyx_v_rDD);
  13702. __Pyx_XGIVEREF(__pyx_r);
  13703. __Pyx_RefNannyFinishContext();
  13704. return __pyx_r;
  13705. }
  13706. /* "fontTools/misc/bezierTools.py":848
  13707. *
  13708. *
  13709. * def solveCubic(a, b, c, d): # <<<<<<<<<<<<<<
  13710. * """Solve a cubic equation.
  13711. *
  13712. */
  13713. /* Python wrapper */
  13714. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_49solveCubic(PyObject *__pyx_self,
  13715. #if CYTHON_METH_FASTCALL
  13716. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  13717. #else
  13718. PyObject *__pyx_args, PyObject *__pyx_kwds
  13719. #endif
  13720. ); /*proto*/
  13721. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_48solveCubic, "solveCubic(a, b, c, d)\n\nSolve a cubic equation.\n\nSolves *a*x*x*x + b*x*x + c*x + d = 0* where a, b, c and d are real.\n\nArgs:\n a: coefficient of *x\302\263*\n b: coefficient of *x\302\262*\n c: coefficient of *x*\n d: constant term\n\nReturns:\n A list of roots. Note that the returned list is neither guaranteed to\n be sorted nor to contain unique values!\n\nExamples::\n\n >>> solveCubic(1, 1, -6, 0)\n [-3.0, -0.0, 2.0]\n >>> solveCubic(-10.0, -9.0, 48.0, -29.0)\n [-2.9, 1.0, 1.0]\n >>> solveCubic(-9.875, -9.0, 47.625, -28.75)\n [-2.911392, 1.0, 1.0]\n >>> solveCubic(1.0, -4.5, 6.75, -3.375)\n [1.5, 1.5, 1.5]\n >>> solveCubic(-12.0, 18.0, -9.0, 1.50023651123)\n [0.5, 0.5, 0.5]\n >>> solveCubic(\n ... 9.0, 0.0, 0.0, -7.62939453125e-05\n ... ) == [-0.0, -0.0, -0.0]\n True");
  13722. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_49solveCubic = {"solveCubic", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_49solveCubic, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_48solveCubic};
  13723. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_49solveCubic(PyObject *__pyx_self,
  13724. #if CYTHON_METH_FASTCALL
  13725. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  13726. #else
  13727. PyObject *__pyx_args, PyObject *__pyx_kwds
  13728. #endif
  13729. ) {
  13730. PyObject *__pyx_v_a = 0;
  13731. PyObject *__pyx_v_b = 0;
  13732. PyObject *__pyx_v_c = 0;
  13733. PyObject *__pyx_v_d = 0;
  13734. #if !CYTHON_METH_FASTCALL
  13735. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  13736. #endif
  13737. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  13738. PyObject* values[4] = {0,0,0,0};
  13739. int __pyx_lineno = 0;
  13740. const char *__pyx_filename = NULL;
  13741. int __pyx_clineno = 0;
  13742. PyObject *__pyx_r = 0;
  13743. __Pyx_RefNannyDeclarations
  13744. __Pyx_RefNannySetupContext("solveCubic (wrapper)", 0);
  13745. #if !CYTHON_METH_FASTCALL
  13746. #if CYTHON_ASSUME_SAFE_SIZE
  13747. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  13748. #else
  13749. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  13750. #endif
  13751. #endif
  13752. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  13753. {
  13754. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_a,&__pyx_mstate_global->__pyx_n_u_b,&__pyx_mstate_global->__pyx_n_u_c,&__pyx_mstate_global->__pyx_n_u_d,0};
  13755. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  13756. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 848, __pyx_L3_error)
  13757. if (__pyx_kwds_len > 0) {
  13758. switch (__pyx_nargs) {
  13759. case 4:
  13760. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  13761. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 848, __pyx_L3_error)
  13762. CYTHON_FALLTHROUGH;
  13763. case 3:
  13764. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  13765. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 848, __pyx_L3_error)
  13766. CYTHON_FALLTHROUGH;
  13767. case 2:
  13768. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  13769. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 848, __pyx_L3_error)
  13770. CYTHON_FALLTHROUGH;
  13771. case 1:
  13772. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  13773. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 848, __pyx_L3_error)
  13774. CYTHON_FALLTHROUGH;
  13775. case 0: break;
  13776. default: goto __pyx_L5_argtuple_error;
  13777. }
  13778. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  13779. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "solveCubic", 0) < (0)) __PYX_ERR(0, 848, __pyx_L3_error)
  13780. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  13781. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("solveCubic", 1, 4, 4, i); __PYX_ERR(0, 848, __pyx_L3_error) }
  13782. }
  13783. } else if (unlikely(__pyx_nargs != 4)) {
  13784. goto __pyx_L5_argtuple_error;
  13785. } else {
  13786. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  13787. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 848, __pyx_L3_error)
  13788. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  13789. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 848, __pyx_L3_error)
  13790. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  13791. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 848, __pyx_L3_error)
  13792. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  13793. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 848, __pyx_L3_error)
  13794. }
  13795. __pyx_v_a = values[0];
  13796. __pyx_v_b = values[1];
  13797. __pyx_v_c = values[2];
  13798. __pyx_v_d = values[3];
  13799. }
  13800. goto __pyx_L6_skip;
  13801. __pyx_L5_argtuple_error:;
  13802. __Pyx_RaiseArgtupleInvalid("solveCubic", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 848, __pyx_L3_error)
  13803. __pyx_L6_skip:;
  13804. goto __pyx_L4_argument_unpacking_done;
  13805. __pyx_L3_error:;
  13806. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  13807. Py_XDECREF(values[__pyx_temp]);
  13808. }
  13809. __Pyx_AddTraceback("fontTools.misc.bezierTools.solveCubic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13810. __Pyx_RefNannyFinishContext();
  13811. return NULL;
  13812. __pyx_L4_argument_unpacking_done:;
  13813. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_48solveCubic(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_d);
  13814. /* function exit code */
  13815. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  13816. Py_XDECREF(values[__pyx_temp]);
  13817. }
  13818. __Pyx_RefNannyFinishContext();
  13819. return __pyx_r;
  13820. }
  13821. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_48solveCubic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  13822. PyObject *__pyx_v_a1 = NULL;
  13823. PyObject *__pyx_v_a2 = NULL;
  13824. PyObject *__pyx_v_a3 = NULL;
  13825. PyObject *__pyx_v_Q = NULL;
  13826. PyObject *__pyx_v_R = NULL;
  13827. PyObject *__pyx_v_R2 = NULL;
  13828. PyObject *__pyx_v_Q3 = NULL;
  13829. PyObject *__pyx_v_R2_Q3 = NULL;
  13830. PyObject *__pyx_v_x = NULL;
  13831. PyObject *__pyx_v_theta = NULL;
  13832. PyObject *__pyx_v_rQ2 = NULL;
  13833. PyObject *__pyx_v_a1_3 = NULL;
  13834. PyObject *__pyx_v_x0 = NULL;
  13835. PyObject *__pyx_v_x1 = NULL;
  13836. PyObject *__pyx_v_x2 = NULL;
  13837. PyObject *__pyx_r = NULL;
  13838. __Pyx_RefNannyDeclarations
  13839. PyObject *__pyx_t_1 = NULL;
  13840. PyObject *__pyx_t_2 = NULL;
  13841. PyObject *__pyx_t_3 = NULL;
  13842. int __pyx_t_4;
  13843. size_t __pyx_t_5;
  13844. PyObject *__pyx_t_6 = NULL;
  13845. int __pyx_t_7;
  13846. double __pyx_t_8;
  13847. double __pyx_t_9;
  13848. PyObject *__pyx_t_10 = NULL;
  13849. PyObject *__pyx_t_11 = NULL;
  13850. PyObject *__pyx_t_12 = NULL;
  13851. int __pyx_lineno = 0;
  13852. const char *__pyx_filename = NULL;
  13853. int __pyx_clineno = 0;
  13854. __Pyx_RefNannySetupContext("solveCubic", 0);
  13855. __Pyx_INCREF(__pyx_v_a);
  13856. /* "fontTools/misc/bezierTools.py":886
  13857. * # found at: http://www.strangecreations.com/library/snippets/Cubic.C
  13858. * #
  13859. * if abs(a) < epsilon: # <<<<<<<<<<<<<<
  13860. * # don't just test for zero; for very small values of 'a' solveCubic()
  13861. * # returns unreliable results, so we fall back to quad.
  13862. */
  13863. __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error)
  13864. __Pyx_GOTREF(__pyx_t_1);
  13865. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error)
  13866. __Pyx_GOTREF(__pyx_t_2);
  13867. __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 886, __pyx_L1_error)
  13868. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13869. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13870. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 886, __pyx_L1_error)
  13871. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13872. if (__pyx_t_4) {
  13873. /* "fontTools/misc/bezierTools.py":889
  13874. * # don't just test for zero; for very small values of 'a' solveCubic()
  13875. * # returns unreliable results, so we fall back to quad.
  13876. * return solveQuadratic(b, c, d) # <<<<<<<<<<<<<<
  13877. * a = float(a)
  13878. * a1 = b / a
  13879. */
  13880. __Pyx_XDECREF(__pyx_r);
  13881. __pyx_t_2 = NULL;
  13882. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_solveQuadratic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error)
  13883. __Pyx_GOTREF(__pyx_t_1);
  13884. __pyx_t_5 = 1;
  13885. #if CYTHON_UNPACK_METHODS
  13886. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  13887. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  13888. assert(__pyx_t_2);
  13889. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  13890. __Pyx_INCREF(__pyx_t_2);
  13891. __Pyx_INCREF(__pyx__function);
  13892. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  13893. __pyx_t_5 = 0;
  13894. }
  13895. #endif
  13896. {
  13897. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_b, __pyx_v_c, __pyx_v_d};
  13898. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  13899. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13900. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13901. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error)
  13902. __Pyx_GOTREF(__pyx_t_3);
  13903. }
  13904. __pyx_r = __pyx_t_3;
  13905. __pyx_t_3 = 0;
  13906. goto __pyx_L0;
  13907. /* "fontTools/misc/bezierTools.py":886
  13908. * # found at: http://www.strangecreations.com/library/snippets/Cubic.C
  13909. * #
  13910. * if abs(a) < epsilon: # <<<<<<<<<<<<<<
  13911. * # don't just test for zero; for very small values of 'a' solveCubic()
  13912. * # returns unreliable results, so we fall back to quad.
  13913. */
  13914. }
  13915. /* "fontTools/misc/bezierTools.py":890
  13916. * # returns unreliable results, so we fall back to quad.
  13917. * return solveQuadratic(b, c, d)
  13918. * a = float(a) # <<<<<<<<<<<<<<
  13919. * a1 = b / a
  13920. * a2 = c / a
  13921. */
  13922. __pyx_t_3 = __Pyx_PyNumber_Float(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __pyx_L1_error)
  13923. __Pyx_GOTREF(__pyx_t_3);
  13924. __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_3);
  13925. __pyx_t_3 = 0;
  13926. /* "fontTools/misc/bezierTools.py":891
  13927. * return solveQuadratic(b, c, d)
  13928. * a = float(a)
  13929. * a1 = b / a # <<<<<<<<<<<<<<
  13930. * a2 = c / a
  13931. * a3 = d / a
  13932. */
  13933. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_b, __pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 891, __pyx_L1_error)
  13934. __Pyx_GOTREF(__pyx_t_3);
  13935. __pyx_v_a1 = __pyx_t_3;
  13936. __pyx_t_3 = 0;
  13937. /* "fontTools/misc/bezierTools.py":892
  13938. * a = float(a)
  13939. * a1 = b / a
  13940. * a2 = c / a # <<<<<<<<<<<<<<
  13941. * a3 = d / a
  13942. *
  13943. */
  13944. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_c, __pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L1_error)
  13945. __Pyx_GOTREF(__pyx_t_3);
  13946. __pyx_v_a2 = __pyx_t_3;
  13947. __pyx_t_3 = 0;
  13948. /* "fontTools/misc/bezierTools.py":893
  13949. * a1 = b / a
  13950. * a2 = c / a
  13951. * a3 = d / a # <<<<<<<<<<<<<<
  13952. *
  13953. * Q = (a1 * a1 - 3.0 * a2) / 9.0
  13954. */
  13955. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_d, __pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 893, __pyx_L1_error)
  13956. __Pyx_GOTREF(__pyx_t_3);
  13957. __pyx_v_a3 = __pyx_t_3;
  13958. __pyx_t_3 = 0;
  13959. /* "fontTools/misc/bezierTools.py":895
  13960. * a3 = d / a
  13961. *
  13962. * Q = (a1 * a1 - 3.0 * a2) / 9.0 # <<<<<<<<<<<<<<
  13963. * R = (2.0 * a1 * a1 * a1 - 9.0 * a1 * a2 + 27.0 * a3) / 54.0
  13964. *
  13965. */
  13966. __pyx_t_3 = PyNumber_Multiply(__pyx_v_a1, __pyx_v_a1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 895, __pyx_L1_error)
  13967. __Pyx_GOTREF(__pyx_t_3);
  13968. __pyx_t_1 = PyNumber_Multiply(__pyx_mstate_global->__pyx_float_3_0, __pyx_v_a2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 895, __pyx_L1_error)
  13969. __Pyx_GOTREF(__pyx_t_1);
  13970. __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 895, __pyx_L1_error)
  13971. __Pyx_GOTREF(__pyx_t_2);
  13972. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13973. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13974. __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_2, __pyx_mstate_global->__pyx_float_9_0, 9.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 895, __pyx_L1_error)
  13975. __Pyx_GOTREF(__pyx_t_1);
  13976. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13977. __pyx_v_Q = __pyx_t_1;
  13978. __pyx_t_1 = 0;
  13979. /* "fontTools/misc/bezierTools.py":896
  13980. *
  13981. * Q = (a1 * a1 - 3.0 * a2) / 9.0
  13982. * R = (2.0 * a1 * a1 * a1 - 9.0 * a1 * a2 + 27.0 * a3) / 54.0 # <<<<<<<<<<<<<<
  13983. *
  13984. * R2 = R * R
  13985. */
  13986. __pyx_t_1 = PyNumber_Multiply(__pyx_mstate_global->__pyx_float_2_0, __pyx_v_a1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
  13987. __Pyx_GOTREF(__pyx_t_1);
  13988. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_a1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
  13989. __Pyx_GOTREF(__pyx_t_2);
  13990. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13991. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_a1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
  13992. __Pyx_GOTREF(__pyx_t_1);
  13993. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13994. __pyx_t_2 = PyNumber_Multiply(__pyx_mstate_global->__pyx_float_9_0, __pyx_v_a1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
  13995. __Pyx_GOTREF(__pyx_t_2);
  13996. __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_a2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error)
  13997. __Pyx_GOTREF(__pyx_t_3);
  13998. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13999. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
  14000. __Pyx_GOTREF(__pyx_t_2);
  14001. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14002. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14003. __pyx_t_3 = PyNumber_Multiply(__pyx_mstate_global->__pyx_float_27_0, __pyx_v_a3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error)
  14004. __Pyx_GOTREF(__pyx_t_3);
  14005. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
  14006. __Pyx_GOTREF(__pyx_t_1);
  14007. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14008. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14009. __pyx_t_3 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_mstate_global->__pyx_float_54_0, 54.0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error)
  14010. __Pyx_GOTREF(__pyx_t_3);
  14011. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14012. __pyx_v_R = __pyx_t_3;
  14013. __pyx_t_3 = 0;
  14014. /* "fontTools/misc/bezierTools.py":898
  14015. * R = (2.0 * a1 * a1 * a1 - 9.0 * a1 * a2 + 27.0 * a3) / 54.0
  14016. *
  14017. * R2 = R * R # <<<<<<<<<<<<<<
  14018. * Q3 = Q * Q * Q
  14019. * R2 = 0 if R2 < epsilon else R2
  14020. */
  14021. __pyx_t_3 = PyNumber_Multiply(__pyx_v_R, __pyx_v_R); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 898, __pyx_L1_error)
  14022. __Pyx_GOTREF(__pyx_t_3);
  14023. __pyx_v_R2 = __pyx_t_3;
  14024. __pyx_t_3 = 0;
  14025. /* "fontTools/misc/bezierTools.py":899
  14026. *
  14027. * R2 = R * R
  14028. * Q3 = Q * Q * Q # <<<<<<<<<<<<<<
  14029. * R2 = 0 if R2 < epsilon else R2
  14030. * Q3 = 0 if abs(Q3) < epsilon else Q3
  14031. */
  14032. __pyx_t_3 = PyNumber_Multiply(__pyx_v_Q, __pyx_v_Q); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
  14033. __Pyx_GOTREF(__pyx_t_3);
  14034. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_v_Q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 899, __pyx_L1_error)
  14035. __Pyx_GOTREF(__pyx_t_1);
  14036. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14037. __pyx_v_Q3 = __pyx_t_1;
  14038. __pyx_t_1 = 0;
  14039. /* "fontTools/misc/bezierTools.py":900
  14040. * R2 = R * R
  14041. * Q3 = Q * Q * Q
  14042. * R2 = 0 if R2 < epsilon else R2 # <<<<<<<<<<<<<<
  14043. * Q3 = 0 if abs(Q3) < epsilon else Q3
  14044. *
  14045. */
  14046. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 900, __pyx_L1_error)
  14047. __Pyx_GOTREF(__pyx_t_3);
  14048. __pyx_t_2 = PyObject_RichCompare(__pyx_v_R2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 900, __pyx_L1_error)
  14049. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14050. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 900, __pyx_L1_error)
  14051. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14052. if (__pyx_t_4) {
  14053. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  14054. __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
  14055. } else {
  14056. __Pyx_INCREF(__pyx_v_R2);
  14057. __pyx_t_1 = __pyx_v_R2;
  14058. }
  14059. __Pyx_DECREF_SET(__pyx_v_R2, __pyx_t_1);
  14060. __pyx_t_1 = 0;
  14061. /* "fontTools/misc/bezierTools.py":901
  14062. * Q3 = Q * Q * Q
  14063. * R2 = 0 if R2 < epsilon else R2
  14064. * Q3 = 0 if abs(Q3) < epsilon else Q3 # <<<<<<<<<<<<<<
  14065. *
  14066. * R2_Q3 = R2 - Q3
  14067. */
  14068. __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_v_Q3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error)
  14069. __Pyx_GOTREF(__pyx_t_2);
  14070. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 901, __pyx_L1_error)
  14071. __Pyx_GOTREF(__pyx_t_3);
  14072. __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 901, __pyx_L1_error)
  14073. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14074. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14075. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 901, __pyx_L1_error)
  14076. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14077. if (__pyx_t_4) {
  14078. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  14079. __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
  14080. } else {
  14081. __Pyx_INCREF(__pyx_v_Q3);
  14082. __pyx_t_1 = __pyx_v_Q3;
  14083. }
  14084. __Pyx_DECREF_SET(__pyx_v_Q3, __pyx_t_1);
  14085. __pyx_t_1 = 0;
  14086. /* "fontTools/misc/bezierTools.py":903
  14087. * Q3 = 0 if abs(Q3) < epsilon else Q3
  14088. *
  14089. * R2_Q3 = R2 - Q3 # <<<<<<<<<<<<<<
  14090. *
  14091. * if R2 == 0.0 and Q3 == 0.0:
  14092. */
  14093. __pyx_t_1 = PyNumber_Subtract(__pyx_v_R2, __pyx_v_Q3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 903, __pyx_L1_error)
  14094. __Pyx_GOTREF(__pyx_t_1);
  14095. __pyx_v_R2_Q3 = __pyx_t_1;
  14096. __pyx_t_1 = 0;
  14097. /* "fontTools/misc/bezierTools.py":905
  14098. * R2_Q3 = R2 - Q3
  14099. *
  14100. * if R2 == 0.0 and Q3 == 0.0: # <<<<<<<<<<<<<<
  14101. * x = round(-a1 / 3.0, epsilonDigits)
  14102. * return [x, x, x]
  14103. */
  14104. __pyx_t_7 = (__Pyx_PyFloat_BoolEqObjC(__pyx_v_R2, __pyx_mstate_global->__pyx_float_0_0, 0.0, 0, 0)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 905, __pyx_L1_error)
  14105. if (__pyx_t_7) {
  14106. } else {
  14107. __pyx_t_4 = __pyx_t_7;
  14108. goto __pyx_L5_bool_binop_done;
  14109. }
  14110. __pyx_t_7 = (__Pyx_PyFloat_BoolEqObjC(__pyx_v_Q3, __pyx_mstate_global->__pyx_float_0_0, 0.0, 0, 0)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 905, __pyx_L1_error)
  14111. __pyx_t_4 = __pyx_t_7;
  14112. __pyx_L5_bool_binop_done:;
  14113. if (__pyx_t_4) {
  14114. /* "fontTools/misc/bezierTools.py":906
  14115. *
  14116. * if R2 == 0.0 and Q3 == 0.0:
  14117. * x = round(-a1 / 3.0, epsilonDigits) # <<<<<<<<<<<<<<
  14118. * return [x, x, x]
  14119. * elif R2_Q3 <= epsilon * 0.5:
  14120. */
  14121. __pyx_t_6 = NULL;
  14122. __pyx_t_3 = PyNumber_Negative(__pyx_v_a1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 906, __pyx_L1_error)
  14123. __Pyx_GOTREF(__pyx_t_3);
  14124. __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_3, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 906, __pyx_L1_error)
  14125. __Pyx_GOTREF(__pyx_t_2);
  14126. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14127. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 906, __pyx_L1_error)
  14128. __Pyx_GOTREF(__pyx_t_3);
  14129. __pyx_t_5 = 1;
  14130. {
  14131. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_3};
  14132. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14133. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  14134. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14135. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14136. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __pyx_L1_error)
  14137. __Pyx_GOTREF(__pyx_t_1);
  14138. }
  14139. __pyx_v_x = __pyx_t_1;
  14140. __pyx_t_1 = 0;
  14141. /* "fontTools/misc/bezierTools.py":907
  14142. * if R2 == 0.0 and Q3 == 0.0:
  14143. * x = round(-a1 / 3.0, epsilonDigits)
  14144. * return [x, x, x] # <<<<<<<<<<<<<<
  14145. * elif R2_Q3 <= epsilon * 0.5:
  14146. * # The epsilon * .5 above ensures that Q3 is not zero.
  14147. */
  14148. __Pyx_XDECREF(__pyx_r);
  14149. __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 907, __pyx_L1_error)
  14150. __Pyx_GOTREF(__pyx_t_1);
  14151. __Pyx_INCREF(__pyx_v_x);
  14152. __Pyx_GIVEREF(__pyx_v_x);
  14153. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 907, __pyx_L1_error);
  14154. __Pyx_INCREF(__pyx_v_x);
  14155. __Pyx_GIVEREF(__pyx_v_x);
  14156. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_x) != (0)) __PYX_ERR(0, 907, __pyx_L1_error);
  14157. __Pyx_INCREF(__pyx_v_x);
  14158. __Pyx_GIVEREF(__pyx_v_x);
  14159. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 2, __pyx_v_x) != (0)) __PYX_ERR(0, 907, __pyx_L1_error);
  14160. __pyx_r = __pyx_t_1;
  14161. __pyx_t_1 = 0;
  14162. goto __pyx_L0;
  14163. /* "fontTools/misc/bezierTools.py":905
  14164. * R2_Q3 = R2 - Q3
  14165. *
  14166. * if R2 == 0.0 and Q3 == 0.0: # <<<<<<<<<<<<<<
  14167. * x = round(-a1 / 3.0, epsilonDigits)
  14168. * return [x, x, x]
  14169. */
  14170. }
  14171. /* "fontTools/misc/bezierTools.py":908
  14172. * x = round(-a1 / 3.0, epsilonDigits)
  14173. * return [x, x, x]
  14174. * elif R2_Q3 <= epsilon * 0.5: # <<<<<<<<<<<<<<
  14175. * # The epsilon * .5 above ensures that Q3 is not zero.
  14176. * theta = acos(max(min(R / sqrt(Q3), 1.0), -1.0))
  14177. */
  14178. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 908, __pyx_L1_error)
  14179. __Pyx_GOTREF(__pyx_t_1);
  14180. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 908, __pyx_L1_error)
  14181. __Pyx_GOTREF(__pyx_t_3);
  14182. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14183. __pyx_t_1 = PyObject_RichCompare(__pyx_v_R2_Q3, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 908, __pyx_L1_error)
  14184. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14185. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 908, __pyx_L1_error)
  14186. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14187. if (__pyx_t_4) {
  14188. /* "fontTools/misc/bezierTools.py":910
  14189. * elif R2_Q3 <= epsilon * 0.5:
  14190. * # The epsilon * .5 above ensures that Q3 is not zero.
  14191. * theta = acos(max(min(R / sqrt(Q3), 1.0), -1.0)) # <<<<<<<<<<<<<<
  14192. * rQ2 = -2.0 * sqrt(Q)
  14193. * a1_3 = a1 / 3.0
  14194. */
  14195. __pyx_t_3 = NULL;
  14196. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_acos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 910, __pyx_L1_error)
  14197. __Pyx_GOTREF(__pyx_t_2);
  14198. __pyx_t_8 = -1.0;
  14199. __pyx_t_9 = 1.0;
  14200. __pyx_t_10 = NULL;
  14201. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_sqrt); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 910, __pyx_L1_error)
  14202. __Pyx_GOTREF(__pyx_t_11);
  14203. __pyx_t_5 = 1;
  14204. #if CYTHON_UNPACK_METHODS
  14205. if (unlikely(PyMethod_Check(__pyx_t_11))) {
  14206. __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
  14207. assert(__pyx_t_10);
  14208. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
  14209. __Pyx_INCREF(__pyx_t_10);
  14210. __Pyx_INCREF(__pyx__function);
  14211. __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
  14212. __pyx_t_5 = 0;
  14213. }
  14214. #endif
  14215. {
  14216. PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_Q3};
  14217. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14218. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  14219. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14220. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 910, __pyx_L1_error)
  14221. __Pyx_GOTREF(__pyx_t_6);
  14222. }
  14223. __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_v_R, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 910, __pyx_L1_error)
  14224. __Pyx_GOTREF(__pyx_t_11);
  14225. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14226. __pyx_t_10 = PyFloat_FromDouble(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 910, __pyx_L1_error)
  14227. __Pyx_GOTREF(__pyx_t_10);
  14228. __pyx_t_12 = PyObject_RichCompare(__pyx_t_10, __pyx_t_11, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 910, __pyx_L1_error)
  14229. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  14230. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 910, __pyx_L1_error)
  14231. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  14232. if (__pyx_t_4) {
  14233. __pyx_t_12 = PyFloat_FromDouble(__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 910, __pyx_L1_error)
  14234. __Pyx_GOTREF(__pyx_t_12);
  14235. __pyx_t_6 = __pyx_t_12;
  14236. __pyx_t_12 = 0;
  14237. } else {
  14238. __Pyx_INCREF(__pyx_t_11);
  14239. __pyx_t_6 = __pyx_t_11;
  14240. }
  14241. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14242. __Pyx_INCREF(__pyx_t_6);
  14243. __pyx_t_11 = __pyx_t_6;
  14244. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14245. __pyx_t_12 = PyFloat_FromDouble(__pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 910, __pyx_L1_error)
  14246. __Pyx_GOTREF(__pyx_t_12);
  14247. __pyx_t_10 = PyObject_RichCompare(__pyx_t_12, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 910, __pyx_L1_error)
  14248. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  14249. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 910, __pyx_L1_error)
  14250. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  14251. if (__pyx_t_4) {
  14252. __pyx_t_10 = PyFloat_FromDouble(__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 910, __pyx_L1_error)
  14253. __Pyx_GOTREF(__pyx_t_10);
  14254. __pyx_t_6 = __pyx_t_10;
  14255. __pyx_t_10 = 0;
  14256. } else {
  14257. __Pyx_INCREF(__pyx_t_11);
  14258. __pyx_t_6 = __pyx_t_11;
  14259. }
  14260. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14261. __pyx_t_5 = 1;
  14262. #if CYTHON_UNPACK_METHODS
  14263. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  14264. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  14265. assert(__pyx_t_3);
  14266. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  14267. __Pyx_INCREF(__pyx_t_3);
  14268. __Pyx_INCREF(__pyx__function);
  14269. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  14270. __pyx_t_5 = 0;
  14271. }
  14272. #endif
  14273. {
  14274. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
  14275. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14276. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14277. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14278. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14279. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 910, __pyx_L1_error)
  14280. __Pyx_GOTREF(__pyx_t_1);
  14281. }
  14282. __pyx_v_theta = __pyx_t_1;
  14283. __pyx_t_1 = 0;
  14284. /* "fontTools/misc/bezierTools.py":911
  14285. * # The epsilon * .5 above ensures that Q3 is not zero.
  14286. * theta = acos(max(min(R / sqrt(Q3), 1.0), -1.0))
  14287. * rQ2 = -2.0 * sqrt(Q) # <<<<<<<<<<<<<<
  14288. * a1_3 = a1 / 3.0
  14289. * x0 = rQ2 * cos(theta / 3.0) - a1_3
  14290. */
  14291. __pyx_t_2 = NULL;
  14292. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_sqrt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 911, __pyx_L1_error)
  14293. __Pyx_GOTREF(__pyx_t_6);
  14294. __pyx_t_5 = 1;
  14295. #if CYTHON_UNPACK_METHODS
  14296. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  14297. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
  14298. assert(__pyx_t_2);
  14299. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  14300. __Pyx_INCREF(__pyx_t_2);
  14301. __Pyx_INCREF(__pyx__function);
  14302. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  14303. __pyx_t_5 = 0;
  14304. }
  14305. #endif
  14306. {
  14307. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_Q};
  14308. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14309. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  14310. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14311. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
  14312. __Pyx_GOTREF(__pyx_t_1);
  14313. }
  14314. __pyx_t_6 = PyNumber_Multiply(__pyx_mstate_global->__pyx_float_neg_2_0, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 911, __pyx_L1_error)
  14315. __Pyx_GOTREF(__pyx_t_6);
  14316. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14317. __pyx_v_rQ2 = __pyx_t_6;
  14318. __pyx_t_6 = 0;
  14319. /* "fontTools/misc/bezierTools.py":912
  14320. * theta = acos(max(min(R / sqrt(Q3), 1.0), -1.0))
  14321. * rQ2 = -2.0 * sqrt(Q)
  14322. * a1_3 = a1 / 3.0 # <<<<<<<<<<<<<<
  14323. * x0 = rQ2 * cos(theta / 3.0) - a1_3
  14324. * x1 = rQ2 * cos((theta + 2.0 * pi) / 3.0) - a1_3
  14325. */
  14326. __pyx_t_6 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_a1, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 912, __pyx_L1_error)
  14327. __Pyx_GOTREF(__pyx_t_6);
  14328. __pyx_v_a1_3 = __pyx_t_6;
  14329. __pyx_t_6 = 0;
  14330. /* "fontTools/misc/bezierTools.py":913
  14331. * rQ2 = -2.0 * sqrt(Q)
  14332. * a1_3 = a1 / 3.0
  14333. * x0 = rQ2 * cos(theta / 3.0) - a1_3 # <<<<<<<<<<<<<<
  14334. * x1 = rQ2 * cos((theta + 2.0 * pi) / 3.0) - a1_3
  14335. * x2 = rQ2 * cos((theta + 4.0 * pi) / 3.0) - a1_3
  14336. */
  14337. __pyx_t_1 = NULL;
  14338. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error)
  14339. __Pyx_GOTREF(__pyx_t_2);
  14340. __pyx_t_3 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_theta, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error)
  14341. __Pyx_GOTREF(__pyx_t_3);
  14342. __pyx_t_5 = 1;
  14343. #if CYTHON_UNPACK_METHODS
  14344. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  14345. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  14346. assert(__pyx_t_1);
  14347. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  14348. __Pyx_INCREF(__pyx_t_1);
  14349. __Pyx_INCREF(__pyx__function);
  14350. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  14351. __pyx_t_5 = 0;
  14352. }
  14353. #endif
  14354. {
  14355. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_3};
  14356. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14357. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  14358. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14359. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14360. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 913, __pyx_L1_error)
  14361. __Pyx_GOTREF(__pyx_t_6);
  14362. }
  14363. __pyx_t_2 = PyNumber_Multiply(__pyx_v_rQ2, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error)
  14364. __Pyx_GOTREF(__pyx_t_2);
  14365. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14366. __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_v_a1_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 913, __pyx_L1_error)
  14367. __Pyx_GOTREF(__pyx_t_6);
  14368. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14369. __pyx_v_x0 = __pyx_t_6;
  14370. __pyx_t_6 = 0;
  14371. /* "fontTools/misc/bezierTools.py":914
  14372. * a1_3 = a1 / 3.0
  14373. * x0 = rQ2 * cos(theta / 3.0) - a1_3
  14374. * x1 = rQ2 * cos((theta + 2.0 * pi) / 3.0) - a1_3 # <<<<<<<<<<<<<<
  14375. * x2 = rQ2 * cos((theta + 4.0 * pi) / 3.0) - a1_3
  14376. * x0, x1, x2 = sorted([x0, x1, x2])
  14377. */
  14378. __pyx_t_2 = NULL;
  14379. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 914, __pyx_L1_error)
  14380. __Pyx_GOTREF(__pyx_t_3);
  14381. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 914, __pyx_L1_error)
  14382. __Pyx_GOTREF(__pyx_t_1);
  14383. __pyx_t_11 = PyNumber_Multiply(__pyx_mstate_global->__pyx_float_2_0, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 914, __pyx_L1_error)
  14384. __Pyx_GOTREF(__pyx_t_11);
  14385. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14386. __pyx_t_1 = PyNumber_Add(__pyx_v_theta, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 914, __pyx_L1_error)
  14387. __Pyx_GOTREF(__pyx_t_1);
  14388. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14389. __pyx_t_11 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 914, __pyx_L1_error)
  14390. __Pyx_GOTREF(__pyx_t_11);
  14391. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14392. __pyx_t_5 = 1;
  14393. #if CYTHON_UNPACK_METHODS
  14394. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  14395. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  14396. assert(__pyx_t_2);
  14397. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  14398. __Pyx_INCREF(__pyx_t_2);
  14399. __Pyx_INCREF(__pyx__function);
  14400. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  14401. __pyx_t_5 = 0;
  14402. }
  14403. #endif
  14404. {
  14405. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_11};
  14406. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14407. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  14408. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14409. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14410. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 914, __pyx_L1_error)
  14411. __Pyx_GOTREF(__pyx_t_6);
  14412. }
  14413. __pyx_t_3 = PyNumber_Multiply(__pyx_v_rQ2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 914, __pyx_L1_error)
  14414. __Pyx_GOTREF(__pyx_t_3);
  14415. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14416. __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_v_a1_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 914, __pyx_L1_error)
  14417. __Pyx_GOTREF(__pyx_t_6);
  14418. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14419. __pyx_v_x1 = __pyx_t_6;
  14420. __pyx_t_6 = 0;
  14421. /* "fontTools/misc/bezierTools.py":915
  14422. * x0 = rQ2 * cos(theta / 3.0) - a1_3
  14423. * x1 = rQ2 * cos((theta + 2.0 * pi) / 3.0) - a1_3
  14424. * x2 = rQ2 * cos((theta + 4.0 * pi) / 3.0) - a1_3 # <<<<<<<<<<<<<<
  14425. * x0, x1, x2 = sorted([x0, x1, x2])
  14426. * # Merge roots that are close-enough
  14427. */
  14428. __pyx_t_3 = NULL;
  14429. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_cos); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 915, __pyx_L1_error)
  14430. __Pyx_GOTREF(__pyx_t_11);
  14431. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pi); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
  14432. __Pyx_GOTREF(__pyx_t_2);
  14433. __pyx_t_1 = PyNumber_Multiply(__pyx_mstate_global->__pyx_float_4_0, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error)
  14434. __Pyx_GOTREF(__pyx_t_1);
  14435. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14436. __pyx_t_2 = PyNumber_Add(__pyx_v_theta, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
  14437. __Pyx_GOTREF(__pyx_t_2);
  14438. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14439. __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_2, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error)
  14440. __Pyx_GOTREF(__pyx_t_1);
  14441. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14442. __pyx_t_5 = 1;
  14443. #if CYTHON_UNPACK_METHODS
  14444. if (unlikely(PyMethod_Check(__pyx_t_11))) {
  14445. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
  14446. assert(__pyx_t_3);
  14447. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
  14448. __Pyx_INCREF(__pyx_t_3);
  14449. __Pyx_INCREF(__pyx__function);
  14450. __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
  14451. __pyx_t_5 = 0;
  14452. }
  14453. #endif
  14454. {
  14455. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_1};
  14456. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14457. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14458. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14459. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14460. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 915, __pyx_L1_error)
  14461. __Pyx_GOTREF(__pyx_t_6);
  14462. }
  14463. __pyx_t_11 = PyNumber_Multiply(__pyx_v_rQ2, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 915, __pyx_L1_error)
  14464. __Pyx_GOTREF(__pyx_t_11);
  14465. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14466. __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_v_a1_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 915, __pyx_L1_error)
  14467. __Pyx_GOTREF(__pyx_t_6);
  14468. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14469. __pyx_v_x2 = __pyx_t_6;
  14470. __pyx_t_6 = 0;
  14471. /* "fontTools/misc/bezierTools.py":916
  14472. * x1 = rQ2 * cos((theta + 2.0 * pi) / 3.0) - a1_3
  14473. * x2 = rQ2 * cos((theta + 4.0 * pi) / 3.0) - a1_3
  14474. * x0, x1, x2 = sorted([x0, x1, x2]) # <<<<<<<<<<<<<<
  14475. * # Merge roots that are close-enough
  14476. * if x1 - x0 < epsilon and x2 - x1 < epsilon:
  14477. */
  14478. __pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 916, __pyx_L1_error)
  14479. __Pyx_GOTREF(__pyx_t_6);
  14480. __Pyx_INCREF(__pyx_v_x0);
  14481. __Pyx_GIVEREF(__pyx_v_x0);
  14482. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_x0) != (0)) __PYX_ERR(0, 916, __pyx_L1_error);
  14483. __Pyx_INCREF(__pyx_v_x1);
  14484. __Pyx_GIVEREF(__pyx_v_x1);
  14485. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 1, __pyx_v_x1) != (0)) __PYX_ERR(0, 916, __pyx_L1_error);
  14486. __Pyx_INCREF(__pyx_v_x2);
  14487. __Pyx_GIVEREF(__pyx_v_x2);
  14488. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 2, __pyx_v_x2) != (0)) __PYX_ERR(0, 916, __pyx_L1_error);
  14489. if (unlikely((PyList_Sort(__pyx_t_6) < 0))) __PYX_ERR(0, 916, __pyx_L1_error)
  14490. if (1) {
  14491. PyObject* sequence = __pyx_t_6;
  14492. Py_ssize_t size = __Pyx_PyList_GET_SIZE(sequence);
  14493. if (unlikely(size != 3)) {
  14494. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  14495. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  14496. __PYX_ERR(0, 916, __pyx_L1_error)
  14497. }
  14498. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  14499. __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  14500. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 916, __pyx_L1_error)
  14501. __Pyx_XGOTREF(__pyx_t_11);
  14502. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  14503. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error)
  14504. __Pyx_XGOTREF(__pyx_t_1);
  14505. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  14506. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 916, __pyx_L1_error)
  14507. __Pyx_XGOTREF(__pyx_t_3);
  14508. #else
  14509. __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 916, __pyx_L1_error)
  14510. __Pyx_GOTREF(__pyx_t_11);
  14511. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error)
  14512. __Pyx_GOTREF(__pyx_t_1);
  14513. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 916, __pyx_L1_error)
  14514. __Pyx_GOTREF(__pyx_t_3);
  14515. #endif
  14516. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14517. }
  14518. __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_11);
  14519. __pyx_t_11 = 0;
  14520. __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_1);
  14521. __pyx_t_1 = 0;
  14522. __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_3);
  14523. __pyx_t_3 = 0;
  14524. /* "fontTools/misc/bezierTools.py":918
  14525. * x0, x1, x2 = sorted([x0, x1, x2])
  14526. * # Merge roots that are close-enough
  14527. * if x1 - x0 < epsilon and x2 - x1 < epsilon: # <<<<<<<<<<<<<<
  14528. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits)
  14529. * elif x1 - x0 < epsilon:
  14530. */
  14531. __pyx_t_6 = PyNumber_Subtract(__pyx_v_x1, __pyx_v_x0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 918, __pyx_L1_error)
  14532. __Pyx_GOTREF(__pyx_t_6);
  14533. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error)
  14534. __Pyx_GOTREF(__pyx_t_3);
  14535. __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
  14536. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14537. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14538. __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 918, __pyx_L1_error)
  14539. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14540. if (__pyx_t_7) {
  14541. } else {
  14542. __pyx_t_4 = __pyx_t_7;
  14543. goto __pyx_L8_bool_binop_done;
  14544. }
  14545. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x2, __pyx_v_x1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
  14546. __Pyx_GOTREF(__pyx_t_1);
  14547. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error)
  14548. __Pyx_GOTREF(__pyx_t_3);
  14549. __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 918, __pyx_L1_error)
  14550. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14551. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14552. __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 918, __pyx_L1_error)
  14553. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14554. __pyx_t_4 = __pyx_t_7;
  14555. __pyx_L8_bool_binop_done:;
  14556. if (__pyx_t_4) {
  14557. /* "fontTools/misc/bezierTools.py":919
  14558. * # Merge roots that are close-enough
  14559. * if x1 - x0 < epsilon and x2 - x1 < epsilon:
  14560. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits) # <<<<<<<<<<<<<<
  14561. * elif x1 - x0 < epsilon:
  14562. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14563. */
  14564. __pyx_t_3 = NULL;
  14565. __pyx_t_1 = PyNumber_Add(__pyx_v_x0, __pyx_v_x1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
  14566. __Pyx_GOTREF(__pyx_t_1);
  14567. __pyx_t_11 = PyNumber_Add(__pyx_t_1, __pyx_v_x2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 919, __pyx_L1_error)
  14568. __Pyx_GOTREF(__pyx_t_11);
  14569. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14570. __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_11, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
  14571. __Pyx_GOTREF(__pyx_t_1);
  14572. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14573. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 919, __pyx_L1_error)
  14574. __Pyx_GOTREF(__pyx_t_11);
  14575. __pyx_t_5 = 1;
  14576. {
  14577. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_1, __pyx_t_11};
  14578. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14579. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14580. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14581. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14582. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 919, __pyx_L1_error)
  14583. __Pyx_GOTREF(__pyx_t_6);
  14584. }
  14585. __Pyx_INCREF(__pyx_t_6);
  14586. __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_6);
  14587. __Pyx_INCREF(__pyx_t_6);
  14588. __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_6);
  14589. __Pyx_INCREF(__pyx_t_6);
  14590. __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_6);
  14591. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14592. /* "fontTools/misc/bezierTools.py":918
  14593. * x0, x1, x2 = sorted([x0, x1, x2])
  14594. * # Merge roots that are close-enough
  14595. * if x1 - x0 < epsilon and x2 - x1 < epsilon: # <<<<<<<<<<<<<<
  14596. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits)
  14597. * elif x1 - x0 < epsilon:
  14598. */
  14599. goto __pyx_L7;
  14600. }
  14601. /* "fontTools/misc/bezierTools.py":920
  14602. * if x1 - x0 < epsilon and x2 - x1 < epsilon:
  14603. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits)
  14604. * elif x1 - x0 < epsilon: # <<<<<<<<<<<<<<
  14605. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14606. * x2 = round(x2, epsilonDigits)
  14607. */
  14608. __pyx_t_6 = PyNumber_Subtract(__pyx_v_x1, __pyx_v_x0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 920, __pyx_L1_error)
  14609. __Pyx_GOTREF(__pyx_t_6);
  14610. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 920, __pyx_L1_error)
  14611. __Pyx_GOTREF(__pyx_t_11);
  14612. __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
  14613. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14614. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14615. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 920, __pyx_L1_error)
  14616. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14617. if (__pyx_t_4) {
  14618. /* "fontTools/misc/bezierTools.py":921
  14619. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits)
  14620. * elif x1 - x0 < epsilon:
  14621. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits) # <<<<<<<<<<<<<<
  14622. * x2 = round(x2, epsilonDigits)
  14623. * elif x2 - x1 < epsilon:
  14624. */
  14625. __pyx_t_11 = NULL;
  14626. __pyx_t_6 = PyNumber_Add(__pyx_v_x0, __pyx_v_x1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 921, __pyx_L1_error)
  14627. __Pyx_GOTREF(__pyx_t_6);
  14628. __pyx_t_3 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_6, __pyx_mstate_global->__pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 921, __pyx_L1_error)
  14629. __Pyx_GOTREF(__pyx_t_3);
  14630. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14631. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 921, __pyx_L1_error)
  14632. __Pyx_GOTREF(__pyx_t_6);
  14633. __pyx_t_5 = 1;
  14634. {
  14635. PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_t_3, __pyx_t_6};
  14636. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14637. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  14638. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14639. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14640. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error)
  14641. __Pyx_GOTREF(__pyx_t_1);
  14642. }
  14643. __Pyx_INCREF(__pyx_t_1);
  14644. __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_1);
  14645. __Pyx_INCREF(__pyx_t_1);
  14646. __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_1);
  14647. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14648. /* "fontTools/misc/bezierTools.py":922
  14649. * elif x1 - x0 < epsilon:
  14650. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14651. * x2 = round(x2, epsilonDigits) # <<<<<<<<<<<<<<
  14652. * elif x2 - x1 < epsilon:
  14653. * x0 = round(x0, epsilonDigits)
  14654. */
  14655. __pyx_t_6 = NULL;
  14656. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 922, __pyx_L1_error)
  14657. __Pyx_GOTREF(__pyx_t_3);
  14658. __pyx_t_5 = 1;
  14659. {
  14660. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_x2, __pyx_t_3};
  14661. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14662. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  14663. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14664. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error)
  14665. __Pyx_GOTREF(__pyx_t_1);
  14666. }
  14667. __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_1);
  14668. __pyx_t_1 = 0;
  14669. /* "fontTools/misc/bezierTools.py":920
  14670. * if x1 - x0 < epsilon and x2 - x1 < epsilon:
  14671. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits)
  14672. * elif x1 - x0 < epsilon: # <<<<<<<<<<<<<<
  14673. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14674. * x2 = round(x2, epsilonDigits)
  14675. */
  14676. goto __pyx_L7;
  14677. }
  14678. /* "fontTools/misc/bezierTools.py":923
  14679. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14680. * x2 = round(x2, epsilonDigits)
  14681. * elif x2 - x1 < epsilon: # <<<<<<<<<<<<<<
  14682. * x0 = round(x0, epsilonDigits)
  14683. * x1 = x2 = round((x1 + x2) / 2.0, epsilonDigits)
  14684. */
  14685. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x2, __pyx_v_x1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 923, __pyx_L1_error)
  14686. __Pyx_GOTREF(__pyx_t_1);
  14687. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
  14688. __Pyx_GOTREF(__pyx_t_3);
  14689. __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 923, __pyx_L1_error)
  14690. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14691. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14692. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 923, __pyx_L1_error)
  14693. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14694. if (__pyx_t_4) {
  14695. /* "fontTools/misc/bezierTools.py":924
  14696. * x2 = round(x2, epsilonDigits)
  14697. * elif x2 - x1 < epsilon:
  14698. * x0 = round(x0, epsilonDigits) # <<<<<<<<<<<<<<
  14699. * x1 = x2 = round((x1 + x2) / 2.0, epsilonDigits)
  14700. * else:
  14701. */
  14702. __pyx_t_3 = NULL;
  14703. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
  14704. __Pyx_GOTREF(__pyx_t_1);
  14705. __pyx_t_5 = 1;
  14706. {
  14707. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_x0, __pyx_t_1};
  14708. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14709. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14710. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14711. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 924, __pyx_L1_error)
  14712. __Pyx_GOTREF(__pyx_t_6);
  14713. }
  14714. __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_6);
  14715. __pyx_t_6 = 0;
  14716. /* "fontTools/misc/bezierTools.py":925
  14717. * elif x2 - x1 < epsilon:
  14718. * x0 = round(x0, epsilonDigits)
  14719. * x1 = x2 = round((x1 + x2) / 2.0, epsilonDigits) # <<<<<<<<<<<<<<
  14720. * else:
  14721. * x0 = round(x0, epsilonDigits)
  14722. */
  14723. __pyx_t_1 = NULL;
  14724. __pyx_t_3 = PyNumber_Add(__pyx_v_x1, __pyx_v_x2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error)
  14725. __Pyx_GOTREF(__pyx_t_3);
  14726. __pyx_t_11 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_3, __pyx_mstate_global->__pyx_float_2_0, 2.0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 925, __pyx_L1_error)
  14727. __Pyx_GOTREF(__pyx_t_11);
  14728. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14729. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error)
  14730. __Pyx_GOTREF(__pyx_t_3);
  14731. __pyx_t_5 = 1;
  14732. {
  14733. PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_11, __pyx_t_3};
  14734. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14735. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  14736. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14737. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14738. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 925, __pyx_L1_error)
  14739. __Pyx_GOTREF(__pyx_t_6);
  14740. }
  14741. __Pyx_INCREF(__pyx_t_6);
  14742. __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_6);
  14743. __Pyx_INCREF(__pyx_t_6);
  14744. __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_6);
  14745. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14746. /* "fontTools/misc/bezierTools.py":923
  14747. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14748. * x2 = round(x2, epsilonDigits)
  14749. * elif x2 - x1 < epsilon: # <<<<<<<<<<<<<<
  14750. * x0 = round(x0, epsilonDigits)
  14751. * x1 = x2 = round((x1 + x2) / 2.0, epsilonDigits)
  14752. */
  14753. goto __pyx_L7;
  14754. }
  14755. /* "fontTools/misc/bezierTools.py":927
  14756. * x1 = x2 = round((x1 + x2) / 2.0, epsilonDigits)
  14757. * else:
  14758. * x0 = round(x0, epsilonDigits) # <<<<<<<<<<<<<<
  14759. * x1 = round(x1, epsilonDigits)
  14760. * x2 = round(x2, epsilonDigits)
  14761. */
  14762. /*else*/ {
  14763. __pyx_t_3 = NULL;
  14764. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 927, __pyx_L1_error)
  14765. __Pyx_GOTREF(__pyx_t_11);
  14766. __pyx_t_5 = 1;
  14767. {
  14768. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_x0, __pyx_t_11};
  14769. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14770. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14771. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14772. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 927, __pyx_L1_error)
  14773. __Pyx_GOTREF(__pyx_t_6);
  14774. }
  14775. __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_6);
  14776. __pyx_t_6 = 0;
  14777. /* "fontTools/misc/bezierTools.py":928
  14778. * else:
  14779. * x0 = round(x0, epsilonDigits)
  14780. * x1 = round(x1, epsilonDigits) # <<<<<<<<<<<<<<
  14781. * x2 = round(x2, epsilonDigits)
  14782. * return [x0, x1, x2]
  14783. */
  14784. __pyx_t_11 = NULL;
  14785. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 928, __pyx_L1_error)
  14786. __Pyx_GOTREF(__pyx_t_3);
  14787. __pyx_t_5 = 1;
  14788. {
  14789. PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_v_x1, __pyx_t_3};
  14790. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14791. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  14792. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14793. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 928, __pyx_L1_error)
  14794. __Pyx_GOTREF(__pyx_t_6);
  14795. }
  14796. __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_6);
  14797. __pyx_t_6 = 0;
  14798. /* "fontTools/misc/bezierTools.py":929
  14799. * x0 = round(x0, epsilonDigits)
  14800. * x1 = round(x1, epsilonDigits)
  14801. * x2 = round(x2, epsilonDigits) # <<<<<<<<<<<<<<
  14802. * return [x0, x1, x2]
  14803. * else:
  14804. */
  14805. __pyx_t_3 = NULL;
  14806. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 929, __pyx_L1_error)
  14807. __Pyx_GOTREF(__pyx_t_11);
  14808. __pyx_t_5 = 1;
  14809. {
  14810. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_x2, __pyx_t_11};
  14811. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14812. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14813. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14814. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 929, __pyx_L1_error)
  14815. __Pyx_GOTREF(__pyx_t_6);
  14816. }
  14817. __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_6);
  14818. __pyx_t_6 = 0;
  14819. }
  14820. __pyx_L7:;
  14821. /* "fontTools/misc/bezierTools.py":930
  14822. * x1 = round(x1, epsilonDigits)
  14823. * x2 = round(x2, epsilonDigits)
  14824. * return [x0, x1, x2] # <<<<<<<<<<<<<<
  14825. * else:
  14826. * x = pow(sqrt(R2_Q3) + abs(R), 1 / 3.0)
  14827. */
  14828. __Pyx_XDECREF(__pyx_r);
  14829. __pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 930, __pyx_L1_error)
  14830. __Pyx_GOTREF(__pyx_t_6);
  14831. __Pyx_INCREF(__pyx_v_x0);
  14832. __Pyx_GIVEREF(__pyx_v_x0);
  14833. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_x0) != (0)) __PYX_ERR(0, 930, __pyx_L1_error);
  14834. __Pyx_INCREF(__pyx_v_x1);
  14835. __Pyx_GIVEREF(__pyx_v_x1);
  14836. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 1, __pyx_v_x1) != (0)) __PYX_ERR(0, 930, __pyx_L1_error);
  14837. __Pyx_INCREF(__pyx_v_x2);
  14838. __Pyx_GIVEREF(__pyx_v_x2);
  14839. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 2, __pyx_v_x2) != (0)) __PYX_ERR(0, 930, __pyx_L1_error);
  14840. __pyx_r = __pyx_t_6;
  14841. __pyx_t_6 = 0;
  14842. goto __pyx_L0;
  14843. /* "fontTools/misc/bezierTools.py":908
  14844. * x = round(-a1 / 3.0, epsilonDigits)
  14845. * return [x, x, x]
  14846. * elif R2_Q3 <= epsilon * 0.5: # <<<<<<<<<<<<<<
  14847. * # The epsilon * .5 above ensures that Q3 is not zero.
  14848. * theta = acos(max(min(R / sqrt(Q3), 1.0), -1.0))
  14849. */
  14850. }
  14851. /* "fontTools/misc/bezierTools.py":932
  14852. * return [x0, x1, x2]
  14853. * else:
  14854. * x = pow(sqrt(R2_Q3) + abs(R), 1 / 3.0) # <<<<<<<<<<<<<<
  14855. * x = x + Q / x
  14856. * if R >= 0.0:
  14857. */
  14858. /*else*/ {
  14859. __pyx_t_11 = NULL;
  14860. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sqrt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error)
  14861. __Pyx_GOTREF(__pyx_t_3);
  14862. __pyx_t_5 = 1;
  14863. #if CYTHON_UNPACK_METHODS
  14864. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  14865. __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
  14866. assert(__pyx_t_11);
  14867. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  14868. __Pyx_INCREF(__pyx_t_11);
  14869. __Pyx_INCREF(__pyx__function);
  14870. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  14871. __pyx_t_5 = 0;
  14872. }
  14873. #endif
  14874. {
  14875. PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_R2_Q3};
  14876. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14877. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  14878. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14879. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 932, __pyx_L1_error)
  14880. __Pyx_GOTREF(__pyx_t_6);
  14881. }
  14882. __pyx_t_3 = __Pyx_PyNumber_Absolute(__pyx_v_R); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error)
  14883. __Pyx_GOTREF(__pyx_t_3);
  14884. __pyx_t_11 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 932, __pyx_L1_error)
  14885. __Pyx_GOTREF(__pyx_t_11);
  14886. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14887. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14888. __pyx_t_3 = PyFloat_FromDouble((1.0 / 3.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error)
  14889. __Pyx_GOTREF(__pyx_t_3);
  14890. __pyx_t_6 = __Pyx_PyNumber_Power2(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 932, __pyx_L1_error)
  14891. __Pyx_GOTREF(__pyx_t_6);
  14892. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14893. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14894. __pyx_v_x = __pyx_t_6;
  14895. __pyx_t_6 = 0;
  14896. /* "fontTools/misc/bezierTools.py":933
  14897. * else:
  14898. * x = pow(sqrt(R2_Q3) + abs(R), 1 / 3.0)
  14899. * x = x + Q / x # <<<<<<<<<<<<<<
  14900. * if R >= 0.0:
  14901. * x = -x
  14902. */
  14903. __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_Q, __pyx_v_x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 933, __pyx_L1_error)
  14904. __Pyx_GOTREF(__pyx_t_6);
  14905. __pyx_t_3 = PyNumber_Add(__pyx_v_x, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 933, __pyx_L1_error)
  14906. __Pyx_GOTREF(__pyx_t_3);
  14907. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14908. __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
  14909. __pyx_t_3 = 0;
  14910. /* "fontTools/misc/bezierTools.py":934
  14911. * x = pow(sqrt(R2_Q3) + abs(R), 1 / 3.0)
  14912. * x = x + Q / x
  14913. * if R >= 0.0: # <<<<<<<<<<<<<<
  14914. * x = -x
  14915. * x = round(x - a1 / 3.0, epsilonDigits)
  14916. */
  14917. __pyx_t_3 = PyObject_RichCompare(__pyx_v_R, __pyx_mstate_global->__pyx_float_0_0, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 934, __pyx_L1_error)
  14918. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 934, __pyx_L1_error)
  14919. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14920. if (__pyx_t_4) {
  14921. /* "fontTools/misc/bezierTools.py":935
  14922. * x = x + Q / x
  14923. * if R >= 0.0:
  14924. * x = -x # <<<<<<<<<<<<<<
  14925. * x = round(x - a1 / 3.0, epsilonDigits)
  14926. * return [x]
  14927. */
  14928. __pyx_t_3 = PyNumber_Negative(__pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 935, __pyx_L1_error)
  14929. __Pyx_GOTREF(__pyx_t_3);
  14930. __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
  14931. __pyx_t_3 = 0;
  14932. /* "fontTools/misc/bezierTools.py":934
  14933. * x = pow(sqrt(R2_Q3) + abs(R), 1 / 3.0)
  14934. * x = x + Q / x
  14935. * if R >= 0.0: # <<<<<<<<<<<<<<
  14936. * x = -x
  14937. * x = round(x - a1 / 3.0, epsilonDigits)
  14938. */
  14939. }
  14940. /* "fontTools/misc/bezierTools.py":936
  14941. * if R >= 0.0:
  14942. * x = -x
  14943. * x = round(x - a1 / 3.0, epsilonDigits) # <<<<<<<<<<<<<<
  14944. * return [x]
  14945. *
  14946. */
  14947. __pyx_t_6 = NULL;
  14948. __pyx_t_11 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_a1, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 936, __pyx_L1_error)
  14949. __Pyx_GOTREF(__pyx_t_11);
  14950. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 936, __pyx_L1_error)
  14951. __Pyx_GOTREF(__pyx_t_1);
  14952. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14953. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 936, __pyx_L1_error)
  14954. __Pyx_GOTREF(__pyx_t_11);
  14955. __pyx_t_5 = 1;
  14956. {
  14957. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_t_11};
  14958. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_round, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  14959. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  14960. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14961. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14962. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 936, __pyx_L1_error)
  14963. __Pyx_GOTREF(__pyx_t_3);
  14964. }
  14965. __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
  14966. __pyx_t_3 = 0;
  14967. /* "fontTools/misc/bezierTools.py":937
  14968. * x = -x
  14969. * x = round(x - a1 / 3.0, epsilonDigits)
  14970. * return [x] # <<<<<<<<<<<<<<
  14971. *
  14972. *
  14973. */
  14974. __Pyx_XDECREF(__pyx_r);
  14975. __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 937, __pyx_L1_error)
  14976. __Pyx_GOTREF(__pyx_t_3);
  14977. __Pyx_INCREF(__pyx_v_x);
  14978. __Pyx_GIVEREF(__pyx_v_x);
  14979. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 937, __pyx_L1_error);
  14980. __pyx_r = __pyx_t_3;
  14981. __pyx_t_3 = 0;
  14982. goto __pyx_L0;
  14983. }
  14984. /* "fontTools/misc/bezierTools.py":848
  14985. *
  14986. *
  14987. * def solveCubic(a, b, c, d): # <<<<<<<<<<<<<<
  14988. * """Solve a cubic equation.
  14989. *
  14990. */
  14991. /* function exit code */
  14992. __pyx_L1_error:;
  14993. __Pyx_XDECREF(__pyx_t_1);
  14994. __Pyx_XDECREF(__pyx_t_2);
  14995. __Pyx_XDECREF(__pyx_t_3);
  14996. __Pyx_XDECREF(__pyx_t_6);
  14997. __Pyx_XDECREF(__pyx_t_10);
  14998. __Pyx_XDECREF(__pyx_t_11);
  14999. __Pyx_XDECREF(__pyx_t_12);
  15000. __Pyx_AddTraceback("fontTools.misc.bezierTools.solveCubic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15001. __pyx_r = NULL;
  15002. __pyx_L0:;
  15003. __Pyx_XDECREF(__pyx_v_a1);
  15004. __Pyx_XDECREF(__pyx_v_a2);
  15005. __Pyx_XDECREF(__pyx_v_a3);
  15006. __Pyx_XDECREF(__pyx_v_Q);
  15007. __Pyx_XDECREF(__pyx_v_R);
  15008. __Pyx_XDECREF(__pyx_v_R2);
  15009. __Pyx_XDECREF(__pyx_v_Q3);
  15010. __Pyx_XDECREF(__pyx_v_R2_Q3);
  15011. __Pyx_XDECREF(__pyx_v_x);
  15012. __Pyx_XDECREF(__pyx_v_theta);
  15013. __Pyx_XDECREF(__pyx_v_rQ2);
  15014. __Pyx_XDECREF(__pyx_v_a1_3);
  15015. __Pyx_XDECREF(__pyx_v_x0);
  15016. __Pyx_XDECREF(__pyx_v_x1);
  15017. __Pyx_XDECREF(__pyx_v_x2);
  15018. __Pyx_XDECREF(__pyx_v_a);
  15019. __Pyx_XGIVEREF(__pyx_r);
  15020. __Pyx_RefNannyFinishContext();
  15021. return __pyx_r;
  15022. }
  15023. /* "fontTools/misc/bezierTools.py":945
  15024. *
  15025. *
  15026. * def calcQuadraticParameters(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  15027. * x2, y2 = pt2
  15028. * x3, y3 = pt3
  15029. */
  15030. /* Python wrapper */
  15031. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_51calcQuadraticParameters(PyObject *__pyx_self,
  15032. #if CYTHON_METH_FASTCALL
  15033. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  15034. #else
  15035. PyObject *__pyx_args, PyObject *__pyx_kwds
  15036. #endif
  15037. ); /*proto*/
  15038. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_50calcQuadraticParameters, "calcQuadraticParameters(pt1, pt2, pt3)");
  15039. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_51calcQuadraticParameters = {"calcQuadraticParameters", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_51calcQuadraticParameters, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_50calcQuadraticParameters};
  15040. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_51calcQuadraticParameters(PyObject *__pyx_self,
  15041. #if CYTHON_METH_FASTCALL
  15042. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  15043. #else
  15044. PyObject *__pyx_args, PyObject *__pyx_kwds
  15045. #endif
  15046. ) {
  15047. PyObject *__pyx_v_pt1 = 0;
  15048. PyObject *__pyx_v_pt2 = 0;
  15049. PyObject *__pyx_v_pt3 = 0;
  15050. #if !CYTHON_METH_FASTCALL
  15051. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  15052. #endif
  15053. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  15054. PyObject* values[3] = {0,0,0};
  15055. int __pyx_lineno = 0;
  15056. const char *__pyx_filename = NULL;
  15057. int __pyx_clineno = 0;
  15058. PyObject *__pyx_r = 0;
  15059. __Pyx_RefNannyDeclarations
  15060. __Pyx_RefNannySetupContext("calcQuadraticParameters (wrapper)", 0);
  15061. #if !CYTHON_METH_FASTCALL
  15062. #if CYTHON_ASSUME_SAFE_SIZE
  15063. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  15064. #else
  15065. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  15066. #endif
  15067. #endif
  15068. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  15069. {
  15070. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,0};
  15071. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  15072. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 945, __pyx_L3_error)
  15073. if (__pyx_kwds_len > 0) {
  15074. switch (__pyx_nargs) {
  15075. case 3:
  15076. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  15077. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 945, __pyx_L3_error)
  15078. CYTHON_FALLTHROUGH;
  15079. case 2:
  15080. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  15081. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 945, __pyx_L3_error)
  15082. CYTHON_FALLTHROUGH;
  15083. case 1:
  15084. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  15085. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 945, __pyx_L3_error)
  15086. CYTHON_FALLTHROUGH;
  15087. case 0: break;
  15088. default: goto __pyx_L5_argtuple_error;
  15089. }
  15090. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  15091. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "calcQuadraticParameters", 0) < (0)) __PYX_ERR(0, 945, __pyx_L3_error)
  15092. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  15093. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcQuadraticParameters", 1, 3, 3, i); __PYX_ERR(0, 945, __pyx_L3_error) }
  15094. }
  15095. } else if (unlikely(__pyx_nargs != 3)) {
  15096. goto __pyx_L5_argtuple_error;
  15097. } else {
  15098. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  15099. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 945, __pyx_L3_error)
  15100. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  15101. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 945, __pyx_L3_error)
  15102. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  15103. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 945, __pyx_L3_error)
  15104. }
  15105. __pyx_v_pt1 = values[0];
  15106. __pyx_v_pt2 = values[1];
  15107. __pyx_v_pt3 = values[2];
  15108. }
  15109. goto __pyx_L6_skip;
  15110. __pyx_L5_argtuple_error:;
  15111. __Pyx_RaiseArgtupleInvalid("calcQuadraticParameters", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 945, __pyx_L3_error)
  15112. __pyx_L6_skip:;
  15113. goto __pyx_L4_argument_unpacking_done;
  15114. __pyx_L3_error:;
  15115. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  15116. Py_XDECREF(values[__pyx_temp]);
  15117. }
  15118. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticParameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15119. __Pyx_RefNannyFinishContext();
  15120. return NULL;
  15121. __pyx_L4_argument_unpacking_done:;
  15122. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_50calcQuadraticParameters(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  15123. /* function exit code */
  15124. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  15125. Py_XDECREF(values[__pyx_temp]);
  15126. }
  15127. __Pyx_RefNannyFinishContext();
  15128. return __pyx_r;
  15129. }
  15130. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_50calcQuadraticParameters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3) {
  15131. PyObject *__pyx_v_x2 = NULL;
  15132. PyObject *__pyx_v_y2 = NULL;
  15133. PyObject *__pyx_v_x3 = NULL;
  15134. PyObject *__pyx_v_y3 = NULL;
  15135. PyObject *__pyx_v_cx = NULL;
  15136. PyObject *__pyx_v_cy = NULL;
  15137. PyObject *__pyx_v_bx = NULL;
  15138. PyObject *__pyx_v_by = NULL;
  15139. PyObject *__pyx_v_ax = NULL;
  15140. PyObject *__pyx_v_ay = NULL;
  15141. PyObject *__pyx_r = NULL;
  15142. __Pyx_RefNannyDeclarations
  15143. PyObject *__pyx_t_1 = NULL;
  15144. PyObject *__pyx_t_2 = NULL;
  15145. PyObject *__pyx_t_3 = NULL;
  15146. PyObject *(*__pyx_t_4)(PyObject *);
  15147. PyObject *__pyx_t_5 = NULL;
  15148. int __pyx_lineno = 0;
  15149. const char *__pyx_filename = NULL;
  15150. int __pyx_clineno = 0;
  15151. __Pyx_RefNannySetupContext("calcQuadraticParameters", 0);
  15152. /* "fontTools/misc/bezierTools.py":946
  15153. *
  15154. * def calcQuadraticParameters(pt1, pt2, pt3):
  15155. * x2, y2 = pt2 # <<<<<<<<<<<<<<
  15156. * x3, y3 = pt3
  15157. * cx, cy = pt1
  15158. */
  15159. if ((likely(PyTuple_CheckExact(__pyx_v_pt2))) || (PyList_CheckExact(__pyx_v_pt2))) {
  15160. PyObject* sequence = __pyx_v_pt2;
  15161. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15162. if (unlikely(size != 2)) {
  15163. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15164. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15165. __PYX_ERR(0, 946, __pyx_L1_error)
  15166. }
  15167. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15168. if (likely(PyTuple_CheckExact(sequence))) {
  15169. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  15170. __Pyx_INCREF(__pyx_t_1);
  15171. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  15172. __Pyx_INCREF(__pyx_t_2);
  15173. } else {
  15174. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15175. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  15176. __Pyx_XGOTREF(__pyx_t_1);
  15177. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15178. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error)
  15179. __Pyx_XGOTREF(__pyx_t_2);
  15180. }
  15181. #else
  15182. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  15183. __Pyx_GOTREF(__pyx_t_1);
  15184. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error)
  15185. __Pyx_GOTREF(__pyx_t_2);
  15186. #endif
  15187. } else {
  15188. Py_ssize_t index = -1;
  15189. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 946, __pyx_L1_error)
  15190. __Pyx_GOTREF(__pyx_t_3);
  15191. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15192. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  15193. __Pyx_GOTREF(__pyx_t_1);
  15194. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  15195. __Pyx_GOTREF(__pyx_t_2);
  15196. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 946, __pyx_L1_error)
  15197. __pyx_t_4 = NULL;
  15198. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15199. goto __pyx_L4_unpacking_done;
  15200. __pyx_L3_unpacking_failed:;
  15201. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15202. __pyx_t_4 = NULL;
  15203. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15204. __PYX_ERR(0, 946, __pyx_L1_error)
  15205. __pyx_L4_unpacking_done:;
  15206. }
  15207. __pyx_v_x2 = __pyx_t_1;
  15208. __pyx_t_1 = 0;
  15209. __pyx_v_y2 = __pyx_t_2;
  15210. __pyx_t_2 = 0;
  15211. /* "fontTools/misc/bezierTools.py":947
  15212. * def calcQuadraticParameters(pt1, pt2, pt3):
  15213. * x2, y2 = pt2
  15214. * x3, y3 = pt3 # <<<<<<<<<<<<<<
  15215. * cx, cy = pt1
  15216. * bx = (x2 - cx) * 2.0
  15217. */
  15218. if ((likely(PyTuple_CheckExact(__pyx_v_pt3))) || (PyList_CheckExact(__pyx_v_pt3))) {
  15219. PyObject* sequence = __pyx_v_pt3;
  15220. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15221. if (unlikely(size != 2)) {
  15222. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15223. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15224. __PYX_ERR(0, 947, __pyx_L1_error)
  15225. }
  15226. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15227. if (likely(PyTuple_CheckExact(sequence))) {
  15228. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  15229. __Pyx_INCREF(__pyx_t_2);
  15230. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  15231. __Pyx_INCREF(__pyx_t_1);
  15232. } else {
  15233. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15234. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error)
  15235. __Pyx_XGOTREF(__pyx_t_2);
  15236. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15237. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
  15238. __Pyx_XGOTREF(__pyx_t_1);
  15239. }
  15240. #else
  15241. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error)
  15242. __Pyx_GOTREF(__pyx_t_2);
  15243. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
  15244. __Pyx_GOTREF(__pyx_t_1);
  15245. #endif
  15246. } else {
  15247. Py_ssize_t index = -1;
  15248. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 947, __pyx_L1_error)
  15249. __Pyx_GOTREF(__pyx_t_3);
  15250. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15251. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  15252. __Pyx_GOTREF(__pyx_t_2);
  15253. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  15254. __Pyx_GOTREF(__pyx_t_1);
  15255. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
  15256. __pyx_t_4 = NULL;
  15257. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15258. goto __pyx_L6_unpacking_done;
  15259. __pyx_L5_unpacking_failed:;
  15260. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15261. __pyx_t_4 = NULL;
  15262. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15263. __PYX_ERR(0, 947, __pyx_L1_error)
  15264. __pyx_L6_unpacking_done:;
  15265. }
  15266. __pyx_v_x3 = __pyx_t_2;
  15267. __pyx_t_2 = 0;
  15268. __pyx_v_y3 = __pyx_t_1;
  15269. __pyx_t_1 = 0;
  15270. /* "fontTools/misc/bezierTools.py":948
  15271. * x2, y2 = pt2
  15272. * x3, y3 = pt3
  15273. * cx, cy = pt1 # <<<<<<<<<<<<<<
  15274. * bx = (x2 - cx) * 2.0
  15275. * by = (y2 - cy) * 2.0
  15276. */
  15277. if ((likely(PyTuple_CheckExact(__pyx_v_pt1))) || (PyList_CheckExact(__pyx_v_pt1))) {
  15278. PyObject* sequence = __pyx_v_pt1;
  15279. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15280. if (unlikely(size != 2)) {
  15281. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15282. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15283. __PYX_ERR(0, 948, __pyx_L1_error)
  15284. }
  15285. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15286. if (likely(PyTuple_CheckExact(sequence))) {
  15287. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  15288. __Pyx_INCREF(__pyx_t_1);
  15289. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  15290. __Pyx_INCREF(__pyx_t_2);
  15291. } else {
  15292. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15293. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error)
  15294. __Pyx_XGOTREF(__pyx_t_1);
  15295. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15296. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
  15297. __Pyx_XGOTREF(__pyx_t_2);
  15298. }
  15299. #else
  15300. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error)
  15301. __Pyx_GOTREF(__pyx_t_1);
  15302. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
  15303. __Pyx_GOTREF(__pyx_t_2);
  15304. #endif
  15305. } else {
  15306. Py_ssize_t index = -1;
  15307. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 948, __pyx_L1_error)
  15308. __Pyx_GOTREF(__pyx_t_3);
  15309. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15310. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  15311. __Pyx_GOTREF(__pyx_t_1);
  15312. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  15313. __Pyx_GOTREF(__pyx_t_2);
  15314. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 948, __pyx_L1_error)
  15315. __pyx_t_4 = NULL;
  15316. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15317. goto __pyx_L8_unpacking_done;
  15318. __pyx_L7_unpacking_failed:;
  15319. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15320. __pyx_t_4 = NULL;
  15321. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15322. __PYX_ERR(0, 948, __pyx_L1_error)
  15323. __pyx_L8_unpacking_done:;
  15324. }
  15325. __pyx_v_cx = __pyx_t_1;
  15326. __pyx_t_1 = 0;
  15327. __pyx_v_cy = __pyx_t_2;
  15328. __pyx_t_2 = 0;
  15329. /* "fontTools/misc/bezierTools.py":949
  15330. * x3, y3 = pt3
  15331. * cx, cy = pt1
  15332. * bx = (x2 - cx) * 2.0 # <<<<<<<<<<<<<<
  15333. * by = (y2 - cy) * 2.0
  15334. * ax = x3 - cx - bx
  15335. */
  15336. __pyx_t_2 = PyNumber_Subtract(__pyx_v_x2, __pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 949, __pyx_L1_error)
  15337. __Pyx_GOTREF(__pyx_t_2);
  15338. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_mstate_global->__pyx_float_2_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 949, __pyx_L1_error)
  15339. __Pyx_GOTREF(__pyx_t_1);
  15340. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15341. __pyx_v_bx = __pyx_t_1;
  15342. __pyx_t_1 = 0;
  15343. /* "fontTools/misc/bezierTools.py":950
  15344. * cx, cy = pt1
  15345. * bx = (x2 - cx) * 2.0
  15346. * by = (y2 - cy) * 2.0 # <<<<<<<<<<<<<<
  15347. * ax = x3 - cx - bx
  15348. * ay = y3 - cy - by
  15349. */
  15350. __pyx_t_1 = PyNumber_Subtract(__pyx_v_y2, __pyx_v_cy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __pyx_L1_error)
  15351. __Pyx_GOTREF(__pyx_t_1);
  15352. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_mstate_global->__pyx_float_2_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 950, __pyx_L1_error)
  15353. __Pyx_GOTREF(__pyx_t_2);
  15354. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15355. __pyx_v_by = __pyx_t_2;
  15356. __pyx_t_2 = 0;
  15357. /* "fontTools/misc/bezierTools.py":951
  15358. * bx = (x2 - cx) * 2.0
  15359. * by = (y2 - cy) * 2.0
  15360. * ax = x3 - cx - bx # <<<<<<<<<<<<<<
  15361. * ay = y3 - cy - by
  15362. * return (ax, ay), (bx, by), (cx, cy)
  15363. */
  15364. __pyx_t_2 = PyNumber_Subtract(__pyx_v_x3, __pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __pyx_L1_error)
  15365. __Pyx_GOTREF(__pyx_t_2);
  15366. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error)
  15367. __Pyx_GOTREF(__pyx_t_1);
  15368. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15369. __pyx_v_ax = __pyx_t_1;
  15370. __pyx_t_1 = 0;
  15371. /* "fontTools/misc/bezierTools.py":952
  15372. * by = (y2 - cy) * 2.0
  15373. * ax = x3 - cx - bx
  15374. * ay = y3 - cy - by # <<<<<<<<<<<<<<
  15375. * return (ax, ay), (bx, by), (cx, cy)
  15376. *
  15377. */
  15378. __pyx_t_1 = PyNumber_Subtract(__pyx_v_y3, __pyx_v_cy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 952, __pyx_L1_error)
  15379. __Pyx_GOTREF(__pyx_t_1);
  15380. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_by); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 952, __pyx_L1_error)
  15381. __Pyx_GOTREF(__pyx_t_2);
  15382. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15383. __pyx_v_ay = __pyx_t_2;
  15384. __pyx_t_2 = 0;
  15385. /* "fontTools/misc/bezierTools.py":953
  15386. * ax = x3 - cx - bx
  15387. * ay = y3 - cy - by
  15388. * return (ax, ay), (bx, by), (cx, cy) # <<<<<<<<<<<<<<
  15389. *
  15390. *
  15391. */
  15392. __Pyx_XDECREF(__pyx_r);
  15393. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 953, __pyx_L1_error)
  15394. __Pyx_GOTREF(__pyx_t_2);
  15395. __Pyx_INCREF(__pyx_v_ax);
  15396. __Pyx_GIVEREF(__pyx_v_ax);
  15397. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ax) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15398. __Pyx_INCREF(__pyx_v_ay);
  15399. __Pyx_GIVEREF(__pyx_v_ay);
  15400. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_ay) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15401. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L1_error)
  15402. __Pyx_GOTREF(__pyx_t_1);
  15403. __Pyx_INCREF(__pyx_v_bx);
  15404. __Pyx_GIVEREF(__pyx_v_bx);
  15405. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bx) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15406. __Pyx_INCREF(__pyx_v_by);
  15407. __Pyx_GIVEREF(__pyx_v_by);
  15408. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_by) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15409. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __pyx_L1_error)
  15410. __Pyx_GOTREF(__pyx_t_3);
  15411. __Pyx_INCREF(__pyx_v_cx);
  15412. __Pyx_GIVEREF(__pyx_v_cx);
  15413. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_cx) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15414. __Pyx_INCREF(__pyx_v_cy);
  15415. __Pyx_GIVEREF(__pyx_v_cy);
  15416. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cy) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15417. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 953, __pyx_L1_error)
  15418. __Pyx_GOTREF(__pyx_t_5);
  15419. __Pyx_GIVEREF(__pyx_t_2);
  15420. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15421. __Pyx_GIVEREF(__pyx_t_1);
  15422. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15423. __Pyx_GIVEREF(__pyx_t_3);
  15424. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15425. __pyx_t_2 = 0;
  15426. __pyx_t_1 = 0;
  15427. __pyx_t_3 = 0;
  15428. __pyx_r = __pyx_t_5;
  15429. __pyx_t_5 = 0;
  15430. goto __pyx_L0;
  15431. /* "fontTools/misc/bezierTools.py":945
  15432. *
  15433. *
  15434. * def calcQuadraticParameters(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  15435. * x2, y2 = pt2
  15436. * x3, y3 = pt3
  15437. */
  15438. /* function exit code */
  15439. __pyx_L1_error:;
  15440. __Pyx_XDECREF(__pyx_t_1);
  15441. __Pyx_XDECREF(__pyx_t_2);
  15442. __Pyx_XDECREF(__pyx_t_3);
  15443. __Pyx_XDECREF(__pyx_t_5);
  15444. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticParameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15445. __pyx_r = NULL;
  15446. __pyx_L0:;
  15447. __Pyx_XDECREF(__pyx_v_x2);
  15448. __Pyx_XDECREF(__pyx_v_y2);
  15449. __Pyx_XDECREF(__pyx_v_x3);
  15450. __Pyx_XDECREF(__pyx_v_y3);
  15451. __Pyx_XDECREF(__pyx_v_cx);
  15452. __Pyx_XDECREF(__pyx_v_cy);
  15453. __Pyx_XDECREF(__pyx_v_bx);
  15454. __Pyx_XDECREF(__pyx_v_by);
  15455. __Pyx_XDECREF(__pyx_v_ax);
  15456. __Pyx_XDECREF(__pyx_v_ay);
  15457. __Pyx_XGIVEREF(__pyx_r);
  15458. __Pyx_RefNannyFinishContext();
  15459. return __pyx_r;
  15460. }
  15461. /* "fontTools/misc/bezierTools.py":956
  15462. *
  15463. *
  15464. * def calcCubicParameters(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  15465. * x2, y2 = pt2
  15466. * x3, y3 = pt3
  15467. */
  15468. /* Python wrapper */
  15469. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_53calcCubicParameters(PyObject *__pyx_self,
  15470. #if CYTHON_METH_FASTCALL
  15471. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  15472. #else
  15473. PyObject *__pyx_args, PyObject *__pyx_kwds
  15474. #endif
  15475. ); /*proto*/
  15476. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_52calcCubicParameters, "calcCubicParameters(pt1, pt2, pt3, pt4)");
  15477. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_53calcCubicParameters = {"calcCubicParameters", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_53calcCubicParameters, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_52calcCubicParameters};
  15478. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_53calcCubicParameters(PyObject *__pyx_self,
  15479. #if CYTHON_METH_FASTCALL
  15480. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  15481. #else
  15482. PyObject *__pyx_args, PyObject *__pyx_kwds
  15483. #endif
  15484. ) {
  15485. PyObject *__pyx_v_pt1 = 0;
  15486. PyObject *__pyx_v_pt2 = 0;
  15487. PyObject *__pyx_v_pt3 = 0;
  15488. PyObject *__pyx_v_pt4 = 0;
  15489. #if !CYTHON_METH_FASTCALL
  15490. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  15491. #endif
  15492. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  15493. PyObject* values[4] = {0,0,0,0};
  15494. int __pyx_lineno = 0;
  15495. const char *__pyx_filename = NULL;
  15496. int __pyx_clineno = 0;
  15497. PyObject *__pyx_r = 0;
  15498. __Pyx_RefNannyDeclarations
  15499. __Pyx_RefNannySetupContext("calcCubicParameters (wrapper)", 0);
  15500. #if !CYTHON_METH_FASTCALL
  15501. #if CYTHON_ASSUME_SAFE_SIZE
  15502. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  15503. #else
  15504. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  15505. #endif
  15506. #endif
  15507. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  15508. {
  15509. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,0};
  15510. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  15511. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 956, __pyx_L3_error)
  15512. if (__pyx_kwds_len > 0) {
  15513. switch (__pyx_nargs) {
  15514. case 4:
  15515. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  15516. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 956, __pyx_L3_error)
  15517. CYTHON_FALLTHROUGH;
  15518. case 3:
  15519. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  15520. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 956, __pyx_L3_error)
  15521. CYTHON_FALLTHROUGH;
  15522. case 2:
  15523. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  15524. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 956, __pyx_L3_error)
  15525. CYTHON_FALLTHROUGH;
  15526. case 1:
  15527. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  15528. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 956, __pyx_L3_error)
  15529. CYTHON_FALLTHROUGH;
  15530. case 0: break;
  15531. default: goto __pyx_L5_argtuple_error;
  15532. }
  15533. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  15534. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "calcCubicParameters", 0) < (0)) __PYX_ERR(0, 956, __pyx_L3_error)
  15535. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  15536. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcCubicParameters", 1, 4, 4, i); __PYX_ERR(0, 956, __pyx_L3_error) }
  15537. }
  15538. } else if (unlikely(__pyx_nargs != 4)) {
  15539. goto __pyx_L5_argtuple_error;
  15540. } else {
  15541. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  15542. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 956, __pyx_L3_error)
  15543. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  15544. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 956, __pyx_L3_error)
  15545. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  15546. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 956, __pyx_L3_error)
  15547. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  15548. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 956, __pyx_L3_error)
  15549. }
  15550. __pyx_v_pt1 = values[0];
  15551. __pyx_v_pt2 = values[1];
  15552. __pyx_v_pt3 = values[2];
  15553. __pyx_v_pt4 = values[3];
  15554. }
  15555. goto __pyx_L6_skip;
  15556. __pyx_L5_argtuple_error:;
  15557. __Pyx_RaiseArgtupleInvalid("calcCubicParameters", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 956, __pyx_L3_error)
  15558. __pyx_L6_skip:;
  15559. goto __pyx_L4_argument_unpacking_done;
  15560. __pyx_L3_error:;
  15561. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  15562. Py_XDECREF(values[__pyx_temp]);
  15563. }
  15564. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicParameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15565. __Pyx_RefNannyFinishContext();
  15566. return NULL;
  15567. __pyx_L4_argument_unpacking_done:;
  15568. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_52calcCubicParameters(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4);
  15569. /* function exit code */
  15570. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  15571. Py_XDECREF(values[__pyx_temp]);
  15572. }
  15573. __Pyx_RefNannyFinishContext();
  15574. return __pyx_r;
  15575. }
  15576. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_52calcCubicParameters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4) {
  15577. PyObject *__pyx_v_x2 = NULL;
  15578. PyObject *__pyx_v_y2 = NULL;
  15579. PyObject *__pyx_v_x3 = NULL;
  15580. PyObject *__pyx_v_y3 = NULL;
  15581. PyObject *__pyx_v_x4 = NULL;
  15582. PyObject *__pyx_v_y4 = NULL;
  15583. PyObject *__pyx_v_dx = NULL;
  15584. PyObject *__pyx_v_dy = NULL;
  15585. PyObject *__pyx_v_cx = NULL;
  15586. PyObject *__pyx_v_cy = NULL;
  15587. PyObject *__pyx_v_bx = NULL;
  15588. PyObject *__pyx_v_by = NULL;
  15589. PyObject *__pyx_v_ax = NULL;
  15590. PyObject *__pyx_v_ay = NULL;
  15591. PyObject *__pyx_r = NULL;
  15592. __Pyx_RefNannyDeclarations
  15593. PyObject *__pyx_t_1 = NULL;
  15594. PyObject *__pyx_t_2 = NULL;
  15595. PyObject *__pyx_t_3 = NULL;
  15596. PyObject *(*__pyx_t_4)(PyObject *);
  15597. PyObject *__pyx_t_5 = NULL;
  15598. PyObject *__pyx_t_6 = NULL;
  15599. int __pyx_lineno = 0;
  15600. const char *__pyx_filename = NULL;
  15601. int __pyx_clineno = 0;
  15602. __Pyx_RefNannySetupContext("calcCubicParameters", 0);
  15603. /* "fontTools/misc/bezierTools.py":957
  15604. *
  15605. * def calcCubicParameters(pt1, pt2, pt3, pt4):
  15606. * x2, y2 = pt2 # <<<<<<<<<<<<<<
  15607. * x3, y3 = pt3
  15608. * x4, y4 = pt4
  15609. */
  15610. if ((likely(PyTuple_CheckExact(__pyx_v_pt2))) || (PyList_CheckExact(__pyx_v_pt2))) {
  15611. PyObject* sequence = __pyx_v_pt2;
  15612. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15613. if (unlikely(size != 2)) {
  15614. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15615. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15616. __PYX_ERR(0, 957, __pyx_L1_error)
  15617. }
  15618. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15619. if (likely(PyTuple_CheckExact(sequence))) {
  15620. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  15621. __Pyx_INCREF(__pyx_t_1);
  15622. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  15623. __Pyx_INCREF(__pyx_t_2);
  15624. } else {
  15625. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15626. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 957, __pyx_L1_error)
  15627. __Pyx_XGOTREF(__pyx_t_1);
  15628. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15629. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error)
  15630. __Pyx_XGOTREF(__pyx_t_2);
  15631. }
  15632. #else
  15633. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 957, __pyx_L1_error)
  15634. __Pyx_GOTREF(__pyx_t_1);
  15635. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error)
  15636. __Pyx_GOTREF(__pyx_t_2);
  15637. #endif
  15638. } else {
  15639. Py_ssize_t index = -1;
  15640. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 957, __pyx_L1_error)
  15641. __Pyx_GOTREF(__pyx_t_3);
  15642. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15643. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  15644. __Pyx_GOTREF(__pyx_t_1);
  15645. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  15646. __Pyx_GOTREF(__pyx_t_2);
  15647. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 957, __pyx_L1_error)
  15648. __pyx_t_4 = NULL;
  15649. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15650. goto __pyx_L4_unpacking_done;
  15651. __pyx_L3_unpacking_failed:;
  15652. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15653. __pyx_t_4 = NULL;
  15654. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15655. __PYX_ERR(0, 957, __pyx_L1_error)
  15656. __pyx_L4_unpacking_done:;
  15657. }
  15658. __pyx_v_x2 = __pyx_t_1;
  15659. __pyx_t_1 = 0;
  15660. __pyx_v_y2 = __pyx_t_2;
  15661. __pyx_t_2 = 0;
  15662. /* "fontTools/misc/bezierTools.py":958
  15663. * def calcCubicParameters(pt1, pt2, pt3, pt4):
  15664. * x2, y2 = pt2
  15665. * x3, y3 = pt3 # <<<<<<<<<<<<<<
  15666. * x4, y4 = pt4
  15667. * dx, dy = pt1
  15668. */
  15669. if ((likely(PyTuple_CheckExact(__pyx_v_pt3))) || (PyList_CheckExact(__pyx_v_pt3))) {
  15670. PyObject* sequence = __pyx_v_pt3;
  15671. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15672. if (unlikely(size != 2)) {
  15673. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15674. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15675. __PYX_ERR(0, 958, __pyx_L1_error)
  15676. }
  15677. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15678. if (likely(PyTuple_CheckExact(sequence))) {
  15679. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  15680. __Pyx_INCREF(__pyx_t_2);
  15681. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  15682. __Pyx_INCREF(__pyx_t_1);
  15683. } else {
  15684. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15685. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error)
  15686. __Pyx_XGOTREF(__pyx_t_2);
  15687. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15688. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 958, __pyx_L1_error)
  15689. __Pyx_XGOTREF(__pyx_t_1);
  15690. }
  15691. #else
  15692. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error)
  15693. __Pyx_GOTREF(__pyx_t_2);
  15694. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 958, __pyx_L1_error)
  15695. __Pyx_GOTREF(__pyx_t_1);
  15696. #endif
  15697. } else {
  15698. Py_ssize_t index = -1;
  15699. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 958, __pyx_L1_error)
  15700. __Pyx_GOTREF(__pyx_t_3);
  15701. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15702. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  15703. __Pyx_GOTREF(__pyx_t_2);
  15704. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  15705. __Pyx_GOTREF(__pyx_t_1);
  15706. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 958, __pyx_L1_error)
  15707. __pyx_t_4 = NULL;
  15708. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15709. goto __pyx_L6_unpacking_done;
  15710. __pyx_L5_unpacking_failed:;
  15711. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15712. __pyx_t_4 = NULL;
  15713. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15714. __PYX_ERR(0, 958, __pyx_L1_error)
  15715. __pyx_L6_unpacking_done:;
  15716. }
  15717. __pyx_v_x3 = __pyx_t_2;
  15718. __pyx_t_2 = 0;
  15719. __pyx_v_y3 = __pyx_t_1;
  15720. __pyx_t_1 = 0;
  15721. /* "fontTools/misc/bezierTools.py":959
  15722. * x2, y2 = pt2
  15723. * x3, y3 = pt3
  15724. * x4, y4 = pt4 # <<<<<<<<<<<<<<
  15725. * dx, dy = pt1
  15726. * cx = (x2 - dx) * 3.0
  15727. */
  15728. if ((likely(PyTuple_CheckExact(__pyx_v_pt4))) || (PyList_CheckExact(__pyx_v_pt4))) {
  15729. PyObject* sequence = __pyx_v_pt4;
  15730. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15731. if (unlikely(size != 2)) {
  15732. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15733. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15734. __PYX_ERR(0, 959, __pyx_L1_error)
  15735. }
  15736. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15737. if (likely(PyTuple_CheckExact(sequence))) {
  15738. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  15739. __Pyx_INCREF(__pyx_t_1);
  15740. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  15741. __Pyx_INCREF(__pyx_t_2);
  15742. } else {
  15743. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15744. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 959, __pyx_L1_error)
  15745. __Pyx_XGOTREF(__pyx_t_1);
  15746. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15747. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error)
  15748. __Pyx_XGOTREF(__pyx_t_2);
  15749. }
  15750. #else
  15751. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 959, __pyx_L1_error)
  15752. __Pyx_GOTREF(__pyx_t_1);
  15753. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error)
  15754. __Pyx_GOTREF(__pyx_t_2);
  15755. #endif
  15756. } else {
  15757. Py_ssize_t index = -1;
  15758. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error)
  15759. __Pyx_GOTREF(__pyx_t_3);
  15760. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15761. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  15762. __Pyx_GOTREF(__pyx_t_1);
  15763. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  15764. __Pyx_GOTREF(__pyx_t_2);
  15765. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 959, __pyx_L1_error)
  15766. __pyx_t_4 = NULL;
  15767. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15768. goto __pyx_L8_unpacking_done;
  15769. __pyx_L7_unpacking_failed:;
  15770. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15771. __pyx_t_4 = NULL;
  15772. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15773. __PYX_ERR(0, 959, __pyx_L1_error)
  15774. __pyx_L8_unpacking_done:;
  15775. }
  15776. __pyx_v_x4 = __pyx_t_1;
  15777. __pyx_t_1 = 0;
  15778. __pyx_v_y4 = __pyx_t_2;
  15779. __pyx_t_2 = 0;
  15780. /* "fontTools/misc/bezierTools.py":960
  15781. * x3, y3 = pt3
  15782. * x4, y4 = pt4
  15783. * dx, dy = pt1 # <<<<<<<<<<<<<<
  15784. * cx = (x2 - dx) * 3.0
  15785. * cy = (y2 - dy) * 3.0
  15786. */
  15787. if ((likely(PyTuple_CheckExact(__pyx_v_pt1))) || (PyList_CheckExact(__pyx_v_pt1))) {
  15788. PyObject* sequence = __pyx_v_pt1;
  15789. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15790. if (unlikely(size != 2)) {
  15791. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15792. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15793. __PYX_ERR(0, 960, __pyx_L1_error)
  15794. }
  15795. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15796. if (likely(PyTuple_CheckExact(sequence))) {
  15797. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  15798. __Pyx_INCREF(__pyx_t_2);
  15799. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  15800. __Pyx_INCREF(__pyx_t_1);
  15801. } else {
  15802. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15803. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
  15804. __Pyx_XGOTREF(__pyx_t_2);
  15805. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15806. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 960, __pyx_L1_error)
  15807. __Pyx_XGOTREF(__pyx_t_1);
  15808. }
  15809. #else
  15810. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
  15811. __Pyx_GOTREF(__pyx_t_2);
  15812. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 960, __pyx_L1_error)
  15813. __Pyx_GOTREF(__pyx_t_1);
  15814. #endif
  15815. } else {
  15816. Py_ssize_t index = -1;
  15817. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error)
  15818. __Pyx_GOTREF(__pyx_t_3);
  15819. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15820. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
  15821. __Pyx_GOTREF(__pyx_t_2);
  15822. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
  15823. __Pyx_GOTREF(__pyx_t_1);
  15824. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 960, __pyx_L1_error)
  15825. __pyx_t_4 = NULL;
  15826. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15827. goto __pyx_L10_unpacking_done;
  15828. __pyx_L9_unpacking_failed:;
  15829. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15830. __pyx_t_4 = NULL;
  15831. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15832. __PYX_ERR(0, 960, __pyx_L1_error)
  15833. __pyx_L10_unpacking_done:;
  15834. }
  15835. __pyx_v_dx = __pyx_t_2;
  15836. __pyx_t_2 = 0;
  15837. __pyx_v_dy = __pyx_t_1;
  15838. __pyx_t_1 = 0;
  15839. /* "fontTools/misc/bezierTools.py":961
  15840. * x4, y4 = pt4
  15841. * dx, dy = pt1
  15842. * cx = (x2 - dx) * 3.0 # <<<<<<<<<<<<<<
  15843. * cy = (y2 - dy) * 3.0
  15844. * bx = (x3 - x2) * 3.0 - cx
  15845. */
  15846. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x2, __pyx_v_dx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
  15847. __Pyx_GOTREF(__pyx_t_1);
  15848. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_mstate_global->__pyx_float_3_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 961, __pyx_L1_error)
  15849. __Pyx_GOTREF(__pyx_t_2);
  15850. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15851. __pyx_v_cx = __pyx_t_2;
  15852. __pyx_t_2 = 0;
  15853. /* "fontTools/misc/bezierTools.py":962
  15854. * dx, dy = pt1
  15855. * cx = (x2 - dx) * 3.0
  15856. * cy = (y2 - dy) * 3.0 # <<<<<<<<<<<<<<
  15857. * bx = (x3 - x2) * 3.0 - cx
  15858. * by = (y3 - y2) * 3.0 - cy
  15859. */
  15860. __pyx_t_2 = PyNumber_Subtract(__pyx_v_y2, __pyx_v_dy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 962, __pyx_L1_error)
  15861. __Pyx_GOTREF(__pyx_t_2);
  15862. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_mstate_global->__pyx_float_3_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 962, __pyx_L1_error)
  15863. __Pyx_GOTREF(__pyx_t_1);
  15864. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15865. __pyx_v_cy = __pyx_t_1;
  15866. __pyx_t_1 = 0;
  15867. /* "fontTools/misc/bezierTools.py":963
  15868. * cx = (x2 - dx) * 3.0
  15869. * cy = (y2 - dy) * 3.0
  15870. * bx = (x3 - x2) * 3.0 - cx # <<<<<<<<<<<<<<
  15871. * by = (y3 - y2) * 3.0 - cy
  15872. * ax = x4 - dx - cx - bx
  15873. */
  15874. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x3, __pyx_v_x2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error)
  15875. __Pyx_GOTREF(__pyx_t_1);
  15876. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_mstate_global->__pyx_float_3_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 963, __pyx_L1_error)
  15877. __Pyx_GOTREF(__pyx_t_2);
  15878. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15879. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error)
  15880. __Pyx_GOTREF(__pyx_t_1);
  15881. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15882. __pyx_v_bx = __pyx_t_1;
  15883. __pyx_t_1 = 0;
  15884. /* "fontTools/misc/bezierTools.py":964
  15885. * cy = (y2 - dy) * 3.0
  15886. * bx = (x3 - x2) * 3.0 - cx
  15887. * by = (y3 - y2) * 3.0 - cy # <<<<<<<<<<<<<<
  15888. * ax = x4 - dx - cx - bx
  15889. * ay = y4 - dy - cy - by
  15890. */
  15891. __pyx_t_1 = PyNumber_Subtract(__pyx_v_y3, __pyx_v_y2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error)
  15892. __Pyx_GOTREF(__pyx_t_1);
  15893. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_mstate_global->__pyx_float_3_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 964, __pyx_L1_error)
  15894. __Pyx_GOTREF(__pyx_t_2);
  15895. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15896. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_cy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error)
  15897. __Pyx_GOTREF(__pyx_t_1);
  15898. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15899. __pyx_v_by = __pyx_t_1;
  15900. __pyx_t_1 = 0;
  15901. /* "fontTools/misc/bezierTools.py":965
  15902. * bx = (x3 - x2) * 3.0 - cx
  15903. * by = (y3 - y2) * 3.0 - cy
  15904. * ax = x4 - dx - cx - bx # <<<<<<<<<<<<<<
  15905. * ay = y4 - dy - cy - by
  15906. * return (ax, ay), (bx, by), (cx, cy), (dx, dy)
  15907. */
  15908. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x4, __pyx_v_dx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error)
  15909. __Pyx_GOTREF(__pyx_t_1);
  15910. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 965, __pyx_L1_error)
  15911. __Pyx_GOTREF(__pyx_t_2);
  15912. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15913. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error)
  15914. __Pyx_GOTREF(__pyx_t_1);
  15915. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15916. __pyx_v_ax = __pyx_t_1;
  15917. __pyx_t_1 = 0;
  15918. /* "fontTools/misc/bezierTools.py":966
  15919. * by = (y3 - y2) * 3.0 - cy
  15920. * ax = x4 - dx - cx - bx
  15921. * ay = y4 - dy - cy - by # <<<<<<<<<<<<<<
  15922. * return (ax, ay), (bx, by), (cx, cy), (dx, dy)
  15923. *
  15924. */
  15925. __pyx_t_1 = PyNumber_Subtract(__pyx_v_y4, __pyx_v_dy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
  15926. __Pyx_GOTREF(__pyx_t_1);
  15927. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_cy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error)
  15928. __Pyx_GOTREF(__pyx_t_2);
  15929. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15930. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_by); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
  15931. __Pyx_GOTREF(__pyx_t_1);
  15932. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15933. __pyx_v_ay = __pyx_t_1;
  15934. __pyx_t_1 = 0;
  15935. /* "fontTools/misc/bezierTools.py":967
  15936. * ax = x4 - dx - cx - bx
  15937. * ay = y4 - dy - cy - by
  15938. * return (ax, ay), (bx, by), (cx, cy), (dx, dy) # <<<<<<<<<<<<<<
  15939. *
  15940. *
  15941. */
  15942. __Pyx_XDECREF(__pyx_r);
  15943. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 967, __pyx_L1_error)
  15944. __Pyx_GOTREF(__pyx_t_1);
  15945. __Pyx_INCREF(__pyx_v_ax);
  15946. __Pyx_GIVEREF(__pyx_v_ax);
  15947. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ax) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15948. __Pyx_INCREF(__pyx_v_ay);
  15949. __Pyx_GIVEREF(__pyx_v_ay);
  15950. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ay) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15951. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 967, __pyx_L1_error)
  15952. __Pyx_GOTREF(__pyx_t_2);
  15953. __Pyx_INCREF(__pyx_v_bx);
  15954. __Pyx_GIVEREF(__pyx_v_bx);
  15955. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_bx) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15956. __Pyx_INCREF(__pyx_v_by);
  15957. __Pyx_GIVEREF(__pyx_v_by);
  15958. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_by) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15959. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 967, __pyx_L1_error)
  15960. __Pyx_GOTREF(__pyx_t_3);
  15961. __Pyx_INCREF(__pyx_v_cx);
  15962. __Pyx_GIVEREF(__pyx_v_cx);
  15963. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_cx) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15964. __Pyx_INCREF(__pyx_v_cy);
  15965. __Pyx_GIVEREF(__pyx_v_cy);
  15966. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cy) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15967. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 967, __pyx_L1_error)
  15968. __Pyx_GOTREF(__pyx_t_5);
  15969. __Pyx_INCREF(__pyx_v_dx);
  15970. __Pyx_GIVEREF(__pyx_v_dx);
  15971. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_dx) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15972. __Pyx_INCREF(__pyx_v_dy);
  15973. __Pyx_GIVEREF(__pyx_v_dy);
  15974. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_dy) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15975. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 967, __pyx_L1_error)
  15976. __Pyx_GOTREF(__pyx_t_6);
  15977. __Pyx_GIVEREF(__pyx_t_1);
  15978. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15979. __Pyx_GIVEREF(__pyx_t_2);
  15980. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15981. __Pyx_GIVEREF(__pyx_t_3);
  15982. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15983. __Pyx_GIVEREF(__pyx_t_5);
  15984. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15985. __pyx_t_1 = 0;
  15986. __pyx_t_2 = 0;
  15987. __pyx_t_3 = 0;
  15988. __pyx_t_5 = 0;
  15989. __pyx_r = __pyx_t_6;
  15990. __pyx_t_6 = 0;
  15991. goto __pyx_L0;
  15992. /* "fontTools/misc/bezierTools.py":956
  15993. *
  15994. *
  15995. * def calcCubicParameters(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  15996. * x2, y2 = pt2
  15997. * x3, y3 = pt3
  15998. */
  15999. /* function exit code */
  16000. __pyx_L1_error:;
  16001. __Pyx_XDECREF(__pyx_t_1);
  16002. __Pyx_XDECREF(__pyx_t_2);
  16003. __Pyx_XDECREF(__pyx_t_3);
  16004. __Pyx_XDECREF(__pyx_t_5);
  16005. __Pyx_XDECREF(__pyx_t_6);
  16006. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicParameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16007. __pyx_r = NULL;
  16008. __pyx_L0:;
  16009. __Pyx_XDECREF(__pyx_v_x2);
  16010. __Pyx_XDECREF(__pyx_v_y2);
  16011. __Pyx_XDECREF(__pyx_v_x3);
  16012. __Pyx_XDECREF(__pyx_v_y3);
  16013. __Pyx_XDECREF(__pyx_v_x4);
  16014. __Pyx_XDECREF(__pyx_v_y4);
  16015. __Pyx_XDECREF(__pyx_v_dx);
  16016. __Pyx_XDECREF(__pyx_v_dy);
  16017. __Pyx_XDECREF(__pyx_v_cx);
  16018. __Pyx_XDECREF(__pyx_v_cy);
  16019. __Pyx_XDECREF(__pyx_v_bx);
  16020. __Pyx_XDECREF(__pyx_v_by);
  16021. __Pyx_XDECREF(__pyx_v_ax);
  16022. __Pyx_XDECREF(__pyx_v_ay);
  16023. __Pyx_XGIVEREF(__pyx_r);
  16024. __Pyx_RefNannyFinishContext();
  16025. return __pyx_r;
  16026. }
  16027. /* "fontTools/misc/bezierTools.py":970
  16028. *
  16029. *
  16030. * @cython.cfunc # <<<<<<<<<<<<<<
  16031. * @cython.inline
  16032. * @cython.locals(
  16033. */
  16034. static CYTHON_INLINE PyObject *__pyx_f_9fontTools_4misc_11bezierTools_calcCubicParametersC(__pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4) {
  16035. __pyx_t_double_complex __pyx_v_a;
  16036. __pyx_t_double_complex __pyx_v_b;
  16037. __pyx_t_double_complex __pyx_v_c;
  16038. PyObject *__pyx_r = NULL;
  16039. __Pyx_RefNannyDeclarations
  16040. PyObject *__pyx_t_1 = NULL;
  16041. PyObject *__pyx_t_2 = NULL;
  16042. PyObject *__pyx_t_3 = NULL;
  16043. PyObject *__pyx_t_4 = NULL;
  16044. PyObject *__pyx_t_5 = NULL;
  16045. int __pyx_lineno = 0;
  16046. const char *__pyx_filename = NULL;
  16047. int __pyx_clineno = 0;
  16048. __Pyx_RefNannySetupContext("calcCubicParametersC", 0);
  16049. /* "fontTools/misc/bezierTools.py":982
  16050. * )
  16051. * def calcCubicParametersC(pt1, pt2, pt3, pt4):
  16052. * c = (pt2 - pt1) * 3.0 # <<<<<<<<<<<<<<
  16053. * b = (pt3 - pt2) * 3.0 - c
  16054. * a = pt4 - pt1 - c - b
  16055. */
  16056. __pyx_v_c = __Pyx_c_prod_double(__Pyx_c_diff_double(__pyx_v_pt2, __pyx_v_pt1), __pyx_t_double_complex_from_parts(3.0, 0));
  16057. /* "fontTools/misc/bezierTools.py":983
  16058. * def calcCubicParametersC(pt1, pt2, pt3, pt4):
  16059. * c = (pt2 - pt1) * 3.0
  16060. * b = (pt3 - pt2) * 3.0 - c # <<<<<<<<<<<<<<
  16061. * a = pt4 - pt1 - c - b
  16062. * return (a, b, c, pt1)
  16063. */
  16064. __pyx_v_b = __Pyx_c_diff_double(__Pyx_c_prod_double(__Pyx_c_diff_double(__pyx_v_pt3, __pyx_v_pt2), __pyx_t_double_complex_from_parts(3.0, 0)), __pyx_v_c);
  16065. /* "fontTools/misc/bezierTools.py":984
  16066. * c = (pt2 - pt1) * 3.0
  16067. * b = (pt3 - pt2) * 3.0 - c
  16068. * a = pt4 - pt1 - c - b # <<<<<<<<<<<<<<
  16069. * return (a, b, c, pt1)
  16070. *
  16071. */
  16072. __pyx_v_a = __Pyx_c_diff_double(__Pyx_c_diff_double(__Pyx_c_diff_double(__pyx_v_pt4, __pyx_v_pt1), __pyx_v_c), __pyx_v_b);
  16073. /* "fontTools/misc/bezierTools.py":985
  16074. * b = (pt3 - pt2) * 3.0 - c
  16075. * a = pt4 - pt1 - c - b
  16076. * return (a, b, c, pt1) # <<<<<<<<<<<<<<
  16077. *
  16078. *
  16079. */
  16080. __Pyx_XDECREF(__pyx_r);
  16081. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 985, __pyx_L1_error)
  16082. __Pyx_GOTREF(__pyx_t_1);
  16083. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 985, __pyx_L1_error)
  16084. __Pyx_GOTREF(__pyx_t_2);
  16085. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 985, __pyx_L1_error)
  16086. __Pyx_GOTREF(__pyx_t_3);
  16087. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_v_pt1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 985, __pyx_L1_error)
  16088. __Pyx_GOTREF(__pyx_t_4);
  16089. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 985, __pyx_L1_error)
  16090. __Pyx_GOTREF(__pyx_t_5);
  16091. __Pyx_GIVEREF(__pyx_t_1);
  16092. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 985, __pyx_L1_error);
  16093. __Pyx_GIVEREF(__pyx_t_2);
  16094. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 985, __pyx_L1_error);
  16095. __Pyx_GIVEREF(__pyx_t_3);
  16096. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 985, __pyx_L1_error);
  16097. __Pyx_GIVEREF(__pyx_t_4);
  16098. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 985, __pyx_L1_error);
  16099. __pyx_t_1 = 0;
  16100. __pyx_t_2 = 0;
  16101. __pyx_t_3 = 0;
  16102. __pyx_t_4 = 0;
  16103. __pyx_r = __pyx_t_5;
  16104. __pyx_t_5 = 0;
  16105. goto __pyx_L0;
  16106. /* "fontTools/misc/bezierTools.py":970
  16107. *
  16108. *
  16109. * @cython.cfunc # <<<<<<<<<<<<<<
  16110. * @cython.inline
  16111. * @cython.locals(
  16112. */
  16113. /* function exit code */
  16114. __pyx_L1_error:;
  16115. __Pyx_XDECREF(__pyx_t_1);
  16116. __Pyx_XDECREF(__pyx_t_2);
  16117. __Pyx_XDECREF(__pyx_t_3);
  16118. __Pyx_XDECREF(__pyx_t_4);
  16119. __Pyx_XDECREF(__pyx_t_5);
  16120. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicParametersC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16121. __pyx_r = 0;
  16122. __pyx_L0:;
  16123. __Pyx_XGIVEREF(__pyx_r);
  16124. __Pyx_RefNannyFinishContext();
  16125. return __pyx_r;
  16126. }
  16127. /* "fontTools/misc/bezierTools.py":988
  16128. *
  16129. *
  16130. * def calcQuadraticPoints(a, b, c): # <<<<<<<<<<<<<<
  16131. * ax, ay = a
  16132. * bx, by = b
  16133. */
  16134. /* Python wrapper */
  16135. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_55calcQuadraticPoints(PyObject *__pyx_self,
  16136. #if CYTHON_METH_FASTCALL
  16137. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  16138. #else
  16139. PyObject *__pyx_args, PyObject *__pyx_kwds
  16140. #endif
  16141. ); /*proto*/
  16142. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_54calcQuadraticPoints, "calcQuadraticPoints(a, b, c)");
  16143. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_55calcQuadraticPoints = {"calcQuadraticPoints", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_55calcQuadraticPoints, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_54calcQuadraticPoints};
  16144. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_55calcQuadraticPoints(PyObject *__pyx_self,
  16145. #if CYTHON_METH_FASTCALL
  16146. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  16147. #else
  16148. PyObject *__pyx_args, PyObject *__pyx_kwds
  16149. #endif
  16150. ) {
  16151. PyObject *__pyx_v_a = 0;
  16152. PyObject *__pyx_v_b = 0;
  16153. PyObject *__pyx_v_c = 0;
  16154. #if !CYTHON_METH_FASTCALL
  16155. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  16156. #endif
  16157. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  16158. PyObject* values[3] = {0,0,0};
  16159. int __pyx_lineno = 0;
  16160. const char *__pyx_filename = NULL;
  16161. int __pyx_clineno = 0;
  16162. PyObject *__pyx_r = 0;
  16163. __Pyx_RefNannyDeclarations
  16164. __Pyx_RefNannySetupContext("calcQuadraticPoints (wrapper)", 0);
  16165. #if !CYTHON_METH_FASTCALL
  16166. #if CYTHON_ASSUME_SAFE_SIZE
  16167. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  16168. #else
  16169. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  16170. #endif
  16171. #endif
  16172. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  16173. {
  16174. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_a,&__pyx_mstate_global->__pyx_n_u_b,&__pyx_mstate_global->__pyx_n_u_c,0};
  16175. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  16176. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 988, __pyx_L3_error)
  16177. if (__pyx_kwds_len > 0) {
  16178. switch (__pyx_nargs) {
  16179. case 3:
  16180. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  16181. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 988, __pyx_L3_error)
  16182. CYTHON_FALLTHROUGH;
  16183. case 2:
  16184. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  16185. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 988, __pyx_L3_error)
  16186. CYTHON_FALLTHROUGH;
  16187. case 1:
  16188. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  16189. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 988, __pyx_L3_error)
  16190. CYTHON_FALLTHROUGH;
  16191. case 0: break;
  16192. default: goto __pyx_L5_argtuple_error;
  16193. }
  16194. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  16195. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "calcQuadraticPoints", 0) < (0)) __PYX_ERR(0, 988, __pyx_L3_error)
  16196. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  16197. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcQuadraticPoints", 1, 3, 3, i); __PYX_ERR(0, 988, __pyx_L3_error) }
  16198. }
  16199. } else if (unlikely(__pyx_nargs != 3)) {
  16200. goto __pyx_L5_argtuple_error;
  16201. } else {
  16202. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  16203. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 988, __pyx_L3_error)
  16204. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  16205. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 988, __pyx_L3_error)
  16206. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  16207. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 988, __pyx_L3_error)
  16208. }
  16209. __pyx_v_a = values[0];
  16210. __pyx_v_b = values[1];
  16211. __pyx_v_c = values[2];
  16212. }
  16213. goto __pyx_L6_skip;
  16214. __pyx_L5_argtuple_error:;
  16215. __Pyx_RaiseArgtupleInvalid("calcQuadraticPoints", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 988, __pyx_L3_error)
  16216. __pyx_L6_skip:;
  16217. goto __pyx_L4_argument_unpacking_done;
  16218. __pyx_L3_error:;
  16219. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  16220. Py_XDECREF(values[__pyx_temp]);
  16221. }
  16222. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticPoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16223. __Pyx_RefNannyFinishContext();
  16224. return NULL;
  16225. __pyx_L4_argument_unpacking_done:;
  16226. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_54calcQuadraticPoints(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c);
  16227. /* function exit code */
  16228. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  16229. Py_XDECREF(values[__pyx_temp]);
  16230. }
  16231. __Pyx_RefNannyFinishContext();
  16232. return __pyx_r;
  16233. }
  16234. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_54calcQuadraticPoints(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  16235. PyObject *__pyx_v_ax = NULL;
  16236. PyObject *__pyx_v_ay = NULL;
  16237. PyObject *__pyx_v_bx = NULL;
  16238. PyObject *__pyx_v_by = NULL;
  16239. PyObject *__pyx_v_cx = NULL;
  16240. PyObject *__pyx_v_cy = NULL;
  16241. PyObject *__pyx_v_x1 = NULL;
  16242. PyObject *__pyx_v_y1 = NULL;
  16243. PyObject *__pyx_v_x2 = NULL;
  16244. PyObject *__pyx_v_y2 = NULL;
  16245. PyObject *__pyx_v_x3 = NULL;
  16246. PyObject *__pyx_v_y3 = NULL;
  16247. PyObject *__pyx_r = NULL;
  16248. __Pyx_RefNannyDeclarations
  16249. PyObject *__pyx_t_1 = NULL;
  16250. PyObject *__pyx_t_2 = NULL;
  16251. PyObject *__pyx_t_3 = NULL;
  16252. PyObject *(*__pyx_t_4)(PyObject *);
  16253. PyObject *__pyx_t_5 = NULL;
  16254. int __pyx_lineno = 0;
  16255. const char *__pyx_filename = NULL;
  16256. int __pyx_clineno = 0;
  16257. __Pyx_RefNannySetupContext("calcQuadraticPoints", 0);
  16258. /* "fontTools/misc/bezierTools.py":989
  16259. *
  16260. * def calcQuadraticPoints(a, b, c):
  16261. * ax, ay = a # <<<<<<<<<<<<<<
  16262. * bx, by = b
  16263. * cx, cy = c
  16264. */
  16265. if ((likely(PyTuple_CheckExact(__pyx_v_a))) || (PyList_CheckExact(__pyx_v_a))) {
  16266. PyObject* sequence = __pyx_v_a;
  16267. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16268. if (unlikely(size != 2)) {
  16269. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16270. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16271. __PYX_ERR(0, 989, __pyx_L1_error)
  16272. }
  16273. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16274. if (likely(PyTuple_CheckExact(sequence))) {
  16275. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  16276. __Pyx_INCREF(__pyx_t_1);
  16277. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  16278. __Pyx_INCREF(__pyx_t_2);
  16279. } else {
  16280. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16281. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L1_error)
  16282. __Pyx_XGOTREF(__pyx_t_1);
  16283. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16284. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 989, __pyx_L1_error)
  16285. __Pyx_XGOTREF(__pyx_t_2);
  16286. }
  16287. #else
  16288. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L1_error)
  16289. __Pyx_GOTREF(__pyx_t_1);
  16290. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 989, __pyx_L1_error)
  16291. __Pyx_GOTREF(__pyx_t_2);
  16292. #endif
  16293. } else {
  16294. Py_ssize_t index = -1;
  16295. __pyx_t_3 = PyObject_GetIter(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 989, __pyx_L1_error)
  16296. __Pyx_GOTREF(__pyx_t_3);
  16297. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16298. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  16299. __Pyx_GOTREF(__pyx_t_1);
  16300. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  16301. __Pyx_GOTREF(__pyx_t_2);
  16302. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 989, __pyx_L1_error)
  16303. __pyx_t_4 = NULL;
  16304. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16305. goto __pyx_L4_unpacking_done;
  16306. __pyx_L3_unpacking_failed:;
  16307. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16308. __pyx_t_4 = NULL;
  16309. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16310. __PYX_ERR(0, 989, __pyx_L1_error)
  16311. __pyx_L4_unpacking_done:;
  16312. }
  16313. __pyx_v_ax = __pyx_t_1;
  16314. __pyx_t_1 = 0;
  16315. __pyx_v_ay = __pyx_t_2;
  16316. __pyx_t_2 = 0;
  16317. /* "fontTools/misc/bezierTools.py":990
  16318. * def calcQuadraticPoints(a, b, c):
  16319. * ax, ay = a
  16320. * bx, by = b # <<<<<<<<<<<<<<
  16321. * cx, cy = c
  16322. * x1 = cx
  16323. */
  16324. if ((likely(PyTuple_CheckExact(__pyx_v_b))) || (PyList_CheckExact(__pyx_v_b))) {
  16325. PyObject* sequence = __pyx_v_b;
  16326. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16327. if (unlikely(size != 2)) {
  16328. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16329. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16330. __PYX_ERR(0, 990, __pyx_L1_error)
  16331. }
  16332. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16333. if (likely(PyTuple_CheckExact(sequence))) {
  16334. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  16335. __Pyx_INCREF(__pyx_t_2);
  16336. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  16337. __Pyx_INCREF(__pyx_t_1);
  16338. } else {
  16339. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16340. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)
  16341. __Pyx_XGOTREF(__pyx_t_2);
  16342. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16343. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __pyx_L1_error)
  16344. __Pyx_XGOTREF(__pyx_t_1);
  16345. }
  16346. #else
  16347. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)
  16348. __Pyx_GOTREF(__pyx_t_2);
  16349. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __pyx_L1_error)
  16350. __Pyx_GOTREF(__pyx_t_1);
  16351. #endif
  16352. } else {
  16353. Py_ssize_t index = -1;
  16354. __pyx_t_3 = PyObject_GetIter(__pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 990, __pyx_L1_error)
  16355. __Pyx_GOTREF(__pyx_t_3);
  16356. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16357. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  16358. __Pyx_GOTREF(__pyx_t_2);
  16359. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  16360. __Pyx_GOTREF(__pyx_t_1);
  16361. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 990, __pyx_L1_error)
  16362. __pyx_t_4 = NULL;
  16363. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16364. goto __pyx_L6_unpacking_done;
  16365. __pyx_L5_unpacking_failed:;
  16366. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16367. __pyx_t_4 = NULL;
  16368. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16369. __PYX_ERR(0, 990, __pyx_L1_error)
  16370. __pyx_L6_unpacking_done:;
  16371. }
  16372. __pyx_v_bx = __pyx_t_2;
  16373. __pyx_t_2 = 0;
  16374. __pyx_v_by = __pyx_t_1;
  16375. __pyx_t_1 = 0;
  16376. /* "fontTools/misc/bezierTools.py":991
  16377. * ax, ay = a
  16378. * bx, by = b
  16379. * cx, cy = c # <<<<<<<<<<<<<<
  16380. * x1 = cx
  16381. * y1 = cy
  16382. */
  16383. if ((likely(PyTuple_CheckExact(__pyx_v_c))) || (PyList_CheckExact(__pyx_v_c))) {
  16384. PyObject* sequence = __pyx_v_c;
  16385. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16386. if (unlikely(size != 2)) {
  16387. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16388. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16389. __PYX_ERR(0, 991, __pyx_L1_error)
  16390. }
  16391. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16392. if (likely(PyTuple_CheckExact(sequence))) {
  16393. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  16394. __Pyx_INCREF(__pyx_t_1);
  16395. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  16396. __Pyx_INCREF(__pyx_t_2);
  16397. } else {
  16398. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16399. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 991, __pyx_L1_error)
  16400. __Pyx_XGOTREF(__pyx_t_1);
  16401. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16402. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 991, __pyx_L1_error)
  16403. __Pyx_XGOTREF(__pyx_t_2);
  16404. }
  16405. #else
  16406. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 991, __pyx_L1_error)
  16407. __Pyx_GOTREF(__pyx_t_1);
  16408. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 991, __pyx_L1_error)
  16409. __Pyx_GOTREF(__pyx_t_2);
  16410. #endif
  16411. } else {
  16412. Py_ssize_t index = -1;
  16413. __pyx_t_3 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 991, __pyx_L1_error)
  16414. __Pyx_GOTREF(__pyx_t_3);
  16415. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16416. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  16417. __Pyx_GOTREF(__pyx_t_1);
  16418. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  16419. __Pyx_GOTREF(__pyx_t_2);
  16420. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 991, __pyx_L1_error)
  16421. __pyx_t_4 = NULL;
  16422. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16423. goto __pyx_L8_unpacking_done;
  16424. __pyx_L7_unpacking_failed:;
  16425. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16426. __pyx_t_4 = NULL;
  16427. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16428. __PYX_ERR(0, 991, __pyx_L1_error)
  16429. __pyx_L8_unpacking_done:;
  16430. }
  16431. __pyx_v_cx = __pyx_t_1;
  16432. __pyx_t_1 = 0;
  16433. __pyx_v_cy = __pyx_t_2;
  16434. __pyx_t_2 = 0;
  16435. /* "fontTools/misc/bezierTools.py":992
  16436. * bx, by = b
  16437. * cx, cy = c
  16438. * x1 = cx # <<<<<<<<<<<<<<
  16439. * y1 = cy
  16440. * x2 = (bx * 0.5) + cx
  16441. */
  16442. __Pyx_INCREF(__pyx_v_cx);
  16443. __pyx_v_x1 = __pyx_v_cx;
  16444. /* "fontTools/misc/bezierTools.py":993
  16445. * cx, cy = c
  16446. * x1 = cx
  16447. * y1 = cy # <<<<<<<<<<<<<<
  16448. * x2 = (bx * 0.5) + cx
  16449. * y2 = (by * 0.5) + cy
  16450. */
  16451. __Pyx_INCREF(__pyx_v_cy);
  16452. __pyx_v_y1 = __pyx_v_cy;
  16453. /* "fontTools/misc/bezierTools.py":994
  16454. * x1 = cx
  16455. * y1 = cy
  16456. * x2 = (bx * 0.5) + cx # <<<<<<<<<<<<<<
  16457. * y2 = (by * 0.5) + cy
  16458. * x3 = ax + bx + cx
  16459. */
  16460. __pyx_t_2 = PyNumber_Multiply(__pyx_v_bx, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 994, __pyx_L1_error)
  16461. __Pyx_GOTREF(__pyx_t_2);
  16462. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)
  16463. __Pyx_GOTREF(__pyx_t_1);
  16464. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  16465. __pyx_v_x2 = __pyx_t_1;
  16466. __pyx_t_1 = 0;
  16467. /* "fontTools/misc/bezierTools.py":995
  16468. * y1 = cy
  16469. * x2 = (bx * 0.5) + cx
  16470. * y2 = (by * 0.5) + cy # <<<<<<<<<<<<<<
  16471. * x3 = ax + bx + cx
  16472. * y3 = ay + by + cy
  16473. */
  16474. __pyx_t_1 = PyNumber_Multiply(__pyx_v_by, __pyx_mstate_global->__pyx_float_0_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error)
  16475. __Pyx_GOTREF(__pyx_t_1);
  16476. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_cy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 995, __pyx_L1_error)
  16477. __Pyx_GOTREF(__pyx_t_2);
  16478. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16479. __pyx_v_y2 = __pyx_t_2;
  16480. __pyx_t_2 = 0;
  16481. /* "fontTools/misc/bezierTools.py":996
  16482. * x2 = (bx * 0.5) + cx
  16483. * y2 = (by * 0.5) + cy
  16484. * x3 = ax + bx + cx # <<<<<<<<<<<<<<
  16485. * y3 = ay + by + cy
  16486. * return (x1, y1), (x2, y2), (x3, y3)
  16487. */
  16488. __pyx_t_2 = PyNumber_Add(__pyx_v_ax, __pyx_v_bx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 996, __pyx_L1_error)
  16489. __Pyx_GOTREF(__pyx_t_2);
  16490. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 996, __pyx_L1_error)
  16491. __Pyx_GOTREF(__pyx_t_1);
  16492. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  16493. __pyx_v_x3 = __pyx_t_1;
  16494. __pyx_t_1 = 0;
  16495. /* "fontTools/misc/bezierTools.py":997
  16496. * y2 = (by * 0.5) + cy
  16497. * x3 = ax + bx + cx
  16498. * y3 = ay + by + cy # <<<<<<<<<<<<<<
  16499. * return (x1, y1), (x2, y2), (x3, y3)
  16500. *
  16501. */
  16502. __pyx_t_1 = PyNumber_Add(__pyx_v_ay, __pyx_v_by); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 997, __pyx_L1_error)
  16503. __Pyx_GOTREF(__pyx_t_1);
  16504. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_cy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 997, __pyx_L1_error)
  16505. __Pyx_GOTREF(__pyx_t_2);
  16506. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16507. __pyx_v_y3 = __pyx_t_2;
  16508. __pyx_t_2 = 0;
  16509. /* "fontTools/misc/bezierTools.py":998
  16510. * x3 = ax + bx + cx
  16511. * y3 = ay + by + cy
  16512. * return (x1, y1), (x2, y2), (x3, y3) # <<<<<<<<<<<<<<
  16513. *
  16514. *
  16515. */
  16516. __Pyx_XDECREF(__pyx_r);
  16517. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 998, __pyx_L1_error)
  16518. __Pyx_GOTREF(__pyx_t_2);
  16519. __Pyx_INCREF(__pyx_v_x1);
  16520. __Pyx_GIVEREF(__pyx_v_x1);
  16521. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x1) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16522. __Pyx_INCREF(__pyx_v_y1);
  16523. __Pyx_GIVEREF(__pyx_v_y1);
  16524. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y1) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16525. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 998, __pyx_L1_error)
  16526. __Pyx_GOTREF(__pyx_t_1);
  16527. __Pyx_INCREF(__pyx_v_x2);
  16528. __Pyx_GIVEREF(__pyx_v_x2);
  16529. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x2) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16530. __Pyx_INCREF(__pyx_v_y2);
  16531. __Pyx_GIVEREF(__pyx_v_y2);
  16532. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y2) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16533. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 998, __pyx_L1_error)
  16534. __Pyx_GOTREF(__pyx_t_3);
  16535. __Pyx_INCREF(__pyx_v_x3);
  16536. __Pyx_GIVEREF(__pyx_v_x3);
  16537. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x3) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16538. __Pyx_INCREF(__pyx_v_y3);
  16539. __Pyx_GIVEREF(__pyx_v_y3);
  16540. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y3) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16541. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 998, __pyx_L1_error)
  16542. __Pyx_GOTREF(__pyx_t_5);
  16543. __Pyx_GIVEREF(__pyx_t_2);
  16544. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16545. __Pyx_GIVEREF(__pyx_t_1);
  16546. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16547. __Pyx_GIVEREF(__pyx_t_3);
  16548. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16549. __pyx_t_2 = 0;
  16550. __pyx_t_1 = 0;
  16551. __pyx_t_3 = 0;
  16552. __pyx_r = __pyx_t_5;
  16553. __pyx_t_5 = 0;
  16554. goto __pyx_L0;
  16555. /* "fontTools/misc/bezierTools.py":988
  16556. *
  16557. *
  16558. * def calcQuadraticPoints(a, b, c): # <<<<<<<<<<<<<<
  16559. * ax, ay = a
  16560. * bx, by = b
  16561. */
  16562. /* function exit code */
  16563. __pyx_L1_error:;
  16564. __Pyx_XDECREF(__pyx_t_1);
  16565. __Pyx_XDECREF(__pyx_t_2);
  16566. __Pyx_XDECREF(__pyx_t_3);
  16567. __Pyx_XDECREF(__pyx_t_5);
  16568. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticPoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16569. __pyx_r = NULL;
  16570. __pyx_L0:;
  16571. __Pyx_XDECREF(__pyx_v_ax);
  16572. __Pyx_XDECREF(__pyx_v_ay);
  16573. __Pyx_XDECREF(__pyx_v_bx);
  16574. __Pyx_XDECREF(__pyx_v_by);
  16575. __Pyx_XDECREF(__pyx_v_cx);
  16576. __Pyx_XDECREF(__pyx_v_cy);
  16577. __Pyx_XDECREF(__pyx_v_x1);
  16578. __Pyx_XDECREF(__pyx_v_y1);
  16579. __Pyx_XDECREF(__pyx_v_x2);
  16580. __Pyx_XDECREF(__pyx_v_y2);
  16581. __Pyx_XDECREF(__pyx_v_x3);
  16582. __Pyx_XDECREF(__pyx_v_y3);
  16583. __Pyx_XGIVEREF(__pyx_r);
  16584. __Pyx_RefNannyFinishContext();
  16585. return __pyx_r;
  16586. }
  16587. /* "fontTools/misc/bezierTools.py":1001
  16588. *
  16589. *
  16590. * def calcCubicPoints(a, b, c, d): # <<<<<<<<<<<<<<
  16591. * ax, ay = a
  16592. * bx, by = b
  16593. */
  16594. /* Python wrapper */
  16595. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_57calcCubicPoints(PyObject *__pyx_self,
  16596. #if CYTHON_METH_FASTCALL
  16597. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  16598. #else
  16599. PyObject *__pyx_args, PyObject *__pyx_kwds
  16600. #endif
  16601. ); /*proto*/
  16602. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_56calcCubicPoints, "calcCubicPoints(a, b, c, d)");
  16603. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_57calcCubicPoints = {"calcCubicPoints", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_57calcCubicPoints, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_56calcCubicPoints};
  16604. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_57calcCubicPoints(PyObject *__pyx_self,
  16605. #if CYTHON_METH_FASTCALL
  16606. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  16607. #else
  16608. PyObject *__pyx_args, PyObject *__pyx_kwds
  16609. #endif
  16610. ) {
  16611. PyObject *__pyx_v_a = 0;
  16612. PyObject *__pyx_v_b = 0;
  16613. PyObject *__pyx_v_c = 0;
  16614. PyObject *__pyx_v_d = 0;
  16615. #if !CYTHON_METH_FASTCALL
  16616. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  16617. #endif
  16618. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  16619. PyObject* values[4] = {0,0,0,0};
  16620. int __pyx_lineno = 0;
  16621. const char *__pyx_filename = NULL;
  16622. int __pyx_clineno = 0;
  16623. PyObject *__pyx_r = 0;
  16624. __Pyx_RefNannyDeclarations
  16625. __Pyx_RefNannySetupContext("calcCubicPoints (wrapper)", 0);
  16626. #if !CYTHON_METH_FASTCALL
  16627. #if CYTHON_ASSUME_SAFE_SIZE
  16628. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  16629. #else
  16630. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  16631. #endif
  16632. #endif
  16633. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  16634. {
  16635. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_a,&__pyx_mstate_global->__pyx_n_u_b,&__pyx_mstate_global->__pyx_n_u_c,&__pyx_mstate_global->__pyx_n_u_d,0};
  16636. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  16637. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1001, __pyx_L3_error)
  16638. if (__pyx_kwds_len > 0) {
  16639. switch (__pyx_nargs) {
  16640. case 4:
  16641. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  16642. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16643. CYTHON_FALLTHROUGH;
  16644. case 3:
  16645. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  16646. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16647. CYTHON_FALLTHROUGH;
  16648. case 2:
  16649. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  16650. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16651. CYTHON_FALLTHROUGH;
  16652. case 1:
  16653. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  16654. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16655. CYTHON_FALLTHROUGH;
  16656. case 0: break;
  16657. default: goto __pyx_L5_argtuple_error;
  16658. }
  16659. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  16660. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "calcCubicPoints", 0) < (0)) __PYX_ERR(0, 1001, __pyx_L3_error)
  16661. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  16662. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcCubicPoints", 1, 4, 4, i); __PYX_ERR(0, 1001, __pyx_L3_error) }
  16663. }
  16664. } else if (unlikely(__pyx_nargs != 4)) {
  16665. goto __pyx_L5_argtuple_error;
  16666. } else {
  16667. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  16668. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16669. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  16670. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16671. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  16672. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16673. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  16674. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16675. }
  16676. __pyx_v_a = values[0];
  16677. __pyx_v_b = values[1];
  16678. __pyx_v_c = values[2];
  16679. __pyx_v_d = values[3];
  16680. }
  16681. goto __pyx_L6_skip;
  16682. __pyx_L5_argtuple_error:;
  16683. __Pyx_RaiseArgtupleInvalid("calcCubicPoints", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1001, __pyx_L3_error)
  16684. __pyx_L6_skip:;
  16685. goto __pyx_L4_argument_unpacking_done;
  16686. __pyx_L3_error:;
  16687. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  16688. Py_XDECREF(values[__pyx_temp]);
  16689. }
  16690. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicPoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16691. __Pyx_RefNannyFinishContext();
  16692. return NULL;
  16693. __pyx_L4_argument_unpacking_done:;
  16694. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_56calcCubicPoints(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_d);
  16695. /* function exit code */
  16696. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  16697. Py_XDECREF(values[__pyx_temp]);
  16698. }
  16699. __Pyx_RefNannyFinishContext();
  16700. return __pyx_r;
  16701. }
  16702. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_56calcCubicPoints(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  16703. PyObject *__pyx_v_ax = NULL;
  16704. PyObject *__pyx_v_ay = NULL;
  16705. PyObject *__pyx_v_bx = NULL;
  16706. PyObject *__pyx_v_by = NULL;
  16707. PyObject *__pyx_v_cx = NULL;
  16708. PyObject *__pyx_v_cy = NULL;
  16709. PyObject *__pyx_v_dx = NULL;
  16710. PyObject *__pyx_v_dy = NULL;
  16711. PyObject *__pyx_v_x1 = NULL;
  16712. PyObject *__pyx_v_y1 = NULL;
  16713. PyObject *__pyx_v_x2 = NULL;
  16714. PyObject *__pyx_v_y2 = NULL;
  16715. PyObject *__pyx_v_x3 = NULL;
  16716. PyObject *__pyx_v_y3 = NULL;
  16717. PyObject *__pyx_v_x4 = NULL;
  16718. PyObject *__pyx_v_y4 = NULL;
  16719. PyObject *__pyx_r = NULL;
  16720. __Pyx_RefNannyDeclarations
  16721. PyObject *__pyx_t_1 = NULL;
  16722. PyObject *__pyx_t_2 = NULL;
  16723. PyObject *__pyx_t_3 = NULL;
  16724. PyObject *(*__pyx_t_4)(PyObject *);
  16725. PyObject *__pyx_t_5 = NULL;
  16726. PyObject *__pyx_t_6 = NULL;
  16727. int __pyx_lineno = 0;
  16728. const char *__pyx_filename = NULL;
  16729. int __pyx_clineno = 0;
  16730. __Pyx_RefNannySetupContext("calcCubicPoints", 0);
  16731. /* "fontTools/misc/bezierTools.py":1002
  16732. *
  16733. * def calcCubicPoints(a, b, c, d):
  16734. * ax, ay = a # <<<<<<<<<<<<<<
  16735. * bx, by = b
  16736. * cx, cy = c
  16737. */
  16738. if ((likely(PyTuple_CheckExact(__pyx_v_a))) || (PyList_CheckExact(__pyx_v_a))) {
  16739. PyObject* sequence = __pyx_v_a;
  16740. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16741. if (unlikely(size != 2)) {
  16742. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16743. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16744. __PYX_ERR(0, 1002, __pyx_L1_error)
  16745. }
  16746. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16747. if (likely(PyTuple_CheckExact(sequence))) {
  16748. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  16749. __Pyx_INCREF(__pyx_t_1);
  16750. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  16751. __Pyx_INCREF(__pyx_t_2);
  16752. } else {
  16753. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16754. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16755. __Pyx_XGOTREF(__pyx_t_1);
  16756. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16757. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16758. __Pyx_XGOTREF(__pyx_t_2);
  16759. }
  16760. #else
  16761. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16762. __Pyx_GOTREF(__pyx_t_1);
  16763. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16764. __Pyx_GOTREF(__pyx_t_2);
  16765. #endif
  16766. } else {
  16767. Py_ssize_t index = -1;
  16768. __pyx_t_3 = PyObject_GetIter(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16769. __Pyx_GOTREF(__pyx_t_3);
  16770. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16771. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  16772. __Pyx_GOTREF(__pyx_t_1);
  16773. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  16774. __Pyx_GOTREF(__pyx_t_2);
  16775. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16776. __pyx_t_4 = NULL;
  16777. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16778. goto __pyx_L4_unpacking_done;
  16779. __pyx_L3_unpacking_failed:;
  16780. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16781. __pyx_t_4 = NULL;
  16782. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16783. __PYX_ERR(0, 1002, __pyx_L1_error)
  16784. __pyx_L4_unpacking_done:;
  16785. }
  16786. __pyx_v_ax = __pyx_t_1;
  16787. __pyx_t_1 = 0;
  16788. __pyx_v_ay = __pyx_t_2;
  16789. __pyx_t_2 = 0;
  16790. /* "fontTools/misc/bezierTools.py":1003
  16791. * def calcCubicPoints(a, b, c, d):
  16792. * ax, ay = a
  16793. * bx, by = b # <<<<<<<<<<<<<<
  16794. * cx, cy = c
  16795. * dx, dy = d
  16796. */
  16797. if ((likely(PyTuple_CheckExact(__pyx_v_b))) || (PyList_CheckExact(__pyx_v_b))) {
  16798. PyObject* sequence = __pyx_v_b;
  16799. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16800. if (unlikely(size != 2)) {
  16801. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16802. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16803. __PYX_ERR(0, 1003, __pyx_L1_error)
  16804. }
  16805. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16806. if (likely(PyTuple_CheckExact(sequence))) {
  16807. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  16808. __Pyx_INCREF(__pyx_t_2);
  16809. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  16810. __Pyx_INCREF(__pyx_t_1);
  16811. } else {
  16812. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16813. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16814. __Pyx_XGOTREF(__pyx_t_2);
  16815. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16816. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16817. __Pyx_XGOTREF(__pyx_t_1);
  16818. }
  16819. #else
  16820. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16821. __Pyx_GOTREF(__pyx_t_2);
  16822. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16823. __Pyx_GOTREF(__pyx_t_1);
  16824. #endif
  16825. } else {
  16826. Py_ssize_t index = -1;
  16827. __pyx_t_3 = PyObject_GetIter(__pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16828. __Pyx_GOTREF(__pyx_t_3);
  16829. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16830. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  16831. __Pyx_GOTREF(__pyx_t_2);
  16832. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  16833. __Pyx_GOTREF(__pyx_t_1);
  16834. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16835. __pyx_t_4 = NULL;
  16836. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16837. goto __pyx_L6_unpacking_done;
  16838. __pyx_L5_unpacking_failed:;
  16839. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16840. __pyx_t_4 = NULL;
  16841. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16842. __PYX_ERR(0, 1003, __pyx_L1_error)
  16843. __pyx_L6_unpacking_done:;
  16844. }
  16845. __pyx_v_bx = __pyx_t_2;
  16846. __pyx_t_2 = 0;
  16847. __pyx_v_by = __pyx_t_1;
  16848. __pyx_t_1 = 0;
  16849. /* "fontTools/misc/bezierTools.py":1004
  16850. * ax, ay = a
  16851. * bx, by = b
  16852. * cx, cy = c # <<<<<<<<<<<<<<
  16853. * dx, dy = d
  16854. * x1 = dx
  16855. */
  16856. if ((likely(PyTuple_CheckExact(__pyx_v_c))) || (PyList_CheckExact(__pyx_v_c))) {
  16857. PyObject* sequence = __pyx_v_c;
  16858. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16859. if (unlikely(size != 2)) {
  16860. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16861. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16862. __PYX_ERR(0, 1004, __pyx_L1_error)
  16863. }
  16864. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16865. if (likely(PyTuple_CheckExact(sequence))) {
  16866. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  16867. __Pyx_INCREF(__pyx_t_1);
  16868. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  16869. __Pyx_INCREF(__pyx_t_2);
  16870. } else {
  16871. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16872. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16873. __Pyx_XGOTREF(__pyx_t_1);
  16874. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16875. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16876. __Pyx_XGOTREF(__pyx_t_2);
  16877. }
  16878. #else
  16879. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16880. __Pyx_GOTREF(__pyx_t_1);
  16881. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16882. __Pyx_GOTREF(__pyx_t_2);
  16883. #endif
  16884. } else {
  16885. Py_ssize_t index = -1;
  16886. __pyx_t_3 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16887. __Pyx_GOTREF(__pyx_t_3);
  16888. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16889. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  16890. __Pyx_GOTREF(__pyx_t_1);
  16891. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  16892. __Pyx_GOTREF(__pyx_t_2);
  16893. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16894. __pyx_t_4 = NULL;
  16895. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16896. goto __pyx_L8_unpacking_done;
  16897. __pyx_L7_unpacking_failed:;
  16898. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16899. __pyx_t_4 = NULL;
  16900. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16901. __PYX_ERR(0, 1004, __pyx_L1_error)
  16902. __pyx_L8_unpacking_done:;
  16903. }
  16904. __pyx_v_cx = __pyx_t_1;
  16905. __pyx_t_1 = 0;
  16906. __pyx_v_cy = __pyx_t_2;
  16907. __pyx_t_2 = 0;
  16908. /* "fontTools/misc/bezierTools.py":1005
  16909. * bx, by = b
  16910. * cx, cy = c
  16911. * dx, dy = d # <<<<<<<<<<<<<<
  16912. * x1 = dx
  16913. * y1 = dy
  16914. */
  16915. if ((likely(PyTuple_CheckExact(__pyx_v_d))) || (PyList_CheckExact(__pyx_v_d))) {
  16916. PyObject* sequence = __pyx_v_d;
  16917. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16918. if (unlikely(size != 2)) {
  16919. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16920. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16921. __PYX_ERR(0, 1005, __pyx_L1_error)
  16922. }
  16923. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16924. if (likely(PyTuple_CheckExact(sequence))) {
  16925. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  16926. __Pyx_INCREF(__pyx_t_2);
  16927. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  16928. __Pyx_INCREF(__pyx_t_1);
  16929. } else {
  16930. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16931. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16932. __Pyx_XGOTREF(__pyx_t_2);
  16933. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16934. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16935. __Pyx_XGOTREF(__pyx_t_1);
  16936. }
  16937. #else
  16938. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16939. __Pyx_GOTREF(__pyx_t_2);
  16940. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16941. __Pyx_GOTREF(__pyx_t_1);
  16942. #endif
  16943. } else {
  16944. Py_ssize_t index = -1;
  16945. __pyx_t_3 = PyObject_GetIter(__pyx_v_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16946. __Pyx_GOTREF(__pyx_t_3);
  16947. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16948. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
  16949. __Pyx_GOTREF(__pyx_t_2);
  16950. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
  16951. __Pyx_GOTREF(__pyx_t_1);
  16952. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16953. __pyx_t_4 = NULL;
  16954. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16955. goto __pyx_L10_unpacking_done;
  16956. __pyx_L9_unpacking_failed:;
  16957. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16958. __pyx_t_4 = NULL;
  16959. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16960. __PYX_ERR(0, 1005, __pyx_L1_error)
  16961. __pyx_L10_unpacking_done:;
  16962. }
  16963. __pyx_v_dx = __pyx_t_2;
  16964. __pyx_t_2 = 0;
  16965. __pyx_v_dy = __pyx_t_1;
  16966. __pyx_t_1 = 0;
  16967. /* "fontTools/misc/bezierTools.py":1006
  16968. * cx, cy = c
  16969. * dx, dy = d
  16970. * x1 = dx # <<<<<<<<<<<<<<
  16971. * y1 = dy
  16972. * x2 = (cx / 3.0) + dx
  16973. */
  16974. __Pyx_INCREF(__pyx_v_dx);
  16975. __pyx_v_x1 = __pyx_v_dx;
  16976. /* "fontTools/misc/bezierTools.py":1007
  16977. * dx, dy = d
  16978. * x1 = dx
  16979. * y1 = dy # <<<<<<<<<<<<<<
  16980. * x2 = (cx / 3.0) + dx
  16981. * y2 = (cy / 3.0) + dy
  16982. */
  16983. __Pyx_INCREF(__pyx_v_dy);
  16984. __pyx_v_y1 = __pyx_v_dy;
  16985. /* "fontTools/misc/bezierTools.py":1008
  16986. * x1 = dx
  16987. * y1 = dy
  16988. * x2 = (cx / 3.0) + dx # <<<<<<<<<<<<<<
  16989. * y2 = (cy / 3.0) + dy
  16990. * x3 = (bx + cx) / 3.0 + x2
  16991. */
  16992. __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_cx, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1008, __pyx_L1_error)
  16993. __Pyx_GOTREF(__pyx_t_1);
  16994. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_dx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1008, __pyx_L1_error)
  16995. __Pyx_GOTREF(__pyx_t_2);
  16996. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16997. __pyx_v_x2 = __pyx_t_2;
  16998. __pyx_t_2 = 0;
  16999. /* "fontTools/misc/bezierTools.py":1009
  17000. * y1 = dy
  17001. * x2 = (cx / 3.0) + dx
  17002. * y2 = (cy / 3.0) + dy # <<<<<<<<<<<<<<
  17003. * x3 = (bx + cx) / 3.0 + x2
  17004. * y3 = (by + cy) / 3.0 + y2
  17005. */
  17006. __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_cy, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1009, __pyx_L1_error)
  17007. __Pyx_GOTREF(__pyx_t_2);
  17008. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_dy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1009, __pyx_L1_error)
  17009. __Pyx_GOTREF(__pyx_t_1);
  17010. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17011. __pyx_v_y2 = __pyx_t_1;
  17012. __pyx_t_1 = 0;
  17013. /* "fontTools/misc/bezierTools.py":1010
  17014. * x2 = (cx / 3.0) + dx
  17015. * y2 = (cy / 3.0) + dy
  17016. * x3 = (bx + cx) / 3.0 + x2 # <<<<<<<<<<<<<<
  17017. * y3 = (by + cy) / 3.0 + y2
  17018. * x4 = ax + dx + cx + bx
  17019. */
  17020. __pyx_t_1 = PyNumber_Add(__pyx_v_bx, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error)
  17021. __Pyx_GOTREF(__pyx_t_1);
  17022. __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1010, __pyx_L1_error)
  17023. __Pyx_GOTREF(__pyx_t_2);
  17024. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17025. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_x2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error)
  17026. __Pyx_GOTREF(__pyx_t_1);
  17027. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17028. __pyx_v_x3 = __pyx_t_1;
  17029. __pyx_t_1 = 0;
  17030. /* "fontTools/misc/bezierTools.py":1011
  17031. * y2 = (cy / 3.0) + dy
  17032. * x3 = (bx + cx) / 3.0 + x2
  17033. * y3 = (by + cy) / 3.0 + y2 # <<<<<<<<<<<<<<
  17034. * x4 = ax + dx + cx + bx
  17035. * y4 = ay + dy + cy + by
  17036. */
  17037. __pyx_t_1 = PyNumber_Add(__pyx_v_by, __pyx_v_cy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1011, __pyx_L1_error)
  17038. __Pyx_GOTREF(__pyx_t_1);
  17039. __pyx_t_2 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_1, __pyx_mstate_global->__pyx_float_3_0, 3.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1011, __pyx_L1_error)
  17040. __Pyx_GOTREF(__pyx_t_2);
  17041. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17042. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_y2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1011, __pyx_L1_error)
  17043. __Pyx_GOTREF(__pyx_t_1);
  17044. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17045. __pyx_v_y3 = __pyx_t_1;
  17046. __pyx_t_1 = 0;
  17047. /* "fontTools/misc/bezierTools.py":1012
  17048. * x3 = (bx + cx) / 3.0 + x2
  17049. * y3 = (by + cy) / 3.0 + y2
  17050. * x4 = ax + dx + cx + bx # <<<<<<<<<<<<<<
  17051. * y4 = ay + dy + cy + by
  17052. * return (x1, y1), (x2, y2), (x3, y3), (x4, y4)
  17053. */
  17054. __pyx_t_1 = PyNumber_Add(__pyx_v_ax, __pyx_v_dx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1012, __pyx_L1_error)
  17055. __Pyx_GOTREF(__pyx_t_1);
  17056. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1012, __pyx_L1_error)
  17057. __Pyx_GOTREF(__pyx_t_2);
  17058. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17059. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1012, __pyx_L1_error)
  17060. __Pyx_GOTREF(__pyx_t_1);
  17061. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17062. __pyx_v_x4 = __pyx_t_1;
  17063. __pyx_t_1 = 0;
  17064. /* "fontTools/misc/bezierTools.py":1013
  17065. * y3 = (by + cy) / 3.0 + y2
  17066. * x4 = ax + dx + cx + bx
  17067. * y4 = ay + dy + cy + by # <<<<<<<<<<<<<<
  17068. * return (x1, y1), (x2, y2), (x3, y3), (x4, y4)
  17069. *
  17070. */
  17071. __pyx_t_1 = PyNumber_Add(__pyx_v_ay, __pyx_v_dy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1013, __pyx_L1_error)
  17072. __Pyx_GOTREF(__pyx_t_1);
  17073. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_cy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
  17074. __Pyx_GOTREF(__pyx_t_2);
  17075. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17076. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_by); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1013, __pyx_L1_error)
  17077. __Pyx_GOTREF(__pyx_t_1);
  17078. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17079. __pyx_v_y4 = __pyx_t_1;
  17080. __pyx_t_1 = 0;
  17081. /* "fontTools/misc/bezierTools.py":1014
  17082. * x4 = ax + dx + cx + bx
  17083. * y4 = ay + dy + cy + by
  17084. * return (x1, y1), (x2, y2), (x3, y3), (x4, y4) # <<<<<<<<<<<<<<
  17085. *
  17086. *
  17087. */
  17088. __Pyx_XDECREF(__pyx_r);
  17089. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1014, __pyx_L1_error)
  17090. __Pyx_GOTREF(__pyx_t_1);
  17091. __Pyx_INCREF(__pyx_v_x1);
  17092. __Pyx_GIVEREF(__pyx_v_x1);
  17093. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x1) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17094. __Pyx_INCREF(__pyx_v_y1);
  17095. __Pyx_GIVEREF(__pyx_v_y1);
  17096. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y1) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17097. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1014, __pyx_L1_error)
  17098. __Pyx_GOTREF(__pyx_t_2);
  17099. __Pyx_INCREF(__pyx_v_x2);
  17100. __Pyx_GIVEREF(__pyx_v_x2);
  17101. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x2) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17102. __Pyx_INCREF(__pyx_v_y2);
  17103. __Pyx_GIVEREF(__pyx_v_y2);
  17104. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y2) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17105. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1014, __pyx_L1_error)
  17106. __Pyx_GOTREF(__pyx_t_3);
  17107. __Pyx_INCREF(__pyx_v_x3);
  17108. __Pyx_GIVEREF(__pyx_v_x3);
  17109. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x3) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17110. __Pyx_INCREF(__pyx_v_y3);
  17111. __Pyx_GIVEREF(__pyx_v_y3);
  17112. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y3) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17113. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1014, __pyx_L1_error)
  17114. __Pyx_GOTREF(__pyx_t_5);
  17115. __Pyx_INCREF(__pyx_v_x4);
  17116. __Pyx_GIVEREF(__pyx_v_x4);
  17117. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_x4) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17118. __Pyx_INCREF(__pyx_v_y4);
  17119. __Pyx_GIVEREF(__pyx_v_y4);
  17120. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_y4) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17121. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1014, __pyx_L1_error)
  17122. __Pyx_GOTREF(__pyx_t_6);
  17123. __Pyx_GIVEREF(__pyx_t_1);
  17124. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17125. __Pyx_GIVEREF(__pyx_t_2);
  17126. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17127. __Pyx_GIVEREF(__pyx_t_3);
  17128. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17129. __Pyx_GIVEREF(__pyx_t_5);
  17130. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17131. __pyx_t_1 = 0;
  17132. __pyx_t_2 = 0;
  17133. __pyx_t_3 = 0;
  17134. __pyx_t_5 = 0;
  17135. __pyx_r = __pyx_t_6;
  17136. __pyx_t_6 = 0;
  17137. goto __pyx_L0;
  17138. /* "fontTools/misc/bezierTools.py":1001
  17139. *
  17140. *
  17141. * def calcCubicPoints(a, b, c, d): # <<<<<<<<<<<<<<
  17142. * ax, ay = a
  17143. * bx, by = b
  17144. */
  17145. /* function exit code */
  17146. __pyx_L1_error:;
  17147. __Pyx_XDECREF(__pyx_t_1);
  17148. __Pyx_XDECREF(__pyx_t_2);
  17149. __Pyx_XDECREF(__pyx_t_3);
  17150. __Pyx_XDECREF(__pyx_t_5);
  17151. __Pyx_XDECREF(__pyx_t_6);
  17152. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicPoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17153. __pyx_r = NULL;
  17154. __pyx_L0:;
  17155. __Pyx_XDECREF(__pyx_v_ax);
  17156. __Pyx_XDECREF(__pyx_v_ay);
  17157. __Pyx_XDECREF(__pyx_v_bx);
  17158. __Pyx_XDECREF(__pyx_v_by);
  17159. __Pyx_XDECREF(__pyx_v_cx);
  17160. __Pyx_XDECREF(__pyx_v_cy);
  17161. __Pyx_XDECREF(__pyx_v_dx);
  17162. __Pyx_XDECREF(__pyx_v_dy);
  17163. __Pyx_XDECREF(__pyx_v_x1);
  17164. __Pyx_XDECREF(__pyx_v_y1);
  17165. __Pyx_XDECREF(__pyx_v_x2);
  17166. __Pyx_XDECREF(__pyx_v_y2);
  17167. __Pyx_XDECREF(__pyx_v_x3);
  17168. __Pyx_XDECREF(__pyx_v_y3);
  17169. __Pyx_XDECREF(__pyx_v_x4);
  17170. __Pyx_XDECREF(__pyx_v_y4);
  17171. __Pyx_XGIVEREF(__pyx_r);
  17172. __Pyx_RefNannyFinishContext();
  17173. return __pyx_r;
  17174. }
  17175. /* "fontTools/misc/bezierTools.py":1017
  17176. *
  17177. *
  17178. * @cython.cfunc # <<<<<<<<<<<<<<
  17179. * @cython.inline
  17180. * @cython.locals(
  17181. */
  17182. static CYTHON_INLINE PyObject *__pyx_f_9fontTools_4misc_11bezierTools_calcCubicPointsC(__pyx_t_double_complex __pyx_v_a, __pyx_t_double_complex __pyx_v_b, __pyx_t_double_complex __pyx_v_c, __pyx_t_double_complex __pyx_v_d) {
  17183. __pyx_t_double_complex __pyx_v_p2;
  17184. __pyx_t_double_complex __pyx_v_p3;
  17185. __pyx_t_double_complex __pyx_v_p4;
  17186. PyObject *__pyx_r = NULL;
  17187. __Pyx_RefNannyDeclarations
  17188. PyObject *__pyx_t_1 = NULL;
  17189. PyObject *__pyx_t_2 = NULL;
  17190. PyObject *__pyx_t_3 = NULL;
  17191. PyObject *__pyx_t_4 = NULL;
  17192. PyObject *__pyx_t_5 = NULL;
  17193. int __pyx_lineno = 0;
  17194. const char *__pyx_filename = NULL;
  17195. int __pyx_clineno = 0;
  17196. __Pyx_RefNannySetupContext("calcCubicPointsC", 0);
  17197. /* "fontTools/misc/bezierTools.py":1029
  17198. * )
  17199. * def calcCubicPointsC(a, b, c, d):
  17200. * p2 = c * (1 / 3) + d # <<<<<<<<<<<<<<
  17201. * p3 = (b + c) * (1 / 3) + p2
  17202. * p4 = a + b + c + d
  17203. */
  17204. __pyx_v_p2 = __Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_v_c, __pyx_t_double_complex_from_parts((1.0 / 3.0), 0)), __pyx_v_d);
  17205. /* "fontTools/misc/bezierTools.py":1030
  17206. * def calcCubicPointsC(a, b, c, d):
  17207. * p2 = c * (1 / 3) + d
  17208. * p3 = (b + c) * (1 / 3) + p2 # <<<<<<<<<<<<<<
  17209. * p4 = a + b + c + d
  17210. * return (d, p2, p3, p4)
  17211. */
  17212. __pyx_v_p3 = __Pyx_c_sum_double(__Pyx_c_prod_double(__Pyx_c_sum_double(__pyx_v_b, __pyx_v_c), __pyx_t_double_complex_from_parts((1.0 / 3.0), 0)), __pyx_v_p2);
  17213. /* "fontTools/misc/bezierTools.py":1031
  17214. * p2 = c * (1 / 3) + d
  17215. * p3 = (b + c) * (1 / 3) + p2
  17216. * p4 = a + b + c + d # <<<<<<<<<<<<<<
  17217. * return (d, p2, p3, p4)
  17218. *
  17219. */
  17220. __pyx_v_p4 = __Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_sum_double(__pyx_v_a, __pyx_v_b), __pyx_v_c), __pyx_v_d);
  17221. /* "fontTools/misc/bezierTools.py":1032
  17222. * p3 = (b + c) * (1 / 3) + p2
  17223. * p4 = a + b + c + d
  17224. * return (d, p2, p3, p4) # <<<<<<<<<<<<<<
  17225. *
  17226. *
  17227. */
  17228. __Pyx_XDECREF(__pyx_r);
  17229. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1032, __pyx_L1_error)
  17230. __Pyx_GOTREF(__pyx_t_1);
  17231. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_v_p2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
  17232. __Pyx_GOTREF(__pyx_t_2);
  17233. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_v_p3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1032, __pyx_L1_error)
  17234. __Pyx_GOTREF(__pyx_t_3);
  17235. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_v_p4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1032, __pyx_L1_error)
  17236. __Pyx_GOTREF(__pyx_t_4);
  17237. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L1_error)
  17238. __Pyx_GOTREF(__pyx_t_5);
  17239. __Pyx_GIVEREF(__pyx_t_1);
  17240. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1032, __pyx_L1_error);
  17241. __Pyx_GIVEREF(__pyx_t_2);
  17242. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1032, __pyx_L1_error);
  17243. __Pyx_GIVEREF(__pyx_t_3);
  17244. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 1032, __pyx_L1_error);
  17245. __Pyx_GIVEREF(__pyx_t_4);
  17246. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 1032, __pyx_L1_error);
  17247. __pyx_t_1 = 0;
  17248. __pyx_t_2 = 0;
  17249. __pyx_t_3 = 0;
  17250. __pyx_t_4 = 0;
  17251. __pyx_r = __pyx_t_5;
  17252. __pyx_t_5 = 0;
  17253. goto __pyx_L0;
  17254. /* "fontTools/misc/bezierTools.py":1017
  17255. *
  17256. *
  17257. * @cython.cfunc # <<<<<<<<<<<<<<
  17258. * @cython.inline
  17259. * @cython.locals(
  17260. */
  17261. /* function exit code */
  17262. __pyx_L1_error:;
  17263. __Pyx_XDECREF(__pyx_t_1);
  17264. __Pyx_XDECREF(__pyx_t_2);
  17265. __Pyx_XDECREF(__pyx_t_3);
  17266. __Pyx_XDECREF(__pyx_t_4);
  17267. __Pyx_XDECREF(__pyx_t_5);
  17268. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicPointsC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17269. __pyx_r = 0;
  17270. __pyx_L0:;
  17271. __Pyx_XGIVEREF(__pyx_r);
  17272. __Pyx_RefNannyFinishContext();
  17273. return __pyx_r;
  17274. }
  17275. /* "fontTools/misc/bezierTools.py":1040
  17276. *
  17277. *
  17278. * def linePointAtT(pt1, pt2, t): # <<<<<<<<<<<<<<
  17279. * """Finds the point at time `t` on a line.
  17280. *
  17281. */
  17282. /* Python wrapper */
  17283. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_59linePointAtT(PyObject *__pyx_self,
  17284. #if CYTHON_METH_FASTCALL
  17285. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  17286. #else
  17287. PyObject *__pyx_args, PyObject *__pyx_kwds
  17288. #endif
  17289. ); /*proto*/
  17290. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_58linePointAtT, "linePointAtT(pt1, pt2, t)\n\nFinds the point at time `t` on a line.\n\nArgs:\n pt1, pt2: Coordinates of the line as 2D tuples.\n t: The time along the line.\n\nReturns:\n A 2D tuple with the coordinates of the point.");
  17291. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_59linePointAtT = {"linePointAtT", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_59linePointAtT, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_58linePointAtT};
  17292. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_59linePointAtT(PyObject *__pyx_self,
  17293. #if CYTHON_METH_FASTCALL
  17294. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  17295. #else
  17296. PyObject *__pyx_args, PyObject *__pyx_kwds
  17297. #endif
  17298. ) {
  17299. PyObject *__pyx_v_pt1 = 0;
  17300. PyObject *__pyx_v_pt2 = 0;
  17301. PyObject *__pyx_v_t = 0;
  17302. #if !CYTHON_METH_FASTCALL
  17303. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  17304. #endif
  17305. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  17306. PyObject* values[3] = {0,0,0};
  17307. int __pyx_lineno = 0;
  17308. const char *__pyx_filename = NULL;
  17309. int __pyx_clineno = 0;
  17310. PyObject *__pyx_r = 0;
  17311. __Pyx_RefNannyDeclarations
  17312. __Pyx_RefNannySetupContext("linePointAtT (wrapper)", 0);
  17313. #if !CYTHON_METH_FASTCALL
  17314. #if CYTHON_ASSUME_SAFE_SIZE
  17315. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  17316. #else
  17317. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  17318. #endif
  17319. #endif
  17320. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  17321. {
  17322. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_t,0};
  17323. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  17324. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1040, __pyx_L3_error)
  17325. if (__pyx_kwds_len > 0) {
  17326. switch (__pyx_nargs) {
  17327. case 3:
  17328. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17329. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17330. CYTHON_FALLTHROUGH;
  17331. case 2:
  17332. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17333. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17334. CYTHON_FALLTHROUGH;
  17335. case 1:
  17336. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17337. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17338. CYTHON_FALLTHROUGH;
  17339. case 0: break;
  17340. default: goto __pyx_L5_argtuple_error;
  17341. }
  17342. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  17343. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "linePointAtT", 0) < (0)) __PYX_ERR(0, 1040, __pyx_L3_error)
  17344. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  17345. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("linePointAtT", 1, 3, 3, i); __PYX_ERR(0, 1040, __pyx_L3_error) }
  17346. }
  17347. } else if (unlikely(__pyx_nargs != 3)) {
  17348. goto __pyx_L5_argtuple_error;
  17349. } else {
  17350. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17351. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17352. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17353. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17354. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17355. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17356. }
  17357. __pyx_v_pt1 = values[0];
  17358. __pyx_v_pt2 = values[1];
  17359. __pyx_v_t = values[2];
  17360. }
  17361. goto __pyx_L6_skip;
  17362. __pyx_L5_argtuple_error:;
  17363. __Pyx_RaiseArgtupleInvalid("linePointAtT", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1040, __pyx_L3_error)
  17364. __pyx_L6_skip:;
  17365. goto __pyx_L4_argument_unpacking_done;
  17366. __pyx_L3_error:;
  17367. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  17368. Py_XDECREF(values[__pyx_temp]);
  17369. }
  17370. __Pyx_AddTraceback("fontTools.misc.bezierTools.linePointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17371. __Pyx_RefNannyFinishContext();
  17372. return NULL;
  17373. __pyx_L4_argument_unpacking_done:;
  17374. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_58linePointAtT(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_t);
  17375. /* function exit code */
  17376. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  17377. Py_XDECREF(values[__pyx_temp]);
  17378. }
  17379. __Pyx_RefNannyFinishContext();
  17380. return __pyx_r;
  17381. }
  17382. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_58linePointAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_t) {
  17383. PyObject *__pyx_r = NULL;
  17384. __Pyx_RefNannyDeclarations
  17385. PyObject *__pyx_t_1 = NULL;
  17386. PyObject *__pyx_t_2 = NULL;
  17387. PyObject *__pyx_t_3 = NULL;
  17388. PyObject *__pyx_t_4 = NULL;
  17389. int __pyx_lineno = 0;
  17390. const char *__pyx_filename = NULL;
  17391. int __pyx_clineno = 0;
  17392. __Pyx_RefNannySetupContext("linePointAtT", 0);
  17393. /* "fontTools/misc/bezierTools.py":1050
  17394. * A 2D tuple with the coordinates of the point.
  17395. * """
  17396. * return ((pt1[0] * (1 - t) + pt2[0] * t), (pt1[1] * (1 - t) + pt2[1] * t)) # <<<<<<<<<<<<<<
  17397. *
  17398. *
  17399. */
  17400. __Pyx_XDECREF(__pyx_r);
  17401. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17402. __Pyx_GOTREF(__pyx_t_1);
  17403. __pyx_t_2 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_t, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17404. __Pyx_GOTREF(__pyx_t_2);
  17405. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17406. __Pyx_GOTREF(__pyx_t_3);
  17407. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17408. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17409. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17410. __Pyx_GOTREF(__pyx_t_2);
  17411. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17412. __Pyx_GOTREF(__pyx_t_1);
  17413. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17414. __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17415. __Pyx_GOTREF(__pyx_t_2);
  17416. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17417. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17418. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17419. __Pyx_GOTREF(__pyx_t_1);
  17420. __pyx_t_3 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_t, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17421. __Pyx_GOTREF(__pyx_t_3);
  17422. __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17423. __Pyx_GOTREF(__pyx_t_4);
  17424. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17425. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17426. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pt2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17427. __Pyx_GOTREF(__pyx_t_3);
  17428. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_v_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17429. __Pyx_GOTREF(__pyx_t_1);
  17430. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17431. __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17432. __Pyx_GOTREF(__pyx_t_3);
  17433. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17434. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17435. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17436. __Pyx_GOTREF(__pyx_t_1);
  17437. __Pyx_GIVEREF(__pyx_t_2);
  17438. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1050, __pyx_L1_error);
  17439. __Pyx_GIVEREF(__pyx_t_3);
  17440. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 1050, __pyx_L1_error);
  17441. __pyx_t_2 = 0;
  17442. __pyx_t_3 = 0;
  17443. __pyx_r = __pyx_t_1;
  17444. __pyx_t_1 = 0;
  17445. goto __pyx_L0;
  17446. /* "fontTools/misc/bezierTools.py":1040
  17447. *
  17448. *
  17449. * def linePointAtT(pt1, pt2, t): # <<<<<<<<<<<<<<
  17450. * """Finds the point at time `t` on a line.
  17451. *
  17452. */
  17453. /* function exit code */
  17454. __pyx_L1_error:;
  17455. __Pyx_XDECREF(__pyx_t_1);
  17456. __Pyx_XDECREF(__pyx_t_2);
  17457. __Pyx_XDECREF(__pyx_t_3);
  17458. __Pyx_XDECREF(__pyx_t_4);
  17459. __Pyx_AddTraceback("fontTools.misc.bezierTools.linePointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17460. __pyx_r = NULL;
  17461. __pyx_L0:;
  17462. __Pyx_XGIVEREF(__pyx_r);
  17463. __Pyx_RefNannyFinishContext();
  17464. return __pyx_r;
  17465. }
  17466. /* "fontTools/misc/bezierTools.py":1053
  17467. *
  17468. *
  17469. * def quadraticPointAtT(pt1, pt2, pt3, t): # <<<<<<<<<<<<<<
  17470. * """Finds the point at time `t` on a quadratic curve.
  17471. *
  17472. */
  17473. /* Python wrapper */
  17474. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_61quadraticPointAtT(PyObject *__pyx_self,
  17475. #if CYTHON_METH_FASTCALL
  17476. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  17477. #else
  17478. PyObject *__pyx_args, PyObject *__pyx_kwds
  17479. #endif
  17480. ); /*proto*/
  17481. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_60quadraticPointAtT, "quadraticPointAtT(pt1, pt2, pt3, t)\n\nFinds the point at time `t` on a quadratic curve.\n\nArgs:\n pt1, pt2, pt3: Coordinates of the curve as 2D tuples.\n t: The time along the curve.\n\nReturns:\n A 2D tuple with the coordinates of the point.");
  17482. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_61quadraticPointAtT = {"quadraticPointAtT", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_61quadraticPointAtT, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_60quadraticPointAtT};
  17483. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_61quadraticPointAtT(PyObject *__pyx_self,
  17484. #if CYTHON_METH_FASTCALL
  17485. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  17486. #else
  17487. PyObject *__pyx_args, PyObject *__pyx_kwds
  17488. #endif
  17489. ) {
  17490. PyObject *__pyx_v_pt1 = 0;
  17491. PyObject *__pyx_v_pt2 = 0;
  17492. PyObject *__pyx_v_pt3 = 0;
  17493. PyObject *__pyx_v_t = 0;
  17494. #if !CYTHON_METH_FASTCALL
  17495. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  17496. #endif
  17497. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  17498. PyObject* values[4] = {0,0,0,0};
  17499. int __pyx_lineno = 0;
  17500. const char *__pyx_filename = NULL;
  17501. int __pyx_clineno = 0;
  17502. PyObject *__pyx_r = 0;
  17503. __Pyx_RefNannyDeclarations
  17504. __Pyx_RefNannySetupContext("quadraticPointAtT (wrapper)", 0);
  17505. #if !CYTHON_METH_FASTCALL
  17506. #if CYTHON_ASSUME_SAFE_SIZE
  17507. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  17508. #else
  17509. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  17510. #endif
  17511. #endif
  17512. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  17513. {
  17514. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_t,0};
  17515. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  17516. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1053, __pyx_L3_error)
  17517. if (__pyx_kwds_len > 0) {
  17518. switch (__pyx_nargs) {
  17519. case 4:
  17520. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  17521. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17522. CYTHON_FALLTHROUGH;
  17523. case 3:
  17524. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17525. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17526. CYTHON_FALLTHROUGH;
  17527. case 2:
  17528. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17529. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17530. CYTHON_FALLTHROUGH;
  17531. case 1:
  17532. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17533. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17534. CYTHON_FALLTHROUGH;
  17535. case 0: break;
  17536. default: goto __pyx_L5_argtuple_error;
  17537. }
  17538. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  17539. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "quadraticPointAtT", 0) < (0)) __PYX_ERR(0, 1053, __pyx_L3_error)
  17540. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  17541. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("quadraticPointAtT", 1, 4, 4, i); __PYX_ERR(0, 1053, __pyx_L3_error) }
  17542. }
  17543. } else if (unlikely(__pyx_nargs != 4)) {
  17544. goto __pyx_L5_argtuple_error;
  17545. } else {
  17546. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17547. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17548. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17549. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17550. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17551. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17552. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  17553. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17554. }
  17555. __pyx_v_pt1 = values[0];
  17556. __pyx_v_pt2 = values[1];
  17557. __pyx_v_pt3 = values[2];
  17558. __pyx_v_t = values[3];
  17559. }
  17560. goto __pyx_L6_skip;
  17561. __pyx_L5_argtuple_error:;
  17562. __Pyx_RaiseArgtupleInvalid("quadraticPointAtT", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1053, __pyx_L3_error)
  17563. __pyx_L6_skip:;
  17564. goto __pyx_L4_argument_unpacking_done;
  17565. __pyx_L3_error:;
  17566. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  17567. Py_XDECREF(values[__pyx_temp]);
  17568. }
  17569. __Pyx_AddTraceback("fontTools.misc.bezierTools.quadraticPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17570. __Pyx_RefNannyFinishContext();
  17571. return NULL;
  17572. __pyx_L4_argument_unpacking_done:;
  17573. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_60quadraticPointAtT(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_t);
  17574. /* function exit code */
  17575. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  17576. Py_XDECREF(values[__pyx_temp]);
  17577. }
  17578. __Pyx_RefNannyFinishContext();
  17579. return __pyx_r;
  17580. }
  17581. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_60quadraticPointAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_t) {
  17582. PyObject *__pyx_v_x = NULL;
  17583. PyObject *__pyx_v_y = NULL;
  17584. PyObject *__pyx_r = NULL;
  17585. __Pyx_RefNannyDeclarations
  17586. PyObject *__pyx_t_1 = NULL;
  17587. PyObject *__pyx_t_2 = NULL;
  17588. PyObject *__pyx_t_3 = NULL;
  17589. PyObject *__pyx_t_4 = NULL;
  17590. int __pyx_lineno = 0;
  17591. const char *__pyx_filename = NULL;
  17592. int __pyx_clineno = 0;
  17593. __Pyx_RefNannySetupContext("quadraticPointAtT", 0);
  17594. /* "fontTools/misc/bezierTools.py":1063
  17595. * A 2D tuple with the coordinates of the point.
  17596. * """
  17597. * x = (1 - t) * (1 - t) * pt1[0] + 2 * (1 - t) * t * pt2[0] + t * t * pt3[0] # <<<<<<<<<<<<<<
  17598. * y = (1 - t) * (1 - t) * pt1[1] + 2 * (1 - t) * t * pt2[1] + t * t * pt3[1]
  17599. * return (x, y)
  17600. */
  17601. __pyx_t_1 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_t, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17602. __Pyx_GOTREF(__pyx_t_1);
  17603. __pyx_t_2 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_t, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17604. __Pyx_GOTREF(__pyx_t_2);
  17605. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17606. __Pyx_GOTREF(__pyx_t_3);
  17607. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17608. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17609. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17610. __Pyx_GOTREF(__pyx_t_2);
  17611. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17612. __Pyx_GOTREF(__pyx_t_1);
  17613. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17614. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17615. __pyx_t_2 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_t, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17616. __Pyx_GOTREF(__pyx_t_2);
  17617. __pyx_t_3 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_t_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17618. __Pyx_GOTREF(__pyx_t_3);
  17619. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17620. __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17621. __Pyx_GOTREF(__pyx_t_2);
  17622. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17623. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pt2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17624. __Pyx_GOTREF(__pyx_t_3);
  17625. __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17626. __Pyx_GOTREF(__pyx_t_4);
  17627. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17628. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17629. __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17630. __Pyx_GOTREF(__pyx_t_3);
  17631. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17632. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17633. __pyx_t_4 = PyNumber_Multiply(__pyx_v_t, __pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17634. __Pyx_GOTREF(__pyx_t_4);
  17635. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt3, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17636. __Pyx_GOTREF(__pyx_t_1);
  17637. __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17638. __Pyx_GOTREF(__pyx_t_2);
  17639. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17640. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17641. __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17642. __Pyx_GOTREF(__pyx_t_1);
  17643. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17644. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17645. __pyx_v_x = __pyx_t_1;
  17646. __pyx_t_1 = 0;
  17647. /* "fontTools/misc/bezierTools.py":1064
  17648. * """
  17649. * x = (1 - t) * (1 - t) * pt1[0] + 2 * (1 - t) * t * pt2[0] + t * t * pt3[0]
  17650. * y = (1 - t) * (1 - t) * pt1[1] + 2 * (1 - t) * t * pt2[1] + t * t * pt3[1] # <<<<<<<<<<<<<<
  17651. * return (x, y)
  17652. *
  17653. */
  17654. __pyx_t_1 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_t, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17655. __Pyx_GOTREF(__pyx_t_1);
  17656. __pyx_t_2 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_t, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17657. __Pyx_GOTREF(__pyx_t_2);
  17658. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17659. __Pyx_GOTREF(__pyx_t_3);
  17660. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17661. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17662. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17663. __Pyx_GOTREF(__pyx_t_2);
  17664. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17665. __Pyx_GOTREF(__pyx_t_1);
  17666. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17667. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17668. __pyx_t_2 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_t, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17669. __Pyx_GOTREF(__pyx_t_2);
  17670. __pyx_t_3 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_2, __pyx_t_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17671. __Pyx_GOTREF(__pyx_t_3);
  17672. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17673. __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17674. __Pyx_GOTREF(__pyx_t_2);
  17675. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17676. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pt2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17677. __Pyx_GOTREF(__pyx_t_3);
  17678. __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17679. __Pyx_GOTREF(__pyx_t_4);
  17680. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17681. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17682. __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17683. __Pyx_GOTREF(__pyx_t_3);
  17684. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17685. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17686. __pyx_t_4 = PyNumber_Multiply(__pyx_v_t, __pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17687. __Pyx_GOTREF(__pyx_t_4);
  17688. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt3, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17689. __Pyx_GOTREF(__pyx_t_1);
  17690. __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17691. __Pyx_GOTREF(__pyx_t_2);
  17692. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17693. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17694. __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17695. __Pyx_GOTREF(__pyx_t_1);
  17696. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17697. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17698. __pyx_v_y = __pyx_t_1;
  17699. __pyx_t_1 = 0;
  17700. /* "fontTools/misc/bezierTools.py":1065
  17701. * x = (1 - t) * (1 - t) * pt1[0] + 2 * (1 - t) * t * pt2[0] + t * t * pt3[0]
  17702. * y = (1 - t) * (1 - t) * pt1[1] + 2 * (1 - t) * t * pt2[1] + t * t * pt3[1]
  17703. * return (x, y) # <<<<<<<<<<<<<<
  17704. *
  17705. *
  17706. */
  17707. __Pyx_XDECREF(__pyx_r);
  17708. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1065, __pyx_L1_error)
  17709. __Pyx_GOTREF(__pyx_t_1);
  17710. __Pyx_INCREF(__pyx_v_x);
  17711. __Pyx_GIVEREF(__pyx_v_x);
  17712. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1065, __pyx_L1_error);
  17713. __Pyx_INCREF(__pyx_v_y);
  17714. __Pyx_GIVEREF(__pyx_v_y);
  17715. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1065, __pyx_L1_error);
  17716. __pyx_r = __pyx_t_1;
  17717. __pyx_t_1 = 0;
  17718. goto __pyx_L0;
  17719. /* "fontTools/misc/bezierTools.py":1053
  17720. *
  17721. *
  17722. * def quadraticPointAtT(pt1, pt2, pt3, t): # <<<<<<<<<<<<<<
  17723. * """Finds the point at time `t` on a quadratic curve.
  17724. *
  17725. */
  17726. /* function exit code */
  17727. __pyx_L1_error:;
  17728. __Pyx_XDECREF(__pyx_t_1);
  17729. __Pyx_XDECREF(__pyx_t_2);
  17730. __Pyx_XDECREF(__pyx_t_3);
  17731. __Pyx_XDECREF(__pyx_t_4);
  17732. __Pyx_AddTraceback("fontTools.misc.bezierTools.quadraticPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17733. __pyx_r = NULL;
  17734. __pyx_L0:;
  17735. __Pyx_XDECREF(__pyx_v_x);
  17736. __Pyx_XDECREF(__pyx_v_y);
  17737. __Pyx_XGIVEREF(__pyx_r);
  17738. __Pyx_RefNannyFinishContext();
  17739. return __pyx_r;
  17740. }
  17741. /* "fontTools/misc/bezierTools.py":1068
  17742. *
  17743. *
  17744. * def cubicPointAtT(pt1, pt2, pt3, pt4, t): # <<<<<<<<<<<<<<
  17745. * """Finds the point at time `t` on a cubic curve.
  17746. *
  17747. */
  17748. /* Python wrapper */
  17749. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_63cubicPointAtT(PyObject *__pyx_self,
  17750. #if CYTHON_METH_FASTCALL
  17751. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  17752. #else
  17753. PyObject *__pyx_args, PyObject *__pyx_kwds
  17754. #endif
  17755. ); /*proto*/
  17756. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_62cubicPointAtT, "cubicPointAtT(pt1, pt2, pt3, pt4, t)\n\nFinds the point at time `t` on a cubic curve.\n\nArgs:\n pt1, pt2, pt3, pt4: Coordinates of the curve as 2D tuples.\n t: The time along the curve.\n\nReturns:\n A 2D tuple with the coordinates of the point.");
  17757. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_63cubicPointAtT = {"cubicPointAtT", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_63cubicPointAtT, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_62cubicPointAtT};
  17758. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_63cubicPointAtT(PyObject *__pyx_self,
  17759. #if CYTHON_METH_FASTCALL
  17760. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  17761. #else
  17762. PyObject *__pyx_args, PyObject *__pyx_kwds
  17763. #endif
  17764. ) {
  17765. PyObject *__pyx_v_pt1 = 0;
  17766. PyObject *__pyx_v_pt2 = 0;
  17767. PyObject *__pyx_v_pt3 = 0;
  17768. PyObject *__pyx_v_pt4 = 0;
  17769. PyObject *__pyx_v_t = 0;
  17770. #if !CYTHON_METH_FASTCALL
  17771. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  17772. #endif
  17773. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  17774. PyObject* values[5] = {0,0,0,0,0};
  17775. int __pyx_lineno = 0;
  17776. const char *__pyx_filename = NULL;
  17777. int __pyx_clineno = 0;
  17778. PyObject *__pyx_r = 0;
  17779. __Pyx_RefNannyDeclarations
  17780. __Pyx_RefNannySetupContext("cubicPointAtT (wrapper)", 0);
  17781. #if !CYTHON_METH_FASTCALL
  17782. #if CYTHON_ASSUME_SAFE_SIZE
  17783. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  17784. #else
  17785. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  17786. #endif
  17787. #endif
  17788. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  17789. {
  17790. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,&__pyx_mstate_global->__pyx_n_u_t,0};
  17791. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  17792. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1068, __pyx_L3_error)
  17793. if (__pyx_kwds_len > 0) {
  17794. switch (__pyx_nargs) {
  17795. case 5:
  17796. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  17797. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17798. CYTHON_FALLTHROUGH;
  17799. case 4:
  17800. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  17801. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17802. CYTHON_FALLTHROUGH;
  17803. case 3:
  17804. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17805. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17806. CYTHON_FALLTHROUGH;
  17807. case 2:
  17808. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17809. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17810. CYTHON_FALLTHROUGH;
  17811. case 1:
  17812. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17813. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17814. CYTHON_FALLTHROUGH;
  17815. case 0: break;
  17816. default: goto __pyx_L5_argtuple_error;
  17817. }
  17818. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  17819. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "cubicPointAtT", 0) < (0)) __PYX_ERR(0, 1068, __pyx_L3_error)
  17820. for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
  17821. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("cubicPointAtT", 1, 5, 5, i); __PYX_ERR(0, 1068, __pyx_L3_error) }
  17822. }
  17823. } else if (unlikely(__pyx_nargs != 5)) {
  17824. goto __pyx_L5_argtuple_error;
  17825. } else {
  17826. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17827. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17828. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17829. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17830. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17831. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17832. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  17833. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17834. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  17835. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17836. }
  17837. __pyx_v_pt1 = values[0];
  17838. __pyx_v_pt2 = values[1];
  17839. __pyx_v_pt3 = values[2];
  17840. __pyx_v_pt4 = values[3];
  17841. __pyx_v_t = values[4];
  17842. }
  17843. goto __pyx_L6_skip;
  17844. __pyx_L5_argtuple_error:;
  17845. __Pyx_RaiseArgtupleInvalid("cubicPointAtT", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1068, __pyx_L3_error)
  17846. __pyx_L6_skip:;
  17847. goto __pyx_L4_argument_unpacking_done;
  17848. __pyx_L3_error:;
  17849. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  17850. Py_XDECREF(values[__pyx_temp]);
  17851. }
  17852. __Pyx_AddTraceback("fontTools.misc.bezierTools.cubicPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17853. __Pyx_RefNannyFinishContext();
  17854. return NULL;
  17855. __pyx_L4_argument_unpacking_done:;
  17856. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_62cubicPointAtT(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4, __pyx_v_t);
  17857. /* function exit code */
  17858. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  17859. Py_XDECREF(values[__pyx_temp]);
  17860. }
  17861. __Pyx_RefNannyFinishContext();
  17862. return __pyx_r;
  17863. }
  17864. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_62cubicPointAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pt1, PyObject *__pyx_v_pt2, PyObject *__pyx_v_pt3, PyObject *__pyx_v_pt4, PyObject *__pyx_v_t) {
  17865. PyObject *__pyx_v_t2 = NULL;
  17866. PyObject *__pyx_v__1_t = NULL;
  17867. PyObject *__pyx_v__1_t_2 = NULL;
  17868. PyObject *__pyx_v_x = NULL;
  17869. PyObject *__pyx_v_y = NULL;
  17870. PyObject *__pyx_r = NULL;
  17871. __Pyx_RefNannyDeclarations
  17872. PyObject *__pyx_t_1 = NULL;
  17873. PyObject *__pyx_t_2 = NULL;
  17874. PyObject *__pyx_t_3 = NULL;
  17875. PyObject *__pyx_t_4 = NULL;
  17876. PyObject *__pyx_t_5 = NULL;
  17877. int __pyx_lineno = 0;
  17878. const char *__pyx_filename = NULL;
  17879. int __pyx_clineno = 0;
  17880. __Pyx_RefNannySetupContext("cubicPointAtT", 0);
  17881. /* "fontTools/misc/bezierTools.py":1078
  17882. * A 2D tuple with the coordinates of the point.
  17883. * """
  17884. * t2 = t * t # <<<<<<<<<<<<<<
  17885. * _1_t = 1 - t
  17886. * _1_t_2 = _1_t * _1_t
  17887. */
  17888. __pyx_t_1 = PyNumber_Multiply(__pyx_v_t, __pyx_v_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1078, __pyx_L1_error)
  17889. __Pyx_GOTREF(__pyx_t_1);
  17890. __pyx_v_t2 = __pyx_t_1;
  17891. __pyx_t_1 = 0;
  17892. /* "fontTools/misc/bezierTools.py":1079
  17893. * """
  17894. * t2 = t * t
  17895. * _1_t = 1 - t # <<<<<<<<<<<<<<
  17896. * _1_t_2 = _1_t * _1_t
  17897. * x = (
  17898. */
  17899. __pyx_t_1 = __Pyx_PyLong_SubtractCObj(__pyx_mstate_global->__pyx_int_1, __pyx_v_t, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1079, __pyx_L1_error)
  17900. __Pyx_GOTREF(__pyx_t_1);
  17901. __pyx_v__1_t = __pyx_t_1;
  17902. __pyx_t_1 = 0;
  17903. /* "fontTools/misc/bezierTools.py":1080
  17904. * t2 = t * t
  17905. * _1_t = 1 - t
  17906. * _1_t_2 = _1_t * _1_t # <<<<<<<<<<<<<<
  17907. * x = (
  17908. * _1_t_2 * _1_t * pt1[0]
  17909. */
  17910. __pyx_t_1 = PyNumber_Multiply(__pyx_v__1_t, __pyx_v__1_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1080, __pyx_L1_error)
  17911. __Pyx_GOTREF(__pyx_t_1);
  17912. __pyx_v__1_t_2 = __pyx_t_1;
  17913. __pyx_t_1 = 0;
  17914. /* "fontTools/misc/bezierTools.py":1082
  17915. * _1_t_2 = _1_t * _1_t
  17916. * x = (
  17917. * _1_t_2 * _1_t * pt1[0] # <<<<<<<<<<<<<<
  17918. * + 3 * (_1_t_2 * t * pt2[0] + _1_t * t2 * pt3[0])
  17919. * + t2 * t * pt4[0]
  17920. */
  17921. __pyx_t_1 = PyNumber_Multiply(__pyx_v__1_t_2, __pyx_v__1_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1082, __pyx_L1_error)
  17922. __Pyx_GOTREF(__pyx_t_1);
  17923. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1082, __pyx_L1_error)
  17924. __Pyx_GOTREF(__pyx_t_2);
  17925. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1082, __pyx_L1_error)
  17926. __Pyx_GOTREF(__pyx_t_3);
  17927. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17928. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17929. /* "fontTools/misc/bezierTools.py":1083
  17930. * x = (
  17931. * _1_t_2 * _1_t * pt1[0]
  17932. * + 3 * (_1_t_2 * t * pt2[0] + _1_t * t2 * pt3[0]) # <<<<<<<<<<<<<<
  17933. * + t2 * t * pt4[0]
  17934. * )
  17935. */
  17936. __pyx_t_2 = PyNumber_Multiply(__pyx_v__1_t_2, __pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17937. __Pyx_GOTREF(__pyx_t_2);
  17938. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pt2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17939. __Pyx_GOTREF(__pyx_t_1);
  17940. __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17941. __Pyx_GOTREF(__pyx_t_4);
  17942. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17943. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17944. __pyx_t_1 = PyNumber_Multiply(__pyx_v__1_t, __pyx_v_t2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17945. __Pyx_GOTREF(__pyx_t_1);
  17946. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt3, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17947. __Pyx_GOTREF(__pyx_t_2);
  17948. __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17949. __Pyx_GOTREF(__pyx_t_5);
  17950. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17951. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17952. __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17953. __Pyx_GOTREF(__pyx_t_2);
  17954. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17955. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  17956. __pyx_t_5 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_3, __pyx_t_2, 3, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17957. __Pyx_GOTREF(__pyx_t_5);
  17958. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17959. __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17960. __Pyx_GOTREF(__pyx_t_2);
  17961. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17962. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  17963. /* "fontTools/misc/bezierTools.py":1084
  17964. * _1_t_2 * _1_t * pt1[0]
  17965. * + 3 * (_1_t_2 * t * pt2[0] + _1_t * t2 * pt3[0])
  17966. * + t2 * t * pt4[0] # <<<<<<<<<<<<<<
  17967. * )
  17968. * y = (
  17969. */
  17970. __pyx_t_5 = PyNumber_Multiply(__pyx_v_t2, __pyx_v_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1084, __pyx_L1_error)
  17971. __Pyx_GOTREF(__pyx_t_5);
  17972. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pt4, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1084, __pyx_L1_error)
  17973. __Pyx_GOTREF(__pyx_t_3);
  17974. __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1084, __pyx_L1_error)
  17975. __Pyx_GOTREF(__pyx_t_4);
  17976. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  17977. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17978. __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1084, __pyx_L1_error)
  17979. __Pyx_GOTREF(__pyx_t_3);
  17980. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17981. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17982. __pyx_v_x = __pyx_t_3;
  17983. __pyx_t_3 = 0;
  17984. /* "fontTools/misc/bezierTools.py":1087
  17985. * )
  17986. * y = (
  17987. * _1_t_2 * _1_t * pt1[1] # <<<<<<<<<<<<<<
  17988. * + 3 * (_1_t_2 * t * pt2[1] + _1_t * t2 * pt3[1])
  17989. * + t2 * t * pt4[1]
  17990. */
  17991. __pyx_t_3 = PyNumber_Multiply(__pyx_v__1_t_2, __pyx_v__1_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1087, __pyx_L1_error)
  17992. __Pyx_GOTREF(__pyx_t_3);
  17993. __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pt1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1087, __pyx_L1_error)
  17994. __Pyx_GOTREF(__pyx_t_4);
  17995. __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1087, __pyx_L1_error)
  17996. __Pyx_GOTREF(__pyx_t_2);
  17997. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17998. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17999. /* "fontTools/misc/bezierTools.py":1088
  18000. * y = (
  18001. * _1_t_2 * _1_t * pt1[1]
  18002. * + 3 * (_1_t_2 * t * pt2[1] + _1_t * t2 * pt3[1]) # <<<<<<<<<<<<<<
  18003. * + t2 * t * pt4[1]
  18004. * )
  18005. */
  18006. __pyx_t_4 = PyNumber_Multiply(__pyx_v__1_t_2, __pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18007. __Pyx_GOTREF(__pyx_t_4);
  18008. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pt2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18009. __Pyx_GOTREF(__pyx_t_3);
  18010. __pyx_t_5 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18011. __Pyx_GOTREF(__pyx_t_5);
  18012. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18013. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18014. __pyx_t_3 = PyNumber_Multiply(__pyx_v__1_t, __pyx_v_t2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18015. __Pyx_GOTREF(__pyx_t_3);
  18016. __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_pt3, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18017. __Pyx_GOTREF(__pyx_t_4);
  18018. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18019. __Pyx_GOTREF(__pyx_t_1);
  18020. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18021. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18022. __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18023. __Pyx_GOTREF(__pyx_t_4);
  18024. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18025. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18026. __pyx_t_1 = __Pyx_PyLong_MultiplyCObj(__pyx_mstate_global->__pyx_int_3, __pyx_t_4, 3, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18027. __Pyx_GOTREF(__pyx_t_1);
  18028. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18029. __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18030. __Pyx_GOTREF(__pyx_t_4);
  18031. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18032. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18033. /* "fontTools/misc/bezierTools.py":1089
  18034. * _1_t_2 * _1_t * pt1[1]
  18035. * + 3 * (_1_t_2 * t * pt2[1] + _1_t * t2 * pt3[1])
  18036. * + t2 * t * pt4[1] # <<<<<<<<<<<<<<
  18037. * )
  18038. * return (x, y)
  18039. */
  18040. __pyx_t_1 = PyNumber_Multiply(__pyx_v_t2, __pyx_v_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1089, __pyx_L1_error)
  18041. __Pyx_GOTREF(__pyx_t_1);
  18042. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pt4, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1089, __pyx_L1_error)
  18043. __Pyx_GOTREF(__pyx_t_2);
  18044. __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1089, __pyx_L1_error)
  18045. __Pyx_GOTREF(__pyx_t_5);
  18046. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18047. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18048. __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1089, __pyx_L1_error)
  18049. __Pyx_GOTREF(__pyx_t_2);
  18050. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18051. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18052. __pyx_v_y = __pyx_t_2;
  18053. __pyx_t_2 = 0;
  18054. /* "fontTools/misc/bezierTools.py":1091
  18055. * + t2 * t * pt4[1]
  18056. * )
  18057. * return (x, y) # <<<<<<<<<<<<<<
  18058. *
  18059. *
  18060. */
  18061. __Pyx_XDECREF(__pyx_r);
  18062. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1091, __pyx_L1_error)
  18063. __Pyx_GOTREF(__pyx_t_2);
  18064. __Pyx_INCREF(__pyx_v_x);
  18065. __Pyx_GIVEREF(__pyx_v_x);
  18066. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1091, __pyx_L1_error);
  18067. __Pyx_INCREF(__pyx_v_y);
  18068. __Pyx_GIVEREF(__pyx_v_y);
  18069. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1091, __pyx_L1_error);
  18070. __pyx_r = __pyx_t_2;
  18071. __pyx_t_2 = 0;
  18072. goto __pyx_L0;
  18073. /* "fontTools/misc/bezierTools.py":1068
  18074. *
  18075. *
  18076. * def cubicPointAtT(pt1, pt2, pt3, pt4, t): # <<<<<<<<<<<<<<
  18077. * """Finds the point at time `t` on a cubic curve.
  18078. *
  18079. */
  18080. /* function exit code */
  18081. __pyx_L1_error:;
  18082. __Pyx_XDECREF(__pyx_t_1);
  18083. __Pyx_XDECREF(__pyx_t_2);
  18084. __Pyx_XDECREF(__pyx_t_3);
  18085. __Pyx_XDECREF(__pyx_t_4);
  18086. __Pyx_XDECREF(__pyx_t_5);
  18087. __Pyx_AddTraceback("fontTools.misc.bezierTools.cubicPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18088. __pyx_r = NULL;
  18089. __pyx_L0:;
  18090. __Pyx_XDECREF(__pyx_v_t2);
  18091. __Pyx_XDECREF(__pyx_v__1_t);
  18092. __Pyx_XDECREF(__pyx_v__1_t_2);
  18093. __Pyx_XDECREF(__pyx_v_x);
  18094. __Pyx_XDECREF(__pyx_v_y);
  18095. __Pyx_XGIVEREF(__pyx_r);
  18096. __Pyx_RefNannyFinishContext();
  18097. return __pyx_r;
  18098. }
  18099. /* "fontTools/misc/bezierTools.py":1094
  18100. *
  18101. *
  18102. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  18103. * @cython.locals(
  18104. * t=cython.double,
  18105. */
  18106. /* Python wrapper */
  18107. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_65cubicPointAtTC(PyObject *__pyx_self,
  18108. #if CYTHON_METH_FASTCALL
  18109. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  18110. #else
  18111. PyObject *__pyx_args, PyObject *__pyx_kwds
  18112. #endif
  18113. ); /*proto*/
  18114. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_64cubicPointAtTC, "cubicPointAtTC(double complex pt1, double complex pt2, double complex pt3, double complex pt4, double t)\n\nFinds the point at time `t` on a cubic curve.\n\nArgs:\n pt1, pt2, pt3, pt4: Coordinates of the curve as complex numbers.\n t: The time along the curve.\n\nReturns:\n A complex number with the coordinates of the point.");
  18115. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_65cubicPointAtTC = {"cubicPointAtTC", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_65cubicPointAtTC, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_64cubicPointAtTC};
  18116. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_65cubicPointAtTC(PyObject *__pyx_self,
  18117. #if CYTHON_METH_FASTCALL
  18118. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  18119. #else
  18120. PyObject *__pyx_args, PyObject *__pyx_kwds
  18121. #endif
  18122. ) {
  18123. __pyx_t_double_complex __pyx_v_pt1;
  18124. __pyx_t_double_complex __pyx_v_pt2;
  18125. __pyx_t_double_complex __pyx_v_pt3;
  18126. __pyx_t_double_complex __pyx_v_pt4;
  18127. double __pyx_v_t;
  18128. #if !CYTHON_METH_FASTCALL
  18129. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  18130. #endif
  18131. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  18132. PyObject* values[5] = {0,0,0,0,0};
  18133. int __pyx_lineno = 0;
  18134. const char *__pyx_filename = NULL;
  18135. int __pyx_clineno = 0;
  18136. PyObject *__pyx_r = 0;
  18137. __Pyx_RefNannyDeclarations
  18138. __Pyx_RefNannySetupContext("cubicPointAtTC (wrapper)", 0);
  18139. #if !CYTHON_METH_FASTCALL
  18140. #if CYTHON_ASSUME_SAFE_SIZE
  18141. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  18142. #else
  18143. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  18144. #endif
  18145. #endif
  18146. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  18147. {
  18148. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pt1,&__pyx_mstate_global->__pyx_n_u_pt2,&__pyx_mstate_global->__pyx_n_u_pt3,&__pyx_mstate_global->__pyx_n_u_pt4,&__pyx_mstate_global->__pyx_n_u_t,0};
  18149. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  18150. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1094, __pyx_L3_error)
  18151. if (__pyx_kwds_len > 0) {
  18152. switch (__pyx_nargs) {
  18153. case 5:
  18154. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  18155. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18156. CYTHON_FALLTHROUGH;
  18157. case 4:
  18158. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  18159. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18160. CYTHON_FALLTHROUGH;
  18161. case 3:
  18162. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  18163. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18164. CYTHON_FALLTHROUGH;
  18165. case 2:
  18166. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18167. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18168. CYTHON_FALLTHROUGH;
  18169. case 1:
  18170. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18171. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18172. CYTHON_FALLTHROUGH;
  18173. case 0: break;
  18174. default: goto __pyx_L5_argtuple_error;
  18175. }
  18176. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  18177. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "cubicPointAtTC", 0) < (0)) __PYX_ERR(0, 1094, __pyx_L3_error)
  18178. for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
  18179. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("cubicPointAtTC", 1, 5, 5, i); __PYX_ERR(0, 1094, __pyx_L3_error) }
  18180. }
  18181. } else if (unlikely(__pyx_nargs != 5)) {
  18182. goto __pyx_L5_argtuple_error;
  18183. } else {
  18184. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18185. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18186. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18187. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18188. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  18189. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18190. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  18191. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18192. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  18193. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18194. }
  18195. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error)
  18196. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error)
  18197. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error)
  18198. __pyx_v_pt4 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error)
  18199. __pyx_v_t = __Pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error)
  18200. }
  18201. goto __pyx_L6_skip;
  18202. __pyx_L5_argtuple_error:;
  18203. __Pyx_RaiseArgtupleInvalid("cubicPointAtTC", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1094, __pyx_L3_error)
  18204. __pyx_L6_skip:;
  18205. goto __pyx_L4_argument_unpacking_done;
  18206. __pyx_L3_error:;
  18207. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  18208. Py_XDECREF(values[__pyx_temp]);
  18209. }
  18210. __Pyx_AddTraceback("fontTools.misc.bezierTools.cubicPointAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18211. __Pyx_RefNannyFinishContext();
  18212. return NULL;
  18213. __pyx_L4_argument_unpacking_done:;
  18214. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_64cubicPointAtTC(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4, __pyx_v_t);
  18215. /* function exit code */
  18216. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  18217. Py_XDECREF(values[__pyx_temp]);
  18218. }
  18219. __Pyx_RefNannyFinishContext();
  18220. return __pyx_r;
  18221. }
  18222. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_64cubicPointAtTC(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_pt1, __pyx_t_double_complex __pyx_v_pt2, __pyx_t_double_complex __pyx_v_pt3, __pyx_t_double_complex __pyx_v_pt4, double __pyx_v_t) {
  18223. double __pyx_v_t2;
  18224. double __pyx_v__1_t;
  18225. double __pyx_v__1_t_2;
  18226. PyObject *__pyx_r = NULL;
  18227. __Pyx_RefNannyDeclarations
  18228. __pyx_t_double_complex __pyx_t_1;
  18229. PyObject *__pyx_t_2 = NULL;
  18230. int __pyx_lineno = 0;
  18231. const char *__pyx_filename = NULL;
  18232. int __pyx_clineno = 0;
  18233. __Pyx_RefNannySetupContext("cubicPointAtTC", 0);
  18234. /* "fontTools/misc/bezierTools.py":1113
  18235. * A complex number with the coordinates of the point.
  18236. * """
  18237. * t2 = t * t # <<<<<<<<<<<<<<
  18238. * _1_t = 1 - t
  18239. * _1_t_2 = _1_t * _1_t
  18240. */
  18241. __pyx_v_t2 = (__pyx_v_t * __pyx_v_t);
  18242. /* "fontTools/misc/bezierTools.py":1114
  18243. * """
  18244. * t2 = t * t
  18245. * _1_t = 1 - t # <<<<<<<<<<<<<<
  18246. * _1_t_2 = _1_t * _1_t
  18247. * return _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4
  18248. */
  18249. __pyx_v__1_t = (1.0 - __pyx_v_t);
  18250. /* "fontTools/misc/bezierTools.py":1115
  18251. * t2 = t * t
  18252. * _1_t = 1 - t
  18253. * _1_t_2 = _1_t * _1_t # <<<<<<<<<<<<<<
  18254. * return _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4
  18255. *
  18256. */
  18257. __pyx_v__1_t_2 = (__pyx_v__1_t * __pyx_v__1_t);
  18258. /* "fontTools/misc/bezierTools.py":1116
  18259. * _1_t = 1 - t
  18260. * _1_t_2 = _1_t * _1_t
  18261. * return _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4 # <<<<<<<<<<<<<<
  18262. *
  18263. *
  18264. */
  18265. __Pyx_XDECREF(__pyx_r);
  18266. __pyx_t_1 = __Pyx_c_sum_double(__Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts((__pyx_v__1_t_2 * __pyx_v__1_t), 0), __pyx_v_pt1), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts(3, 0), __Pyx_c_sum_double(__Pyx_c_prod_double(__pyx_t_double_complex_from_parts((__pyx_v__1_t_2 * __pyx_v_t), 0), __pyx_v_pt2), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts((__pyx_v__1_t * __pyx_v_t2), 0), __pyx_v_pt3)))), __Pyx_c_prod_double(__pyx_t_double_complex_from_parts((__pyx_v_t2 * __pyx_v_t), 0), __pyx_v_pt4));
  18267. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error)
  18268. __Pyx_GOTREF(__pyx_t_2);
  18269. __pyx_r = __pyx_t_2;
  18270. __pyx_t_2 = 0;
  18271. goto __pyx_L0;
  18272. /* "fontTools/misc/bezierTools.py":1094
  18273. *
  18274. *
  18275. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  18276. * @cython.locals(
  18277. * t=cython.double,
  18278. */
  18279. /* function exit code */
  18280. __pyx_L1_error:;
  18281. __Pyx_XDECREF(__pyx_t_2);
  18282. __Pyx_AddTraceback("fontTools.misc.bezierTools.cubicPointAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18283. __pyx_r = NULL;
  18284. __pyx_L0:;
  18285. __Pyx_XGIVEREF(__pyx_r);
  18286. __Pyx_RefNannyFinishContext();
  18287. return __pyx_r;
  18288. }
  18289. /* "fontTools/misc/bezierTools.py":1119
  18290. *
  18291. *
  18292. * def segmentPointAtT(seg, t): # <<<<<<<<<<<<<<
  18293. * if len(seg) == 2:
  18294. * return linePointAtT(*seg, t)
  18295. */
  18296. /* Python wrapper */
  18297. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_67segmentPointAtT(PyObject *__pyx_self,
  18298. #if CYTHON_METH_FASTCALL
  18299. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  18300. #else
  18301. PyObject *__pyx_args, PyObject *__pyx_kwds
  18302. #endif
  18303. ); /*proto*/
  18304. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_66segmentPointAtT, "segmentPointAtT(seg, t)");
  18305. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_67segmentPointAtT = {"segmentPointAtT", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_67segmentPointAtT, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_66segmentPointAtT};
  18306. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_67segmentPointAtT(PyObject *__pyx_self,
  18307. #if CYTHON_METH_FASTCALL
  18308. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  18309. #else
  18310. PyObject *__pyx_args, PyObject *__pyx_kwds
  18311. #endif
  18312. ) {
  18313. PyObject *__pyx_v_seg = 0;
  18314. PyObject *__pyx_v_t = 0;
  18315. #if !CYTHON_METH_FASTCALL
  18316. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  18317. #endif
  18318. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  18319. PyObject* values[2] = {0,0};
  18320. int __pyx_lineno = 0;
  18321. const char *__pyx_filename = NULL;
  18322. int __pyx_clineno = 0;
  18323. PyObject *__pyx_r = 0;
  18324. __Pyx_RefNannyDeclarations
  18325. __Pyx_RefNannySetupContext("segmentPointAtT (wrapper)", 0);
  18326. #if !CYTHON_METH_FASTCALL
  18327. #if CYTHON_ASSUME_SAFE_SIZE
  18328. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  18329. #else
  18330. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  18331. #endif
  18332. #endif
  18333. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  18334. {
  18335. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_seg,&__pyx_mstate_global->__pyx_n_u_t,0};
  18336. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  18337. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1119, __pyx_L3_error)
  18338. if (__pyx_kwds_len > 0) {
  18339. switch (__pyx_nargs) {
  18340. case 2:
  18341. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18342. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1119, __pyx_L3_error)
  18343. CYTHON_FALLTHROUGH;
  18344. case 1:
  18345. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18346. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1119, __pyx_L3_error)
  18347. CYTHON_FALLTHROUGH;
  18348. case 0: break;
  18349. default: goto __pyx_L5_argtuple_error;
  18350. }
  18351. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  18352. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "segmentPointAtT", 0) < (0)) __PYX_ERR(0, 1119, __pyx_L3_error)
  18353. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  18354. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("segmentPointAtT", 1, 2, 2, i); __PYX_ERR(0, 1119, __pyx_L3_error) }
  18355. }
  18356. } else if (unlikely(__pyx_nargs != 2)) {
  18357. goto __pyx_L5_argtuple_error;
  18358. } else {
  18359. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18360. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1119, __pyx_L3_error)
  18361. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18362. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1119, __pyx_L3_error)
  18363. }
  18364. __pyx_v_seg = values[0];
  18365. __pyx_v_t = values[1];
  18366. }
  18367. goto __pyx_L6_skip;
  18368. __pyx_L5_argtuple_error:;
  18369. __Pyx_RaiseArgtupleInvalid("segmentPointAtT", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1119, __pyx_L3_error)
  18370. __pyx_L6_skip:;
  18371. goto __pyx_L4_argument_unpacking_done;
  18372. __pyx_L3_error:;
  18373. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  18374. Py_XDECREF(values[__pyx_temp]);
  18375. }
  18376. __Pyx_AddTraceback("fontTools.misc.bezierTools.segmentPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18377. __Pyx_RefNannyFinishContext();
  18378. return NULL;
  18379. __pyx_L4_argument_unpacking_done:;
  18380. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_66segmentPointAtT(__pyx_self, __pyx_v_seg, __pyx_v_t);
  18381. /* function exit code */
  18382. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  18383. Py_XDECREF(values[__pyx_temp]);
  18384. }
  18385. __Pyx_RefNannyFinishContext();
  18386. return __pyx_r;
  18387. }
  18388. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_66segmentPointAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_seg, PyObject *__pyx_v_t) {
  18389. PyObject *__pyx_r = NULL;
  18390. __Pyx_RefNannyDeclarations
  18391. Py_ssize_t __pyx_t_1;
  18392. int __pyx_t_2;
  18393. PyObject *__pyx_t_3 = NULL;
  18394. PyObject *__pyx_t_4 = NULL;
  18395. PyObject *__pyx_t_5 = NULL;
  18396. PyObject *__pyx_t_6 = NULL;
  18397. size_t __pyx_t_7;
  18398. int __pyx_lineno = 0;
  18399. const char *__pyx_filename = NULL;
  18400. int __pyx_clineno = 0;
  18401. __Pyx_RefNannySetupContext("segmentPointAtT", 0);
  18402. /* "fontTools/misc/bezierTools.py":1120
  18403. *
  18404. * def segmentPointAtT(seg, t):
  18405. * if len(seg) == 2: # <<<<<<<<<<<<<<
  18406. * return linePointAtT(*seg, t)
  18407. * elif len(seg) == 3:
  18408. */
  18409. __pyx_t_1 = PyObject_Length(__pyx_v_seg); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1120, __pyx_L1_error)
  18410. __pyx_t_2 = (__pyx_t_1 == 2);
  18411. if (__pyx_t_2) {
  18412. /* "fontTools/misc/bezierTools.py":1121
  18413. * def segmentPointAtT(seg, t):
  18414. * if len(seg) == 2:
  18415. * return linePointAtT(*seg, t) # <<<<<<<<<<<<<<
  18416. * elif len(seg) == 3:
  18417. * return quadraticPointAtT(*seg, t)
  18418. */
  18419. __Pyx_XDECREF(__pyx_r);
  18420. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_linePointAtT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1121, __pyx_L1_error)
  18421. __Pyx_GOTREF(__pyx_t_3);
  18422. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_seg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error)
  18423. __Pyx_GOTREF(__pyx_t_4);
  18424. __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1121, __pyx_L1_error)
  18425. __Pyx_GOTREF(__pyx_t_5);
  18426. __Pyx_INCREF(__pyx_v_t);
  18427. __Pyx_GIVEREF(__pyx_v_t);
  18428. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1121, __pyx_L1_error);
  18429. __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error)
  18430. __Pyx_GOTREF(__pyx_t_6);
  18431. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18432. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18433. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1121, __pyx_L1_error)
  18434. __Pyx_GOTREF(__pyx_t_5);
  18435. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18436. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18437. __pyx_r = __pyx_t_5;
  18438. __pyx_t_5 = 0;
  18439. goto __pyx_L0;
  18440. /* "fontTools/misc/bezierTools.py":1120
  18441. *
  18442. * def segmentPointAtT(seg, t):
  18443. * if len(seg) == 2: # <<<<<<<<<<<<<<
  18444. * return linePointAtT(*seg, t)
  18445. * elif len(seg) == 3:
  18446. */
  18447. }
  18448. /* "fontTools/misc/bezierTools.py":1122
  18449. * if len(seg) == 2:
  18450. * return linePointAtT(*seg, t)
  18451. * elif len(seg) == 3: # <<<<<<<<<<<<<<
  18452. * return quadraticPointAtT(*seg, t)
  18453. * elif len(seg) == 4:
  18454. */
  18455. __pyx_t_1 = PyObject_Length(__pyx_v_seg); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1122, __pyx_L1_error)
  18456. __pyx_t_2 = (__pyx_t_1 == 3);
  18457. if (__pyx_t_2) {
  18458. /* "fontTools/misc/bezierTools.py":1123
  18459. * return linePointAtT(*seg, t)
  18460. * elif len(seg) == 3:
  18461. * return quadraticPointAtT(*seg, t) # <<<<<<<<<<<<<<
  18462. * elif len(seg) == 4:
  18463. * return cubicPointAtT(*seg, t)
  18464. */
  18465. __Pyx_XDECREF(__pyx_r);
  18466. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_quadraticPointAtT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1123, __pyx_L1_error)
  18467. __Pyx_GOTREF(__pyx_t_5);
  18468. __pyx_t_6 = __Pyx_PySequence_Tuple(__pyx_v_seg); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1123, __pyx_L1_error)
  18469. __Pyx_GOTREF(__pyx_t_6);
  18470. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
  18471. __Pyx_GOTREF(__pyx_t_3);
  18472. __Pyx_INCREF(__pyx_v_t);
  18473. __Pyx_GIVEREF(__pyx_v_t);
  18474. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1123, __pyx_L1_error);
  18475. __pyx_t_4 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1123, __pyx_L1_error)
  18476. __Pyx_GOTREF(__pyx_t_4);
  18477. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18478. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18479. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
  18480. __Pyx_GOTREF(__pyx_t_3);
  18481. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18482. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18483. __pyx_r = __pyx_t_3;
  18484. __pyx_t_3 = 0;
  18485. goto __pyx_L0;
  18486. /* "fontTools/misc/bezierTools.py":1122
  18487. * if len(seg) == 2:
  18488. * return linePointAtT(*seg, t)
  18489. * elif len(seg) == 3: # <<<<<<<<<<<<<<
  18490. * return quadraticPointAtT(*seg, t)
  18491. * elif len(seg) == 4:
  18492. */
  18493. }
  18494. /* "fontTools/misc/bezierTools.py":1124
  18495. * elif len(seg) == 3:
  18496. * return quadraticPointAtT(*seg, t)
  18497. * elif len(seg) == 4: # <<<<<<<<<<<<<<
  18498. * return cubicPointAtT(*seg, t)
  18499. * raise ValueError("Unknown curve degree")
  18500. */
  18501. __pyx_t_1 = PyObject_Length(__pyx_v_seg); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1124, __pyx_L1_error)
  18502. __pyx_t_2 = (__pyx_t_1 == 4);
  18503. if (__pyx_t_2) {
  18504. /* "fontTools/misc/bezierTools.py":1125
  18505. * return quadraticPointAtT(*seg, t)
  18506. * elif len(seg) == 4:
  18507. * return cubicPointAtT(*seg, t) # <<<<<<<<<<<<<<
  18508. * raise ValueError("Unknown curve degree")
  18509. *
  18510. */
  18511. __Pyx_XDECREF(__pyx_r);
  18512. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cubicPointAtT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
  18513. __Pyx_GOTREF(__pyx_t_3);
  18514. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_seg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1125, __pyx_L1_error)
  18515. __Pyx_GOTREF(__pyx_t_4);
  18516. __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1125, __pyx_L1_error)
  18517. __Pyx_GOTREF(__pyx_t_5);
  18518. __Pyx_INCREF(__pyx_v_t);
  18519. __Pyx_GIVEREF(__pyx_v_t);
  18520. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1125, __pyx_L1_error);
  18521. __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1125, __pyx_L1_error)
  18522. __Pyx_GOTREF(__pyx_t_6);
  18523. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18524. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18525. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1125, __pyx_L1_error)
  18526. __Pyx_GOTREF(__pyx_t_5);
  18527. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18528. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18529. __pyx_r = __pyx_t_5;
  18530. __pyx_t_5 = 0;
  18531. goto __pyx_L0;
  18532. /* "fontTools/misc/bezierTools.py":1124
  18533. * elif len(seg) == 3:
  18534. * return quadraticPointAtT(*seg, t)
  18535. * elif len(seg) == 4: # <<<<<<<<<<<<<<
  18536. * return cubicPointAtT(*seg, t)
  18537. * raise ValueError("Unknown curve degree")
  18538. */
  18539. }
  18540. /* "fontTools/misc/bezierTools.py":1126
  18541. * elif len(seg) == 4:
  18542. * return cubicPointAtT(*seg, t)
  18543. * raise ValueError("Unknown curve degree") # <<<<<<<<<<<<<<
  18544. *
  18545. *
  18546. */
  18547. __pyx_t_6 = NULL;
  18548. __pyx_t_7 = 1;
  18549. {
  18550. PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Unknown_curve_degree};
  18551. __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  18552. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  18553. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error)
  18554. __Pyx_GOTREF(__pyx_t_5);
  18555. }
  18556. __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  18557. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18558. __PYX_ERR(0, 1126, __pyx_L1_error)
  18559. /* "fontTools/misc/bezierTools.py":1119
  18560. *
  18561. *
  18562. * def segmentPointAtT(seg, t): # <<<<<<<<<<<<<<
  18563. * if len(seg) == 2:
  18564. * return linePointAtT(*seg, t)
  18565. */
  18566. /* function exit code */
  18567. __pyx_L1_error:;
  18568. __Pyx_XDECREF(__pyx_t_3);
  18569. __Pyx_XDECREF(__pyx_t_4);
  18570. __Pyx_XDECREF(__pyx_t_5);
  18571. __Pyx_XDECREF(__pyx_t_6);
  18572. __Pyx_AddTraceback("fontTools.misc.bezierTools.segmentPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18573. __pyx_r = NULL;
  18574. __pyx_L0:;
  18575. __Pyx_XGIVEREF(__pyx_r);
  18576. __Pyx_RefNannyFinishContext();
  18577. return __pyx_r;
  18578. }
  18579. /* "fontTools/misc/bezierTools.py":1134
  18580. *
  18581. *
  18582. * def _line_t_of_pt(s, e, pt): # <<<<<<<<<<<<<<
  18583. * sx, sy = s
  18584. * ex, ey = e
  18585. */
  18586. /* Python wrapper */
  18587. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_69_line_t_of_pt(PyObject *__pyx_self,
  18588. #if CYTHON_METH_FASTCALL
  18589. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  18590. #else
  18591. PyObject *__pyx_args, PyObject *__pyx_kwds
  18592. #endif
  18593. ); /*proto*/
  18594. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_68_line_t_of_pt, "_line_t_of_pt(s, e, pt)");
  18595. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_69_line_t_of_pt = {"_line_t_of_pt", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_69_line_t_of_pt, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_68_line_t_of_pt};
  18596. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_69_line_t_of_pt(PyObject *__pyx_self,
  18597. #if CYTHON_METH_FASTCALL
  18598. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  18599. #else
  18600. PyObject *__pyx_args, PyObject *__pyx_kwds
  18601. #endif
  18602. ) {
  18603. PyObject *__pyx_v_s = 0;
  18604. PyObject *__pyx_v_e = 0;
  18605. PyObject *__pyx_v_pt = 0;
  18606. #if !CYTHON_METH_FASTCALL
  18607. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  18608. #endif
  18609. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  18610. PyObject* values[3] = {0,0,0};
  18611. int __pyx_lineno = 0;
  18612. const char *__pyx_filename = NULL;
  18613. int __pyx_clineno = 0;
  18614. PyObject *__pyx_r = 0;
  18615. __Pyx_RefNannyDeclarations
  18616. __Pyx_RefNannySetupContext("_line_t_of_pt (wrapper)", 0);
  18617. #if !CYTHON_METH_FASTCALL
  18618. #if CYTHON_ASSUME_SAFE_SIZE
  18619. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  18620. #else
  18621. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  18622. #endif
  18623. #endif
  18624. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  18625. {
  18626. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_s,&__pyx_mstate_global->__pyx_n_u_e,&__pyx_mstate_global->__pyx_n_u_pt,0};
  18627. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  18628. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1134, __pyx_L3_error)
  18629. if (__pyx_kwds_len > 0) {
  18630. switch (__pyx_nargs) {
  18631. case 3:
  18632. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  18633. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18634. CYTHON_FALLTHROUGH;
  18635. case 2:
  18636. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18637. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18638. CYTHON_FALLTHROUGH;
  18639. case 1:
  18640. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18641. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18642. CYTHON_FALLTHROUGH;
  18643. case 0: break;
  18644. default: goto __pyx_L5_argtuple_error;
  18645. }
  18646. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  18647. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_line_t_of_pt", 0) < (0)) __PYX_ERR(0, 1134, __pyx_L3_error)
  18648. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  18649. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_line_t_of_pt", 1, 3, 3, i); __PYX_ERR(0, 1134, __pyx_L3_error) }
  18650. }
  18651. } else if (unlikely(__pyx_nargs != 3)) {
  18652. goto __pyx_L5_argtuple_error;
  18653. } else {
  18654. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18655. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18656. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18657. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18658. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  18659. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18660. }
  18661. __pyx_v_s = values[0];
  18662. __pyx_v_e = values[1];
  18663. __pyx_v_pt = values[2];
  18664. }
  18665. goto __pyx_L6_skip;
  18666. __pyx_L5_argtuple_error:;
  18667. __Pyx_RaiseArgtupleInvalid("_line_t_of_pt", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1134, __pyx_L3_error)
  18668. __pyx_L6_skip:;
  18669. goto __pyx_L4_argument_unpacking_done;
  18670. __pyx_L3_error:;
  18671. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  18672. Py_XDECREF(values[__pyx_temp]);
  18673. }
  18674. __Pyx_AddTraceback("fontTools.misc.bezierTools._line_t_of_pt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18675. __Pyx_RefNannyFinishContext();
  18676. return NULL;
  18677. __pyx_L4_argument_unpacking_done:;
  18678. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_68_line_t_of_pt(__pyx_self, __pyx_v_s, __pyx_v_e, __pyx_v_pt);
  18679. /* function exit code */
  18680. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  18681. Py_XDECREF(values[__pyx_temp]);
  18682. }
  18683. __Pyx_RefNannyFinishContext();
  18684. return __pyx_r;
  18685. }
  18686. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_68_line_t_of_pt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s, PyObject *__pyx_v_e, PyObject *__pyx_v_pt) {
  18687. PyObject *__pyx_v_sx = NULL;
  18688. PyObject *__pyx_v_sy = NULL;
  18689. PyObject *__pyx_v_ex = NULL;
  18690. PyObject *__pyx_v_ey = NULL;
  18691. PyObject *__pyx_v_px = NULL;
  18692. PyObject *__pyx_v_py = NULL;
  18693. PyObject *__pyx_r = NULL;
  18694. __Pyx_RefNannyDeclarations
  18695. PyObject *__pyx_t_1 = NULL;
  18696. PyObject *__pyx_t_2 = NULL;
  18697. PyObject *__pyx_t_3 = NULL;
  18698. PyObject *(*__pyx_t_4)(PyObject *);
  18699. int __pyx_t_5;
  18700. int __pyx_t_6;
  18701. int __pyx_lineno = 0;
  18702. const char *__pyx_filename = NULL;
  18703. int __pyx_clineno = 0;
  18704. __Pyx_RefNannySetupContext("_line_t_of_pt", 0);
  18705. /* "fontTools/misc/bezierTools.py":1135
  18706. *
  18707. * def _line_t_of_pt(s, e, pt):
  18708. * sx, sy = s # <<<<<<<<<<<<<<
  18709. * ex, ey = e
  18710. * px, py = pt
  18711. */
  18712. if ((likely(PyTuple_CheckExact(__pyx_v_s))) || (PyList_CheckExact(__pyx_v_s))) {
  18713. PyObject* sequence = __pyx_v_s;
  18714. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  18715. if (unlikely(size != 2)) {
  18716. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  18717. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  18718. __PYX_ERR(0, 1135, __pyx_L1_error)
  18719. }
  18720. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  18721. if (likely(PyTuple_CheckExact(sequence))) {
  18722. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  18723. __Pyx_INCREF(__pyx_t_1);
  18724. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  18725. __Pyx_INCREF(__pyx_t_2);
  18726. } else {
  18727. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  18728. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18729. __Pyx_XGOTREF(__pyx_t_1);
  18730. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  18731. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18732. __Pyx_XGOTREF(__pyx_t_2);
  18733. }
  18734. #else
  18735. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18736. __Pyx_GOTREF(__pyx_t_1);
  18737. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18738. __Pyx_GOTREF(__pyx_t_2);
  18739. #endif
  18740. } else {
  18741. Py_ssize_t index = -1;
  18742. __pyx_t_3 = PyObject_GetIter(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18743. __Pyx_GOTREF(__pyx_t_3);
  18744. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  18745. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  18746. __Pyx_GOTREF(__pyx_t_1);
  18747. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  18748. __Pyx_GOTREF(__pyx_t_2);
  18749. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18750. __pyx_t_4 = NULL;
  18751. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18752. goto __pyx_L4_unpacking_done;
  18753. __pyx_L3_unpacking_failed:;
  18754. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18755. __pyx_t_4 = NULL;
  18756. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  18757. __PYX_ERR(0, 1135, __pyx_L1_error)
  18758. __pyx_L4_unpacking_done:;
  18759. }
  18760. __pyx_v_sx = __pyx_t_1;
  18761. __pyx_t_1 = 0;
  18762. __pyx_v_sy = __pyx_t_2;
  18763. __pyx_t_2 = 0;
  18764. /* "fontTools/misc/bezierTools.py":1136
  18765. * def _line_t_of_pt(s, e, pt):
  18766. * sx, sy = s
  18767. * ex, ey = e # <<<<<<<<<<<<<<
  18768. * px, py = pt
  18769. * if abs(sx - ex) < epsilon and abs(sy - ey) < epsilon:
  18770. */
  18771. if ((likely(PyTuple_CheckExact(__pyx_v_e))) || (PyList_CheckExact(__pyx_v_e))) {
  18772. PyObject* sequence = __pyx_v_e;
  18773. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  18774. if (unlikely(size != 2)) {
  18775. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  18776. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  18777. __PYX_ERR(0, 1136, __pyx_L1_error)
  18778. }
  18779. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  18780. if (likely(PyTuple_CheckExact(sequence))) {
  18781. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  18782. __Pyx_INCREF(__pyx_t_2);
  18783. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  18784. __Pyx_INCREF(__pyx_t_1);
  18785. } else {
  18786. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  18787. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18788. __Pyx_XGOTREF(__pyx_t_2);
  18789. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  18790. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18791. __Pyx_XGOTREF(__pyx_t_1);
  18792. }
  18793. #else
  18794. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18795. __Pyx_GOTREF(__pyx_t_2);
  18796. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18797. __Pyx_GOTREF(__pyx_t_1);
  18798. #endif
  18799. } else {
  18800. Py_ssize_t index = -1;
  18801. __pyx_t_3 = PyObject_GetIter(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18802. __Pyx_GOTREF(__pyx_t_3);
  18803. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  18804. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  18805. __Pyx_GOTREF(__pyx_t_2);
  18806. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  18807. __Pyx_GOTREF(__pyx_t_1);
  18808. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18809. __pyx_t_4 = NULL;
  18810. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18811. goto __pyx_L6_unpacking_done;
  18812. __pyx_L5_unpacking_failed:;
  18813. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18814. __pyx_t_4 = NULL;
  18815. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  18816. __PYX_ERR(0, 1136, __pyx_L1_error)
  18817. __pyx_L6_unpacking_done:;
  18818. }
  18819. __pyx_v_ex = __pyx_t_2;
  18820. __pyx_t_2 = 0;
  18821. __pyx_v_ey = __pyx_t_1;
  18822. __pyx_t_1 = 0;
  18823. /* "fontTools/misc/bezierTools.py":1137
  18824. * sx, sy = s
  18825. * ex, ey = e
  18826. * px, py = pt # <<<<<<<<<<<<<<
  18827. * if abs(sx - ex) < epsilon and abs(sy - ey) < epsilon:
  18828. * # Line is a point!
  18829. */
  18830. if ((likely(PyTuple_CheckExact(__pyx_v_pt))) || (PyList_CheckExact(__pyx_v_pt))) {
  18831. PyObject* sequence = __pyx_v_pt;
  18832. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  18833. if (unlikely(size != 2)) {
  18834. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  18835. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  18836. __PYX_ERR(0, 1137, __pyx_L1_error)
  18837. }
  18838. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  18839. if (likely(PyTuple_CheckExact(sequence))) {
  18840. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  18841. __Pyx_INCREF(__pyx_t_1);
  18842. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  18843. __Pyx_INCREF(__pyx_t_2);
  18844. } else {
  18845. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  18846. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18847. __Pyx_XGOTREF(__pyx_t_1);
  18848. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  18849. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18850. __Pyx_XGOTREF(__pyx_t_2);
  18851. }
  18852. #else
  18853. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18854. __Pyx_GOTREF(__pyx_t_1);
  18855. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18856. __Pyx_GOTREF(__pyx_t_2);
  18857. #endif
  18858. } else {
  18859. Py_ssize_t index = -1;
  18860. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18861. __Pyx_GOTREF(__pyx_t_3);
  18862. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  18863. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  18864. __Pyx_GOTREF(__pyx_t_1);
  18865. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  18866. __Pyx_GOTREF(__pyx_t_2);
  18867. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18868. __pyx_t_4 = NULL;
  18869. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18870. goto __pyx_L8_unpacking_done;
  18871. __pyx_L7_unpacking_failed:;
  18872. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18873. __pyx_t_4 = NULL;
  18874. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  18875. __PYX_ERR(0, 1137, __pyx_L1_error)
  18876. __pyx_L8_unpacking_done:;
  18877. }
  18878. __pyx_v_px = __pyx_t_1;
  18879. __pyx_t_1 = 0;
  18880. __pyx_v_py = __pyx_t_2;
  18881. __pyx_t_2 = 0;
  18882. /* "fontTools/misc/bezierTools.py":1138
  18883. * ex, ey = e
  18884. * px, py = pt
  18885. * if abs(sx - ex) < epsilon and abs(sy - ey) < epsilon: # <<<<<<<<<<<<<<
  18886. * # Line is a point!
  18887. * return -1
  18888. */
  18889. __pyx_t_2 = PyNumber_Subtract(__pyx_v_sx, __pyx_v_ex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18890. __Pyx_GOTREF(__pyx_t_2);
  18891. __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18892. __Pyx_GOTREF(__pyx_t_1);
  18893. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18894. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18895. __Pyx_GOTREF(__pyx_t_2);
  18896. __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18897. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18898. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18899. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1138, __pyx_L1_error)
  18900. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18901. if (__pyx_t_6) {
  18902. } else {
  18903. __pyx_t_5 = __pyx_t_6;
  18904. goto __pyx_L10_bool_binop_done;
  18905. }
  18906. __pyx_t_3 = PyNumber_Subtract(__pyx_v_sy, __pyx_v_ey); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18907. __Pyx_GOTREF(__pyx_t_3);
  18908. __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18909. __Pyx_GOTREF(__pyx_t_2);
  18910. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18911. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18912. __Pyx_GOTREF(__pyx_t_3);
  18913. __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18914. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18915. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18916. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1138, __pyx_L1_error)
  18917. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18918. __pyx_t_5 = __pyx_t_6;
  18919. __pyx_L10_bool_binop_done:;
  18920. if (__pyx_t_5) {
  18921. /* "fontTools/misc/bezierTools.py":1140
  18922. * if abs(sx - ex) < epsilon and abs(sy - ey) < epsilon:
  18923. * # Line is a point!
  18924. * return -1 # <<<<<<<<<<<<<<
  18925. * # Use the largest
  18926. * if abs(sx - ex) > abs(sy - ey):
  18927. */
  18928. __Pyx_XDECREF(__pyx_r);
  18929. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1);
  18930. __pyx_r = __pyx_mstate_global->__pyx_int_neg_1;
  18931. goto __pyx_L0;
  18932. /* "fontTools/misc/bezierTools.py":1138
  18933. * ex, ey = e
  18934. * px, py = pt
  18935. * if abs(sx - ex) < epsilon and abs(sy - ey) < epsilon: # <<<<<<<<<<<<<<
  18936. * # Line is a point!
  18937. * return -1
  18938. */
  18939. }
  18940. /* "fontTools/misc/bezierTools.py":1142
  18941. * return -1
  18942. * # Use the largest
  18943. * if abs(sx - ex) > abs(sy - ey): # <<<<<<<<<<<<<<
  18944. * return (px - sx) / (ex - sx)
  18945. * else:
  18946. */
  18947. __pyx_t_1 = PyNumber_Subtract(__pyx_v_sx, __pyx_v_ex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
  18948. __Pyx_GOTREF(__pyx_t_1);
  18949. __pyx_t_3 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1142, __pyx_L1_error)
  18950. __Pyx_GOTREF(__pyx_t_3);
  18951. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18952. __pyx_t_1 = PyNumber_Subtract(__pyx_v_sy, __pyx_v_ey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
  18953. __Pyx_GOTREF(__pyx_t_1);
  18954. __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1142, __pyx_L1_error)
  18955. __Pyx_GOTREF(__pyx_t_2);
  18956. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18957. __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
  18958. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18959. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18960. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1142, __pyx_L1_error)
  18961. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18962. if (__pyx_t_5) {
  18963. /* "fontTools/misc/bezierTools.py":1143
  18964. * # Use the largest
  18965. * if abs(sx - ex) > abs(sy - ey):
  18966. * return (px - sx) / (ex - sx) # <<<<<<<<<<<<<<
  18967. * else:
  18968. * return (py - sy) / (ey - sy)
  18969. */
  18970. __Pyx_XDECREF(__pyx_r);
  18971. __pyx_t_1 = PyNumber_Subtract(__pyx_v_px, __pyx_v_sx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1143, __pyx_L1_error)
  18972. __Pyx_GOTREF(__pyx_t_1);
  18973. __pyx_t_2 = PyNumber_Subtract(__pyx_v_ex, __pyx_v_sx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1143, __pyx_L1_error)
  18974. __Pyx_GOTREF(__pyx_t_2);
  18975. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1143, __pyx_L1_error)
  18976. __Pyx_GOTREF(__pyx_t_3);
  18977. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18978. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18979. __pyx_r = __pyx_t_3;
  18980. __pyx_t_3 = 0;
  18981. goto __pyx_L0;
  18982. /* "fontTools/misc/bezierTools.py":1142
  18983. * return -1
  18984. * # Use the largest
  18985. * if abs(sx - ex) > abs(sy - ey): # <<<<<<<<<<<<<<
  18986. * return (px - sx) / (ex - sx)
  18987. * else:
  18988. */
  18989. }
  18990. /* "fontTools/misc/bezierTools.py":1145
  18991. * return (px - sx) / (ex - sx)
  18992. * else:
  18993. * return (py - sy) / (ey - sy) # <<<<<<<<<<<<<<
  18994. *
  18995. *
  18996. */
  18997. /*else*/ {
  18998. __Pyx_XDECREF(__pyx_r);
  18999. __pyx_t_3 = PyNumber_Subtract(__pyx_v_py, __pyx_v_sy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1145, __pyx_L1_error)
  19000. __Pyx_GOTREF(__pyx_t_3);
  19001. __pyx_t_2 = PyNumber_Subtract(__pyx_v_ey, __pyx_v_sy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1145, __pyx_L1_error)
  19002. __Pyx_GOTREF(__pyx_t_2);
  19003. __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1145, __pyx_L1_error)
  19004. __Pyx_GOTREF(__pyx_t_1);
  19005. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19006. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19007. __pyx_r = __pyx_t_1;
  19008. __pyx_t_1 = 0;
  19009. goto __pyx_L0;
  19010. }
  19011. /* "fontTools/misc/bezierTools.py":1134
  19012. *
  19013. *
  19014. * def _line_t_of_pt(s, e, pt): # <<<<<<<<<<<<<<
  19015. * sx, sy = s
  19016. * ex, ey = e
  19017. */
  19018. /* function exit code */
  19019. __pyx_L1_error:;
  19020. __Pyx_XDECREF(__pyx_t_1);
  19021. __Pyx_XDECREF(__pyx_t_2);
  19022. __Pyx_XDECREF(__pyx_t_3);
  19023. __Pyx_AddTraceback("fontTools.misc.bezierTools._line_t_of_pt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19024. __pyx_r = NULL;
  19025. __pyx_L0:;
  19026. __Pyx_XDECREF(__pyx_v_sx);
  19027. __Pyx_XDECREF(__pyx_v_sy);
  19028. __Pyx_XDECREF(__pyx_v_ex);
  19029. __Pyx_XDECREF(__pyx_v_ey);
  19030. __Pyx_XDECREF(__pyx_v_px);
  19031. __Pyx_XDECREF(__pyx_v_py);
  19032. __Pyx_XGIVEREF(__pyx_r);
  19033. __Pyx_RefNannyFinishContext();
  19034. return __pyx_r;
  19035. }
  19036. /* "fontTools/misc/bezierTools.py":1148
  19037. *
  19038. *
  19039. * def _both_points_are_on_same_side_of_origin(a, b, origin): # <<<<<<<<<<<<<<
  19040. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0])
  19041. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1])
  19042. */
  19043. /* Python wrapper */
  19044. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_71_both_points_are_on_same_side_of_origin(PyObject *__pyx_self,
  19045. #if CYTHON_METH_FASTCALL
  19046. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  19047. #else
  19048. PyObject *__pyx_args, PyObject *__pyx_kwds
  19049. #endif
  19050. ); /*proto*/
  19051. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_70_both_points_are_on_same_side_of_origin, "_both_points_are_on_same_side_of_origin(a, b, origin)");
  19052. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_71_both_points_are_on_same_side_of_origin = {"_both_points_are_on_same_side_of_origin", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_71_both_points_are_on_same_side_of_origin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_70_both_points_are_on_same_side_of_origin};
  19053. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_71_both_points_are_on_same_side_of_origin(PyObject *__pyx_self,
  19054. #if CYTHON_METH_FASTCALL
  19055. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  19056. #else
  19057. PyObject *__pyx_args, PyObject *__pyx_kwds
  19058. #endif
  19059. ) {
  19060. PyObject *__pyx_v_a = 0;
  19061. PyObject *__pyx_v_b = 0;
  19062. PyObject *__pyx_v_origin = 0;
  19063. #if !CYTHON_METH_FASTCALL
  19064. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  19065. #endif
  19066. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  19067. PyObject* values[3] = {0,0,0};
  19068. int __pyx_lineno = 0;
  19069. const char *__pyx_filename = NULL;
  19070. int __pyx_clineno = 0;
  19071. PyObject *__pyx_r = 0;
  19072. __Pyx_RefNannyDeclarations
  19073. __Pyx_RefNannySetupContext("_both_points_are_on_same_side_of_origin (wrapper)", 0);
  19074. #if !CYTHON_METH_FASTCALL
  19075. #if CYTHON_ASSUME_SAFE_SIZE
  19076. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  19077. #else
  19078. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  19079. #endif
  19080. #endif
  19081. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  19082. {
  19083. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_a,&__pyx_mstate_global->__pyx_n_u_b,&__pyx_mstate_global->__pyx_n_u_origin,0};
  19084. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  19085. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1148, __pyx_L3_error)
  19086. if (__pyx_kwds_len > 0) {
  19087. switch (__pyx_nargs) {
  19088. case 3:
  19089. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  19090. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19091. CYTHON_FALLTHROUGH;
  19092. case 2:
  19093. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  19094. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19095. CYTHON_FALLTHROUGH;
  19096. case 1:
  19097. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  19098. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19099. CYTHON_FALLTHROUGH;
  19100. case 0: break;
  19101. default: goto __pyx_L5_argtuple_error;
  19102. }
  19103. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  19104. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_both_points_are_on_same_side_of_origin", 0) < (0)) __PYX_ERR(0, 1148, __pyx_L3_error)
  19105. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  19106. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_both_points_are_on_same_side_of_origin", 1, 3, 3, i); __PYX_ERR(0, 1148, __pyx_L3_error) }
  19107. }
  19108. } else if (unlikely(__pyx_nargs != 3)) {
  19109. goto __pyx_L5_argtuple_error;
  19110. } else {
  19111. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  19112. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19113. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  19114. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19115. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  19116. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19117. }
  19118. __pyx_v_a = values[0];
  19119. __pyx_v_b = values[1];
  19120. __pyx_v_origin = values[2];
  19121. }
  19122. goto __pyx_L6_skip;
  19123. __pyx_L5_argtuple_error:;
  19124. __Pyx_RaiseArgtupleInvalid("_both_points_are_on_same_side_of_origin", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1148, __pyx_L3_error)
  19125. __pyx_L6_skip:;
  19126. goto __pyx_L4_argument_unpacking_done;
  19127. __pyx_L3_error:;
  19128. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  19129. Py_XDECREF(values[__pyx_temp]);
  19130. }
  19131. __Pyx_AddTraceback("fontTools.misc.bezierTools._both_points_are_on_same_side_of_origin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19132. __Pyx_RefNannyFinishContext();
  19133. return NULL;
  19134. __pyx_L4_argument_unpacking_done:;
  19135. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_70_both_points_are_on_same_side_of_origin(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_origin);
  19136. /* function exit code */
  19137. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  19138. Py_XDECREF(values[__pyx_temp]);
  19139. }
  19140. __Pyx_RefNannyFinishContext();
  19141. return __pyx_r;
  19142. }
  19143. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_70_both_points_are_on_same_side_of_origin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_origin) {
  19144. PyObject *__pyx_v_xDiff = NULL;
  19145. PyObject *__pyx_v_yDiff = NULL;
  19146. PyObject *__pyx_r = NULL;
  19147. __Pyx_RefNannyDeclarations
  19148. PyObject *__pyx_t_1 = NULL;
  19149. PyObject *__pyx_t_2 = NULL;
  19150. PyObject *__pyx_t_3 = NULL;
  19151. PyObject *__pyx_t_4 = NULL;
  19152. int __pyx_t_5;
  19153. int __pyx_t_6;
  19154. int __pyx_lineno = 0;
  19155. const char *__pyx_filename = NULL;
  19156. int __pyx_clineno = 0;
  19157. __Pyx_RefNannySetupContext("_both_points_are_on_same_side_of_origin", 0);
  19158. /* "fontTools/misc/bezierTools.py":1149
  19159. *
  19160. * def _both_points_are_on_same_side_of_origin(a, b, origin):
  19161. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0]) # <<<<<<<<<<<<<<
  19162. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1])
  19163. * return not (xDiff <= 0.0 and yDiff <= 0.0)
  19164. */
  19165. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_a, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1149, __pyx_L1_error)
  19166. __Pyx_GOTREF(__pyx_t_1);
  19167. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_origin, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1149, __pyx_L1_error)
  19168. __Pyx_GOTREF(__pyx_t_2);
  19169. __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1149, __pyx_L1_error)
  19170. __Pyx_GOTREF(__pyx_t_3);
  19171. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19172. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19173. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1149, __pyx_L1_error)
  19174. __Pyx_GOTREF(__pyx_t_2);
  19175. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_origin, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1149, __pyx_L1_error)
  19176. __Pyx_GOTREF(__pyx_t_1);
  19177. __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
  19178. __Pyx_GOTREF(__pyx_t_4);
  19179. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19180. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19181. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1149, __pyx_L1_error)
  19182. __Pyx_GOTREF(__pyx_t_1);
  19183. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19184. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  19185. __pyx_v_xDiff = __pyx_t_1;
  19186. __pyx_t_1 = 0;
  19187. /* "fontTools/misc/bezierTools.py":1150
  19188. * def _both_points_are_on_same_side_of_origin(a, b, origin):
  19189. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0])
  19190. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1]) # <<<<<<<<<<<<<<
  19191. * return not (xDiff <= 0.0 and yDiff <= 0.0)
  19192. *
  19193. */
  19194. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_a, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1150, __pyx_L1_error)
  19195. __Pyx_GOTREF(__pyx_t_1);
  19196. __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_origin, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1150, __pyx_L1_error)
  19197. __Pyx_GOTREF(__pyx_t_4);
  19198. __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1150, __pyx_L1_error)
  19199. __Pyx_GOTREF(__pyx_t_3);
  19200. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19201. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  19202. __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1150, __pyx_L1_error)
  19203. __Pyx_GOTREF(__pyx_t_4);
  19204. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_origin, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1150, __pyx_L1_error)
  19205. __Pyx_GOTREF(__pyx_t_1);
  19206. __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1150, __pyx_L1_error)
  19207. __Pyx_GOTREF(__pyx_t_2);
  19208. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  19209. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19210. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1150, __pyx_L1_error)
  19211. __Pyx_GOTREF(__pyx_t_1);
  19212. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19213. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19214. __pyx_v_yDiff = __pyx_t_1;
  19215. __pyx_t_1 = 0;
  19216. /* "fontTools/misc/bezierTools.py":1151
  19217. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0])
  19218. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1])
  19219. * return not (xDiff <= 0.0 and yDiff <= 0.0) # <<<<<<<<<<<<<<
  19220. *
  19221. *
  19222. */
  19223. __Pyx_XDECREF(__pyx_r);
  19224. __pyx_t_1 = PyObject_RichCompare(__pyx_v_xDiff, __pyx_mstate_global->__pyx_float_0_0, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1151, __pyx_L1_error)
  19225. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1151, __pyx_L1_error)
  19226. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19227. if (__pyx_t_6) {
  19228. } else {
  19229. __pyx_t_5 = __pyx_t_6;
  19230. goto __pyx_L3_bool_binop_done;
  19231. }
  19232. __pyx_t_1 = PyObject_RichCompare(__pyx_v_yDiff, __pyx_mstate_global->__pyx_float_0_0, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1151, __pyx_L1_error)
  19233. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1151, __pyx_L1_error)
  19234. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19235. __pyx_t_5 = __pyx_t_6;
  19236. __pyx_L3_bool_binop_done:;
  19237. __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1151, __pyx_L1_error)
  19238. __Pyx_GOTREF(__pyx_t_1);
  19239. __pyx_r = __pyx_t_1;
  19240. __pyx_t_1 = 0;
  19241. goto __pyx_L0;
  19242. /* "fontTools/misc/bezierTools.py":1148
  19243. *
  19244. *
  19245. * def _both_points_are_on_same_side_of_origin(a, b, origin): # <<<<<<<<<<<<<<
  19246. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0])
  19247. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1])
  19248. */
  19249. /* function exit code */
  19250. __pyx_L1_error:;
  19251. __Pyx_XDECREF(__pyx_t_1);
  19252. __Pyx_XDECREF(__pyx_t_2);
  19253. __Pyx_XDECREF(__pyx_t_3);
  19254. __Pyx_XDECREF(__pyx_t_4);
  19255. __Pyx_AddTraceback("fontTools.misc.bezierTools._both_points_are_on_same_side_of_origin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19256. __pyx_r = NULL;
  19257. __pyx_L0:;
  19258. __Pyx_XDECREF(__pyx_v_xDiff);
  19259. __Pyx_XDECREF(__pyx_v_yDiff);
  19260. __Pyx_XGIVEREF(__pyx_r);
  19261. __Pyx_RefNannyFinishContext();
  19262. return __pyx_r;
  19263. }
  19264. /* "fontTools/misc/bezierTools.py":1154
  19265. *
  19266. *
  19267. * def lineLineIntersections(s1, e1, s2, e2): # <<<<<<<<<<<<<<
  19268. * """Finds intersections between two line segments.
  19269. *
  19270. */
  19271. /* Python wrapper */
  19272. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_73lineLineIntersections(PyObject *__pyx_self,
  19273. #if CYTHON_METH_FASTCALL
  19274. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  19275. #else
  19276. PyObject *__pyx_args, PyObject *__pyx_kwds
  19277. #endif
  19278. ); /*proto*/
  19279. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_72lineLineIntersections, "lineLineIntersections(s1, e1, s2, e2)\n\nFinds intersections between two line segments.\n\nArgs:\n s1, e1: Coordinates of the first line as 2D tuples.\n s2, e2: Coordinates of the second line as 2D tuples.\n\nReturns:\n A list of ``Intersection`` objects, each object having ``pt``, ``t1``\n and ``t2`` attributes containing the intersection point, time on first\n segment and time on second segment respectively.\n\nExamples::\n\n >>> a = lineLineIntersections( (310,389), (453, 222), (289, 251), (447, 367))\n >>> len(a)\n 1\n >>> intersection = a[0]\n >>> intersection.pt\n (374.44882952482897, 313.73458370177315)\n >>> (intersection.t1, intersection.t2)\n (0.45069111555824465, 0.5408153767394238)");
  19280. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_73lineLineIntersections = {"lineLineIntersections", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_73lineLineIntersections, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_72lineLineIntersections};
  19281. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_73lineLineIntersections(PyObject *__pyx_self,
  19282. #if CYTHON_METH_FASTCALL
  19283. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  19284. #else
  19285. PyObject *__pyx_args, PyObject *__pyx_kwds
  19286. #endif
  19287. ) {
  19288. PyObject *__pyx_v_s1 = 0;
  19289. PyObject *__pyx_v_e1 = 0;
  19290. PyObject *__pyx_v_s2 = 0;
  19291. PyObject *__pyx_v_e2 = 0;
  19292. #if !CYTHON_METH_FASTCALL
  19293. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  19294. #endif
  19295. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  19296. PyObject* values[4] = {0,0,0,0};
  19297. int __pyx_lineno = 0;
  19298. const char *__pyx_filename = NULL;
  19299. int __pyx_clineno = 0;
  19300. PyObject *__pyx_r = 0;
  19301. __Pyx_RefNannyDeclarations
  19302. __Pyx_RefNannySetupContext("lineLineIntersections (wrapper)", 0);
  19303. #if !CYTHON_METH_FASTCALL
  19304. #if CYTHON_ASSUME_SAFE_SIZE
  19305. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  19306. #else
  19307. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  19308. #endif
  19309. #endif
  19310. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  19311. {
  19312. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_s1,&__pyx_mstate_global->__pyx_n_u_e1,&__pyx_mstate_global->__pyx_n_u_s2,&__pyx_mstate_global->__pyx_n_u_e2,0};
  19313. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  19314. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1154, __pyx_L3_error)
  19315. if (__pyx_kwds_len > 0) {
  19316. switch (__pyx_nargs) {
  19317. case 4:
  19318. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  19319. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19320. CYTHON_FALLTHROUGH;
  19321. case 3:
  19322. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  19323. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19324. CYTHON_FALLTHROUGH;
  19325. case 2:
  19326. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  19327. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19328. CYTHON_FALLTHROUGH;
  19329. case 1:
  19330. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  19331. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19332. CYTHON_FALLTHROUGH;
  19333. case 0: break;
  19334. default: goto __pyx_L5_argtuple_error;
  19335. }
  19336. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  19337. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lineLineIntersections", 0) < (0)) __PYX_ERR(0, 1154, __pyx_L3_error)
  19338. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  19339. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lineLineIntersections", 1, 4, 4, i); __PYX_ERR(0, 1154, __pyx_L3_error) }
  19340. }
  19341. } else if (unlikely(__pyx_nargs != 4)) {
  19342. goto __pyx_L5_argtuple_error;
  19343. } else {
  19344. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  19345. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19346. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  19347. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19348. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  19349. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19350. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  19351. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19352. }
  19353. __pyx_v_s1 = values[0];
  19354. __pyx_v_e1 = values[1];
  19355. __pyx_v_s2 = values[2];
  19356. __pyx_v_e2 = values[3];
  19357. }
  19358. goto __pyx_L6_skip;
  19359. __pyx_L5_argtuple_error:;
  19360. __Pyx_RaiseArgtupleInvalid("lineLineIntersections", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1154, __pyx_L3_error)
  19361. __pyx_L6_skip:;
  19362. goto __pyx_L4_argument_unpacking_done;
  19363. __pyx_L3_error:;
  19364. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  19365. Py_XDECREF(values[__pyx_temp]);
  19366. }
  19367. __Pyx_AddTraceback("fontTools.misc.bezierTools.lineLineIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19368. __Pyx_RefNannyFinishContext();
  19369. return NULL;
  19370. __pyx_L4_argument_unpacking_done:;
  19371. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_72lineLineIntersections(__pyx_self, __pyx_v_s1, __pyx_v_e1, __pyx_v_s2, __pyx_v_e2);
  19372. /* function exit code */
  19373. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  19374. Py_XDECREF(values[__pyx_temp]);
  19375. }
  19376. __Pyx_RefNannyFinishContext();
  19377. return __pyx_r;
  19378. }
  19379. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_72lineLineIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_e1, PyObject *__pyx_v_s2, PyObject *__pyx_v_e2) {
  19380. PyObject *__pyx_v_s1x = NULL;
  19381. PyObject *__pyx_v_s1y = NULL;
  19382. PyObject *__pyx_v_e1x = NULL;
  19383. PyObject *__pyx_v_e1y = NULL;
  19384. PyObject *__pyx_v_s2x = NULL;
  19385. PyObject *__pyx_v_s2y = NULL;
  19386. PyObject *__pyx_v_e2x = NULL;
  19387. PyObject *__pyx_v_e2y = NULL;
  19388. PyObject *__pyx_v_x = NULL;
  19389. PyObject *__pyx_v_slope34 = NULL;
  19390. PyObject *__pyx_v_y = NULL;
  19391. PyObject *__pyx_v_pt = NULL;
  19392. PyObject *__pyx_v_slope12 = NULL;
  19393. PyObject *__pyx_r = NULL;
  19394. __Pyx_RefNannyDeclarations
  19395. PyObject *__pyx_t_1 = NULL;
  19396. PyObject *__pyx_t_2 = NULL;
  19397. PyObject *__pyx_t_3 = NULL;
  19398. PyObject *(*__pyx_t_4)(PyObject *);
  19399. int __pyx_t_5;
  19400. PyObject *__pyx_t_6 = NULL;
  19401. size_t __pyx_t_7;
  19402. int __pyx_t_8;
  19403. int __pyx_t_9;
  19404. PyObject *__pyx_t_10 = NULL;
  19405. PyObject *__pyx_t_11 = NULL;
  19406. PyObject *__pyx_t_12 = NULL;
  19407. int __pyx_lineno = 0;
  19408. const char *__pyx_filename = NULL;
  19409. int __pyx_clineno = 0;
  19410. __Pyx_RefNannySetupContext("lineLineIntersections", 0);
  19411. /* "fontTools/misc/bezierTools.py":1177
  19412. * (0.45069111555824465, 0.5408153767394238)
  19413. * """
  19414. * s1x, s1y = s1 # <<<<<<<<<<<<<<
  19415. * e1x, e1y = e1
  19416. * s2x, s2y = s2
  19417. */
  19418. if ((likely(PyTuple_CheckExact(__pyx_v_s1))) || (PyList_CheckExact(__pyx_v_s1))) {
  19419. PyObject* sequence = __pyx_v_s1;
  19420. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  19421. if (unlikely(size != 2)) {
  19422. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  19423. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  19424. __PYX_ERR(0, 1177, __pyx_L1_error)
  19425. }
  19426. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  19427. if (likely(PyTuple_CheckExact(sequence))) {
  19428. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  19429. __Pyx_INCREF(__pyx_t_1);
  19430. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  19431. __Pyx_INCREF(__pyx_t_2);
  19432. } else {
  19433. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  19434. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19435. __Pyx_XGOTREF(__pyx_t_1);
  19436. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  19437. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19438. __Pyx_XGOTREF(__pyx_t_2);
  19439. }
  19440. #else
  19441. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19442. __Pyx_GOTREF(__pyx_t_1);
  19443. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19444. __Pyx_GOTREF(__pyx_t_2);
  19445. #endif
  19446. } else {
  19447. Py_ssize_t index = -1;
  19448. __pyx_t_3 = PyObject_GetIter(__pyx_v_s1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19449. __Pyx_GOTREF(__pyx_t_3);
  19450. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  19451. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  19452. __Pyx_GOTREF(__pyx_t_1);
  19453. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  19454. __Pyx_GOTREF(__pyx_t_2);
  19455. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19456. __pyx_t_4 = NULL;
  19457. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19458. goto __pyx_L4_unpacking_done;
  19459. __pyx_L3_unpacking_failed:;
  19460. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19461. __pyx_t_4 = NULL;
  19462. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  19463. __PYX_ERR(0, 1177, __pyx_L1_error)
  19464. __pyx_L4_unpacking_done:;
  19465. }
  19466. __pyx_v_s1x = __pyx_t_1;
  19467. __pyx_t_1 = 0;
  19468. __pyx_v_s1y = __pyx_t_2;
  19469. __pyx_t_2 = 0;
  19470. /* "fontTools/misc/bezierTools.py":1178
  19471. * """
  19472. * s1x, s1y = s1
  19473. * e1x, e1y = e1 # <<<<<<<<<<<<<<
  19474. * s2x, s2y = s2
  19475. * e2x, e2y = e2
  19476. */
  19477. if ((likely(PyTuple_CheckExact(__pyx_v_e1))) || (PyList_CheckExact(__pyx_v_e1))) {
  19478. PyObject* sequence = __pyx_v_e1;
  19479. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  19480. if (unlikely(size != 2)) {
  19481. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  19482. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  19483. __PYX_ERR(0, 1178, __pyx_L1_error)
  19484. }
  19485. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  19486. if (likely(PyTuple_CheckExact(sequence))) {
  19487. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  19488. __Pyx_INCREF(__pyx_t_2);
  19489. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  19490. __Pyx_INCREF(__pyx_t_1);
  19491. } else {
  19492. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  19493. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19494. __Pyx_XGOTREF(__pyx_t_2);
  19495. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  19496. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19497. __Pyx_XGOTREF(__pyx_t_1);
  19498. }
  19499. #else
  19500. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19501. __Pyx_GOTREF(__pyx_t_2);
  19502. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19503. __Pyx_GOTREF(__pyx_t_1);
  19504. #endif
  19505. } else {
  19506. Py_ssize_t index = -1;
  19507. __pyx_t_3 = PyObject_GetIter(__pyx_v_e1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19508. __Pyx_GOTREF(__pyx_t_3);
  19509. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  19510. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  19511. __Pyx_GOTREF(__pyx_t_2);
  19512. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  19513. __Pyx_GOTREF(__pyx_t_1);
  19514. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19515. __pyx_t_4 = NULL;
  19516. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19517. goto __pyx_L6_unpacking_done;
  19518. __pyx_L5_unpacking_failed:;
  19519. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19520. __pyx_t_4 = NULL;
  19521. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  19522. __PYX_ERR(0, 1178, __pyx_L1_error)
  19523. __pyx_L6_unpacking_done:;
  19524. }
  19525. __pyx_v_e1x = __pyx_t_2;
  19526. __pyx_t_2 = 0;
  19527. __pyx_v_e1y = __pyx_t_1;
  19528. __pyx_t_1 = 0;
  19529. /* "fontTools/misc/bezierTools.py":1179
  19530. * s1x, s1y = s1
  19531. * e1x, e1y = e1
  19532. * s2x, s2y = s2 # <<<<<<<<<<<<<<
  19533. * e2x, e2y = e2
  19534. * if (
  19535. */
  19536. if ((likely(PyTuple_CheckExact(__pyx_v_s2))) || (PyList_CheckExact(__pyx_v_s2))) {
  19537. PyObject* sequence = __pyx_v_s2;
  19538. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  19539. if (unlikely(size != 2)) {
  19540. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  19541. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  19542. __PYX_ERR(0, 1179, __pyx_L1_error)
  19543. }
  19544. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  19545. if (likely(PyTuple_CheckExact(sequence))) {
  19546. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  19547. __Pyx_INCREF(__pyx_t_1);
  19548. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  19549. __Pyx_INCREF(__pyx_t_2);
  19550. } else {
  19551. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  19552. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19553. __Pyx_XGOTREF(__pyx_t_1);
  19554. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  19555. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19556. __Pyx_XGOTREF(__pyx_t_2);
  19557. }
  19558. #else
  19559. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19560. __Pyx_GOTREF(__pyx_t_1);
  19561. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19562. __Pyx_GOTREF(__pyx_t_2);
  19563. #endif
  19564. } else {
  19565. Py_ssize_t index = -1;
  19566. __pyx_t_3 = PyObject_GetIter(__pyx_v_s2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19567. __Pyx_GOTREF(__pyx_t_3);
  19568. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  19569. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  19570. __Pyx_GOTREF(__pyx_t_1);
  19571. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  19572. __Pyx_GOTREF(__pyx_t_2);
  19573. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19574. __pyx_t_4 = NULL;
  19575. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19576. goto __pyx_L8_unpacking_done;
  19577. __pyx_L7_unpacking_failed:;
  19578. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19579. __pyx_t_4 = NULL;
  19580. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  19581. __PYX_ERR(0, 1179, __pyx_L1_error)
  19582. __pyx_L8_unpacking_done:;
  19583. }
  19584. __pyx_v_s2x = __pyx_t_1;
  19585. __pyx_t_1 = 0;
  19586. __pyx_v_s2y = __pyx_t_2;
  19587. __pyx_t_2 = 0;
  19588. /* "fontTools/misc/bezierTools.py":1180
  19589. * e1x, e1y = e1
  19590. * s2x, s2y = s2
  19591. * e2x, e2y = e2 # <<<<<<<<<<<<<<
  19592. * if (
  19593. * math.isclose(s2x, e2x) and math.isclose(s1x, e1x) and not math.isclose(s1x, s2x)
  19594. */
  19595. if ((likely(PyTuple_CheckExact(__pyx_v_e2))) || (PyList_CheckExact(__pyx_v_e2))) {
  19596. PyObject* sequence = __pyx_v_e2;
  19597. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  19598. if (unlikely(size != 2)) {
  19599. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  19600. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  19601. __PYX_ERR(0, 1180, __pyx_L1_error)
  19602. }
  19603. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  19604. if (likely(PyTuple_CheckExact(sequence))) {
  19605. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  19606. __Pyx_INCREF(__pyx_t_2);
  19607. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  19608. __Pyx_INCREF(__pyx_t_1);
  19609. } else {
  19610. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  19611. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19612. __Pyx_XGOTREF(__pyx_t_2);
  19613. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  19614. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19615. __Pyx_XGOTREF(__pyx_t_1);
  19616. }
  19617. #else
  19618. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19619. __Pyx_GOTREF(__pyx_t_2);
  19620. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19621. __Pyx_GOTREF(__pyx_t_1);
  19622. #endif
  19623. } else {
  19624. Py_ssize_t index = -1;
  19625. __pyx_t_3 = PyObject_GetIter(__pyx_v_e2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19626. __Pyx_GOTREF(__pyx_t_3);
  19627. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  19628. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
  19629. __Pyx_GOTREF(__pyx_t_2);
  19630. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
  19631. __Pyx_GOTREF(__pyx_t_1);
  19632. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19633. __pyx_t_4 = NULL;
  19634. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19635. goto __pyx_L10_unpacking_done;
  19636. __pyx_L9_unpacking_failed:;
  19637. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19638. __pyx_t_4 = NULL;
  19639. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  19640. __PYX_ERR(0, 1180, __pyx_L1_error)
  19641. __pyx_L10_unpacking_done:;
  19642. }
  19643. __pyx_v_e2x = __pyx_t_2;
  19644. __pyx_t_2 = 0;
  19645. __pyx_v_e2y = __pyx_t_1;
  19646. __pyx_t_1 = 0;
  19647. /* "fontTools/misc/bezierTools.py":1182
  19648. * e2x, e2y = e2
  19649. * if (
  19650. * math.isclose(s2x, e2x) and math.isclose(s1x, e1x) and not math.isclose(s1x, s2x) # <<<<<<<<<<<<<<
  19651. * ): # Parallel vertical
  19652. * return []
  19653. */
  19654. __pyx_t_2 = NULL;
  19655. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19656. __Pyx_GOTREF(__pyx_t_3);
  19657. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19658. __Pyx_GOTREF(__pyx_t_6);
  19659. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19660. __pyx_t_7 = 1;
  19661. #if CYTHON_UNPACK_METHODS
  19662. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  19663. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
  19664. assert(__pyx_t_2);
  19665. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  19666. __Pyx_INCREF(__pyx_t_2);
  19667. __Pyx_INCREF(__pyx__function);
  19668. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  19669. __pyx_t_7 = 0;
  19670. }
  19671. #endif
  19672. {
  19673. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_s2x, __pyx_v_e2x};
  19674. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  19675. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  19676. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  19677. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19678. __Pyx_GOTREF(__pyx_t_1);
  19679. }
  19680. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1182, __pyx_L1_error)
  19681. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19682. if (__pyx_t_8) {
  19683. } else {
  19684. __pyx_t_5 = __pyx_t_8;
  19685. goto __pyx_L12_bool_binop_done;
  19686. }
  19687. __pyx_t_6 = NULL;
  19688. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19689. __Pyx_GOTREF(__pyx_t_2);
  19690. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19691. __Pyx_GOTREF(__pyx_t_3);
  19692. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19693. __pyx_t_7 = 1;
  19694. #if CYTHON_UNPACK_METHODS
  19695. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  19696. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  19697. assert(__pyx_t_6);
  19698. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  19699. __Pyx_INCREF(__pyx_t_6);
  19700. __Pyx_INCREF(__pyx__function);
  19701. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  19702. __pyx_t_7 = 0;
  19703. }
  19704. #endif
  19705. {
  19706. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_s1x, __pyx_v_e1x};
  19707. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  19708. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  19709. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19710. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19711. __Pyx_GOTREF(__pyx_t_1);
  19712. }
  19713. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1182, __pyx_L1_error)
  19714. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19715. if (__pyx_t_8) {
  19716. } else {
  19717. __pyx_t_5 = __pyx_t_8;
  19718. goto __pyx_L12_bool_binop_done;
  19719. }
  19720. __pyx_t_3 = NULL;
  19721. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19722. __Pyx_GOTREF(__pyx_t_6);
  19723. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19724. __Pyx_GOTREF(__pyx_t_2);
  19725. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  19726. __pyx_t_7 = 1;
  19727. #if CYTHON_UNPACK_METHODS
  19728. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  19729. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  19730. assert(__pyx_t_3);
  19731. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  19732. __Pyx_INCREF(__pyx_t_3);
  19733. __Pyx_INCREF(__pyx__function);
  19734. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  19735. __pyx_t_7 = 0;
  19736. }
  19737. #endif
  19738. {
  19739. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_s1x, __pyx_v_s2x};
  19740. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  19741. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  19742. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19743. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19744. __Pyx_GOTREF(__pyx_t_1);
  19745. }
  19746. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1182, __pyx_L1_error)
  19747. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19748. __pyx_t_9 = (!__pyx_t_8);
  19749. __pyx_t_5 = __pyx_t_9;
  19750. __pyx_L12_bool_binop_done:;
  19751. /* "fontTools/misc/bezierTools.py":1181
  19752. * s2x, s2y = s2
  19753. * e2x, e2y = e2
  19754. * if ( # <<<<<<<<<<<<<<
  19755. * math.isclose(s2x, e2x) and math.isclose(s1x, e1x) and not math.isclose(s1x, s2x)
  19756. * ): # Parallel vertical
  19757. */
  19758. if (__pyx_t_5) {
  19759. /* "fontTools/misc/bezierTools.py":1184
  19760. * math.isclose(s2x, e2x) and math.isclose(s1x, e1x) and not math.isclose(s1x, s2x)
  19761. * ): # Parallel vertical
  19762. * return [] # <<<<<<<<<<<<<<
  19763. * if (
  19764. * math.isclose(s2y, e2y) and math.isclose(s1y, e1y) and not math.isclose(s1y, s2y)
  19765. */
  19766. __Pyx_XDECREF(__pyx_r);
  19767. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1184, __pyx_L1_error)
  19768. __Pyx_GOTREF(__pyx_t_1);
  19769. __pyx_r = __pyx_t_1;
  19770. __pyx_t_1 = 0;
  19771. goto __pyx_L0;
  19772. /* "fontTools/misc/bezierTools.py":1181
  19773. * s2x, s2y = s2
  19774. * e2x, e2y = e2
  19775. * if ( # <<<<<<<<<<<<<<
  19776. * math.isclose(s2x, e2x) and math.isclose(s1x, e1x) and not math.isclose(s1x, s2x)
  19777. * ): # Parallel vertical
  19778. */
  19779. }
  19780. /* "fontTools/misc/bezierTools.py":1186
  19781. * return []
  19782. * if (
  19783. * math.isclose(s2y, e2y) and math.isclose(s1y, e1y) and not math.isclose(s1y, s2y) # <<<<<<<<<<<<<<
  19784. * ): # Parallel horizontal
  19785. * return []
  19786. */
  19787. __pyx_t_2 = NULL;
  19788. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19789. __Pyx_GOTREF(__pyx_t_3);
  19790. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19791. __Pyx_GOTREF(__pyx_t_6);
  19792. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19793. __pyx_t_7 = 1;
  19794. #if CYTHON_UNPACK_METHODS
  19795. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  19796. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
  19797. assert(__pyx_t_2);
  19798. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  19799. __Pyx_INCREF(__pyx_t_2);
  19800. __Pyx_INCREF(__pyx__function);
  19801. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  19802. __pyx_t_7 = 0;
  19803. }
  19804. #endif
  19805. {
  19806. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_s2y, __pyx_v_e2y};
  19807. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  19808. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  19809. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  19810. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19811. __Pyx_GOTREF(__pyx_t_1);
  19812. }
  19813. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1186, __pyx_L1_error)
  19814. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19815. if (__pyx_t_9) {
  19816. } else {
  19817. __pyx_t_5 = __pyx_t_9;
  19818. goto __pyx_L16_bool_binop_done;
  19819. }
  19820. __pyx_t_6 = NULL;
  19821. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19822. __Pyx_GOTREF(__pyx_t_2);
  19823. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19824. __Pyx_GOTREF(__pyx_t_3);
  19825. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19826. __pyx_t_7 = 1;
  19827. #if CYTHON_UNPACK_METHODS
  19828. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  19829. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  19830. assert(__pyx_t_6);
  19831. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  19832. __Pyx_INCREF(__pyx_t_6);
  19833. __Pyx_INCREF(__pyx__function);
  19834. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  19835. __pyx_t_7 = 0;
  19836. }
  19837. #endif
  19838. {
  19839. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_s1y, __pyx_v_e1y};
  19840. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  19841. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  19842. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19843. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19844. __Pyx_GOTREF(__pyx_t_1);
  19845. }
  19846. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1186, __pyx_L1_error)
  19847. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19848. if (__pyx_t_9) {
  19849. } else {
  19850. __pyx_t_5 = __pyx_t_9;
  19851. goto __pyx_L16_bool_binop_done;
  19852. }
  19853. __pyx_t_3 = NULL;
  19854. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19855. __Pyx_GOTREF(__pyx_t_6);
  19856. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19857. __Pyx_GOTREF(__pyx_t_2);
  19858. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  19859. __pyx_t_7 = 1;
  19860. #if CYTHON_UNPACK_METHODS
  19861. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  19862. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  19863. assert(__pyx_t_3);
  19864. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  19865. __Pyx_INCREF(__pyx_t_3);
  19866. __Pyx_INCREF(__pyx__function);
  19867. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  19868. __pyx_t_7 = 0;
  19869. }
  19870. #endif
  19871. {
  19872. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_s1y, __pyx_v_s2y};
  19873. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  19874. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  19875. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19876. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19877. __Pyx_GOTREF(__pyx_t_1);
  19878. }
  19879. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1186, __pyx_L1_error)
  19880. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19881. __pyx_t_8 = (!__pyx_t_9);
  19882. __pyx_t_5 = __pyx_t_8;
  19883. __pyx_L16_bool_binop_done:;
  19884. /* "fontTools/misc/bezierTools.py":1185
  19885. * ): # Parallel vertical
  19886. * return []
  19887. * if ( # <<<<<<<<<<<<<<
  19888. * math.isclose(s2y, e2y) and math.isclose(s1y, e1y) and not math.isclose(s1y, s2y)
  19889. * ): # Parallel horizontal
  19890. */
  19891. if (__pyx_t_5) {
  19892. /* "fontTools/misc/bezierTools.py":1188
  19893. * math.isclose(s2y, e2y) and math.isclose(s1y, e1y) and not math.isclose(s1y, s2y)
  19894. * ): # Parallel horizontal
  19895. * return [] # <<<<<<<<<<<<<<
  19896. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny
  19897. * return []
  19898. */
  19899. __Pyx_XDECREF(__pyx_r);
  19900. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1188, __pyx_L1_error)
  19901. __Pyx_GOTREF(__pyx_t_1);
  19902. __pyx_r = __pyx_t_1;
  19903. __pyx_t_1 = 0;
  19904. goto __pyx_L0;
  19905. /* "fontTools/misc/bezierTools.py":1185
  19906. * ): # Parallel vertical
  19907. * return []
  19908. * if ( # <<<<<<<<<<<<<<
  19909. * math.isclose(s2y, e2y) and math.isclose(s1y, e1y) and not math.isclose(s1y, s2y)
  19910. * ): # Parallel horizontal
  19911. */
  19912. }
  19913. /* "fontTools/misc/bezierTools.py":1189
  19914. * ): # Parallel horizontal
  19915. * return []
  19916. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny # <<<<<<<<<<<<<<
  19917. * return []
  19918. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  19919. */
  19920. __pyx_t_2 = NULL;
  19921. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1189, __pyx_L1_error)
  19922. __Pyx_GOTREF(__pyx_t_3);
  19923. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1189, __pyx_L1_error)
  19924. __Pyx_GOTREF(__pyx_t_6);
  19925. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19926. __pyx_t_7 = 1;
  19927. #if CYTHON_UNPACK_METHODS
  19928. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  19929. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
  19930. assert(__pyx_t_2);
  19931. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  19932. __Pyx_INCREF(__pyx_t_2);
  19933. __Pyx_INCREF(__pyx__function);
  19934. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  19935. __pyx_t_7 = 0;
  19936. }
  19937. #endif
  19938. {
  19939. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_s2x, __pyx_v_e2x};
  19940. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  19941. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  19942. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  19943. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
  19944. __Pyx_GOTREF(__pyx_t_1);
  19945. }
  19946. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1189, __pyx_L1_error)
  19947. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19948. if (__pyx_t_8) {
  19949. } else {
  19950. __pyx_t_5 = __pyx_t_8;
  19951. goto __pyx_L20_bool_binop_done;
  19952. }
  19953. __pyx_t_6 = NULL;
  19954. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error)
  19955. __Pyx_GOTREF(__pyx_t_2);
  19956. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1189, __pyx_L1_error)
  19957. __Pyx_GOTREF(__pyx_t_3);
  19958. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19959. __pyx_t_7 = 1;
  19960. #if CYTHON_UNPACK_METHODS
  19961. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  19962. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  19963. assert(__pyx_t_6);
  19964. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  19965. __Pyx_INCREF(__pyx_t_6);
  19966. __Pyx_INCREF(__pyx__function);
  19967. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  19968. __pyx_t_7 = 0;
  19969. }
  19970. #endif
  19971. {
  19972. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_s2y, __pyx_v_e2y};
  19973. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  19974. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  19975. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19976. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
  19977. __Pyx_GOTREF(__pyx_t_1);
  19978. }
  19979. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1189, __pyx_L1_error)
  19980. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19981. __pyx_t_5 = __pyx_t_8;
  19982. __pyx_L20_bool_binop_done:;
  19983. if (__pyx_t_5) {
  19984. /* "fontTools/misc/bezierTools.py":1190
  19985. * return []
  19986. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny
  19987. * return [] # <<<<<<<<<<<<<<
  19988. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  19989. * return []
  19990. */
  19991. __Pyx_XDECREF(__pyx_r);
  19992. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error)
  19993. __Pyx_GOTREF(__pyx_t_1);
  19994. __pyx_r = __pyx_t_1;
  19995. __pyx_t_1 = 0;
  19996. goto __pyx_L0;
  19997. /* "fontTools/misc/bezierTools.py":1189
  19998. * ): # Parallel horizontal
  19999. * return []
  20000. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny # <<<<<<<<<<<<<<
  20001. * return []
  20002. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  20003. */
  20004. }
  20005. /* "fontTools/misc/bezierTools.py":1191
  20006. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny
  20007. * return []
  20008. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny # <<<<<<<<<<<<<<
  20009. * return []
  20010. * if math.isclose(e1x, s1x):
  20011. */
  20012. __pyx_t_3 = NULL;
  20013. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1191, __pyx_L1_error)
  20014. __Pyx_GOTREF(__pyx_t_6);
  20015. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1191, __pyx_L1_error)
  20016. __Pyx_GOTREF(__pyx_t_2);
  20017. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20018. __pyx_t_7 = 1;
  20019. #if CYTHON_UNPACK_METHODS
  20020. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  20021. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  20022. assert(__pyx_t_3);
  20023. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  20024. __Pyx_INCREF(__pyx_t_3);
  20025. __Pyx_INCREF(__pyx__function);
  20026. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  20027. __pyx_t_7 = 0;
  20028. }
  20029. #endif
  20030. {
  20031. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_s1x, __pyx_v_e1x};
  20032. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20033. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  20034. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20035. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1191, __pyx_L1_error)
  20036. __Pyx_GOTREF(__pyx_t_1);
  20037. }
  20038. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1191, __pyx_L1_error)
  20039. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20040. if (__pyx_t_8) {
  20041. } else {
  20042. __pyx_t_5 = __pyx_t_8;
  20043. goto __pyx_L23_bool_binop_done;
  20044. }
  20045. __pyx_t_2 = NULL;
  20046. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1191, __pyx_L1_error)
  20047. __Pyx_GOTREF(__pyx_t_3);
  20048. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1191, __pyx_L1_error)
  20049. __Pyx_GOTREF(__pyx_t_6);
  20050. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20051. __pyx_t_7 = 1;
  20052. #if CYTHON_UNPACK_METHODS
  20053. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  20054. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
  20055. assert(__pyx_t_2);
  20056. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  20057. __Pyx_INCREF(__pyx_t_2);
  20058. __Pyx_INCREF(__pyx__function);
  20059. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  20060. __pyx_t_7 = 0;
  20061. }
  20062. #endif
  20063. {
  20064. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_s1y, __pyx_v_e1y};
  20065. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20066. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20067. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20068. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1191, __pyx_L1_error)
  20069. __Pyx_GOTREF(__pyx_t_1);
  20070. }
  20071. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1191, __pyx_L1_error)
  20072. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20073. __pyx_t_5 = __pyx_t_8;
  20074. __pyx_L23_bool_binop_done:;
  20075. if (__pyx_t_5) {
  20076. /* "fontTools/misc/bezierTools.py":1192
  20077. * return []
  20078. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  20079. * return [] # <<<<<<<<<<<<<<
  20080. * if math.isclose(e1x, s1x):
  20081. * x = s1x
  20082. */
  20083. __Pyx_XDECREF(__pyx_r);
  20084. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error)
  20085. __Pyx_GOTREF(__pyx_t_1);
  20086. __pyx_r = __pyx_t_1;
  20087. __pyx_t_1 = 0;
  20088. goto __pyx_L0;
  20089. /* "fontTools/misc/bezierTools.py":1191
  20090. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny
  20091. * return []
  20092. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny # <<<<<<<<<<<<<<
  20093. * return []
  20094. * if math.isclose(e1x, s1x):
  20095. */
  20096. }
  20097. /* "fontTools/misc/bezierTools.py":1193
  20098. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  20099. * return []
  20100. * if math.isclose(e1x, s1x): # <<<<<<<<<<<<<<
  20101. * x = s1x
  20102. * slope34 = (e2y - s2y) / (e2x - s2x)
  20103. */
  20104. __pyx_t_6 = NULL;
  20105. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1193, __pyx_L1_error)
  20106. __Pyx_GOTREF(__pyx_t_2);
  20107. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1193, __pyx_L1_error)
  20108. __Pyx_GOTREF(__pyx_t_3);
  20109. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20110. __pyx_t_7 = 1;
  20111. #if CYTHON_UNPACK_METHODS
  20112. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  20113. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  20114. assert(__pyx_t_6);
  20115. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  20116. __Pyx_INCREF(__pyx_t_6);
  20117. __Pyx_INCREF(__pyx__function);
  20118. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  20119. __pyx_t_7 = 0;
  20120. }
  20121. #endif
  20122. {
  20123. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_e1x, __pyx_v_s1x};
  20124. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20125. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20126. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20127. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1193, __pyx_L1_error)
  20128. __Pyx_GOTREF(__pyx_t_1);
  20129. }
  20130. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1193, __pyx_L1_error)
  20131. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20132. if (__pyx_t_5) {
  20133. /* "fontTools/misc/bezierTools.py":1194
  20134. * return []
  20135. * if math.isclose(e1x, s1x):
  20136. * x = s1x # <<<<<<<<<<<<<<
  20137. * slope34 = (e2y - s2y) / (e2x - s2x)
  20138. * y = slope34 * (x - s2x) + s2y
  20139. */
  20140. __Pyx_INCREF(__pyx_v_s1x);
  20141. __pyx_v_x = __pyx_v_s1x;
  20142. /* "fontTools/misc/bezierTools.py":1195
  20143. * if math.isclose(e1x, s1x):
  20144. * x = s1x
  20145. * slope34 = (e2y - s2y) / (e2x - s2x) # <<<<<<<<<<<<<<
  20146. * y = slope34 * (x - s2x) + s2y
  20147. * pt = (x, y)
  20148. */
  20149. __pyx_t_1 = PyNumber_Subtract(__pyx_v_e2y, __pyx_v_s2y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1195, __pyx_L1_error)
  20150. __Pyx_GOTREF(__pyx_t_1);
  20151. __pyx_t_3 = PyNumber_Subtract(__pyx_v_e2x, __pyx_v_s2x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1195, __pyx_L1_error)
  20152. __Pyx_GOTREF(__pyx_t_3);
  20153. __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1195, __pyx_L1_error)
  20154. __Pyx_GOTREF(__pyx_t_6);
  20155. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20156. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20157. __pyx_v_slope34 = __pyx_t_6;
  20158. __pyx_t_6 = 0;
  20159. /* "fontTools/misc/bezierTools.py":1196
  20160. * x = s1x
  20161. * slope34 = (e2y - s2y) / (e2x - s2x)
  20162. * y = slope34 * (x - s2x) + s2y # <<<<<<<<<<<<<<
  20163. * pt = (x, y)
  20164. * return [
  20165. */
  20166. __pyx_t_6 = PyNumber_Subtract(__pyx_v_x, __pyx_v_s2x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1196, __pyx_L1_error)
  20167. __Pyx_GOTREF(__pyx_t_6);
  20168. __pyx_t_3 = PyNumber_Multiply(__pyx_v_slope34, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
  20169. __Pyx_GOTREF(__pyx_t_3);
  20170. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20171. __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_v_s2y); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1196, __pyx_L1_error)
  20172. __Pyx_GOTREF(__pyx_t_6);
  20173. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20174. __pyx_v_y = __pyx_t_6;
  20175. __pyx_t_6 = 0;
  20176. /* "fontTools/misc/bezierTools.py":1197
  20177. * slope34 = (e2y - s2y) / (e2x - s2x)
  20178. * y = slope34 * (x - s2x) + s2y
  20179. * pt = (x, y) # <<<<<<<<<<<<<<
  20180. * return [
  20181. * Intersection(
  20182. */
  20183. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1197, __pyx_L1_error)
  20184. __Pyx_GOTREF(__pyx_t_6);
  20185. __Pyx_INCREF(__pyx_v_x);
  20186. __Pyx_GIVEREF(__pyx_v_x);
  20187. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1197, __pyx_L1_error);
  20188. __Pyx_INCREF(__pyx_v_y);
  20189. __Pyx_GIVEREF(__pyx_v_y);
  20190. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1197, __pyx_L1_error);
  20191. __pyx_v_pt = ((PyObject*)__pyx_t_6);
  20192. __pyx_t_6 = 0;
  20193. /* "fontTools/misc/bezierTools.py":1198
  20194. * y = slope34 * (x - s2x) + s2y
  20195. * pt = (x, y)
  20196. * return [ # <<<<<<<<<<<<<<
  20197. * Intersection(
  20198. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20199. */
  20200. __Pyx_XDECREF(__pyx_r);
  20201. /* "fontTools/misc/bezierTools.py":1199
  20202. * pt = (x, y)
  20203. * return [
  20204. * Intersection( # <<<<<<<<<<<<<<
  20205. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20206. * )
  20207. */
  20208. __pyx_t_3 = NULL;
  20209. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1199, __pyx_L1_error)
  20210. __Pyx_GOTREF(__pyx_t_1);
  20211. /* "fontTools/misc/bezierTools.py":1200
  20212. * return [
  20213. * Intersection(
  20214. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt) # <<<<<<<<<<<<<<
  20215. * )
  20216. * ]
  20217. */
  20218. __pyx_t_10 = NULL;
  20219. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_line_t_of_pt); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1200, __pyx_L1_error)
  20220. __Pyx_GOTREF(__pyx_t_11);
  20221. __pyx_t_7 = 1;
  20222. #if CYTHON_UNPACK_METHODS
  20223. if (unlikely(PyMethod_Check(__pyx_t_11))) {
  20224. __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
  20225. assert(__pyx_t_10);
  20226. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
  20227. __Pyx_INCREF(__pyx_t_10);
  20228. __Pyx_INCREF(__pyx__function);
  20229. __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
  20230. __pyx_t_7 = 0;
  20231. }
  20232. #endif
  20233. {
  20234. PyObject *__pyx_callargs[4] = {__pyx_t_10, __pyx_v_s1, __pyx_v_e1, __pyx_v_pt};
  20235. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20236. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  20237. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20238. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1200, __pyx_L1_error)
  20239. __Pyx_GOTREF(__pyx_t_2);
  20240. }
  20241. __pyx_t_10 = NULL;
  20242. __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_line_t_of_pt); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1200, __pyx_L1_error)
  20243. __Pyx_GOTREF(__pyx_t_12);
  20244. __pyx_t_7 = 1;
  20245. #if CYTHON_UNPACK_METHODS
  20246. if (unlikely(PyMethod_Check(__pyx_t_12))) {
  20247. __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
  20248. assert(__pyx_t_10);
  20249. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
  20250. __Pyx_INCREF(__pyx_t_10);
  20251. __Pyx_INCREF(__pyx__function);
  20252. __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
  20253. __pyx_t_7 = 0;
  20254. }
  20255. #endif
  20256. {
  20257. PyObject *__pyx_callargs[4] = {__pyx_t_10, __pyx_v_s2, __pyx_v_e2, __pyx_v_pt};
  20258. __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_12, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20259. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  20260. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  20261. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1200, __pyx_L1_error)
  20262. __Pyx_GOTREF(__pyx_t_11);
  20263. }
  20264. __pyx_t_7 = 1;
  20265. #if CYTHON_UNPACK_METHODS
  20266. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  20267. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
  20268. assert(__pyx_t_3);
  20269. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  20270. __Pyx_INCREF(__pyx_t_3);
  20271. __Pyx_INCREF(__pyx__function);
  20272. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  20273. __pyx_t_7 = 0;
  20274. }
  20275. #endif
  20276. {
  20277. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_3, NULL};
  20278. __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1199, __pyx_L1_error)
  20279. __Pyx_GOTREF(__pyx_t_12);
  20280. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pt, __pyx_v_pt, __pyx_t_12, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1199, __pyx_L1_error)
  20281. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t1, __pyx_t_2, __pyx_t_12, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1199, __pyx_L1_error)
  20282. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t2, __pyx_t_11, __pyx_t_12, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1199, __pyx_L1_error)
  20283. __pyx_t_6 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12);
  20284. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  20285. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20286. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20287. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  20288. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20289. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1199, __pyx_L1_error)
  20290. __Pyx_GOTREF(__pyx_t_6);
  20291. }
  20292. /* "fontTools/misc/bezierTools.py":1198
  20293. * y = slope34 * (x - s2x) + s2y
  20294. * pt = (x, y)
  20295. * return [ # <<<<<<<<<<<<<<
  20296. * Intersection(
  20297. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20298. */
  20299. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1198, __pyx_L1_error)
  20300. __Pyx_GOTREF(__pyx_t_1);
  20301. __Pyx_GIVEREF(__pyx_t_6);
  20302. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 1198, __pyx_L1_error);
  20303. __pyx_t_6 = 0;
  20304. __pyx_r = __pyx_t_1;
  20305. __pyx_t_1 = 0;
  20306. goto __pyx_L0;
  20307. /* "fontTools/misc/bezierTools.py":1193
  20308. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  20309. * return []
  20310. * if math.isclose(e1x, s1x): # <<<<<<<<<<<<<<
  20311. * x = s1x
  20312. * slope34 = (e2y - s2y) / (e2x - s2x)
  20313. */
  20314. }
  20315. /* "fontTools/misc/bezierTools.py":1203
  20316. * )
  20317. * ]
  20318. * if math.isclose(s2x, e2x): # <<<<<<<<<<<<<<
  20319. * x = s2x
  20320. * slope12 = (e1y - s1y) / (e1x - s1x)
  20321. */
  20322. __pyx_t_6 = NULL;
  20323. __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1203, __pyx_L1_error)
  20324. __Pyx_GOTREF(__pyx_t_12);
  20325. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1203, __pyx_L1_error)
  20326. __Pyx_GOTREF(__pyx_t_11);
  20327. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  20328. __pyx_t_7 = 1;
  20329. #if CYTHON_UNPACK_METHODS
  20330. if (unlikely(PyMethod_Check(__pyx_t_11))) {
  20331. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
  20332. assert(__pyx_t_6);
  20333. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
  20334. __Pyx_INCREF(__pyx_t_6);
  20335. __Pyx_INCREF(__pyx__function);
  20336. __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
  20337. __pyx_t_7 = 0;
  20338. }
  20339. #endif
  20340. {
  20341. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_s2x, __pyx_v_e2x};
  20342. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20343. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20344. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20345. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
  20346. __Pyx_GOTREF(__pyx_t_1);
  20347. }
  20348. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1203, __pyx_L1_error)
  20349. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20350. if (__pyx_t_5) {
  20351. /* "fontTools/misc/bezierTools.py":1204
  20352. * ]
  20353. * if math.isclose(s2x, e2x):
  20354. * x = s2x # <<<<<<<<<<<<<<
  20355. * slope12 = (e1y - s1y) / (e1x - s1x)
  20356. * y = slope12 * (x - s1x) + s1y
  20357. */
  20358. __Pyx_INCREF(__pyx_v_s2x);
  20359. __pyx_v_x = __pyx_v_s2x;
  20360. /* "fontTools/misc/bezierTools.py":1205
  20361. * if math.isclose(s2x, e2x):
  20362. * x = s2x
  20363. * slope12 = (e1y - s1y) / (e1x - s1x) # <<<<<<<<<<<<<<
  20364. * y = slope12 * (x - s1x) + s1y
  20365. * pt = (x, y)
  20366. */
  20367. __pyx_t_1 = PyNumber_Subtract(__pyx_v_e1y, __pyx_v_s1y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
  20368. __Pyx_GOTREF(__pyx_t_1);
  20369. __pyx_t_11 = PyNumber_Subtract(__pyx_v_e1x, __pyx_v_s1x); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1205, __pyx_L1_error)
  20370. __Pyx_GOTREF(__pyx_t_11);
  20371. __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1205, __pyx_L1_error)
  20372. __Pyx_GOTREF(__pyx_t_6);
  20373. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20374. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20375. __pyx_v_slope12 = __pyx_t_6;
  20376. __pyx_t_6 = 0;
  20377. /* "fontTools/misc/bezierTools.py":1206
  20378. * x = s2x
  20379. * slope12 = (e1y - s1y) / (e1x - s1x)
  20380. * y = slope12 * (x - s1x) + s1y # <<<<<<<<<<<<<<
  20381. * pt = (x, y)
  20382. * return [
  20383. */
  20384. __pyx_t_6 = PyNumber_Subtract(__pyx_v_x, __pyx_v_s1x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error)
  20385. __Pyx_GOTREF(__pyx_t_6);
  20386. __pyx_t_11 = PyNumber_Multiply(__pyx_v_slope12, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1206, __pyx_L1_error)
  20387. __Pyx_GOTREF(__pyx_t_11);
  20388. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20389. __pyx_t_6 = PyNumber_Add(__pyx_t_11, __pyx_v_s1y); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error)
  20390. __Pyx_GOTREF(__pyx_t_6);
  20391. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20392. __pyx_v_y = __pyx_t_6;
  20393. __pyx_t_6 = 0;
  20394. /* "fontTools/misc/bezierTools.py":1207
  20395. * slope12 = (e1y - s1y) / (e1x - s1x)
  20396. * y = slope12 * (x - s1x) + s1y
  20397. * pt = (x, y) # <<<<<<<<<<<<<<
  20398. * return [
  20399. * Intersection(
  20400. */
  20401. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1207, __pyx_L1_error)
  20402. __Pyx_GOTREF(__pyx_t_6);
  20403. __Pyx_INCREF(__pyx_v_x);
  20404. __Pyx_GIVEREF(__pyx_v_x);
  20405. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1207, __pyx_L1_error);
  20406. __Pyx_INCREF(__pyx_v_y);
  20407. __Pyx_GIVEREF(__pyx_v_y);
  20408. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1207, __pyx_L1_error);
  20409. __pyx_v_pt = ((PyObject*)__pyx_t_6);
  20410. __pyx_t_6 = 0;
  20411. /* "fontTools/misc/bezierTools.py":1208
  20412. * y = slope12 * (x - s1x) + s1y
  20413. * pt = (x, y)
  20414. * return [ # <<<<<<<<<<<<<<
  20415. * Intersection(
  20416. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20417. */
  20418. __Pyx_XDECREF(__pyx_r);
  20419. /* "fontTools/misc/bezierTools.py":1209
  20420. * pt = (x, y)
  20421. * return [
  20422. * Intersection( # <<<<<<<<<<<<<<
  20423. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20424. * )
  20425. */
  20426. __pyx_t_11 = NULL;
  20427. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1209, __pyx_L1_error)
  20428. __Pyx_GOTREF(__pyx_t_1);
  20429. /* "fontTools/misc/bezierTools.py":1210
  20430. * return [
  20431. * Intersection(
  20432. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt) # <<<<<<<<<<<<<<
  20433. * )
  20434. * ]
  20435. */
  20436. __pyx_t_2 = NULL;
  20437. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_line_t_of_pt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1210, __pyx_L1_error)
  20438. __Pyx_GOTREF(__pyx_t_3);
  20439. __pyx_t_7 = 1;
  20440. #if CYTHON_UNPACK_METHODS
  20441. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  20442. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  20443. assert(__pyx_t_2);
  20444. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  20445. __Pyx_INCREF(__pyx_t_2);
  20446. __Pyx_INCREF(__pyx__function);
  20447. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  20448. __pyx_t_7 = 0;
  20449. }
  20450. #endif
  20451. {
  20452. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_s1, __pyx_v_e1, __pyx_v_pt};
  20453. __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20454. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20455. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20456. if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1210, __pyx_L1_error)
  20457. __Pyx_GOTREF(__pyx_t_12);
  20458. }
  20459. __pyx_t_2 = NULL;
  20460. __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_line_t_of_pt); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1210, __pyx_L1_error)
  20461. __Pyx_GOTREF(__pyx_t_10);
  20462. __pyx_t_7 = 1;
  20463. #if CYTHON_UNPACK_METHODS
  20464. if (unlikely(PyMethod_Check(__pyx_t_10))) {
  20465. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
  20466. assert(__pyx_t_2);
  20467. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
  20468. __Pyx_INCREF(__pyx_t_2);
  20469. __Pyx_INCREF(__pyx__function);
  20470. __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
  20471. __pyx_t_7 = 0;
  20472. }
  20473. #endif
  20474. {
  20475. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_s2, __pyx_v_e2, __pyx_v_pt};
  20476. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20477. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20478. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  20479. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1210, __pyx_L1_error)
  20480. __Pyx_GOTREF(__pyx_t_3);
  20481. }
  20482. __pyx_t_7 = 1;
  20483. #if CYTHON_UNPACK_METHODS
  20484. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  20485. __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
  20486. assert(__pyx_t_11);
  20487. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  20488. __Pyx_INCREF(__pyx_t_11);
  20489. __Pyx_INCREF(__pyx__function);
  20490. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  20491. __pyx_t_7 = 0;
  20492. }
  20493. #endif
  20494. {
  20495. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_11, NULL};
  20496. __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1209, __pyx_L1_error)
  20497. __Pyx_GOTREF(__pyx_t_10);
  20498. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pt, __pyx_v_pt, __pyx_t_10, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1209, __pyx_L1_error)
  20499. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t1, __pyx_t_12, __pyx_t_10, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1209, __pyx_L1_error)
  20500. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t2, __pyx_t_3, __pyx_t_10, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1209, __pyx_L1_error)
  20501. __pyx_t_6 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10);
  20502. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  20503. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  20504. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20505. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  20506. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20507. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1209, __pyx_L1_error)
  20508. __Pyx_GOTREF(__pyx_t_6);
  20509. }
  20510. /* "fontTools/misc/bezierTools.py":1208
  20511. * y = slope12 * (x - s1x) + s1y
  20512. * pt = (x, y)
  20513. * return [ # <<<<<<<<<<<<<<
  20514. * Intersection(
  20515. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20516. */
  20517. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1208, __pyx_L1_error)
  20518. __Pyx_GOTREF(__pyx_t_1);
  20519. __Pyx_GIVEREF(__pyx_t_6);
  20520. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 1208, __pyx_L1_error);
  20521. __pyx_t_6 = 0;
  20522. __pyx_r = __pyx_t_1;
  20523. __pyx_t_1 = 0;
  20524. goto __pyx_L0;
  20525. /* "fontTools/misc/bezierTools.py":1203
  20526. * )
  20527. * ]
  20528. * if math.isclose(s2x, e2x): # <<<<<<<<<<<<<<
  20529. * x = s2x
  20530. * slope12 = (e1y - s1y) / (e1x - s1x)
  20531. */
  20532. }
  20533. /* "fontTools/misc/bezierTools.py":1214
  20534. * ]
  20535. *
  20536. * slope12 = (e1y - s1y) / (e1x - s1x) # <<<<<<<<<<<<<<
  20537. * slope34 = (e2y - s2y) / (e2x - s2x)
  20538. * if math.isclose(slope12, slope34):
  20539. */
  20540. __pyx_t_1 = PyNumber_Subtract(__pyx_v_e1y, __pyx_v_s1y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1214, __pyx_L1_error)
  20541. __Pyx_GOTREF(__pyx_t_1);
  20542. __pyx_t_6 = PyNumber_Subtract(__pyx_v_e1x, __pyx_v_s1x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1214, __pyx_L1_error)
  20543. __Pyx_GOTREF(__pyx_t_6);
  20544. __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1214, __pyx_L1_error)
  20545. __Pyx_GOTREF(__pyx_t_10);
  20546. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20547. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20548. __pyx_v_slope12 = __pyx_t_10;
  20549. __pyx_t_10 = 0;
  20550. /* "fontTools/misc/bezierTools.py":1215
  20551. *
  20552. * slope12 = (e1y - s1y) / (e1x - s1x)
  20553. * slope34 = (e2y - s2y) / (e2x - s2x) # <<<<<<<<<<<<<<
  20554. * if math.isclose(slope12, slope34):
  20555. * return []
  20556. */
  20557. __pyx_t_10 = PyNumber_Subtract(__pyx_v_e2y, __pyx_v_s2y); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1215, __pyx_L1_error)
  20558. __Pyx_GOTREF(__pyx_t_10);
  20559. __pyx_t_6 = PyNumber_Subtract(__pyx_v_e2x, __pyx_v_s2x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1215, __pyx_L1_error)
  20560. __Pyx_GOTREF(__pyx_t_6);
  20561. __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_10, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1215, __pyx_L1_error)
  20562. __Pyx_GOTREF(__pyx_t_1);
  20563. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  20564. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20565. __pyx_v_slope34 = __pyx_t_1;
  20566. __pyx_t_1 = 0;
  20567. /* "fontTools/misc/bezierTools.py":1216
  20568. * slope12 = (e1y - s1y) / (e1x - s1x)
  20569. * slope34 = (e2y - s2y) / (e2x - s2x)
  20570. * if math.isclose(slope12, slope34): # <<<<<<<<<<<<<<
  20571. * return []
  20572. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34)
  20573. */
  20574. __pyx_t_6 = NULL;
  20575. __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1216, __pyx_L1_error)
  20576. __Pyx_GOTREF(__pyx_t_10);
  20577. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1216, __pyx_L1_error)
  20578. __Pyx_GOTREF(__pyx_t_3);
  20579. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  20580. __pyx_t_7 = 1;
  20581. #if CYTHON_UNPACK_METHODS
  20582. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  20583. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  20584. assert(__pyx_t_6);
  20585. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  20586. __Pyx_INCREF(__pyx_t_6);
  20587. __Pyx_INCREF(__pyx__function);
  20588. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  20589. __pyx_t_7 = 0;
  20590. }
  20591. #endif
  20592. {
  20593. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_slope12, __pyx_v_slope34};
  20594. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20595. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20596. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20597. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1216, __pyx_L1_error)
  20598. __Pyx_GOTREF(__pyx_t_1);
  20599. }
  20600. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1216, __pyx_L1_error)
  20601. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20602. if (__pyx_t_5) {
  20603. /* "fontTools/misc/bezierTools.py":1217
  20604. * slope34 = (e2y - s2y) / (e2x - s2x)
  20605. * if math.isclose(slope12, slope34):
  20606. * return [] # <<<<<<<<<<<<<<
  20607. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34)
  20608. * y = slope12 * (x - s1x) + s1y
  20609. */
  20610. __Pyx_XDECREF(__pyx_r);
  20611. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1217, __pyx_L1_error)
  20612. __Pyx_GOTREF(__pyx_t_1);
  20613. __pyx_r = __pyx_t_1;
  20614. __pyx_t_1 = 0;
  20615. goto __pyx_L0;
  20616. /* "fontTools/misc/bezierTools.py":1216
  20617. * slope12 = (e1y - s1y) / (e1x - s1x)
  20618. * slope34 = (e2y - s2y) / (e2x - s2x)
  20619. * if math.isclose(slope12, slope34): # <<<<<<<<<<<<<<
  20620. * return []
  20621. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34)
  20622. */
  20623. }
  20624. /* "fontTools/misc/bezierTools.py":1218
  20625. * if math.isclose(slope12, slope34):
  20626. * return []
  20627. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34) # <<<<<<<<<<<<<<
  20628. * y = slope12 * (x - s1x) + s1y
  20629. * pt = (x, y)
  20630. */
  20631. __pyx_t_1 = PyNumber_Multiply(__pyx_v_slope12, __pyx_v_s1x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20632. __Pyx_GOTREF(__pyx_t_1);
  20633. __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_v_s1y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20634. __Pyx_GOTREF(__pyx_t_3);
  20635. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20636. __pyx_t_1 = PyNumber_Multiply(__pyx_v_slope34, __pyx_v_s2x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20637. __Pyx_GOTREF(__pyx_t_1);
  20638. __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20639. __Pyx_GOTREF(__pyx_t_6);
  20640. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20641. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20642. __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_v_s2y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20643. __Pyx_GOTREF(__pyx_t_1);
  20644. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20645. __pyx_t_6 = PyNumber_Subtract(__pyx_v_slope12, __pyx_v_slope34); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20646. __Pyx_GOTREF(__pyx_t_6);
  20647. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20648. __Pyx_GOTREF(__pyx_t_3);
  20649. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20650. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20651. __pyx_v_x = __pyx_t_3;
  20652. __pyx_t_3 = 0;
  20653. /* "fontTools/misc/bezierTools.py":1219
  20654. * return []
  20655. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34)
  20656. * y = slope12 * (x - s1x) + s1y # <<<<<<<<<<<<<<
  20657. * pt = (x, y)
  20658. * if _both_points_are_on_same_side_of_origin(
  20659. */
  20660. __pyx_t_3 = PyNumber_Subtract(__pyx_v_x, __pyx_v_s1x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1219, __pyx_L1_error)
  20661. __Pyx_GOTREF(__pyx_t_3);
  20662. __pyx_t_6 = PyNumber_Multiply(__pyx_v_slope12, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1219, __pyx_L1_error)
  20663. __Pyx_GOTREF(__pyx_t_6);
  20664. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20665. __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_v_s1y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1219, __pyx_L1_error)
  20666. __Pyx_GOTREF(__pyx_t_3);
  20667. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20668. __pyx_v_y = __pyx_t_3;
  20669. __pyx_t_3 = 0;
  20670. /* "fontTools/misc/bezierTools.py":1220
  20671. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34)
  20672. * y = slope12 * (x - s1x) + s1y
  20673. * pt = (x, y) # <<<<<<<<<<<<<<
  20674. * if _both_points_are_on_same_side_of_origin(
  20675. * pt, e1, s1
  20676. */
  20677. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1220, __pyx_L1_error)
  20678. __Pyx_GOTREF(__pyx_t_3);
  20679. __Pyx_INCREF(__pyx_v_x);
  20680. __Pyx_GIVEREF(__pyx_v_x);
  20681. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1220, __pyx_L1_error);
  20682. __Pyx_INCREF(__pyx_v_y);
  20683. __Pyx_GIVEREF(__pyx_v_y);
  20684. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1220, __pyx_L1_error);
  20685. __pyx_v_pt = ((PyObject*)__pyx_t_3);
  20686. __pyx_t_3 = 0;
  20687. /* "fontTools/misc/bezierTools.py":1221
  20688. * y = slope12 * (x - s1x) + s1y
  20689. * pt = (x, y)
  20690. * if _both_points_are_on_same_side_of_origin( # <<<<<<<<<<<<<<
  20691. * pt, e1, s1
  20692. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20693. */
  20694. __pyx_t_6 = NULL;
  20695. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_both_points_are_on_same_side_of); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1221, __pyx_L1_error)
  20696. __Pyx_GOTREF(__pyx_t_1);
  20697. /* "fontTools/misc/bezierTools.py":1222
  20698. * pt = (x, y)
  20699. * if _both_points_are_on_same_side_of_origin(
  20700. * pt, e1, s1 # <<<<<<<<<<<<<<
  20701. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20702. * return [
  20703. */
  20704. __pyx_t_7 = 1;
  20705. #if CYTHON_UNPACK_METHODS
  20706. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  20707. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
  20708. assert(__pyx_t_6);
  20709. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  20710. __Pyx_INCREF(__pyx_t_6);
  20711. __Pyx_INCREF(__pyx__function);
  20712. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  20713. __pyx_t_7 = 0;
  20714. }
  20715. #endif
  20716. {
  20717. PyObject *__pyx_callargs[4] = {__pyx_t_6, __pyx_v_pt, __pyx_v_e1, __pyx_v_s1};
  20718. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20719. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20720. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20721. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1221, __pyx_L1_error)
  20722. __Pyx_GOTREF(__pyx_t_3);
  20723. }
  20724. /* "fontTools/misc/bezierTools.py":1221
  20725. * y = slope12 * (x - s1x) + s1y
  20726. * pt = (x, y)
  20727. * if _both_points_are_on_same_side_of_origin( # <<<<<<<<<<<<<<
  20728. * pt, e1, s1
  20729. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20730. */
  20731. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1221, __pyx_L1_error)
  20732. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20733. if (__pyx_t_8) {
  20734. } else {
  20735. __pyx_t_5 = __pyx_t_8;
  20736. goto __pyx_L29_bool_binop_done;
  20737. }
  20738. /* "fontTools/misc/bezierTools.py":1223
  20739. * if _both_points_are_on_same_side_of_origin(
  20740. * pt, e1, s1
  20741. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2): # <<<<<<<<<<<<<<
  20742. * return [
  20743. * Intersection(
  20744. */
  20745. __pyx_t_1 = NULL;
  20746. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_both_points_are_on_same_side_of); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1223, __pyx_L1_error)
  20747. __Pyx_GOTREF(__pyx_t_6);
  20748. __pyx_t_7 = 1;
  20749. #if CYTHON_UNPACK_METHODS
  20750. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  20751. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
  20752. assert(__pyx_t_1);
  20753. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  20754. __Pyx_INCREF(__pyx_t_1);
  20755. __Pyx_INCREF(__pyx__function);
  20756. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  20757. __pyx_t_7 = 0;
  20758. }
  20759. #endif
  20760. {
  20761. PyObject *__pyx_callargs[4] = {__pyx_t_1, __pyx_v_pt, __pyx_v_s2, __pyx_v_e2};
  20762. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20763. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  20764. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20765. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1223, __pyx_L1_error)
  20766. __Pyx_GOTREF(__pyx_t_3);
  20767. }
  20768. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1223, __pyx_L1_error)
  20769. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20770. __pyx_t_5 = __pyx_t_8;
  20771. __pyx_L29_bool_binop_done:;
  20772. /* "fontTools/misc/bezierTools.py":1221
  20773. * y = slope12 * (x - s1x) + s1y
  20774. * pt = (x, y)
  20775. * if _both_points_are_on_same_side_of_origin( # <<<<<<<<<<<<<<
  20776. * pt, e1, s1
  20777. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20778. */
  20779. if (__pyx_t_5) {
  20780. /* "fontTools/misc/bezierTools.py":1224
  20781. * pt, e1, s1
  20782. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20783. * return [ # <<<<<<<<<<<<<<
  20784. * Intersection(
  20785. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20786. */
  20787. __Pyx_XDECREF(__pyx_r);
  20788. /* "fontTools/misc/bezierTools.py":1225
  20789. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20790. * return [
  20791. * Intersection( # <<<<<<<<<<<<<<
  20792. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20793. * )
  20794. */
  20795. __pyx_t_6 = NULL;
  20796. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1225, __pyx_L1_error)
  20797. __Pyx_GOTREF(__pyx_t_1);
  20798. /* "fontTools/misc/bezierTools.py":1226
  20799. * return [
  20800. * Intersection(
  20801. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt) # <<<<<<<<<<<<<<
  20802. * )
  20803. * ]
  20804. */
  20805. __pyx_t_12 = NULL;
  20806. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_line_t_of_pt); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1226, __pyx_L1_error)
  20807. __Pyx_GOTREF(__pyx_t_11);
  20808. __pyx_t_7 = 1;
  20809. #if CYTHON_UNPACK_METHODS
  20810. if (unlikely(PyMethod_Check(__pyx_t_11))) {
  20811. __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
  20812. assert(__pyx_t_12);
  20813. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
  20814. __Pyx_INCREF(__pyx_t_12);
  20815. __Pyx_INCREF(__pyx__function);
  20816. __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
  20817. __pyx_t_7 = 0;
  20818. }
  20819. #endif
  20820. {
  20821. PyObject *__pyx_callargs[4] = {__pyx_t_12, __pyx_v_s1, __pyx_v_e1, __pyx_v_pt};
  20822. __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_11, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20823. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  20824. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20825. if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1226, __pyx_L1_error)
  20826. __Pyx_GOTREF(__pyx_t_10);
  20827. }
  20828. __pyx_t_12 = NULL;
  20829. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_line_t_of_pt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1226, __pyx_L1_error)
  20830. __Pyx_GOTREF(__pyx_t_2);
  20831. __pyx_t_7 = 1;
  20832. #if CYTHON_UNPACK_METHODS
  20833. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  20834. __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
  20835. assert(__pyx_t_12);
  20836. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  20837. __Pyx_INCREF(__pyx_t_12);
  20838. __Pyx_INCREF(__pyx__function);
  20839. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  20840. __pyx_t_7 = 0;
  20841. }
  20842. #endif
  20843. {
  20844. PyObject *__pyx_callargs[4] = {__pyx_t_12, __pyx_v_s2, __pyx_v_e2, __pyx_v_pt};
  20845. __pyx_t_11 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  20846. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  20847. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20848. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1226, __pyx_L1_error)
  20849. __Pyx_GOTREF(__pyx_t_11);
  20850. }
  20851. __pyx_t_7 = 1;
  20852. #if CYTHON_UNPACK_METHODS
  20853. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  20854. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
  20855. assert(__pyx_t_6);
  20856. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  20857. __Pyx_INCREF(__pyx_t_6);
  20858. __Pyx_INCREF(__pyx__function);
  20859. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  20860. __pyx_t_7 = 0;
  20861. }
  20862. #endif
  20863. {
  20864. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_6, NULL};
  20865. __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1225, __pyx_L1_error)
  20866. __Pyx_GOTREF(__pyx_t_2);
  20867. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pt, __pyx_v_pt, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1225, __pyx_L1_error)
  20868. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t1, __pyx_t_10, __pyx_t_2, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1225, __pyx_L1_error)
  20869. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t2, __pyx_t_11, __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1225, __pyx_L1_error)
  20870. __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
  20871. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20872. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  20873. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20874. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20875. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20876. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1225, __pyx_L1_error)
  20877. __Pyx_GOTREF(__pyx_t_3);
  20878. }
  20879. /* "fontTools/misc/bezierTools.py":1224
  20880. * pt, e1, s1
  20881. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20882. * return [ # <<<<<<<<<<<<<<
  20883. * Intersection(
  20884. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20885. */
  20886. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1224, __pyx_L1_error)
  20887. __Pyx_GOTREF(__pyx_t_1);
  20888. __Pyx_GIVEREF(__pyx_t_3);
  20889. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 1224, __pyx_L1_error);
  20890. __pyx_t_3 = 0;
  20891. __pyx_r = __pyx_t_1;
  20892. __pyx_t_1 = 0;
  20893. goto __pyx_L0;
  20894. /* "fontTools/misc/bezierTools.py":1221
  20895. * y = slope12 * (x - s1x) + s1y
  20896. * pt = (x, y)
  20897. * if _both_points_are_on_same_side_of_origin( # <<<<<<<<<<<<<<
  20898. * pt, e1, s1
  20899. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20900. */
  20901. }
  20902. /* "fontTools/misc/bezierTools.py":1229
  20903. * )
  20904. * ]
  20905. * return [] # <<<<<<<<<<<<<<
  20906. *
  20907. *
  20908. */
  20909. __Pyx_XDECREF(__pyx_r);
  20910. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1229, __pyx_L1_error)
  20911. __Pyx_GOTREF(__pyx_t_1);
  20912. __pyx_r = __pyx_t_1;
  20913. __pyx_t_1 = 0;
  20914. goto __pyx_L0;
  20915. /* "fontTools/misc/bezierTools.py":1154
  20916. *
  20917. *
  20918. * def lineLineIntersections(s1, e1, s2, e2): # <<<<<<<<<<<<<<
  20919. * """Finds intersections between two line segments.
  20920. *
  20921. */
  20922. /* function exit code */
  20923. __pyx_L1_error:;
  20924. __Pyx_XDECREF(__pyx_t_1);
  20925. __Pyx_XDECREF(__pyx_t_2);
  20926. __Pyx_XDECREF(__pyx_t_3);
  20927. __Pyx_XDECREF(__pyx_t_6);
  20928. __Pyx_XDECREF(__pyx_t_10);
  20929. __Pyx_XDECREF(__pyx_t_11);
  20930. __Pyx_XDECREF(__pyx_t_12);
  20931. __Pyx_AddTraceback("fontTools.misc.bezierTools.lineLineIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  20932. __pyx_r = NULL;
  20933. __pyx_L0:;
  20934. __Pyx_XDECREF(__pyx_v_s1x);
  20935. __Pyx_XDECREF(__pyx_v_s1y);
  20936. __Pyx_XDECREF(__pyx_v_e1x);
  20937. __Pyx_XDECREF(__pyx_v_e1y);
  20938. __Pyx_XDECREF(__pyx_v_s2x);
  20939. __Pyx_XDECREF(__pyx_v_s2y);
  20940. __Pyx_XDECREF(__pyx_v_e2x);
  20941. __Pyx_XDECREF(__pyx_v_e2y);
  20942. __Pyx_XDECREF(__pyx_v_x);
  20943. __Pyx_XDECREF(__pyx_v_slope34);
  20944. __Pyx_XDECREF(__pyx_v_y);
  20945. __Pyx_XDECREF(__pyx_v_pt);
  20946. __Pyx_XDECREF(__pyx_v_slope12);
  20947. __Pyx_XGIVEREF(__pyx_r);
  20948. __Pyx_RefNannyFinishContext();
  20949. return __pyx_r;
  20950. }
  20951. /* "fontTools/misc/bezierTools.py":1232
  20952. *
  20953. *
  20954. * def _alignment_transformation(segment): # <<<<<<<<<<<<<<
  20955. * # Returns a transformation which aligns a segment horizontally at the
  20956. * # origin. Apply this transformation to curves and root-find to find
  20957. */
  20958. /* Python wrapper */
  20959. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_75_alignment_transformation(PyObject *__pyx_self,
  20960. #if CYTHON_METH_FASTCALL
  20961. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  20962. #else
  20963. PyObject *__pyx_args, PyObject *__pyx_kwds
  20964. #endif
  20965. ); /*proto*/
  20966. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_74_alignment_transformation, "_alignment_transformation(segment)");
  20967. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_75_alignment_transformation = {"_alignment_transformation", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_75_alignment_transformation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_74_alignment_transformation};
  20968. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_75_alignment_transformation(PyObject *__pyx_self,
  20969. #if CYTHON_METH_FASTCALL
  20970. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  20971. #else
  20972. PyObject *__pyx_args, PyObject *__pyx_kwds
  20973. #endif
  20974. ) {
  20975. PyObject *__pyx_v_segment = 0;
  20976. #if !CYTHON_METH_FASTCALL
  20977. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  20978. #endif
  20979. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  20980. PyObject* values[1] = {0};
  20981. int __pyx_lineno = 0;
  20982. const char *__pyx_filename = NULL;
  20983. int __pyx_clineno = 0;
  20984. PyObject *__pyx_r = 0;
  20985. __Pyx_RefNannyDeclarations
  20986. __Pyx_RefNannySetupContext("_alignment_transformation (wrapper)", 0);
  20987. #if !CYTHON_METH_FASTCALL
  20988. #if CYTHON_ASSUME_SAFE_SIZE
  20989. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  20990. #else
  20991. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  20992. #endif
  20993. #endif
  20994. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  20995. {
  20996. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_segment,0};
  20997. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  20998. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1232, __pyx_L3_error)
  20999. if (__pyx_kwds_len > 0) {
  21000. switch (__pyx_nargs) {
  21001. case 1:
  21002. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21003. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1232, __pyx_L3_error)
  21004. CYTHON_FALLTHROUGH;
  21005. case 0: break;
  21006. default: goto __pyx_L5_argtuple_error;
  21007. }
  21008. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  21009. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_alignment_transformation", 0) < (0)) __PYX_ERR(0, 1232, __pyx_L3_error)
  21010. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  21011. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_alignment_transformation", 1, 1, 1, i); __PYX_ERR(0, 1232, __pyx_L3_error) }
  21012. }
  21013. } else if (unlikely(__pyx_nargs != 1)) {
  21014. goto __pyx_L5_argtuple_error;
  21015. } else {
  21016. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21017. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1232, __pyx_L3_error)
  21018. }
  21019. __pyx_v_segment = values[0];
  21020. }
  21021. goto __pyx_L6_skip;
  21022. __pyx_L5_argtuple_error:;
  21023. __Pyx_RaiseArgtupleInvalid("_alignment_transformation", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1232, __pyx_L3_error)
  21024. __pyx_L6_skip:;
  21025. goto __pyx_L4_argument_unpacking_done;
  21026. __pyx_L3_error:;
  21027. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  21028. Py_XDECREF(values[__pyx_temp]);
  21029. }
  21030. __Pyx_AddTraceback("fontTools.misc.bezierTools._alignment_transformation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21031. __Pyx_RefNannyFinishContext();
  21032. return NULL;
  21033. __pyx_L4_argument_unpacking_done:;
  21034. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_74_alignment_transformation(__pyx_self, __pyx_v_segment);
  21035. /* function exit code */
  21036. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  21037. Py_XDECREF(values[__pyx_temp]);
  21038. }
  21039. __Pyx_RefNannyFinishContext();
  21040. return __pyx_r;
  21041. }
  21042. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_74_alignment_transformation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segment) {
  21043. PyObject *__pyx_v_start = NULL;
  21044. PyObject *__pyx_v_end = NULL;
  21045. PyObject *__pyx_v_angle = NULL;
  21046. PyObject *__pyx_r = NULL;
  21047. __Pyx_RefNannyDeclarations
  21048. PyObject *__pyx_t_1 = NULL;
  21049. PyObject *__pyx_t_2 = NULL;
  21050. PyObject *__pyx_t_3 = NULL;
  21051. PyObject *__pyx_t_4 = NULL;
  21052. PyObject *__pyx_t_5 = NULL;
  21053. PyObject *__pyx_t_6 = NULL;
  21054. PyObject *__pyx_t_7 = NULL;
  21055. size_t __pyx_t_8;
  21056. int __pyx_lineno = 0;
  21057. const char *__pyx_filename = NULL;
  21058. int __pyx_clineno = 0;
  21059. __Pyx_RefNannySetupContext("_alignment_transformation", 0);
  21060. /* "fontTools/misc/bezierTools.py":1236
  21061. * # origin. Apply this transformation to curves and root-find to find
  21062. * # intersections with the segment.
  21063. * start = segment[0] # <<<<<<<<<<<<<<
  21064. * end = segment[-1]
  21065. * angle = math.atan2(end[1] - start[1], end[0] - start[0])
  21066. */
  21067. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_segment, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
  21068. __Pyx_GOTREF(__pyx_t_1);
  21069. __pyx_v_start = __pyx_t_1;
  21070. __pyx_t_1 = 0;
  21071. /* "fontTools/misc/bezierTools.py":1237
  21072. * # intersections with the segment.
  21073. * start = segment[0]
  21074. * end = segment[-1] # <<<<<<<<<<<<<<
  21075. * angle = math.atan2(end[1] - start[1], end[0] - start[0])
  21076. * return Identity.rotate(-angle).translate(-start[0], -start[1])
  21077. */
  21078. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_segment, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1237, __pyx_L1_error)
  21079. __Pyx_GOTREF(__pyx_t_1);
  21080. __pyx_v_end = __pyx_t_1;
  21081. __pyx_t_1 = 0;
  21082. /* "fontTools/misc/bezierTools.py":1238
  21083. * start = segment[0]
  21084. * end = segment[-1]
  21085. * angle = math.atan2(end[1] - start[1], end[0] - start[0]) # <<<<<<<<<<<<<<
  21086. * return Identity.rotate(-angle).translate(-start[0], -start[1])
  21087. *
  21088. */
  21089. __pyx_t_2 = NULL;
  21090. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21091. __Pyx_GOTREF(__pyx_t_3);
  21092. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_atan2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21093. __Pyx_GOTREF(__pyx_t_4);
  21094. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21095. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_end, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21096. __Pyx_GOTREF(__pyx_t_3);
  21097. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_start, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21098. __Pyx_GOTREF(__pyx_t_5);
  21099. __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21100. __Pyx_GOTREF(__pyx_t_6);
  21101. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21102. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21103. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_end, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21104. __Pyx_GOTREF(__pyx_t_5);
  21105. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_start, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21106. __Pyx_GOTREF(__pyx_t_3);
  21107. __pyx_t_7 = PyNumber_Subtract(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21108. __Pyx_GOTREF(__pyx_t_7);
  21109. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21110. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21111. __pyx_t_8 = 1;
  21112. #if CYTHON_UNPACK_METHODS
  21113. if (unlikely(PyMethod_Check(__pyx_t_4))) {
  21114. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
  21115. assert(__pyx_t_2);
  21116. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
  21117. __Pyx_INCREF(__pyx_t_2);
  21118. __Pyx_INCREF(__pyx__function);
  21119. __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
  21120. __pyx_t_8 = 0;
  21121. }
  21122. #endif
  21123. {
  21124. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_6, __pyx_t_7};
  21125. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  21126. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  21127. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21128. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21129. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21130. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21131. __Pyx_GOTREF(__pyx_t_1);
  21132. }
  21133. __pyx_v_angle = __pyx_t_1;
  21134. __pyx_t_1 = 0;
  21135. /* "fontTools/misc/bezierTools.py":1239
  21136. * end = segment[-1]
  21137. * angle = math.atan2(end[1] - start[1], end[0] - start[0])
  21138. * return Identity.rotate(-angle).translate(-start[0], -start[1]) # <<<<<<<<<<<<<<
  21139. *
  21140. *
  21141. */
  21142. __Pyx_XDECREF(__pyx_r);
  21143. __pyx_t_6 = NULL;
  21144. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Identity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21145. __Pyx_GOTREF(__pyx_t_2);
  21146. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_rotate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21147. __Pyx_GOTREF(__pyx_t_3);
  21148. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21149. __pyx_t_2 = PyNumber_Negative(__pyx_v_angle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21150. __Pyx_GOTREF(__pyx_t_2);
  21151. __pyx_t_8 = 1;
  21152. #if CYTHON_UNPACK_METHODS
  21153. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  21154. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  21155. assert(__pyx_t_6);
  21156. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  21157. __Pyx_INCREF(__pyx_t_6);
  21158. __Pyx_INCREF(__pyx__function);
  21159. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  21160. __pyx_t_8 = 0;
  21161. }
  21162. #endif
  21163. {
  21164. PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_2};
  21165. __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  21166. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  21167. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21168. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21169. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21170. __Pyx_GOTREF(__pyx_t_7);
  21171. }
  21172. __pyx_t_4 = __pyx_t_7;
  21173. __Pyx_INCREF(__pyx_t_4);
  21174. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_start, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21175. __Pyx_GOTREF(__pyx_t_3);
  21176. __pyx_t_2 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21177. __Pyx_GOTREF(__pyx_t_2);
  21178. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21179. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_start, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21180. __Pyx_GOTREF(__pyx_t_3);
  21181. __pyx_t_6 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21182. __Pyx_GOTREF(__pyx_t_6);
  21183. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21184. __pyx_t_8 = 0;
  21185. {
  21186. PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_2, __pyx_t_6};
  21187. __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_translate, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  21188. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  21189. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21190. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21191. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21192. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21193. __Pyx_GOTREF(__pyx_t_1);
  21194. }
  21195. __pyx_r = __pyx_t_1;
  21196. __pyx_t_1 = 0;
  21197. goto __pyx_L0;
  21198. /* "fontTools/misc/bezierTools.py":1232
  21199. *
  21200. *
  21201. * def _alignment_transformation(segment): # <<<<<<<<<<<<<<
  21202. * # Returns a transformation which aligns a segment horizontally at the
  21203. * # origin. Apply this transformation to curves and root-find to find
  21204. */
  21205. /* function exit code */
  21206. __pyx_L1_error:;
  21207. __Pyx_XDECREF(__pyx_t_1);
  21208. __Pyx_XDECREF(__pyx_t_2);
  21209. __Pyx_XDECREF(__pyx_t_3);
  21210. __Pyx_XDECREF(__pyx_t_4);
  21211. __Pyx_XDECREF(__pyx_t_5);
  21212. __Pyx_XDECREF(__pyx_t_6);
  21213. __Pyx_XDECREF(__pyx_t_7);
  21214. __Pyx_AddTraceback("fontTools.misc.bezierTools._alignment_transformation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21215. __pyx_r = NULL;
  21216. __pyx_L0:;
  21217. __Pyx_XDECREF(__pyx_v_start);
  21218. __Pyx_XDECREF(__pyx_v_end);
  21219. __Pyx_XDECREF(__pyx_v_angle);
  21220. __Pyx_XGIVEREF(__pyx_r);
  21221. __Pyx_RefNannyFinishContext();
  21222. return __pyx_r;
  21223. }
  21224. /* "fontTools/misc/bezierTools.py":1242
  21225. *
  21226. *
  21227. * def _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  21228. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21229. * if len(curve) == 3:
  21230. */
  21231. /* Python wrapper */
  21232. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_77_curve_line_intersections_t(PyObject *__pyx_self,
  21233. #if CYTHON_METH_FASTCALL
  21234. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  21235. #else
  21236. PyObject *__pyx_args, PyObject *__pyx_kwds
  21237. #endif
  21238. ); /*proto*/
  21239. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_76_curve_line_intersections_t, "_curve_line_intersections_t(curve, line)");
  21240. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_77_curve_line_intersections_t = {"_curve_line_intersections_t", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_77_curve_line_intersections_t, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_76_curve_line_intersections_t};
  21241. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_77_curve_line_intersections_t(PyObject *__pyx_self,
  21242. #if CYTHON_METH_FASTCALL
  21243. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  21244. #else
  21245. PyObject *__pyx_args, PyObject *__pyx_kwds
  21246. #endif
  21247. ) {
  21248. PyObject *__pyx_v_curve = 0;
  21249. PyObject *__pyx_v_line = 0;
  21250. #if !CYTHON_METH_FASTCALL
  21251. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  21252. #endif
  21253. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  21254. PyObject* values[2] = {0,0};
  21255. int __pyx_lineno = 0;
  21256. const char *__pyx_filename = NULL;
  21257. int __pyx_clineno = 0;
  21258. PyObject *__pyx_r = 0;
  21259. __Pyx_RefNannyDeclarations
  21260. __Pyx_RefNannySetupContext("_curve_line_intersections_t (wrapper)", 0);
  21261. #if !CYTHON_METH_FASTCALL
  21262. #if CYTHON_ASSUME_SAFE_SIZE
  21263. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  21264. #else
  21265. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  21266. #endif
  21267. #endif
  21268. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  21269. {
  21270. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_curve,&__pyx_mstate_global->__pyx_n_u_line,0};
  21271. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  21272. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1242, __pyx_L3_error)
  21273. if (__pyx_kwds_len > 0) {
  21274. switch (__pyx_nargs) {
  21275. case 2:
  21276. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  21277. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1242, __pyx_L3_error)
  21278. CYTHON_FALLTHROUGH;
  21279. case 1:
  21280. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21281. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1242, __pyx_L3_error)
  21282. CYTHON_FALLTHROUGH;
  21283. case 0: break;
  21284. default: goto __pyx_L5_argtuple_error;
  21285. }
  21286. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  21287. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_curve_line_intersections_t", 0) < (0)) __PYX_ERR(0, 1242, __pyx_L3_error)
  21288. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  21289. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_curve_line_intersections_t", 1, 2, 2, i); __PYX_ERR(0, 1242, __pyx_L3_error) }
  21290. }
  21291. } else if (unlikely(__pyx_nargs != 2)) {
  21292. goto __pyx_L5_argtuple_error;
  21293. } else {
  21294. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21295. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1242, __pyx_L3_error)
  21296. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  21297. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1242, __pyx_L3_error)
  21298. }
  21299. __pyx_v_curve = values[0];
  21300. __pyx_v_line = values[1];
  21301. }
  21302. goto __pyx_L6_skip;
  21303. __pyx_L5_argtuple_error:;
  21304. __Pyx_RaiseArgtupleInvalid("_curve_line_intersections_t", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1242, __pyx_L3_error)
  21305. __pyx_L6_skip:;
  21306. goto __pyx_L4_argument_unpacking_done;
  21307. __pyx_L3_error:;
  21308. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  21309. Py_XDECREF(values[__pyx_temp]);
  21310. }
  21311. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_line_intersections_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21312. __Pyx_RefNannyFinishContext();
  21313. return NULL;
  21314. __pyx_L4_argument_unpacking_done:;
  21315. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_76_curve_line_intersections_t(__pyx_self, __pyx_v_curve, __pyx_v_line);
  21316. /* function exit code */
  21317. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  21318. Py_XDECREF(values[__pyx_temp]);
  21319. }
  21320. __Pyx_RefNannyFinishContext();
  21321. return __pyx_r;
  21322. }
  21323. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_2generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  21324. /* "fontTools/misc/bezierTools.py":1252
  21325. * else:
  21326. * raise ValueError("Unknown curve degree")
  21327. * return sorted(i for i in intersections if 0.0 <= i <= 1) # <<<<<<<<<<<<<<
  21328. *
  21329. *
  21330. */
  21331. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  21332. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  21333. PyObject *__pyx_r = NULL;
  21334. __Pyx_RefNannyDeclarations
  21335. int __pyx_lineno = 0;
  21336. const char *__pyx_filename = NULL;
  21337. int __pyx_clineno = 0;
  21338. __Pyx_RefNannySetupContext("genexpr", 0);
  21339. __pyx_cur_scope = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr(__pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  21340. if (unlikely(!__pyx_cur_scope)) {
  21341. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *)Py_None);
  21342. __Pyx_INCREF(Py_None);
  21343. __PYX_ERR(0, 1252, __pyx_L1_error)
  21344. } else {
  21345. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  21346. }
  21347. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  21348. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  21349. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  21350. {
  21351. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_2generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_curve_line_intersections_t_loca, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools); if (unlikely(!gen)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21352. __Pyx_DECREF(__pyx_cur_scope);
  21353. __Pyx_RefNannyFinishContext();
  21354. return (PyObject *) gen;
  21355. }
  21356. /* function exit code */
  21357. __pyx_L1_error:;
  21358. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_line_intersections_t.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21359. __pyx_r = NULL;
  21360. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  21361. __Pyx_XGIVEREF(__pyx_r);
  21362. __Pyx_RefNannyFinishContext();
  21363. return __pyx_r;
  21364. }
  21365. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_2generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  21366. {
  21367. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *)__pyx_generator->closure);
  21368. PyObject *__pyx_r = NULL;
  21369. PyObject *__pyx_t_1 = NULL;
  21370. Py_ssize_t __pyx_t_2;
  21371. PyObject *(*__pyx_t_3)(PyObject *);
  21372. PyObject *__pyx_t_4 = NULL;
  21373. int __pyx_t_5;
  21374. int __pyx_lineno = 0;
  21375. const char *__pyx_filename = NULL;
  21376. int __pyx_clineno = 0;
  21377. __Pyx_RefNannyDeclarations
  21378. __Pyx_RefNannySetupContext("genexpr", 0);
  21379. switch (__pyx_generator->resume_label) {
  21380. case 0: goto __pyx_L3_first_run;
  21381. default: /* CPython raises the right error here */
  21382. __Pyx_RefNannyFinishContext();
  21383. return NULL;
  21384. }
  21385. __pyx_L3_first_run:;
  21386. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21387. __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21388. __Pyx_GOTREF(__pyx_r);
  21389. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1252, __pyx_L1_error) }
  21390. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  21391. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  21392. __pyx_t_2 = 0;
  21393. __pyx_t_3 = NULL;
  21394. } else {
  21395. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21396. __Pyx_GOTREF(__pyx_t_1);
  21397. __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21398. }
  21399. for (;;) {
  21400. if (likely(!__pyx_t_3)) {
  21401. if (likely(PyList_CheckExact(__pyx_t_1))) {
  21402. {
  21403. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  21404. #if !CYTHON_ASSUME_SAFE_SIZE
  21405. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21406. #endif
  21407. if (__pyx_t_2 >= __pyx_temp) break;
  21408. }
  21409. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  21410. ++__pyx_t_2;
  21411. } else {
  21412. {
  21413. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  21414. #if !CYTHON_ASSUME_SAFE_SIZE
  21415. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21416. #endif
  21417. if (__pyx_t_2 >= __pyx_temp) break;
  21418. }
  21419. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  21420. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  21421. #else
  21422. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  21423. #endif
  21424. ++__pyx_t_2;
  21425. }
  21426. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21427. } else {
  21428. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  21429. if (unlikely(!__pyx_t_4)) {
  21430. PyObject* exc_type = PyErr_Occurred();
  21431. if (exc_type) {
  21432. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21433. PyErr_Clear();
  21434. }
  21435. break;
  21436. }
  21437. }
  21438. __Pyx_GOTREF(__pyx_t_4);
  21439. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
  21440. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_4);
  21441. __Pyx_GIVEREF(__pyx_t_4);
  21442. __pyx_t_4 = 0;
  21443. __pyx_t_4 = PyObject_RichCompare(__pyx_mstate_global->__pyx_float_0_0, __pyx_cur_scope->__pyx_v_i, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21444. if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
  21445. __Pyx_DECREF(__pyx_t_4);
  21446. __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_i, __pyx_mstate_global->__pyx_int_1, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21447. }
  21448. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21449. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21450. if (__pyx_t_5) {
  21451. if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_i))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21452. }
  21453. }
  21454. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21455. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  21456. /* function exit code */
  21457. goto __pyx_L0;
  21458. __pyx_L1_error:;
  21459. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  21460. __Pyx_XDECREF(__pyx_t_1);
  21461. __Pyx_XDECREF(__pyx_t_4);
  21462. if (__Pyx_PyErr_Occurred()) {
  21463. __Pyx_Generator_Replace_StopIteration(0);
  21464. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21465. }
  21466. __pyx_L0:;
  21467. __Pyx_XGIVEREF(__pyx_r);
  21468. #if !CYTHON_USE_EXC_INFO_STACK
  21469. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  21470. #endif
  21471. __pyx_generator->resume_label = -1;
  21472. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  21473. __Pyx_RefNannyFinishContext();
  21474. return __pyx_r;
  21475. }
  21476. /* "fontTools/misc/bezierTools.py":1242
  21477. *
  21478. *
  21479. * def _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  21480. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21481. * if len(curve) == 3:
  21482. */
  21483. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_76_curve_line_intersections_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve, PyObject *__pyx_v_line) {
  21484. PyObject *__pyx_v_aligned_curve = NULL;
  21485. PyObject *__pyx_v_a = NULL;
  21486. PyObject *__pyx_v_b = NULL;
  21487. PyObject *__pyx_v_c = NULL;
  21488. PyObject *__pyx_v_intersections = NULL;
  21489. PyObject *__pyx_v_d = NULL;
  21490. PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_2generator4 = 0;
  21491. PyObject *__pyx_r = NULL;
  21492. __Pyx_RefNannyDeclarations
  21493. PyObject *__pyx_t_1 = NULL;
  21494. PyObject *__pyx_t_2 = NULL;
  21495. PyObject *__pyx_t_3 = NULL;
  21496. PyObject *__pyx_t_4 = NULL;
  21497. PyObject *__pyx_t_5 = NULL;
  21498. size_t __pyx_t_6;
  21499. Py_ssize_t __pyx_t_7;
  21500. int __pyx_t_8;
  21501. PyObject *(*__pyx_t_9)(PyObject *);
  21502. PyObject *__pyx_t_10 = NULL;
  21503. PyObject *__pyx_t_11 = NULL;
  21504. int __pyx_lineno = 0;
  21505. const char *__pyx_filename = NULL;
  21506. int __pyx_clineno = 0;
  21507. __Pyx_RefNannySetupContext("_curve_line_intersections_t", 0);
  21508. /* "fontTools/misc/bezierTools.py":1243
  21509. *
  21510. * def _curve_line_intersections_t(curve, line):
  21511. * aligned_curve = _alignment_transformation(line).transformPoints(curve) # <<<<<<<<<<<<<<
  21512. * if len(curve) == 3:
  21513. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21514. */
  21515. __pyx_t_4 = NULL;
  21516. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_alignment_transformation); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1243, __pyx_L1_error)
  21517. __Pyx_GOTREF(__pyx_t_5);
  21518. __pyx_t_6 = 1;
  21519. #if CYTHON_UNPACK_METHODS
  21520. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  21521. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
  21522. assert(__pyx_t_4);
  21523. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  21524. __Pyx_INCREF(__pyx_t_4);
  21525. __Pyx_INCREF(__pyx__function);
  21526. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  21527. __pyx_t_6 = 0;
  21528. }
  21529. #endif
  21530. {
  21531. PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_line};
  21532. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  21533. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  21534. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21535. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1243, __pyx_L1_error)
  21536. __Pyx_GOTREF(__pyx_t_3);
  21537. }
  21538. __pyx_t_2 = __pyx_t_3;
  21539. __Pyx_INCREF(__pyx_t_2);
  21540. __pyx_t_6 = 0;
  21541. {
  21542. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_curve};
  21543. __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_transformPoints, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  21544. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  21545. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21546. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1243, __pyx_L1_error)
  21547. __Pyx_GOTREF(__pyx_t_1);
  21548. }
  21549. __pyx_v_aligned_curve = __pyx_t_1;
  21550. __pyx_t_1 = 0;
  21551. /* "fontTools/misc/bezierTools.py":1244
  21552. * def _curve_line_intersections_t(curve, line):
  21553. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21554. * if len(curve) == 3: # <<<<<<<<<<<<<<
  21555. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21556. * intersections = solveQuadratic(a[1], b[1], c[1])
  21557. */
  21558. __pyx_t_7 = PyObject_Length(__pyx_v_curve); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1244, __pyx_L1_error)
  21559. __pyx_t_8 = (__pyx_t_7 == 3);
  21560. if (__pyx_t_8) {
  21561. /* "fontTools/misc/bezierTools.py":1245
  21562. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21563. * if len(curve) == 3:
  21564. * a, b, c = calcQuadraticParameters(*aligned_curve) # <<<<<<<<<<<<<<
  21565. * intersections = solveQuadratic(a[1], b[1], c[1])
  21566. * elif len(curve) == 4:
  21567. */
  21568. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_calcQuadraticParameters); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21569. __Pyx_GOTREF(__pyx_t_1);
  21570. __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_aligned_curve); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21571. __Pyx_GOTREF(__pyx_t_3);
  21572. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21573. __Pyx_GOTREF(__pyx_t_2);
  21574. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21575. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21576. if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
  21577. PyObject* sequence = __pyx_t_2;
  21578. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  21579. if (unlikely(size != 3)) {
  21580. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  21581. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  21582. __PYX_ERR(0, 1245, __pyx_L1_error)
  21583. }
  21584. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  21585. if (likely(PyTuple_CheckExact(sequence))) {
  21586. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  21587. __Pyx_INCREF(__pyx_t_3);
  21588. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  21589. __Pyx_INCREF(__pyx_t_1);
  21590. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  21591. __Pyx_INCREF(__pyx_t_5);
  21592. } else {
  21593. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  21594. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21595. __Pyx_XGOTREF(__pyx_t_3);
  21596. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  21597. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21598. __Pyx_XGOTREF(__pyx_t_1);
  21599. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  21600. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21601. __Pyx_XGOTREF(__pyx_t_5);
  21602. }
  21603. #else
  21604. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21605. __Pyx_GOTREF(__pyx_t_3);
  21606. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21607. __Pyx_GOTREF(__pyx_t_1);
  21608. __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21609. __Pyx_GOTREF(__pyx_t_5);
  21610. #endif
  21611. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21612. } else {
  21613. Py_ssize_t index = -1;
  21614. __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21615. __Pyx_GOTREF(__pyx_t_4);
  21616. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21617. __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  21618. index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
  21619. __Pyx_GOTREF(__pyx_t_3);
  21620. index = 1; __pyx_t_1 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
  21621. __Pyx_GOTREF(__pyx_t_1);
  21622. index = 2; __pyx_t_5 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
  21623. __Pyx_GOTREF(__pyx_t_5);
  21624. if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21625. __pyx_t_9 = NULL;
  21626. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21627. goto __pyx_L5_unpacking_done;
  21628. __pyx_L4_unpacking_failed:;
  21629. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21630. __pyx_t_9 = NULL;
  21631. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  21632. __PYX_ERR(0, 1245, __pyx_L1_error)
  21633. __pyx_L5_unpacking_done:;
  21634. }
  21635. __pyx_v_a = __pyx_t_3;
  21636. __pyx_t_3 = 0;
  21637. __pyx_v_b = __pyx_t_1;
  21638. __pyx_t_1 = 0;
  21639. __pyx_v_c = __pyx_t_5;
  21640. __pyx_t_5 = 0;
  21641. /* "fontTools/misc/bezierTools.py":1246
  21642. * if len(curve) == 3:
  21643. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21644. * intersections = solveQuadratic(a[1], b[1], c[1]) # <<<<<<<<<<<<<<
  21645. * elif len(curve) == 4:
  21646. * a, b, c, d = calcCubicParameters(*aligned_curve)
  21647. */
  21648. __pyx_t_5 = NULL;
  21649. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_solveQuadratic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1246, __pyx_L1_error)
  21650. __Pyx_GOTREF(__pyx_t_1);
  21651. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_a, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1246, __pyx_L1_error)
  21652. __Pyx_GOTREF(__pyx_t_3);
  21653. __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1246, __pyx_L1_error)
  21654. __Pyx_GOTREF(__pyx_t_4);
  21655. __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_c, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1246, __pyx_L1_error)
  21656. __Pyx_GOTREF(__pyx_t_10);
  21657. __pyx_t_6 = 1;
  21658. #if CYTHON_UNPACK_METHODS
  21659. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  21660. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
  21661. assert(__pyx_t_5);
  21662. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  21663. __Pyx_INCREF(__pyx_t_5);
  21664. __Pyx_INCREF(__pyx__function);
  21665. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  21666. __pyx_t_6 = 0;
  21667. }
  21668. #endif
  21669. {
  21670. PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_t_10};
  21671. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  21672. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  21673. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21674. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21675. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  21676. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21677. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1246, __pyx_L1_error)
  21678. __Pyx_GOTREF(__pyx_t_2);
  21679. }
  21680. __pyx_v_intersections = __pyx_t_2;
  21681. __pyx_t_2 = 0;
  21682. /* "fontTools/misc/bezierTools.py":1244
  21683. * def _curve_line_intersections_t(curve, line):
  21684. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21685. * if len(curve) == 3: # <<<<<<<<<<<<<<
  21686. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21687. * intersections = solveQuadratic(a[1], b[1], c[1])
  21688. */
  21689. goto __pyx_L3;
  21690. }
  21691. /* "fontTools/misc/bezierTools.py":1247
  21692. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21693. * intersections = solveQuadratic(a[1], b[1], c[1])
  21694. * elif len(curve) == 4: # <<<<<<<<<<<<<<
  21695. * a, b, c, d = calcCubicParameters(*aligned_curve)
  21696. * intersections = solveCubic(a[1], b[1], c[1], d[1])
  21697. */
  21698. __pyx_t_7 = PyObject_Length(__pyx_v_curve); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1247, __pyx_L1_error)
  21699. __pyx_t_8 = (__pyx_t_7 == 4);
  21700. if (likely(__pyx_t_8)) {
  21701. /* "fontTools/misc/bezierTools.py":1248
  21702. * intersections = solveQuadratic(a[1], b[1], c[1])
  21703. * elif len(curve) == 4:
  21704. * a, b, c, d = calcCubicParameters(*aligned_curve) # <<<<<<<<<<<<<<
  21705. * intersections = solveCubic(a[1], b[1], c[1], d[1])
  21706. * else:
  21707. */
  21708. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_calcCubicParameters); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21709. __Pyx_GOTREF(__pyx_t_2);
  21710. __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_aligned_curve); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21711. __Pyx_GOTREF(__pyx_t_1);
  21712. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21713. __Pyx_GOTREF(__pyx_t_10);
  21714. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21715. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21716. if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
  21717. PyObject* sequence = __pyx_t_10;
  21718. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  21719. if (unlikely(size != 4)) {
  21720. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  21721. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  21722. __PYX_ERR(0, 1248, __pyx_L1_error)
  21723. }
  21724. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  21725. if (likely(PyTuple_CheckExact(sequence))) {
  21726. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  21727. __Pyx_INCREF(__pyx_t_1);
  21728. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  21729. __Pyx_INCREF(__pyx_t_2);
  21730. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
  21731. __Pyx_INCREF(__pyx_t_4);
  21732. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3);
  21733. __Pyx_INCREF(__pyx_t_3);
  21734. } else {
  21735. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  21736. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21737. __Pyx_XGOTREF(__pyx_t_1);
  21738. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  21739. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21740. __Pyx_XGOTREF(__pyx_t_2);
  21741. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  21742. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21743. __Pyx_XGOTREF(__pyx_t_4);
  21744. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  21745. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21746. __Pyx_XGOTREF(__pyx_t_3);
  21747. }
  21748. #else
  21749. {
  21750. Py_ssize_t i;
  21751. PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_4,&__pyx_t_3};
  21752. for (i=0; i < 4; i++) {
  21753. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21754. __Pyx_GOTREF(item);
  21755. *(temps[i]) = item;
  21756. }
  21757. }
  21758. #endif
  21759. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  21760. } else {
  21761. Py_ssize_t index = -1;
  21762. PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_4,&__pyx_t_3};
  21763. __pyx_t_5 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21764. __Pyx_GOTREF(__pyx_t_5);
  21765. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  21766. __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
  21767. for (index=0; index < 4; index++) {
  21768. PyObject* item = __pyx_t_9(__pyx_t_5); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
  21769. __Pyx_GOTREF(item);
  21770. *(temps[index]) = item;
  21771. }
  21772. if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_5), 4) < (0)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21773. __pyx_t_9 = NULL;
  21774. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21775. goto __pyx_L7_unpacking_done;
  21776. __pyx_L6_unpacking_failed:;
  21777. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21778. __pyx_t_9 = NULL;
  21779. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  21780. __PYX_ERR(0, 1248, __pyx_L1_error)
  21781. __pyx_L7_unpacking_done:;
  21782. }
  21783. __pyx_v_a = __pyx_t_1;
  21784. __pyx_t_1 = 0;
  21785. __pyx_v_b = __pyx_t_2;
  21786. __pyx_t_2 = 0;
  21787. __pyx_v_c = __pyx_t_4;
  21788. __pyx_t_4 = 0;
  21789. __pyx_v_d = __pyx_t_3;
  21790. __pyx_t_3 = 0;
  21791. /* "fontTools/misc/bezierTools.py":1249
  21792. * elif len(curve) == 4:
  21793. * a, b, c, d = calcCubicParameters(*aligned_curve)
  21794. * intersections = solveCubic(a[1], b[1], c[1], d[1]) # <<<<<<<<<<<<<<
  21795. * else:
  21796. * raise ValueError("Unknown curve degree")
  21797. */
  21798. __pyx_t_3 = NULL;
  21799. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_solveCubic); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1249, __pyx_L1_error)
  21800. __Pyx_GOTREF(__pyx_t_4);
  21801. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_a, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1249, __pyx_L1_error)
  21802. __Pyx_GOTREF(__pyx_t_2);
  21803. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __pyx_L1_error)
  21804. __Pyx_GOTREF(__pyx_t_1);
  21805. __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_c, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1249, __pyx_L1_error)
  21806. __Pyx_GOTREF(__pyx_t_5);
  21807. __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_d, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_OwnStrongReference); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1249, __pyx_L1_error)
  21808. __Pyx_GOTREF(__pyx_t_11);
  21809. __pyx_t_6 = 1;
  21810. #if CYTHON_UNPACK_METHODS
  21811. if (unlikely(PyMethod_Check(__pyx_t_4))) {
  21812. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
  21813. assert(__pyx_t_3);
  21814. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
  21815. __Pyx_INCREF(__pyx_t_3);
  21816. __Pyx_INCREF(__pyx__function);
  21817. __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
  21818. __pyx_t_6 = 0;
  21819. }
  21820. #endif
  21821. {
  21822. PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_t_2, __pyx_t_1, __pyx_t_5, __pyx_t_11};
  21823. __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  21824. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  21825. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21826. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21827. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21828. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  21829. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21830. if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1249, __pyx_L1_error)
  21831. __Pyx_GOTREF(__pyx_t_10);
  21832. }
  21833. __pyx_v_intersections = __pyx_t_10;
  21834. __pyx_t_10 = 0;
  21835. /* "fontTools/misc/bezierTools.py":1247
  21836. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21837. * intersections = solveQuadratic(a[1], b[1], c[1])
  21838. * elif len(curve) == 4: # <<<<<<<<<<<<<<
  21839. * a, b, c, d = calcCubicParameters(*aligned_curve)
  21840. * intersections = solveCubic(a[1], b[1], c[1], d[1])
  21841. */
  21842. goto __pyx_L3;
  21843. }
  21844. /* "fontTools/misc/bezierTools.py":1251
  21845. * intersections = solveCubic(a[1], b[1], c[1], d[1])
  21846. * else:
  21847. * raise ValueError("Unknown curve degree") # <<<<<<<<<<<<<<
  21848. * return sorted(i for i in intersections if 0.0 <= i <= 1)
  21849. *
  21850. */
  21851. /*else*/ {
  21852. __pyx_t_4 = NULL;
  21853. __pyx_t_6 = 1;
  21854. {
  21855. PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unknown_curve_degree};
  21856. __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  21857. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  21858. if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1251, __pyx_L1_error)
  21859. __Pyx_GOTREF(__pyx_t_10);
  21860. }
  21861. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  21862. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  21863. __PYX_ERR(0, 1251, __pyx_L1_error)
  21864. }
  21865. __pyx_L3:;
  21866. /* "fontTools/misc/bezierTools.py":1252
  21867. * else:
  21868. * raise ValueError("Unknown curve degree")
  21869. * return sorted(i for i in intersections if 0.0 <= i <= 1) # <<<<<<<<<<<<<<
  21870. *
  21871. *
  21872. */
  21873. __Pyx_XDECREF(__pyx_r);
  21874. __pyx_t_10 = __pyx_pf_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_genexpr(NULL, __pyx_v_intersections); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21875. __Pyx_GOTREF(__pyx_t_10);
  21876. __pyx_t_4 = __Pyx_Generator_GetInlinedResult(__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21877. __Pyx_GOTREF(__pyx_t_4);
  21878. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  21879. if (unlikely((PyList_Sort(__pyx_t_4) < 0))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21880. __pyx_r = __pyx_t_4;
  21881. __pyx_t_4 = 0;
  21882. goto __pyx_L0;
  21883. /* "fontTools/misc/bezierTools.py":1242
  21884. *
  21885. *
  21886. * def _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  21887. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21888. * if len(curve) == 3:
  21889. */
  21890. /* function exit code */
  21891. __pyx_L1_error:;
  21892. __Pyx_XDECREF(__pyx_t_1);
  21893. __Pyx_XDECREF(__pyx_t_2);
  21894. __Pyx_XDECREF(__pyx_t_3);
  21895. __Pyx_XDECREF(__pyx_t_4);
  21896. __Pyx_XDECREF(__pyx_t_5);
  21897. __Pyx_XDECREF(__pyx_t_10);
  21898. __Pyx_XDECREF(__pyx_t_11);
  21899. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_line_intersections_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21900. __pyx_r = NULL;
  21901. __pyx_L0:;
  21902. __Pyx_XDECREF(__pyx_v_aligned_curve);
  21903. __Pyx_XDECREF(__pyx_v_a);
  21904. __Pyx_XDECREF(__pyx_v_b);
  21905. __Pyx_XDECREF(__pyx_v_c);
  21906. __Pyx_XDECREF(__pyx_v_intersections);
  21907. __Pyx_XDECREF(__pyx_v_d);
  21908. __Pyx_XDECREF(__pyx_gb_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_2generator4);
  21909. __Pyx_XGIVEREF(__pyx_r);
  21910. __Pyx_RefNannyFinishContext();
  21911. return __pyx_r;
  21912. }
  21913. /* "fontTools/misc/bezierTools.py":1255
  21914. *
  21915. *
  21916. * def curveLineIntersections(curve, line): # <<<<<<<<<<<<<<
  21917. * """Finds intersections between a curve and a line.
  21918. *
  21919. */
  21920. /* Python wrapper */
  21921. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_79curveLineIntersections(PyObject *__pyx_self,
  21922. #if CYTHON_METH_FASTCALL
  21923. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  21924. #else
  21925. PyObject *__pyx_args, PyObject *__pyx_kwds
  21926. #endif
  21927. ); /*proto*/
  21928. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_78curveLineIntersections, "curveLineIntersections(curve, line)\n\nFinds intersections between a curve and a line.\n\nArgs:\n curve: List of coordinates of the curve segment as 2D tuples.\n line: List of coordinates of the line segment as 2D tuples.\n\nReturns:\n A list of ``Intersection`` objects, each object having ``pt``, ``t1``\n and ``t2`` attributes containing the intersection point, time on first\n segment and time on second segment respectively.\n\nExamples::\n >>> curve = [ (100, 240), (30, 60), (210, 230), (160, 30) ]\n >>> line = [ (25, 260), (230, 20) ]\n >>> intersections = curveLineIntersections(curve, line)\n >>> len(intersections)\n 3\n >>> intersections[0].pt\n (84.9000930760723, 189.87306176459828)");
  21929. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_79curveLineIntersections = {"curveLineIntersections", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_79curveLineIntersections, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_78curveLineIntersections};
  21930. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_79curveLineIntersections(PyObject *__pyx_self,
  21931. #if CYTHON_METH_FASTCALL
  21932. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  21933. #else
  21934. PyObject *__pyx_args, PyObject *__pyx_kwds
  21935. #endif
  21936. ) {
  21937. PyObject *__pyx_v_curve = 0;
  21938. PyObject *__pyx_v_line = 0;
  21939. #if !CYTHON_METH_FASTCALL
  21940. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  21941. #endif
  21942. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  21943. PyObject* values[2] = {0,0};
  21944. int __pyx_lineno = 0;
  21945. const char *__pyx_filename = NULL;
  21946. int __pyx_clineno = 0;
  21947. PyObject *__pyx_r = 0;
  21948. __Pyx_RefNannyDeclarations
  21949. __Pyx_RefNannySetupContext("curveLineIntersections (wrapper)", 0);
  21950. #if !CYTHON_METH_FASTCALL
  21951. #if CYTHON_ASSUME_SAFE_SIZE
  21952. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  21953. #else
  21954. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  21955. #endif
  21956. #endif
  21957. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  21958. {
  21959. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_curve,&__pyx_mstate_global->__pyx_n_u_line,0};
  21960. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  21961. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1255, __pyx_L3_error)
  21962. if (__pyx_kwds_len > 0) {
  21963. switch (__pyx_nargs) {
  21964. case 2:
  21965. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  21966. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1255, __pyx_L3_error)
  21967. CYTHON_FALLTHROUGH;
  21968. case 1:
  21969. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21970. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1255, __pyx_L3_error)
  21971. CYTHON_FALLTHROUGH;
  21972. case 0: break;
  21973. default: goto __pyx_L5_argtuple_error;
  21974. }
  21975. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  21976. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "curveLineIntersections", 0) < (0)) __PYX_ERR(0, 1255, __pyx_L3_error)
  21977. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  21978. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("curveLineIntersections", 1, 2, 2, i); __PYX_ERR(0, 1255, __pyx_L3_error) }
  21979. }
  21980. } else if (unlikely(__pyx_nargs != 2)) {
  21981. goto __pyx_L5_argtuple_error;
  21982. } else {
  21983. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21984. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1255, __pyx_L3_error)
  21985. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  21986. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1255, __pyx_L3_error)
  21987. }
  21988. __pyx_v_curve = values[0];
  21989. __pyx_v_line = values[1];
  21990. }
  21991. goto __pyx_L6_skip;
  21992. __pyx_L5_argtuple_error:;
  21993. __Pyx_RaiseArgtupleInvalid("curveLineIntersections", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1255, __pyx_L3_error)
  21994. __pyx_L6_skip:;
  21995. goto __pyx_L4_argument_unpacking_done;
  21996. __pyx_L3_error:;
  21997. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  21998. Py_XDECREF(values[__pyx_temp]);
  21999. }
  22000. __Pyx_AddTraceback("fontTools.misc.bezierTools.curveLineIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22001. __Pyx_RefNannyFinishContext();
  22002. return NULL;
  22003. __pyx_L4_argument_unpacking_done:;
  22004. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_78curveLineIntersections(__pyx_self, __pyx_v_curve, __pyx_v_line);
  22005. /* function exit code */
  22006. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  22007. Py_XDECREF(values[__pyx_temp]);
  22008. }
  22009. __Pyx_RefNannyFinishContext();
  22010. return __pyx_r;
  22011. }
  22012. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_78curveLineIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve, PyObject *__pyx_v_line) {
  22013. PyObject *__pyx_v_pointFinder = NULL;
  22014. PyObject *__pyx_v_intersections = NULL;
  22015. PyObject *__pyx_v_t = NULL;
  22016. PyObject *__pyx_v_pt = NULL;
  22017. PyObject *__pyx_v_line_t = NULL;
  22018. PyObject *__pyx_r = NULL;
  22019. __Pyx_RefNannyDeclarations
  22020. Py_ssize_t __pyx_t_1;
  22021. int __pyx_t_2;
  22022. PyObject *__pyx_t_3 = NULL;
  22023. PyObject *__pyx_t_4 = NULL;
  22024. size_t __pyx_t_5;
  22025. PyObject *__pyx_t_6 = NULL;
  22026. PyObject *(*__pyx_t_7)(PyObject *);
  22027. PyObject *__pyx_t_8 = NULL;
  22028. PyObject *__pyx_t_9 = NULL;
  22029. int __pyx_t_10;
  22030. int __pyx_lineno = 0;
  22031. const char *__pyx_filename = NULL;
  22032. int __pyx_clineno = 0;
  22033. __Pyx_RefNannySetupContext("curveLineIntersections", 0);
  22034. /* "fontTools/misc/bezierTools.py":1276
  22035. * (84.9000930760723, 189.87306176459828)
  22036. * """
  22037. * if len(curve) == 3: # <<<<<<<<<<<<<<
  22038. * pointFinder = quadraticPointAtT
  22039. * elif len(curve) == 4:
  22040. */
  22041. __pyx_t_1 = PyObject_Length(__pyx_v_curve); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1276, __pyx_L1_error)
  22042. __pyx_t_2 = (__pyx_t_1 == 3);
  22043. if (__pyx_t_2) {
  22044. /* "fontTools/misc/bezierTools.py":1277
  22045. * """
  22046. * if len(curve) == 3:
  22047. * pointFinder = quadraticPointAtT # <<<<<<<<<<<<<<
  22048. * elif len(curve) == 4:
  22049. * pointFinder = cubicPointAtT
  22050. */
  22051. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_quadraticPointAtT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1277, __pyx_L1_error)
  22052. __Pyx_GOTREF(__pyx_t_3);
  22053. __pyx_v_pointFinder = __pyx_t_3;
  22054. __pyx_t_3 = 0;
  22055. /* "fontTools/misc/bezierTools.py":1276
  22056. * (84.9000930760723, 189.87306176459828)
  22057. * """
  22058. * if len(curve) == 3: # <<<<<<<<<<<<<<
  22059. * pointFinder = quadraticPointAtT
  22060. * elif len(curve) == 4:
  22061. */
  22062. goto __pyx_L3;
  22063. }
  22064. /* "fontTools/misc/bezierTools.py":1278
  22065. * if len(curve) == 3:
  22066. * pointFinder = quadraticPointAtT
  22067. * elif len(curve) == 4: # <<<<<<<<<<<<<<
  22068. * pointFinder = cubicPointAtT
  22069. * else:
  22070. */
  22071. __pyx_t_1 = PyObject_Length(__pyx_v_curve); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1278, __pyx_L1_error)
  22072. __pyx_t_2 = (__pyx_t_1 == 4);
  22073. if (likely(__pyx_t_2)) {
  22074. /* "fontTools/misc/bezierTools.py":1279
  22075. * pointFinder = quadraticPointAtT
  22076. * elif len(curve) == 4:
  22077. * pointFinder = cubicPointAtT # <<<<<<<<<<<<<<
  22078. * else:
  22079. * raise ValueError("Unknown curve degree")
  22080. */
  22081. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cubicPointAtT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
  22082. __Pyx_GOTREF(__pyx_t_3);
  22083. __pyx_v_pointFinder = __pyx_t_3;
  22084. __pyx_t_3 = 0;
  22085. /* "fontTools/misc/bezierTools.py":1278
  22086. * if len(curve) == 3:
  22087. * pointFinder = quadraticPointAtT
  22088. * elif len(curve) == 4: # <<<<<<<<<<<<<<
  22089. * pointFinder = cubicPointAtT
  22090. * else:
  22091. */
  22092. goto __pyx_L3;
  22093. }
  22094. /* "fontTools/misc/bezierTools.py":1281
  22095. * pointFinder = cubicPointAtT
  22096. * else:
  22097. * raise ValueError("Unknown curve degree") # <<<<<<<<<<<<<<
  22098. * intersections = []
  22099. * for t in _curve_line_intersections_t(curve, line):
  22100. */
  22101. /*else*/ {
  22102. __pyx_t_4 = NULL;
  22103. __pyx_t_5 = 1;
  22104. {
  22105. PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unknown_curve_degree};
  22106. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  22107. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  22108. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1281, __pyx_L1_error)
  22109. __Pyx_GOTREF(__pyx_t_3);
  22110. }
  22111. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  22112. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22113. __PYX_ERR(0, 1281, __pyx_L1_error)
  22114. }
  22115. __pyx_L3:;
  22116. /* "fontTools/misc/bezierTools.py":1282
  22117. * else:
  22118. * raise ValueError("Unknown curve degree")
  22119. * intersections = [] # <<<<<<<<<<<<<<
  22120. * for t in _curve_line_intersections_t(curve, line):
  22121. * pt = pointFinder(*curve, t)
  22122. */
  22123. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1282, __pyx_L1_error)
  22124. __Pyx_GOTREF(__pyx_t_3);
  22125. __pyx_v_intersections = ((PyObject*)__pyx_t_3);
  22126. __pyx_t_3 = 0;
  22127. /* "fontTools/misc/bezierTools.py":1283
  22128. * raise ValueError("Unknown curve degree")
  22129. * intersections = []
  22130. * for t in _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  22131. * pt = pointFinder(*curve, t)
  22132. * # Back-project the point onto the line, to avoid problems with
  22133. */
  22134. __pyx_t_4 = NULL;
  22135. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_curve_line_intersections_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1283, __pyx_L1_error)
  22136. __Pyx_GOTREF(__pyx_t_6);
  22137. __pyx_t_5 = 1;
  22138. #if CYTHON_UNPACK_METHODS
  22139. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  22140. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
  22141. assert(__pyx_t_4);
  22142. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  22143. __Pyx_INCREF(__pyx_t_4);
  22144. __Pyx_INCREF(__pyx__function);
  22145. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  22146. __pyx_t_5 = 0;
  22147. }
  22148. #endif
  22149. {
  22150. PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_curve, __pyx_v_line};
  22151. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  22152. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  22153. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22154. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1283, __pyx_L1_error)
  22155. __Pyx_GOTREF(__pyx_t_3);
  22156. }
  22157. if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
  22158. __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6);
  22159. __pyx_t_1 = 0;
  22160. __pyx_t_7 = NULL;
  22161. } else {
  22162. __pyx_t_1 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1283, __pyx_L1_error)
  22163. __Pyx_GOTREF(__pyx_t_6);
  22164. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1283, __pyx_L1_error)
  22165. }
  22166. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22167. for (;;) {
  22168. if (likely(!__pyx_t_7)) {
  22169. if (likely(PyList_CheckExact(__pyx_t_6))) {
  22170. {
  22171. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
  22172. #if !CYTHON_ASSUME_SAFE_SIZE
  22173. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1283, __pyx_L1_error)
  22174. #endif
  22175. if (__pyx_t_1 >= __pyx_temp) break;
  22176. }
  22177. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference);
  22178. ++__pyx_t_1;
  22179. } else {
  22180. {
  22181. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
  22182. #if !CYTHON_ASSUME_SAFE_SIZE
  22183. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1283, __pyx_L1_error)
  22184. #endif
  22185. if (__pyx_t_1 >= __pyx_temp) break;
  22186. }
  22187. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  22188. __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_1));
  22189. #else
  22190. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_1);
  22191. #endif
  22192. ++__pyx_t_1;
  22193. }
  22194. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1283, __pyx_L1_error)
  22195. } else {
  22196. __pyx_t_3 = __pyx_t_7(__pyx_t_6);
  22197. if (unlikely(!__pyx_t_3)) {
  22198. PyObject* exc_type = PyErr_Occurred();
  22199. if (exc_type) {
  22200. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1283, __pyx_L1_error)
  22201. PyErr_Clear();
  22202. }
  22203. break;
  22204. }
  22205. }
  22206. __Pyx_GOTREF(__pyx_t_3);
  22207. __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
  22208. __pyx_t_3 = 0;
  22209. /* "fontTools/misc/bezierTools.py":1284
  22210. * intersections = []
  22211. * for t in _curve_line_intersections_t(curve, line):
  22212. * pt = pointFinder(*curve, t) # <<<<<<<<<<<<<<
  22213. * # Back-project the point onto the line, to avoid problems with
  22214. * # numerical accuracy in the case of vertical and horizontal lines
  22215. */
  22216. __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_curve); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1284, __pyx_L1_error)
  22217. __Pyx_GOTREF(__pyx_t_3);
  22218. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1284, __pyx_L1_error)
  22219. __Pyx_GOTREF(__pyx_t_4);
  22220. __Pyx_INCREF(__pyx_v_t);
  22221. __Pyx_GIVEREF(__pyx_v_t);
  22222. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1284, __pyx_L1_error);
  22223. __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1284, __pyx_L1_error)
  22224. __Pyx_GOTREF(__pyx_t_8);
  22225. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22226. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22227. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_pointFinder, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1284, __pyx_L1_error)
  22228. __Pyx_GOTREF(__pyx_t_4);
  22229. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  22230. __Pyx_XDECREF_SET(__pyx_v_pt, __pyx_t_4);
  22231. __pyx_t_4 = 0;
  22232. /* "fontTools/misc/bezierTools.py":1287
  22233. * # Back-project the point onto the line, to avoid problems with
  22234. * # numerical accuracy in the case of vertical and horizontal lines
  22235. * line_t = _line_t_of_pt(*line, pt) # <<<<<<<<<<<<<<
  22236. * pt = linePointAtT(*line, line_t)
  22237. * intersections.append(Intersection(pt=pt, t1=t, t2=line_t))
  22238. */
  22239. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_line_t_of_pt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1287, __pyx_L1_error)
  22240. __Pyx_GOTREF(__pyx_t_4);
  22241. __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_v_line); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1287, __pyx_L1_error)
  22242. __Pyx_GOTREF(__pyx_t_8);
  22243. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1287, __pyx_L1_error)
  22244. __Pyx_GOTREF(__pyx_t_3);
  22245. __Pyx_INCREF(__pyx_v_pt);
  22246. __Pyx_GIVEREF(__pyx_v_pt);
  22247. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pt) != (0)) __PYX_ERR(0, 1287, __pyx_L1_error);
  22248. __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1287, __pyx_L1_error)
  22249. __Pyx_GOTREF(__pyx_t_9);
  22250. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  22251. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22252. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1287, __pyx_L1_error)
  22253. __Pyx_GOTREF(__pyx_t_3);
  22254. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22255. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  22256. __Pyx_XDECREF_SET(__pyx_v_line_t, __pyx_t_3);
  22257. __pyx_t_3 = 0;
  22258. /* "fontTools/misc/bezierTools.py":1288
  22259. * # numerical accuracy in the case of vertical and horizontal lines
  22260. * line_t = _line_t_of_pt(*line, pt)
  22261. * pt = linePointAtT(*line, line_t) # <<<<<<<<<<<<<<
  22262. * intersections.append(Intersection(pt=pt, t1=t, t2=line_t))
  22263. * return intersections
  22264. */
  22265. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_linePointAtT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1288, __pyx_L1_error)
  22266. __Pyx_GOTREF(__pyx_t_3);
  22267. __pyx_t_9 = __Pyx_PySequence_Tuple(__pyx_v_line); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1288, __pyx_L1_error)
  22268. __Pyx_GOTREF(__pyx_t_9);
  22269. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1288, __pyx_L1_error)
  22270. __Pyx_GOTREF(__pyx_t_4);
  22271. __Pyx_INCREF(__pyx_v_line_t);
  22272. __Pyx_GIVEREF(__pyx_v_line_t);
  22273. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_line_t) != (0)) __PYX_ERR(0, 1288, __pyx_L1_error);
  22274. __pyx_t_8 = PyNumber_Add(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1288, __pyx_L1_error)
  22275. __Pyx_GOTREF(__pyx_t_8);
  22276. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  22277. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22278. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1288, __pyx_L1_error)
  22279. __Pyx_GOTREF(__pyx_t_4);
  22280. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22281. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  22282. __Pyx_DECREF_SET(__pyx_v_pt, __pyx_t_4);
  22283. __pyx_t_4 = 0;
  22284. /* "fontTools/misc/bezierTools.py":1289
  22285. * line_t = _line_t_of_pt(*line, pt)
  22286. * pt = linePointAtT(*line, line_t)
  22287. * intersections.append(Intersection(pt=pt, t1=t, t2=line_t)) # <<<<<<<<<<<<<<
  22288. * return intersections
  22289. *
  22290. */
  22291. __pyx_t_8 = NULL;
  22292. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1289, __pyx_L1_error)
  22293. __Pyx_GOTREF(__pyx_t_3);
  22294. __pyx_t_5 = 1;
  22295. #if CYTHON_UNPACK_METHODS
  22296. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  22297. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
  22298. assert(__pyx_t_8);
  22299. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  22300. __Pyx_INCREF(__pyx_t_8);
  22301. __Pyx_INCREF(__pyx__function);
  22302. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  22303. __pyx_t_5 = 0;
  22304. }
  22305. #endif
  22306. {
  22307. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_8, NULL};
  22308. __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1289, __pyx_L1_error)
  22309. __Pyx_GOTREF(__pyx_t_9);
  22310. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pt, __pyx_v_pt, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1289, __pyx_L1_error)
  22311. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t1, __pyx_v_t, __pyx_t_9, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1289, __pyx_L1_error)
  22312. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t2, __pyx_v_line_t, __pyx_t_9, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1289, __pyx_L1_error)
  22313. __pyx_t_4 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
  22314. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  22315. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  22316. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22317. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1289, __pyx_L1_error)
  22318. __Pyx_GOTREF(__pyx_t_4);
  22319. }
  22320. __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_intersections, __pyx_t_4); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1289, __pyx_L1_error)
  22321. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22322. /* "fontTools/misc/bezierTools.py":1283
  22323. * raise ValueError("Unknown curve degree")
  22324. * intersections = []
  22325. * for t in _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  22326. * pt = pointFinder(*curve, t)
  22327. * # Back-project the point onto the line, to avoid problems with
  22328. */
  22329. }
  22330. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22331. /* "fontTools/misc/bezierTools.py":1290
  22332. * pt = linePointAtT(*line, line_t)
  22333. * intersections.append(Intersection(pt=pt, t1=t, t2=line_t))
  22334. * return intersections # <<<<<<<<<<<<<<
  22335. *
  22336. *
  22337. */
  22338. __Pyx_XDECREF(__pyx_r);
  22339. __Pyx_INCREF(__pyx_v_intersections);
  22340. __pyx_r = __pyx_v_intersections;
  22341. goto __pyx_L0;
  22342. /* "fontTools/misc/bezierTools.py":1255
  22343. *
  22344. *
  22345. * def curveLineIntersections(curve, line): # <<<<<<<<<<<<<<
  22346. * """Finds intersections between a curve and a line.
  22347. *
  22348. */
  22349. /* function exit code */
  22350. __pyx_L1_error:;
  22351. __Pyx_XDECREF(__pyx_t_3);
  22352. __Pyx_XDECREF(__pyx_t_4);
  22353. __Pyx_XDECREF(__pyx_t_6);
  22354. __Pyx_XDECREF(__pyx_t_8);
  22355. __Pyx_XDECREF(__pyx_t_9);
  22356. __Pyx_AddTraceback("fontTools.misc.bezierTools.curveLineIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22357. __pyx_r = NULL;
  22358. __pyx_L0:;
  22359. __Pyx_XDECREF(__pyx_v_pointFinder);
  22360. __Pyx_XDECREF(__pyx_v_intersections);
  22361. __Pyx_XDECREF(__pyx_v_t);
  22362. __Pyx_XDECREF(__pyx_v_pt);
  22363. __Pyx_XDECREF(__pyx_v_line_t);
  22364. __Pyx_XGIVEREF(__pyx_r);
  22365. __Pyx_RefNannyFinishContext();
  22366. return __pyx_r;
  22367. }
  22368. /* "fontTools/misc/bezierTools.py":1293
  22369. *
  22370. *
  22371. * def _curve_bounds(c): # <<<<<<<<<<<<<<
  22372. * if len(c) == 3:
  22373. * return calcQuadraticBounds(*c)
  22374. */
  22375. /* Python wrapper */
  22376. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_81_curve_bounds(PyObject *__pyx_self,
  22377. #if CYTHON_METH_FASTCALL
  22378. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  22379. #else
  22380. PyObject *__pyx_args, PyObject *__pyx_kwds
  22381. #endif
  22382. ); /*proto*/
  22383. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_80_curve_bounds, "_curve_bounds(c)");
  22384. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_81_curve_bounds = {"_curve_bounds", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_81_curve_bounds, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_80_curve_bounds};
  22385. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_81_curve_bounds(PyObject *__pyx_self,
  22386. #if CYTHON_METH_FASTCALL
  22387. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  22388. #else
  22389. PyObject *__pyx_args, PyObject *__pyx_kwds
  22390. #endif
  22391. ) {
  22392. PyObject *__pyx_v_c = 0;
  22393. #if !CYTHON_METH_FASTCALL
  22394. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  22395. #endif
  22396. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  22397. PyObject* values[1] = {0};
  22398. int __pyx_lineno = 0;
  22399. const char *__pyx_filename = NULL;
  22400. int __pyx_clineno = 0;
  22401. PyObject *__pyx_r = 0;
  22402. __Pyx_RefNannyDeclarations
  22403. __Pyx_RefNannySetupContext("_curve_bounds (wrapper)", 0);
  22404. #if !CYTHON_METH_FASTCALL
  22405. #if CYTHON_ASSUME_SAFE_SIZE
  22406. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  22407. #else
  22408. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  22409. #endif
  22410. #endif
  22411. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  22412. {
  22413. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_c,0};
  22414. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  22415. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1293, __pyx_L3_error)
  22416. if (__pyx_kwds_len > 0) {
  22417. switch (__pyx_nargs) {
  22418. case 1:
  22419. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  22420. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1293, __pyx_L3_error)
  22421. CYTHON_FALLTHROUGH;
  22422. case 0: break;
  22423. default: goto __pyx_L5_argtuple_error;
  22424. }
  22425. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  22426. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_curve_bounds", 0) < (0)) __PYX_ERR(0, 1293, __pyx_L3_error)
  22427. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  22428. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_curve_bounds", 1, 1, 1, i); __PYX_ERR(0, 1293, __pyx_L3_error) }
  22429. }
  22430. } else if (unlikely(__pyx_nargs != 1)) {
  22431. goto __pyx_L5_argtuple_error;
  22432. } else {
  22433. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  22434. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1293, __pyx_L3_error)
  22435. }
  22436. __pyx_v_c = values[0];
  22437. }
  22438. goto __pyx_L6_skip;
  22439. __pyx_L5_argtuple_error:;
  22440. __Pyx_RaiseArgtupleInvalid("_curve_bounds", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1293, __pyx_L3_error)
  22441. __pyx_L6_skip:;
  22442. goto __pyx_L4_argument_unpacking_done;
  22443. __pyx_L3_error:;
  22444. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  22445. Py_XDECREF(values[__pyx_temp]);
  22446. }
  22447. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_bounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22448. __Pyx_RefNannyFinishContext();
  22449. return NULL;
  22450. __pyx_L4_argument_unpacking_done:;
  22451. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_80_curve_bounds(__pyx_self, __pyx_v_c);
  22452. /* function exit code */
  22453. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  22454. Py_XDECREF(values[__pyx_temp]);
  22455. }
  22456. __Pyx_RefNannyFinishContext();
  22457. return __pyx_r;
  22458. }
  22459. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_80_curve_bounds(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_c) {
  22460. PyObject *__pyx_r = NULL;
  22461. __Pyx_RefNannyDeclarations
  22462. Py_ssize_t __pyx_t_1;
  22463. int __pyx_t_2;
  22464. PyObject *__pyx_t_3 = NULL;
  22465. PyObject *__pyx_t_4 = NULL;
  22466. PyObject *__pyx_t_5 = NULL;
  22467. size_t __pyx_t_6;
  22468. int __pyx_lineno = 0;
  22469. const char *__pyx_filename = NULL;
  22470. int __pyx_clineno = 0;
  22471. __Pyx_RefNannySetupContext("_curve_bounds", 0);
  22472. /* "fontTools/misc/bezierTools.py":1294
  22473. *
  22474. * def _curve_bounds(c):
  22475. * if len(c) == 3: # <<<<<<<<<<<<<<
  22476. * return calcQuadraticBounds(*c)
  22477. * elif len(c) == 4:
  22478. */
  22479. __pyx_t_1 = PyObject_Length(__pyx_v_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1294, __pyx_L1_error)
  22480. __pyx_t_2 = (__pyx_t_1 == 3);
  22481. if (__pyx_t_2) {
  22482. /* "fontTools/misc/bezierTools.py":1295
  22483. * def _curve_bounds(c):
  22484. * if len(c) == 3:
  22485. * return calcQuadraticBounds(*c) # <<<<<<<<<<<<<<
  22486. * elif len(c) == 4:
  22487. * return calcCubicBounds(*c)
  22488. */
  22489. __Pyx_XDECREF(__pyx_r);
  22490. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcQuadraticBounds); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1295, __pyx_L1_error)
  22491. __Pyx_GOTREF(__pyx_t_3);
  22492. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1295, __pyx_L1_error)
  22493. __Pyx_GOTREF(__pyx_t_4);
  22494. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1295, __pyx_L1_error)
  22495. __Pyx_GOTREF(__pyx_t_5);
  22496. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22497. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22498. __pyx_r = __pyx_t_5;
  22499. __pyx_t_5 = 0;
  22500. goto __pyx_L0;
  22501. /* "fontTools/misc/bezierTools.py":1294
  22502. *
  22503. * def _curve_bounds(c):
  22504. * if len(c) == 3: # <<<<<<<<<<<<<<
  22505. * return calcQuadraticBounds(*c)
  22506. * elif len(c) == 4:
  22507. */
  22508. }
  22509. /* "fontTools/misc/bezierTools.py":1296
  22510. * if len(c) == 3:
  22511. * return calcQuadraticBounds(*c)
  22512. * elif len(c) == 4: # <<<<<<<<<<<<<<
  22513. * return calcCubicBounds(*c)
  22514. * raise ValueError("Unknown curve degree")
  22515. */
  22516. __pyx_t_1 = PyObject_Length(__pyx_v_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1296, __pyx_L1_error)
  22517. __pyx_t_2 = (__pyx_t_1 == 4);
  22518. if (__pyx_t_2) {
  22519. /* "fontTools/misc/bezierTools.py":1297
  22520. * return calcQuadraticBounds(*c)
  22521. * elif len(c) == 4:
  22522. * return calcCubicBounds(*c) # <<<<<<<<<<<<<<
  22523. * raise ValueError("Unknown curve degree")
  22524. *
  22525. */
  22526. __Pyx_XDECREF(__pyx_r);
  22527. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_calcCubicBounds); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1297, __pyx_L1_error)
  22528. __Pyx_GOTREF(__pyx_t_5);
  22529. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1297, __pyx_L1_error)
  22530. __Pyx_GOTREF(__pyx_t_4);
  22531. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1297, __pyx_L1_error)
  22532. __Pyx_GOTREF(__pyx_t_3);
  22533. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22534. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22535. __pyx_r = __pyx_t_3;
  22536. __pyx_t_3 = 0;
  22537. goto __pyx_L0;
  22538. /* "fontTools/misc/bezierTools.py":1296
  22539. * if len(c) == 3:
  22540. * return calcQuadraticBounds(*c)
  22541. * elif len(c) == 4: # <<<<<<<<<<<<<<
  22542. * return calcCubicBounds(*c)
  22543. * raise ValueError("Unknown curve degree")
  22544. */
  22545. }
  22546. /* "fontTools/misc/bezierTools.py":1298
  22547. * elif len(c) == 4:
  22548. * return calcCubicBounds(*c)
  22549. * raise ValueError("Unknown curve degree") # <<<<<<<<<<<<<<
  22550. *
  22551. *
  22552. */
  22553. __pyx_t_4 = NULL;
  22554. __pyx_t_6 = 1;
  22555. {
  22556. PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unknown_curve_degree};
  22557. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  22558. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  22559. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1298, __pyx_L1_error)
  22560. __Pyx_GOTREF(__pyx_t_3);
  22561. }
  22562. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  22563. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22564. __PYX_ERR(0, 1298, __pyx_L1_error)
  22565. /* "fontTools/misc/bezierTools.py":1293
  22566. *
  22567. *
  22568. * def _curve_bounds(c): # <<<<<<<<<<<<<<
  22569. * if len(c) == 3:
  22570. * return calcQuadraticBounds(*c)
  22571. */
  22572. /* function exit code */
  22573. __pyx_L1_error:;
  22574. __Pyx_XDECREF(__pyx_t_3);
  22575. __Pyx_XDECREF(__pyx_t_4);
  22576. __Pyx_XDECREF(__pyx_t_5);
  22577. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_bounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22578. __pyx_r = NULL;
  22579. __pyx_L0:;
  22580. __Pyx_XGIVEREF(__pyx_r);
  22581. __Pyx_RefNannyFinishContext();
  22582. return __pyx_r;
  22583. }
  22584. /* "fontTools/misc/bezierTools.py":1301
  22585. *
  22586. *
  22587. * def _split_segment_at_t(c, t): # <<<<<<<<<<<<<<
  22588. * if len(c) == 2:
  22589. * s, e = c
  22590. */
  22591. /* Python wrapper */
  22592. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_83_split_segment_at_t(PyObject *__pyx_self,
  22593. #if CYTHON_METH_FASTCALL
  22594. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  22595. #else
  22596. PyObject *__pyx_args, PyObject *__pyx_kwds
  22597. #endif
  22598. ); /*proto*/
  22599. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_82_split_segment_at_t, "_split_segment_at_t(c, t)");
  22600. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_83_split_segment_at_t = {"_split_segment_at_t", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_83_split_segment_at_t, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_82_split_segment_at_t};
  22601. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_83_split_segment_at_t(PyObject *__pyx_self,
  22602. #if CYTHON_METH_FASTCALL
  22603. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  22604. #else
  22605. PyObject *__pyx_args, PyObject *__pyx_kwds
  22606. #endif
  22607. ) {
  22608. PyObject *__pyx_v_c = 0;
  22609. PyObject *__pyx_v_t = 0;
  22610. #if !CYTHON_METH_FASTCALL
  22611. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  22612. #endif
  22613. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  22614. PyObject* values[2] = {0,0};
  22615. int __pyx_lineno = 0;
  22616. const char *__pyx_filename = NULL;
  22617. int __pyx_clineno = 0;
  22618. PyObject *__pyx_r = 0;
  22619. __Pyx_RefNannyDeclarations
  22620. __Pyx_RefNannySetupContext("_split_segment_at_t (wrapper)", 0);
  22621. #if !CYTHON_METH_FASTCALL
  22622. #if CYTHON_ASSUME_SAFE_SIZE
  22623. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  22624. #else
  22625. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  22626. #endif
  22627. #endif
  22628. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  22629. {
  22630. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_c,&__pyx_mstate_global->__pyx_n_u_t,0};
  22631. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  22632. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1301, __pyx_L3_error)
  22633. if (__pyx_kwds_len > 0) {
  22634. switch (__pyx_nargs) {
  22635. case 2:
  22636. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  22637. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1301, __pyx_L3_error)
  22638. CYTHON_FALLTHROUGH;
  22639. case 1:
  22640. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  22641. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1301, __pyx_L3_error)
  22642. CYTHON_FALLTHROUGH;
  22643. case 0: break;
  22644. default: goto __pyx_L5_argtuple_error;
  22645. }
  22646. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  22647. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_split_segment_at_t", 0) < (0)) __PYX_ERR(0, 1301, __pyx_L3_error)
  22648. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  22649. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_split_segment_at_t", 1, 2, 2, i); __PYX_ERR(0, 1301, __pyx_L3_error) }
  22650. }
  22651. } else if (unlikely(__pyx_nargs != 2)) {
  22652. goto __pyx_L5_argtuple_error;
  22653. } else {
  22654. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  22655. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1301, __pyx_L3_error)
  22656. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  22657. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1301, __pyx_L3_error)
  22658. }
  22659. __pyx_v_c = values[0];
  22660. __pyx_v_t = values[1];
  22661. }
  22662. goto __pyx_L6_skip;
  22663. __pyx_L5_argtuple_error:;
  22664. __Pyx_RaiseArgtupleInvalid("_split_segment_at_t", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1301, __pyx_L3_error)
  22665. __pyx_L6_skip:;
  22666. goto __pyx_L4_argument_unpacking_done;
  22667. __pyx_L3_error:;
  22668. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  22669. Py_XDECREF(values[__pyx_temp]);
  22670. }
  22671. __Pyx_AddTraceback("fontTools.misc.bezierTools._split_segment_at_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22672. __Pyx_RefNannyFinishContext();
  22673. return NULL;
  22674. __pyx_L4_argument_unpacking_done:;
  22675. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_82_split_segment_at_t(__pyx_self, __pyx_v_c, __pyx_v_t);
  22676. /* function exit code */
  22677. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  22678. Py_XDECREF(values[__pyx_temp]);
  22679. }
  22680. __Pyx_RefNannyFinishContext();
  22681. return __pyx_r;
  22682. }
  22683. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_82_split_segment_at_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_c, PyObject *__pyx_v_t) {
  22684. PyObject *__pyx_v_s = NULL;
  22685. PyObject *__pyx_v_e = NULL;
  22686. PyObject *__pyx_v_midpoint = NULL;
  22687. PyObject *__pyx_r = NULL;
  22688. __Pyx_RefNannyDeclarations
  22689. Py_ssize_t __pyx_t_1;
  22690. int __pyx_t_2;
  22691. PyObject *__pyx_t_3 = NULL;
  22692. PyObject *__pyx_t_4 = NULL;
  22693. PyObject *__pyx_t_5 = NULL;
  22694. PyObject *(*__pyx_t_6)(PyObject *);
  22695. size_t __pyx_t_7;
  22696. PyObject *__pyx_t_8 = NULL;
  22697. int __pyx_lineno = 0;
  22698. const char *__pyx_filename = NULL;
  22699. int __pyx_clineno = 0;
  22700. __Pyx_RefNannySetupContext("_split_segment_at_t", 0);
  22701. /* "fontTools/misc/bezierTools.py":1302
  22702. *
  22703. * def _split_segment_at_t(c, t):
  22704. * if len(c) == 2: # <<<<<<<<<<<<<<
  22705. * s, e = c
  22706. * midpoint = linePointAtT(s, e, t)
  22707. */
  22708. __pyx_t_1 = PyObject_Length(__pyx_v_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1302, __pyx_L1_error)
  22709. __pyx_t_2 = (__pyx_t_1 == 2);
  22710. if (__pyx_t_2) {
  22711. /* "fontTools/misc/bezierTools.py":1303
  22712. * def _split_segment_at_t(c, t):
  22713. * if len(c) == 2:
  22714. * s, e = c # <<<<<<<<<<<<<<
  22715. * midpoint = linePointAtT(s, e, t)
  22716. * return [(s, midpoint), (midpoint, e)]
  22717. */
  22718. if ((likely(PyTuple_CheckExact(__pyx_v_c))) || (PyList_CheckExact(__pyx_v_c))) {
  22719. PyObject* sequence = __pyx_v_c;
  22720. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  22721. if (unlikely(size != 2)) {
  22722. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  22723. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  22724. __PYX_ERR(0, 1303, __pyx_L1_error)
  22725. }
  22726. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  22727. if (likely(PyTuple_CheckExact(sequence))) {
  22728. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  22729. __Pyx_INCREF(__pyx_t_3);
  22730. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
  22731. __Pyx_INCREF(__pyx_t_4);
  22732. } else {
  22733. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  22734. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22735. __Pyx_XGOTREF(__pyx_t_3);
  22736. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  22737. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22738. __Pyx_XGOTREF(__pyx_t_4);
  22739. }
  22740. #else
  22741. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22742. __Pyx_GOTREF(__pyx_t_3);
  22743. __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22744. __Pyx_GOTREF(__pyx_t_4);
  22745. #endif
  22746. } else {
  22747. Py_ssize_t index = -1;
  22748. __pyx_t_5 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22749. __Pyx_GOTREF(__pyx_t_5);
  22750. __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
  22751. index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
  22752. __Pyx_GOTREF(__pyx_t_3);
  22753. index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
  22754. __Pyx_GOTREF(__pyx_t_4);
  22755. if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22756. __pyx_t_6 = NULL;
  22757. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22758. goto __pyx_L5_unpacking_done;
  22759. __pyx_L4_unpacking_failed:;
  22760. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22761. __pyx_t_6 = NULL;
  22762. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  22763. __PYX_ERR(0, 1303, __pyx_L1_error)
  22764. __pyx_L5_unpacking_done:;
  22765. }
  22766. __pyx_v_s = __pyx_t_3;
  22767. __pyx_t_3 = 0;
  22768. __pyx_v_e = __pyx_t_4;
  22769. __pyx_t_4 = 0;
  22770. /* "fontTools/misc/bezierTools.py":1304
  22771. * if len(c) == 2:
  22772. * s, e = c
  22773. * midpoint = linePointAtT(s, e, t) # <<<<<<<<<<<<<<
  22774. * return [(s, midpoint), (midpoint, e)]
  22775. * if len(c) == 3:
  22776. */
  22777. __pyx_t_3 = NULL;
  22778. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_linePointAtT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1304, __pyx_L1_error)
  22779. __Pyx_GOTREF(__pyx_t_5);
  22780. __pyx_t_7 = 1;
  22781. #if CYTHON_UNPACK_METHODS
  22782. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  22783. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
  22784. assert(__pyx_t_3);
  22785. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  22786. __Pyx_INCREF(__pyx_t_3);
  22787. __Pyx_INCREF(__pyx__function);
  22788. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  22789. __pyx_t_7 = 0;
  22790. }
  22791. #endif
  22792. {
  22793. PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_s, __pyx_v_e, __pyx_v_t};
  22794. __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_7, (4-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  22795. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22796. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22797. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1304, __pyx_L1_error)
  22798. __Pyx_GOTREF(__pyx_t_4);
  22799. }
  22800. __pyx_v_midpoint = __pyx_t_4;
  22801. __pyx_t_4 = 0;
  22802. /* "fontTools/misc/bezierTools.py":1305
  22803. * s, e = c
  22804. * midpoint = linePointAtT(s, e, t)
  22805. * return [(s, midpoint), (midpoint, e)] # <<<<<<<<<<<<<<
  22806. * if len(c) == 3:
  22807. * return splitQuadraticAtT(*c, t)
  22808. */
  22809. __Pyx_XDECREF(__pyx_r);
  22810. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1305, __pyx_L1_error)
  22811. __Pyx_GOTREF(__pyx_t_4);
  22812. __Pyx_INCREF(__pyx_v_s);
  22813. __Pyx_GIVEREF(__pyx_v_s);
  22814. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_s) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22815. __Pyx_INCREF(__pyx_v_midpoint);
  22816. __Pyx_GIVEREF(__pyx_v_midpoint);
  22817. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_midpoint) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22818. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1305, __pyx_L1_error)
  22819. __Pyx_GOTREF(__pyx_t_5);
  22820. __Pyx_INCREF(__pyx_v_midpoint);
  22821. __Pyx_GIVEREF(__pyx_v_midpoint);
  22822. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_midpoint) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22823. __Pyx_INCREF(__pyx_v_e);
  22824. __Pyx_GIVEREF(__pyx_v_e);
  22825. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_e) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22826. __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1305, __pyx_L1_error)
  22827. __Pyx_GOTREF(__pyx_t_3);
  22828. __Pyx_GIVEREF(__pyx_t_4);
  22829. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22830. __Pyx_GIVEREF(__pyx_t_5);
  22831. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22832. __pyx_t_4 = 0;
  22833. __pyx_t_5 = 0;
  22834. __pyx_r = __pyx_t_3;
  22835. __pyx_t_3 = 0;
  22836. goto __pyx_L0;
  22837. /* "fontTools/misc/bezierTools.py":1302
  22838. *
  22839. * def _split_segment_at_t(c, t):
  22840. * if len(c) == 2: # <<<<<<<<<<<<<<
  22841. * s, e = c
  22842. * midpoint = linePointAtT(s, e, t)
  22843. */
  22844. }
  22845. /* "fontTools/misc/bezierTools.py":1306
  22846. * midpoint = linePointAtT(s, e, t)
  22847. * return [(s, midpoint), (midpoint, e)]
  22848. * if len(c) == 3: # <<<<<<<<<<<<<<
  22849. * return splitQuadraticAtT(*c, t)
  22850. * elif len(c) == 4:
  22851. */
  22852. __pyx_t_1 = PyObject_Length(__pyx_v_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1306, __pyx_L1_error)
  22853. __pyx_t_2 = (__pyx_t_1 == 3);
  22854. if (__pyx_t_2) {
  22855. /* "fontTools/misc/bezierTools.py":1307
  22856. * return [(s, midpoint), (midpoint, e)]
  22857. * if len(c) == 3:
  22858. * return splitQuadraticAtT(*c, t) # <<<<<<<<<<<<<<
  22859. * elif len(c) == 4:
  22860. * return splitCubicAtT(*c, t)
  22861. */
  22862. __Pyx_XDECREF(__pyx_r);
  22863. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_splitQuadraticAtT_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1307, __pyx_L1_error)
  22864. __Pyx_GOTREF(__pyx_t_3);
  22865. __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_v_c); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1307, __pyx_L1_error)
  22866. __Pyx_GOTREF(__pyx_t_5);
  22867. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1307, __pyx_L1_error)
  22868. __Pyx_GOTREF(__pyx_t_4);
  22869. __Pyx_INCREF(__pyx_v_t);
  22870. __Pyx_GIVEREF(__pyx_v_t);
  22871. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1307, __pyx_L1_error);
  22872. __pyx_t_8 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1307, __pyx_L1_error)
  22873. __Pyx_GOTREF(__pyx_t_8);
  22874. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22875. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22876. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1307, __pyx_L1_error)
  22877. __Pyx_GOTREF(__pyx_t_4);
  22878. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22879. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  22880. __pyx_r = __pyx_t_4;
  22881. __pyx_t_4 = 0;
  22882. goto __pyx_L0;
  22883. /* "fontTools/misc/bezierTools.py":1306
  22884. * midpoint = linePointAtT(s, e, t)
  22885. * return [(s, midpoint), (midpoint, e)]
  22886. * if len(c) == 3: # <<<<<<<<<<<<<<
  22887. * return splitQuadraticAtT(*c, t)
  22888. * elif len(c) == 4:
  22889. */
  22890. }
  22891. /* "fontTools/misc/bezierTools.py":1308
  22892. * if len(c) == 3:
  22893. * return splitQuadraticAtT(*c, t)
  22894. * elif len(c) == 4: # <<<<<<<<<<<<<<
  22895. * return splitCubicAtT(*c, t)
  22896. * raise ValueError("Unknown curve degree")
  22897. */
  22898. __pyx_t_1 = PyObject_Length(__pyx_v_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1308, __pyx_L1_error)
  22899. __pyx_t_2 = (__pyx_t_1 == 4);
  22900. if (__pyx_t_2) {
  22901. /* "fontTools/misc/bezierTools.py":1309
  22902. * return splitQuadraticAtT(*c, t)
  22903. * elif len(c) == 4:
  22904. * return splitCubicAtT(*c, t) # <<<<<<<<<<<<<<
  22905. * raise ValueError("Unknown curve degree")
  22906. *
  22907. */
  22908. __Pyx_XDECREF(__pyx_r);
  22909. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_splitCubicAtT_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1309, __pyx_L1_error)
  22910. __Pyx_GOTREF(__pyx_t_4);
  22911. __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_v_c); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1309, __pyx_L1_error)
  22912. __Pyx_GOTREF(__pyx_t_8);
  22913. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1309, __pyx_L1_error)
  22914. __Pyx_GOTREF(__pyx_t_3);
  22915. __Pyx_INCREF(__pyx_v_t);
  22916. __Pyx_GIVEREF(__pyx_v_t);
  22917. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1309, __pyx_L1_error);
  22918. __pyx_t_5 = PyNumber_Add(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1309, __pyx_L1_error)
  22919. __Pyx_GOTREF(__pyx_t_5);
  22920. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  22921. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22922. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1309, __pyx_L1_error)
  22923. __Pyx_GOTREF(__pyx_t_3);
  22924. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22925. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22926. __pyx_r = __pyx_t_3;
  22927. __pyx_t_3 = 0;
  22928. goto __pyx_L0;
  22929. /* "fontTools/misc/bezierTools.py":1308
  22930. * if len(c) == 3:
  22931. * return splitQuadraticAtT(*c, t)
  22932. * elif len(c) == 4: # <<<<<<<<<<<<<<
  22933. * return splitCubicAtT(*c, t)
  22934. * raise ValueError("Unknown curve degree")
  22935. */
  22936. }
  22937. /* "fontTools/misc/bezierTools.py":1310
  22938. * elif len(c) == 4:
  22939. * return splitCubicAtT(*c, t)
  22940. * raise ValueError("Unknown curve degree") # <<<<<<<<<<<<<<
  22941. *
  22942. *
  22943. */
  22944. __pyx_t_5 = NULL;
  22945. __pyx_t_7 = 1;
  22946. {
  22947. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Unknown_curve_degree};
  22948. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  22949. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  22950. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1310, __pyx_L1_error)
  22951. __Pyx_GOTREF(__pyx_t_3);
  22952. }
  22953. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  22954. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22955. __PYX_ERR(0, 1310, __pyx_L1_error)
  22956. /* "fontTools/misc/bezierTools.py":1301
  22957. *
  22958. *
  22959. * def _split_segment_at_t(c, t): # <<<<<<<<<<<<<<
  22960. * if len(c) == 2:
  22961. * s, e = c
  22962. */
  22963. /* function exit code */
  22964. __pyx_L1_error:;
  22965. __Pyx_XDECREF(__pyx_t_3);
  22966. __Pyx_XDECREF(__pyx_t_4);
  22967. __Pyx_XDECREF(__pyx_t_5);
  22968. __Pyx_XDECREF(__pyx_t_8);
  22969. __Pyx_AddTraceback("fontTools.misc.bezierTools._split_segment_at_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22970. __pyx_r = NULL;
  22971. __pyx_L0:;
  22972. __Pyx_XDECREF(__pyx_v_s);
  22973. __Pyx_XDECREF(__pyx_v_e);
  22974. __Pyx_XDECREF(__pyx_v_midpoint);
  22975. __Pyx_XGIVEREF(__pyx_r);
  22976. __Pyx_RefNannyFinishContext();
  22977. return __pyx_r;
  22978. }
  22979. /* "fontTools/misc/bezierTools.py":1313
  22980. *
  22981. *
  22982. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  22983. * curve1, curve2, precision=1e-3, range1=None, range2=None
  22984. * ):
  22985. */
  22986. /* Python wrapper */
  22987. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_85_curve_curve_intersections_t(PyObject *__pyx_self,
  22988. #if CYTHON_METH_FASTCALL
  22989. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  22990. #else
  22991. PyObject *__pyx_args, PyObject *__pyx_kwds
  22992. #endif
  22993. ); /*proto*/
  22994. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_84_curve_curve_intersections_t, "_curve_curve_intersections_t(curve1, curve2, precision=1e-3, range1=None, range2=None)");
  22995. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_85_curve_curve_intersections_t = {"_curve_curve_intersections_t", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_85_curve_curve_intersections_t, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_84_curve_curve_intersections_t};
  22996. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_85_curve_curve_intersections_t(PyObject *__pyx_self,
  22997. #if CYTHON_METH_FASTCALL
  22998. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  22999. #else
  23000. PyObject *__pyx_args, PyObject *__pyx_kwds
  23001. #endif
  23002. ) {
  23003. PyObject *__pyx_v_curve1 = 0;
  23004. PyObject *__pyx_v_curve2 = 0;
  23005. PyObject *__pyx_v_precision = 0;
  23006. PyObject *__pyx_v_range1 = 0;
  23007. PyObject *__pyx_v_range2 = 0;
  23008. #if !CYTHON_METH_FASTCALL
  23009. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  23010. #endif
  23011. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  23012. PyObject* values[5] = {0,0,0,0,0};
  23013. int __pyx_lineno = 0;
  23014. const char *__pyx_filename = NULL;
  23015. int __pyx_clineno = 0;
  23016. PyObject *__pyx_r = 0;
  23017. __Pyx_RefNannyDeclarations
  23018. __Pyx_RefNannySetupContext("_curve_curve_intersections_t (wrapper)", 0);
  23019. #if !CYTHON_METH_FASTCALL
  23020. #if CYTHON_ASSUME_SAFE_SIZE
  23021. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  23022. #else
  23023. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  23024. #endif
  23025. #endif
  23026. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  23027. {
  23028. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_curve1,&__pyx_mstate_global->__pyx_n_u_curve2,&__pyx_mstate_global->__pyx_n_u_precision,&__pyx_mstate_global->__pyx_n_u_range1,&__pyx_mstate_global->__pyx_n_u_range2,0};
  23029. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  23030. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1313, __pyx_L3_error)
  23031. if (__pyx_kwds_len > 0) {
  23032. switch (__pyx_nargs) {
  23033. case 5:
  23034. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  23035. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23036. CYTHON_FALLTHROUGH;
  23037. case 4:
  23038. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  23039. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23040. CYTHON_FALLTHROUGH;
  23041. case 3:
  23042. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  23043. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23044. CYTHON_FALLTHROUGH;
  23045. case 2:
  23046. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  23047. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23048. CYTHON_FALLTHROUGH;
  23049. case 1:
  23050. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23051. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23052. CYTHON_FALLTHROUGH;
  23053. case 0: break;
  23054. default: goto __pyx_L5_argtuple_error;
  23055. }
  23056. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  23057. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_curve_curve_intersections_t", 0) < (0)) __PYX_ERR(0, 1313, __pyx_L3_error)
  23058. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_1eneg_3)));
  23059. /* "fontTools/misc/bezierTools.py":1314
  23060. *
  23061. * def _curve_curve_intersections_t(
  23062. * curve1, curve2, precision=1e-3, range1=None, range2=None # <<<<<<<<<<<<<<
  23063. * ):
  23064. * bounds1 = _curve_bounds(curve1)
  23065. */
  23066. if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
  23067. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
  23068. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  23069. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_curve_curve_intersections_t", 0, 2, 5, i); __PYX_ERR(0, 1313, __pyx_L3_error) }
  23070. }
  23071. } else {
  23072. switch (__pyx_nargs) {
  23073. case 5:
  23074. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  23075. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23076. CYTHON_FALLTHROUGH;
  23077. case 4:
  23078. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  23079. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23080. CYTHON_FALLTHROUGH;
  23081. case 3:
  23082. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  23083. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23084. CYTHON_FALLTHROUGH;
  23085. case 2:
  23086. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  23087. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23088. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23089. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23090. break;
  23091. default: goto __pyx_L5_argtuple_error;
  23092. }
  23093. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_1eneg_3)));
  23094. if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
  23095. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
  23096. }
  23097. __pyx_v_curve1 = values[0];
  23098. __pyx_v_curve2 = values[1];
  23099. __pyx_v_precision = values[2];
  23100. __pyx_v_range1 = values[3];
  23101. __pyx_v_range2 = values[4];
  23102. }
  23103. goto __pyx_L6_skip;
  23104. __pyx_L5_argtuple_error:;
  23105. __Pyx_RaiseArgtupleInvalid("_curve_curve_intersections_t", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 1313, __pyx_L3_error)
  23106. __pyx_L6_skip:;
  23107. goto __pyx_L4_argument_unpacking_done;
  23108. __pyx_L3_error:;
  23109. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  23110. Py_XDECREF(values[__pyx_temp]);
  23111. }
  23112. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23113. __Pyx_RefNannyFinishContext();
  23114. return NULL;
  23115. __pyx_L4_argument_unpacking_done:;
  23116. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_84_curve_curve_intersections_t(__pyx_self, __pyx_v_curve1, __pyx_v_curve2, __pyx_v_precision, __pyx_v_range1, __pyx_v_range2);
  23117. /* "fontTools/misc/bezierTools.py":1313
  23118. *
  23119. *
  23120. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  23121. * curve1, curve2, precision=1e-3, range1=None, range2=None
  23122. * ):
  23123. */
  23124. /* function exit code */
  23125. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  23126. Py_XDECREF(values[__pyx_temp]);
  23127. }
  23128. __Pyx_RefNannyFinishContext();
  23129. return __pyx_r;
  23130. }
  23131. /* "fontTools/misc/bezierTools.py":1329
  23132. * return []
  23133. *
  23134. * def midpoint(r): # <<<<<<<<<<<<<<
  23135. * return 0.5 * (r[0] + r[1])
  23136. *
  23137. */
  23138. /* Python wrapper */
  23139. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_1midpoint(PyObject *__pyx_self,
  23140. #if CYTHON_METH_FASTCALL
  23141. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  23142. #else
  23143. PyObject *__pyx_args, PyObject *__pyx_kwds
  23144. #endif
  23145. ); /*proto*/
  23146. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_1midpoint = {"midpoint", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_1midpoint, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
  23147. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_1midpoint(PyObject *__pyx_self,
  23148. #if CYTHON_METH_FASTCALL
  23149. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  23150. #else
  23151. PyObject *__pyx_args, PyObject *__pyx_kwds
  23152. #endif
  23153. ) {
  23154. PyObject *__pyx_v_r = 0;
  23155. #if !CYTHON_METH_FASTCALL
  23156. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  23157. #endif
  23158. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  23159. PyObject* values[1] = {0};
  23160. int __pyx_lineno = 0;
  23161. const char *__pyx_filename = NULL;
  23162. int __pyx_clineno = 0;
  23163. PyObject *__pyx_r = 0;
  23164. __Pyx_RefNannyDeclarations
  23165. __Pyx_RefNannySetupContext("midpoint (wrapper)", 0);
  23166. #if !CYTHON_METH_FASTCALL
  23167. #if CYTHON_ASSUME_SAFE_SIZE
  23168. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  23169. #else
  23170. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  23171. #endif
  23172. #endif
  23173. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  23174. {
  23175. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_r,0};
  23176. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  23177. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1329, __pyx_L3_error)
  23178. if (__pyx_kwds_len > 0) {
  23179. switch (__pyx_nargs) {
  23180. case 1:
  23181. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23182. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1329, __pyx_L3_error)
  23183. CYTHON_FALLTHROUGH;
  23184. case 0: break;
  23185. default: goto __pyx_L5_argtuple_error;
  23186. }
  23187. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  23188. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "midpoint", 0) < (0)) __PYX_ERR(0, 1329, __pyx_L3_error)
  23189. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  23190. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("midpoint", 1, 1, 1, i); __PYX_ERR(0, 1329, __pyx_L3_error) }
  23191. }
  23192. } else if (unlikely(__pyx_nargs != 1)) {
  23193. goto __pyx_L5_argtuple_error;
  23194. } else {
  23195. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23196. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1329, __pyx_L3_error)
  23197. }
  23198. __pyx_v_r = values[0];
  23199. }
  23200. goto __pyx_L6_skip;
  23201. __pyx_L5_argtuple_error:;
  23202. __Pyx_RaiseArgtupleInvalid("midpoint", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1329, __pyx_L3_error)
  23203. __pyx_L6_skip:;
  23204. goto __pyx_L4_argument_unpacking_done;
  23205. __pyx_L3_error:;
  23206. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  23207. Py_XDECREF(values[__pyx_temp]);
  23208. }
  23209. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t.midpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23210. __Pyx_RefNannyFinishContext();
  23211. return NULL;
  23212. __pyx_L4_argument_unpacking_done:;
  23213. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(__pyx_self, __pyx_v_r);
  23214. /* function exit code */
  23215. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  23216. Py_XDECREF(values[__pyx_temp]);
  23217. }
  23218. __Pyx_RefNannyFinishContext();
  23219. return __pyx_r;
  23220. }
  23221. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_r) {
  23222. PyObject *__pyx_r = NULL;
  23223. __Pyx_RefNannyDeclarations
  23224. PyObject *__pyx_t_1 = NULL;
  23225. PyObject *__pyx_t_2 = NULL;
  23226. PyObject *__pyx_t_3 = NULL;
  23227. int __pyx_lineno = 0;
  23228. const char *__pyx_filename = NULL;
  23229. int __pyx_clineno = 0;
  23230. __Pyx_RefNannySetupContext("midpoint", 0);
  23231. /* "fontTools/misc/bezierTools.py":1330
  23232. *
  23233. * def midpoint(r):
  23234. * return 0.5 * (r[0] + r[1]) # <<<<<<<<<<<<<<
  23235. *
  23236. * # If they do overlap but they're tiny, approximate
  23237. */
  23238. __Pyx_XDECREF(__pyx_r);
  23239. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_r, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1330, __pyx_L1_error)
  23240. __Pyx_GOTREF(__pyx_t_1);
  23241. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_r, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1330, __pyx_L1_error)
  23242. __Pyx_GOTREF(__pyx_t_2);
  23243. __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1330, __pyx_L1_error)
  23244. __Pyx_GOTREF(__pyx_t_3);
  23245. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23246. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23247. __pyx_t_2 = PyNumber_Multiply(__pyx_mstate_global->__pyx_float_0_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1330, __pyx_L1_error)
  23248. __Pyx_GOTREF(__pyx_t_2);
  23249. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23250. __pyx_r = __pyx_t_2;
  23251. __pyx_t_2 = 0;
  23252. goto __pyx_L0;
  23253. /* "fontTools/misc/bezierTools.py":1329
  23254. * return []
  23255. *
  23256. * def midpoint(r): # <<<<<<<<<<<<<<
  23257. * return 0.5 * (r[0] + r[1])
  23258. *
  23259. */
  23260. /* function exit code */
  23261. __pyx_L1_error:;
  23262. __Pyx_XDECREF(__pyx_t_1);
  23263. __Pyx_XDECREF(__pyx_t_2);
  23264. __Pyx_XDECREF(__pyx_t_3);
  23265. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t.midpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23266. __pyx_r = NULL;
  23267. __pyx_L0:;
  23268. __Pyx_XGIVEREF(__pyx_r);
  23269. __Pyx_RefNannyFinishContext();
  23270. return __pyx_r;
  23271. }
  23272. /* "fontTools/misc/bezierTools.py":1366
  23273. * )
  23274. *
  23275. * unique_key = lambda ts: (int(ts[0] / precision), int(ts[1] / precision)) # <<<<<<<<<<<<<<
  23276. * seen = set()
  23277. * unique_values = []
  23278. */
  23279. /* Python wrapper */
  23280. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_2lambda3(PyObject *__pyx_self,
  23281. #if CYTHON_METH_FASTCALL
  23282. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  23283. #else
  23284. PyObject *__pyx_args, PyObject *__pyx_kwds
  23285. #endif
  23286. ); /*proto*/
  23287. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_2lambda3 = {"lambda3", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_2lambda3, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
  23288. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_2lambda3(PyObject *__pyx_self,
  23289. #if CYTHON_METH_FASTCALL
  23290. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  23291. #else
  23292. PyObject *__pyx_args, PyObject *__pyx_kwds
  23293. #endif
  23294. ) {
  23295. PyObject *__pyx_v_ts = 0;
  23296. #if !CYTHON_METH_FASTCALL
  23297. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  23298. #endif
  23299. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  23300. PyObject* values[1] = {0};
  23301. int __pyx_lineno = 0;
  23302. const char *__pyx_filename = NULL;
  23303. int __pyx_clineno = 0;
  23304. PyObject *__pyx_r = 0;
  23305. __Pyx_RefNannyDeclarations
  23306. __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0);
  23307. #if !CYTHON_METH_FASTCALL
  23308. #if CYTHON_ASSUME_SAFE_SIZE
  23309. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  23310. #else
  23311. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  23312. #endif
  23313. #endif
  23314. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  23315. {
  23316. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ts,0};
  23317. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  23318. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1366, __pyx_L3_error)
  23319. if (__pyx_kwds_len > 0) {
  23320. switch (__pyx_nargs) {
  23321. case 1:
  23322. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23323. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1366, __pyx_L3_error)
  23324. CYTHON_FALLTHROUGH;
  23325. case 0: break;
  23326. default: goto __pyx_L5_argtuple_error;
  23327. }
  23328. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  23329. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "lambda3", 0) < (0)) __PYX_ERR(0, 1366, __pyx_L3_error)
  23330. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  23331. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda3", 1, 1, 1, i); __PYX_ERR(0, 1366, __pyx_L3_error) }
  23332. }
  23333. } else if (unlikely(__pyx_nargs != 1)) {
  23334. goto __pyx_L5_argtuple_error;
  23335. } else {
  23336. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23337. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1366, __pyx_L3_error)
  23338. }
  23339. __pyx_v_ts = values[0];
  23340. }
  23341. goto __pyx_L6_skip;
  23342. __pyx_L5_argtuple_error:;
  23343. __Pyx_RaiseArgtupleInvalid("lambda3", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1366, __pyx_L3_error)
  23344. __pyx_L6_skip:;
  23345. goto __pyx_L4_argument_unpacking_done;
  23346. __pyx_L3_error:;
  23347. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  23348. Py_XDECREF(values[__pyx_temp]);
  23349. }
  23350. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23351. __Pyx_RefNannyFinishContext();
  23352. return NULL;
  23353. __pyx_L4_argument_unpacking_done:;
  23354. __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self, __pyx_v_ts);
  23355. /* function exit code */
  23356. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  23357. Py_XDECREF(values[__pyx_temp]);
  23358. }
  23359. __Pyx_RefNannyFinishContext();
  23360. return __pyx_r;
  23361. }
  23362. static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_ts) {
  23363. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *__pyx_cur_scope;
  23364. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *__pyx_outer_scope;
  23365. PyObject *__pyx_r = NULL;
  23366. __Pyx_RefNannyDeclarations
  23367. PyObject *__pyx_t_1 = NULL;
  23368. PyObject *__pyx_t_2 = NULL;
  23369. PyObject *__pyx_t_3 = NULL;
  23370. int __pyx_lineno = 0;
  23371. const char *__pyx_filename = NULL;
  23372. int __pyx_clineno = 0;
  23373. __Pyx_RefNannySetupContext("lambda3", 0);
  23374. __pyx_outer_scope = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *) __Pyx_CyFunction_GetClosure(__pyx_self);
  23375. __pyx_cur_scope = __pyx_outer_scope;
  23376. __Pyx_XDECREF(__pyx_r);
  23377. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_ts, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1366, __pyx_L1_error)
  23378. __Pyx_GOTREF(__pyx_t_1);
  23379. if (unlikely(!__pyx_cur_scope->__pyx_v_precision)) { __Pyx_RaiseClosureNameError("precision"); __PYX_ERR(0, 1366, __pyx_L1_error) }
  23380. __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_cur_scope->__pyx_v_precision); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1366, __pyx_L1_error)
  23381. __Pyx_GOTREF(__pyx_t_2);
  23382. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23383. __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1366, __pyx_L1_error)
  23384. __Pyx_GOTREF(__pyx_t_1);
  23385. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23386. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ts, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1366, __pyx_L1_error)
  23387. __Pyx_GOTREF(__pyx_t_2);
  23388. if (unlikely(!__pyx_cur_scope->__pyx_v_precision)) { __Pyx_RaiseClosureNameError("precision"); __PYX_ERR(0, 1366, __pyx_L1_error) }
  23389. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_cur_scope->__pyx_v_precision); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1366, __pyx_L1_error)
  23390. __Pyx_GOTREF(__pyx_t_3);
  23391. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23392. __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1366, __pyx_L1_error)
  23393. __Pyx_GOTREF(__pyx_t_2);
  23394. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23395. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1366, __pyx_L1_error)
  23396. __Pyx_GOTREF(__pyx_t_3);
  23397. __Pyx_GIVEREF(__pyx_t_1);
  23398. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1366, __pyx_L1_error);
  23399. __Pyx_GIVEREF(__pyx_t_2);
  23400. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1366, __pyx_L1_error);
  23401. __pyx_t_1 = 0;
  23402. __pyx_t_2 = 0;
  23403. __pyx_r = __pyx_t_3;
  23404. __pyx_t_3 = 0;
  23405. goto __pyx_L0;
  23406. /* function exit code */
  23407. __pyx_L1_error:;
  23408. __Pyx_XDECREF(__pyx_t_1);
  23409. __Pyx_XDECREF(__pyx_t_2);
  23410. __Pyx_XDECREF(__pyx_t_3);
  23411. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23412. __pyx_r = NULL;
  23413. __pyx_L0:;
  23414. __Pyx_XGIVEREF(__pyx_r);
  23415. __Pyx_RefNannyFinishContext();
  23416. return __pyx_r;
  23417. }
  23418. /* "fontTools/misc/bezierTools.py":1313
  23419. *
  23420. *
  23421. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  23422. * curve1, curve2, precision=1e-3, range1=None, range2=None
  23423. * ):
  23424. */
  23425. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_84_curve_curve_intersections_t(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve1, PyObject *__pyx_v_curve2, PyObject *__pyx_v_precision, PyObject *__pyx_v_range1, PyObject *__pyx_v_range2) {
  23426. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *__pyx_cur_scope;
  23427. PyObject *__pyx_v_bounds1 = NULL;
  23428. PyObject *__pyx_v_bounds2 = NULL;
  23429. PyObject *__pyx_v_intersects = NULL;
  23430. CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  23431. PyObject *__pyx_v_midpoint = 0;
  23432. PyObject *__pyx_v_c11 = NULL;
  23433. PyObject *__pyx_v_c12 = NULL;
  23434. PyObject *__pyx_v_c11_range = NULL;
  23435. PyObject *__pyx_v_c12_range = NULL;
  23436. PyObject *__pyx_v_c21 = NULL;
  23437. PyObject *__pyx_v_c22 = NULL;
  23438. PyObject *__pyx_v_c21_range = NULL;
  23439. PyObject *__pyx_v_c22_range = NULL;
  23440. PyObject *__pyx_v_found = NULL;
  23441. PyObject *__pyx_v_unique_key = NULL;
  23442. PyObject *__pyx_v_seen = NULL;
  23443. PyObject *__pyx_v_unique_values = NULL;
  23444. PyObject *__pyx_v_ts = NULL;
  23445. PyObject *__pyx_v_key = NULL;
  23446. PyObject *__pyx_r = NULL;
  23447. __Pyx_RefNannyDeclarations
  23448. PyObject *__pyx_t_1 = NULL;
  23449. PyObject *__pyx_t_2 = NULL;
  23450. PyObject *__pyx_t_3 = NULL;
  23451. size_t __pyx_t_4;
  23452. int __pyx_t_5;
  23453. int __pyx_t_6;
  23454. PyObject *__pyx_t_7 = NULL;
  23455. PyObject *(*__pyx_t_8)(PyObject *);
  23456. int __pyx_t_9;
  23457. Py_ssize_t __pyx_t_10;
  23458. int __pyx_lineno = 0;
  23459. const char *__pyx_filename = NULL;
  23460. int __pyx_clineno = 0;
  23461. __Pyx_RefNannySetupContext("_curve_curve_intersections_t", 0);
  23462. __pyx_cur_scope = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t(__pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  23463. if (unlikely(!__pyx_cur_scope)) {
  23464. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *)Py_None);
  23465. __Pyx_INCREF(Py_None);
  23466. __PYX_ERR(0, 1313, __pyx_L1_error)
  23467. } else {
  23468. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  23469. }
  23470. __pyx_cur_scope->__pyx_v_precision = __pyx_v_precision;
  23471. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_precision);
  23472. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_precision);
  23473. __Pyx_INCREF(__pyx_v_range1);
  23474. __Pyx_INCREF(__pyx_v_range2);
  23475. /* "fontTools/misc/bezierTools.py":1316
  23476. * curve1, curve2, precision=1e-3, range1=None, range2=None
  23477. * ):
  23478. * bounds1 = _curve_bounds(curve1) # <<<<<<<<<<<<<<
  23479. * bounds2 = _curve_bounds(curve2)
  23480. *
  23481. */
  23482. __pyx_t_2 = NULL;
  23483. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_curve_bounds); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1316, __pyx_L1_error)
  23484. __Pyx_GOTREF(__pyx_t_3);
  23485. __pyx_t_4 = 1;
  23486. #if CYTHON_UNPACK_METHODS
  23487. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  23488. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  23489. assert(__pyx_t_2);
  23490. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  23491. __Pyx_INCREF(__pyx_t_2);
  23492. __Pyx_INCREF(__pyx__function);
  23493. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  23494. __pyx_t_4 = 0;
  23495. }
  23496. #endif
  23497. {
  23498. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_curve1};
  23499. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  23500. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23501. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23502. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1316, __pyx_L1_error)
  23503. __Pyx_GOTREF(__pyx_t_1);
  23504. }
  23505. __pyx_v_bounds1 = __pyx_t_1;
  23506. __pyx_t_1 = 0;
  23507. /* "fontTools/misc/bezierTools.py":1317
  23508. * ):
  23509. * bounds1 = _curve_bounds(curve1)
  23510. * bounds2 = _curve_bounds(curve2) # <<<<<<<<<<<<<<
  23511. *
  23512. * if not range1:
  23513. */
  23514. __pyx_t_3 = NULL;
  23515. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_curve_bounds); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L1_error)
  23516. __Pyx_GOTREF(__pyx_t_2);
  23517. __pyx_t_4 = 1;
  23518. #if CYTHON_UNPACK_METHODS
  23519. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  23520. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  23521. assert(__pyx_t_3);
  23522. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  23523. __Pyx_INCREF(__pyx_t_3);
  23524. __Pyx_INCREF(__pyx__function);
  23525. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  23526. __pyx_t_4 = 0;
  23527. }
  23528. #endif
  23529. {
  23530. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_curve2};
  23531. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  23532. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  23533. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23534. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error)
  23535. __Pyx_GOTREF(__pyx_t_1);
  23536. }
  23537. __pyx_v_bounds2 = __pyx_t_1;
  23538. __pyx_t_1 = 0;
  23539. /* "fontTools/misc/bezierTools.py":1319
  23540. * bounds2 = _curve_bounds(curve2)
  23541. *
  23542. * if not range1: # <<<<<<<<<<<<<<
  23543. * range1 = (0.0, 1.0)
  23544. * if not range2:
  23545. */
  23546. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_range1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1319, __pyx_L1_error)
  23547. __pyx_t_6 = (!__pyx_t_5);
  23548. if (__pyx_t_6) {
  23549. /* "fontTools/misc/bezierTools.py":1320
  23550. *
  23551. * if not range1:
  23552. * range1 = (0.0, 1.0) # <<<<<<<<<<<<<<
  23553. * if not range2:
  23554. * range2 = (0.0, 1.0)
  23555. */
  23556. __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[1]);
  23557. __Pyx_DECREF_SET(__pyx_v_range1, __pyx_mstate_global->__pyx_tuple[1]);
  23558. /* "fontTools/misc/bezierTools.py":1319
  23559. * bounds2 = _curve_bounds(curve2)
  23560. *
  23561. * if not range1: # <<<<<<<<<<<<<<
  23562. * range1 = (0.0, 1.0)
  23563. * if not range2:
  23564. */
  23565. }
  23566. /* "fontTools/misc/bezierTools.py":1321
  23567. * if not range1:
  23568. * range1 = (0.0, 1.0)
  23569. * if not range2: # <<<<<<<<<<<<<<
  23570. * range2 = (0.0, 1.0)
  23571. *
  23572. */
  23573. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_range2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1321, __pyx_L1_error)
  23574. __pyx_t_5 = (!__pyx_t_6);
  23575. if (__pyx_t_5) {
  23576. /* "fontTools/misc/bezierTools.py":1322
  23577. * range1 = (0.0, 1.0)
  23578. * if not range2:
  23579. * range2 = (0.0, 1.0) # <<<<<<<<<<<<<<
  23580. *
  23581. * # If bounds don't intersect, go home
  23582. */
  23583. __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[1]);
  23584. __Pyx_DECREF_SET(__pyx_v_range2, __pyx_mstate_global->__pyx_tuple[1]);
  23585. /* "fontTools/misc/bezierTools.py":1321
  23586. * if not range1:
  23587. * range1 = (0.0, 1.0)
  23588. * if not range2: # <<<<<<<<<<<<<<
  23589. * range2 = (0.0, 1.0)
  23590. *
  23591. */
  23592. }
  23593. /* "fontTools/misc/bezierTools.py":1325
  23594. *
  23595. * # If bounds don't intersect, go home
  23596. * intersects, _ = sectRect(bounds1, bounds2) # <<<<<<<<<<<<<<
  23597. * if not intersects:
  23598. * return []
  23599. */
  23600. __pyx_t_2 = NULL;
  23601. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sectRect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23602. __Pyx_GOTREF(__pyx_t_3);
  23603. __pyx_t_4 = 1;
  23604. #if CYTHON_UNPACK_METHODS
  23605. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  23606. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  23607. assert(__pyx_t_2);
  23608. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  23609. __Pyx_INCREF(__pyx_t_2);
  23610. __Pyx_INCREF(__pyx__function);
  23611. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  23612. __pyx_t_4 = 0;
  23613. }
  23614. #endif
  23615. {
  23616. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_bounds1, __pyx_v_bounds2};
  23617. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  23618. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23619. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23620. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23621. __Pyx_GOTREF(__pyx_t_1);
  23622. }
  23623. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  23624. PyObject* sequence = __pyx_t_1;
  23625. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  23626. if (unlikely(size != 2)) {
  23627. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  23628. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  23629. __PYX_ERR(0, 1325, __pyx_L1_error)
  23630. }
  23631. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  23632. if (likely(PyTuple_CheckExact(sequence))) {
  23633. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  23634. __Pyx_INCREF(__pyx_t_3);
  23635. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  23636. __Pyx_INCREF(__pyx_t_2);
  23637. } else {
  23638. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  23639. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23640. __Pyx_XGOTREF(__pyx_t_3);
  23641. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  23642. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23643. __Pyx_XGOTREF(__pyx_t_2);
  23644. }
  23645. #else
  23646. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23647. __Pyx_GOTREF(__pyx_t_3);
  23648. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23649. __Pyx_GOTREF(__pyx_t_2);
  23650. #endif
  23651. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23652. } else {
  23653. Py_ssize_t index = -1;
  23654. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23655. __Pyx_GOTREF(__pyx_t_7);
  23656. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23657. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  23658. index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
  23659. __Pyx_GOTREF(__pyx_t_3);
  23660. index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  23661. __Pyx_GOTREF(__pyx_t_2);
  23662. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23663. __pyx_t_8 = NULL;
  23664. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23665. goto __pyx_L6_unpacking_done;
  23666. __pyx_L5_unpacking_failed:;
  23667. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23668. __pyx_t_8 = NULL;
  23669. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  23670. __PYX_ERR(0, 1325, __pyx_L1_error)
  23671. __pyx_L6_unpacking_done:;
  23672. }
  23673. __pyx_v_intersects = __pyx_t_3;
  23674. __pyx_t_3 = 0;
  23675. __pyx_v__ = __pyx_t_2;
  23676. __pyx_t_2 = 0;
  23677. /* "fontTools/misc/bezierTools.py":1326
  23678. * # If bounds don't intersect, go home
  23679. * intersects, _ = sectRect(bounds1, bounds2)
  23680. * if not intersects: # <<<<<<<<<<<<<<
  23681. * return []
  23682. *
  23683. */
  23684. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_intersects); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1326, __pyx_L1_error)
  23685. __pyx_t_6 = (!__pyx_t_5);
  23686. if (__pyx_t_6) {
  23687. /* "fontTools/misc/bezierTools.py":1327
  23688. * intersects, _ = sectRect(bounds1, bounds2)
  23689. * if not intersects:
  23690. * return [] # <<<<<<<<<<<<<<
  23691. *
  23692. * def midpoint(r):
  23693. */
  23694. __Pyx_XDECREF(__pyx_r);
  23695. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __pyx_L1_error)
  23696. __Pyx_GOTREF(__pyx_t_1);
  23697. __pyx_r = __pyx_t_1;
  23698. __pyx_t_1 = 0;
  23699. goto __pyx_L0;
  23700. /* "fontTools/misc/bezierTools.py":1326
  23701. * # If bounds don't intersect, go home
  23702. * intersects, _ = sectRect(bounds1, bounds2)
  23703. * if not intersects: # <<<<<<<<<<<<<<
  23704. * return []
  23705. *
  23706. */
  23707. }
  23708. /* "fontTools/misc/bezierTools.py":1329
  23709. * return []
  23710. *
  23711. * def midpoint(r): # <<<<<<<<<<<<<<
  23712. * return 0.5 * (r[0] + r[1])
  23713. *
  23714. */
  23715. __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_1midpoint, 0, __pyx_mstate_global->__pyx_n_u_curve_curve_intersections_t_loc, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1329, __pyx_L1_error)
  23716. __Pyx_GOTREF(__pyx_t_1);
  23717. __pyx_v_midpoint = __pyx_t_1;
  23718. __pyx_t_1 = 0;
  23719. /* "fontTools/misc/bezierTools.py":1333
  23720. *
  23721. * # If they do overlap but they're tiny, approximate
  23722. * if rectArea(bounds1) < precision and rectArea(bounds2) < precision: # <<<<<<<<<<<<<<
  23723. * return [(midpoint(range1), midpoint(range2))]
  23724. *
  23725. */
  23726. __pyx_t_2 = NULL;
  23727. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_rectArea); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1333, __pyx_L1_error)
  23728. __Pyx_GOTREF(__pyx_t_3);
  23729. __pyx_t_4 = 1;
  23730. #if CYTHON_UNPACK_METHODS
  23731. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  23732. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  23733. assert(__pyx_t_2);
  23734. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  23735. __Pyx_INCREF(__pyx_t_2);
  23736. __Pyx_INCREF(__pyx__function);
  23737. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  23738. __pyx_t_4 = 0;
  23739. }
  23740. #endif
  23741. {
  23742. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_bounds1};
  23743. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  23744. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23745. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23746. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1333, __pyx_L1_error)
  23747. __Pyx_GOTREF(__pyx_t_1);
  23748. }
  23749. __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_cur_scope->__pyx_v_precision, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1333, __pyx_L1_error)
  23750. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23751. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1333, __pyx_L1_error)
  23752. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23753. if (__pyx_t_5) {
  23754. } else {
  23755. __pyx_t_6 = __pyx_t_5;
  23756. goto __pyx_L9_bool_binop_done;
  23757. }
  23758. __pyx_t_1 = NULL;
  23759. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_rectArea); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1333, __pyx_L1_error)
  23760. __Pyx_GOTREF(__pyx_t_2);
  23761. __pyx_t_4 = 1;
  23762. #if CYTHON_UNPACK_METHODS
  23763. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  23764. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  23765. assert(__pyx_t_1);
  23766. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  23767. __Pyx_INCREF(__pyx_t_1);
  23768. __Pyx_INCREF(__pyx__function);
  23769. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  23770. __pyx_t_4 = 0;
  23771. }
  23772. #endif
  23773. {
  23774. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_bounds2};
  23775. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  23776. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  23777. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23778. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1333, __pyx_L1_error)
  23779. __Pyx_GOTREF(__pyx_t_3);
  23780. }
  23781. __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_cur_scope->__pyx_v_precision, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1333, __pyx_L1_error)
  23782. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23783. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1333, __pyx_L1_error)
  23784. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23785. __pyx_t_6 = __pyx_t_5;
  23786. __pyx_L9_bool_binop_done:;
  23787. if (__pyx_t_6) {
  23788. /* "fontTools/misc/bezierTools.py":1334
  23789. * # If they do overlap but they're tiny, approximate
  23790. * if rectArea(bounds1) < precision and rectArea(bounds2) < precision:
  23791. * return [(midpoint(range1), midpoint(range2))] # <<<<<<<<<<<<<<
  23792. *
  23793. * c11, c12 = _split_segment_at_t(curve1, 0.5)
  23794. */
  23795. __Pyx_XDECREF(__pyx_r);
  23796. __pyx_t_2 = __pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(__pyx_v_midpoint, __pyx_v_range1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1334, __pyx_L1_error)
  23797. __Pyx_GOTREF(__pyx_t_2);
  23798. __pyx_t_3 = __pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(__pyx_v_midpoint, __pyx_v_range2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1334, __pyx_L1_error)
  23799. __Pyx_GOTREF(__pyx_t_3);
  23800. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1334, __pyx_L1_error)
  23801. __Pyx_GOTREF(__pyx_t_1);
  23802. __Pyx_GIVEREF(__pyx_t_2);
  23803. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1334, __pyx_L1_error);
  23804. __Pyx_GIVEREF(__pyx_t_3);
  23805. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 1334, __pyx_L1_error);
  23806. __pyx_t_2 = 0;
  23807. __pyx_t_3 = 0;
  23808. __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1334, __pyx_L1_error)
  23809. __Pyx_GOTREF(__pyx_t_3);
  23810. __Pyx_GIVEREF(__pyx_t_1);
  23811. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1334, __pyx_L1_error);
  23812. __pyx_t_1 = 0;
  23813. __pyx_r = __pyx_t_3;
  23814. __pyx_t_3 = 0;
  23815. goto __pyx_L0;
  23816. /* "fontTools/misc/bezierTools.py":1333
  23817. *
  23818. * # If they do overlap but they're tiny, approximate
  23819. * if rectArea(bounds1) < precision and rectArea(bounds2) < precision: # <<<<<<<<<<<<<<
  23820. * return [(midpoint(range1), midpoint(range2))]
  23821. *
  23822. */
  23823. }
  23824. /* "fontTools/misc/bezierTools.py":1336
  23825. * return [(midpoint(range1), midpoint(range2))]
  23826. *
  23827. * c11, c12 = _split_segment_at_t(curve1, 0.5) # <<<<<<<<<<<<<<
  23828. * c11_range = (range1[0], midpoint(range1))
  23829. * c12_range = (midpoint(range1), range1[1])
  23830. */
  23831. __pyx_t_1 = NULL;
  23832. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_split_segment_at_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23833. __Pyx_GOTREF(__pyx_t_2);
  23834. __pyx_t_4 = 1;
  23835. #if CYTHON_UNPACK_METHODS
  23836. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  23837. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  23838. assert(__pyx_t_1);
  23839. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  23840. __Pyx_INCREF(__pyx_t_1);
  23841. __Pyx_INCREF(__pyx__function);
  23842. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  23843. __pyx_t_4 = 0;
  23844. }
  23845. #endif
  23846. {
  23847. PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_curve1, __pyx_mstate_global->__pyx_float_0_5};
  23848. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  23849. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  23850. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23851. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23852. __Pyx_GOTREF(__pyx_t_3);
  23853. }
  23854. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  23855. PyObject* sequence = __pyx_t_3;
  23856. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  23857. if (unlikely(size != 2)) {
  23858. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  23859. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  23860. __PYX_ERR(0, 1336, __pyx_L1_error)
  23861. }
  23862. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  23863. if (likely(PyTuple_CheckExact(sequence))) {
  23864. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  23865. __Pyx_INCREF(__pyx_t_2);
  23866. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  23867. __Pyx_INCREF(__pyx_t_1);
  23868. } else {
  23869. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  23870. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23871. __Pyx_XGOTREF(__pyx_t_2);
  23872. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  23873. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23874. __Pyx_XGOTREF(__pyx_t_1);
  23875. }
  23876. #else
  23877. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23878. __Pyx_GOTREF(__pyx_t_2);
  23879. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23880. __Pyx_GOTREF(__pyx_t_1);
  23881. #endif
  23882. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23883. } else {
  23884. Py_ssize_t index = -1;
  23885. __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23886. __Pyx_GOTREF(__pyx_t_7);
  23887. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23888. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  23889. index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed;
  23890. __Pyx_GOTREF(__pyx_t_2);
  23891. index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
  23892. __Pyx_GOTREF(__pyx_t_1);
  23893. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23894. __pyx_t_8 = NULL;
  23895. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23896. goto __pyx_L12_unpacking_done;
  23897. __pyx_L11_unpacking_failed:;
  23898. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23899. __pyx_t_8 = NULL;
  23900. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  23901. __PYX_ERR(0, 1336, __pyx_L1_error)
  23902. __pyx_L12_unpacking_done:;
  23903. }
  23904. __pyx_v_c11 = __pyx_t_2;
  23905. __pyx_t_2 = 0;
  23906. __pyx_v_c12 = __pyx_t_1;
  23907. __pyx_t_1 = 0;
  23908. /* "fontTools/misc/bezierTools.py":1337
  23909. *
  23910. * c11, c12 = _split_segment_at_t(curve1, 0.5)
  23911. * c11_range = (range1[0], midpoint(range1)) # <<<<<<<<<<<<<<
  23912. * c12_range = (midpoint(range1), range1[1])
  23913. *
  23914. */
  23915. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_range1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1337, __pyx_L1_error)
  23916. __Pyx_GOTREF(__pyx_t_3);
  23917. __pyx_t_1 = __pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(__pyx_v_midpoint, __pyx_v_range1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1337, __pyx_L1_error)
  23918. __Pyx_GOTREF(__pyx_t_1);
  23919. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L1_error)
  23920. __Pyx_GOTREF(__pyx_t_2);
  23921. __Pyx_GIVEREF(__pyx_t_3);
  23922. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 1337, __pyx_L1_error);
  23923. __Pyx_GIVEREF(__pyx_t_1);
  23924. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1337, __pyx_L1_error);
  23925. __pyx_t_3 = 0;
  23926. __pyx_t_1 = 0;
  23927. __pyx_v_c11_range = ((PyObject*)__pyx_t_2);
  23928. __pyx_t_2 = 0;
  23929. /* "fontTools/misc/bezierTools.py":1338
  23930. * c11, c12 = _split_segment_at_t(curve1, 0.5)
  23931. * c11_range = (range1[0], midpoint(range1))
  23932. * c12_range = (midpoint(range1), range1[1]) # <<<<<<<<<<<<<<
  23933. *
  23934. * c21, c22 = _split_segment_at_t(curve2, 0.5)
  23935. */
  23936. __pyx_t_2 = __pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(__pyx_v_midpoint, __pyx_v_range1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1338, __pyx_L1_error)
  23937. __Pyx_GOTREF(__pyx_t_2);
  23938. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_range1, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1338, __pyx_L1_error)
  23939. __Pyx_GOTREF(__pyx_t_1);
  23940. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1338, __pyx_L1_error)
  23941. __Pyx_GOTREF(__pyx_t_3);
  23942. __Pyx_GIVEREF(__pyx_t_2);
  23943. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1338, __pyx_L1_error);
  23944. __Pyx_GIVEREF(__pyx_t_1);
  23945. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1338, __pyx_L1_error);
  23946. __pyx_t_2 = 0;
  23947. __pyx_t_1 = 0;
  23948. __pyx_v_c12_range = ((PyObject*)__pyx_t_3);
  23949. __pyx_t_3 = 0;
  23950. /* "fontTools/misc/bezierTools.py":1340
  23951. * c12_range = (midpoint(range1), range1[1])
  23952. *
  23953. * c21, c22 = _split_segment_at_t(curve2, 0.5) # <<<<<<<<<<<<<<
  23954. * c21_range = (range2[0], midpoint(range2))
  23955. * c22_range = (midpoint(range2), range2[1])
  23956. */
  23957. __pyx_t_1 = NULL;
  23958. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_split_segment_at_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1340, __pyx_L1_error)
  23959. __Pyx_GOTREF(__pyx_t_2);
  23960. __pyx_t_4 = 1;
  23961. #if CYTHON_UNPACK_METHODS
  23962. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  23963. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  23964. assert(__pyx_t_1);
  23965. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  23966. __Pyx_INCREF(__pyx_t_1);
  23967. __Pyx_INCREF(__pyx__function);
  23968. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  23969. __pyx_t_4 = 0;
  23970. }
  23971. #endif
  23972. {
  23973. PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_curve2, __pyx_mstate_global->__pyx_float_0_5};
  23974. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  23975. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  23976. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23977. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1340, __pyx_L1_error)
  23978. __Pyx_GOTREF(__pyx_t_3);
  23979. }
  23980. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  23981. PyObject* sequence = __pyx_t_3;
  23982. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  23983. if (unlikely(size != 2)) {
  23984. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  23985. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  23986. __PYX_ERR(0, 1340, __pyx_L1_error)
  23987. }
  23988. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  23989. if (likely(PyTuple_CheckExact(sequence))) {
  23990. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  23991. __Pyx_INCREF(__pyx_t_2);
  23992. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  23993. __Pyx_INCREF(__pyx_t_1);
  23994. } else {
  23995. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  23996. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1340, __pyx_L1_error)
  23997. __Pyx_XGOTREF(__pyx_t_2);
  23998. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  23999. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1340, __pyx_L1_error)
  24000. __Pyx_XGOTREF(__pyx_t_1);
  24001. }
  24002. #else
  24003. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1340, __pyx_L1_error)
  24004. __Pyx_GOTREF(__pyx_t_2);
  24005. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1340, __pyx_L1_error)
  24006. __Pyx_GOTREF(__pyx_t_1);
  24007. #endif
  24008. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24009. } else {
  24010. Py_ssize_t index = -1;
  24011. __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1340, __pyx_L1_error)
  24012. __Pyx_GOTREF(__pyx_t_7);
  24013. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24014. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  24015. index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L13_unpacking_failed;
  24016. __Pyx_GOTREF(__pyx_t_2);
  24017. index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L13_unpacking_failed;
  24018. __Pyx_GOTREF(__pyx_t_1);
  24019. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 1340, __pyx_L1_error)
  24020. __pyx_t_8 = NULL;
  24021. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24022. goto __pyx_L14_unpacking_done;
  24023. __pyx_L13_unpacking_failed:;
  24024. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24025. __pyx_t_8 = NULL;
  24026. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  24027. __PYX_ERR(0, 1340, __pyx_L1_error)
  24028. __pyx_L14_unpacking_done:;
  24029. }
  24030. __pyx_v_c21 = __pyx_t_2;
  24031. __pyx_t_2 = 0;
  24032. __pyx_v_c22 = __pyx_t_1;
  24033. __pyx_t_1 = 0;
  24034. /* "fontTools/misc/bezierTools.py":1341
  24035. *
  24036. * c21, c22 = _split_segment_at_t(curve2, 0.5)
  24037. * c21_range = (range2[0], midpoint(range2)) # <<<<<<<<<<<<<<
  24038. * c22_range = (midpoint(range2), range2[1])
  24039. *
  24040. */
  24041. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_range2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1341, __pyx_L1_error)
  24042. __Pyx_GOTREF(__pyx_t_3);
  24043. __pyx_t_1 = __pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(__pyx_v_midpoint, __pyx_v_range2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1341, __pyx_L1_error)
  24044. __Pyx_GOTREF(__pyx_t_1);
  24045. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1341, __pyx_L1_error)
  24046. __Pyx_GOTREF(__pyx_t_2);
  24047. __Pyx_GIVEREF(__pyx_t_3);
  24048. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 1341, __pyx_L1_error);
  24049. __Pyx_GIVEREF(__pyx_t_1);
  24050. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1341, __pyx_L1_error);
  24051. __pyx_t_3 = 0;
  24052. __pyx_t_1 = 0;
  24053. __pyx_v_c21_range = ((PyObject*)__pyx_t_2);
  24054. __pyx_t_2 = 0;
  24055. /* "fontTools/misc/bezierTools.py":1342
  24056. * c21, c22 = _split_segment_at_t(curve2, 0.5)
  24057. * c21_range = (range2[0], midpoint(range2))
  24058. * c22_range = (midpoint(range2), range2[1]) # <<<<<<<<<<<<<<
  24059. *
  24060. * found = []
  24061. */
  24062. __pyx_t_2 = __pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(__pyx_v_midpoint, __pyx_v_range2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1342, __pyx_L1_error)
  24063. __Pyx_GOTREF(__pyx_t_2);
  24064. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_range2, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1342, __pyx_L1_error)
  24065. __Pyx_GOTREF(__pyx_t_1);
  24066. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1342, __pyx_L1_error)
  24067. __Pyx_GOTREF(__pyx_t_3);
  24068. __Pyx_GIVEREF(__pyx_t_2);
  24069. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1342, __pyx_L1_error);
  24070. __Pyx_GIVEREF(__pyx_t_1);
  24071. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1342, __pyx_L1_error);
  24072. __pyx_t_2 = 0;
  24073. __pyx_t_1 = 0;
  24074. __pyx_v_c22_range = ((PyObject*)__pyx_t_3);
  24075. __pyx_t_3 = 0;
  24076. /* "fontTools/misc/bezierTools.py":1344
  24077. * c22_range = (midpoint(range2), range2[1])
  24078. *
  24079. * found = [] # <<<<<<<<<<<<<<
  24080. * found.extend(
  24081. * _curve_curve_intersections_t(
  24082. */
  24083. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1344, __pyx_L1_error)
  24084. __Pyx_GOTREF(__pyx_t_3);
  24085. __pyx_v_found = ((PyObject*)__pyx_t_3);
  24086. __pyx_t_3 = 0;
  24087. /* "fontTools/misc/bezierTools.py":1346
  24088. * found = []
  24089. * found.extend(
  24090. * _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  24091. * c11, c21, precision, range1=c11_range, range2=c21_range
  24092. * )
  24093. */
  24094. __pyx_t_1 = NULL;
  24095. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_curve_curve_intersections_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1346, __pyx_L1_error)
  24096. __Pyx_GOTREF(__pyx_t_2);
  24097. /* "fontTools/misc/bezierTools.py":1347
  24098. * found.extend(
  24099. * _curve_curve_intersections_t(
  24100. * c11, c21, precision, range1=c11_range, range2=c21_range # <<<<<<<<<<<<<<
  24101. * )
  24102. * )
  24103. */
  24104. __pyx_t_4 = 1;
  24105. #if CYTHON_UNPACK_METHODS
  24106. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  24107. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  24108. assert(__pyx_t_1);
  24109. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  24110. __Pyx_INCREF(__pyx_t_1);
  24111. __Pyx_INCREF(__pyx__function);
  24112. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  24113. __pyx_t_4 = 0;
  24114. }
  24115. #endif
  24116. {
  24117. PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, __pyx_v_c11, __pyx_v_c21, __pyx_cur_scope->__pyx_v_precision};
  24118. __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1346, __pyx_L1_error)
  24119. __Pyx_GOTREF(__pyx_t_7);
  24120. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_range1, __pyx_v_c11_range, __pyx_t_7, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 1346, __pyx_L1_error)
  24121. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_range2, __pyx_v_c21_range, __pyx_t_7, __pyx_callargs+4, 1) < (0)) __PYX_ERR(0, 1346, __pyx_L1_error)
  24122. __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
  24123. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  24124. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24125. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24126. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1346, __pyx_L1_error)
  24127. __Pyx_GOTREF(__pyx_t_3);
  24128. }
  24129. /* "fontTools/misc/bezierTools.py":1345
  24130. *
  24131. * found = []
  24132. * found.extend( # <<<<<<<<<<<<<<
  24133. * _curve_curve_intersections_t(
  24134. * c11, c21, precision, range1=c11_range, range2=c21_range
  24135. */
  24136. __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_found, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1345, __pyx_L1_error)
  24137. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24138. /* "fontTools/misc/bezierTools.py":1351
  24139. * )
  24140. * found.extend(
  24141. * _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  24142. * c12, c21, precision, range1=c12_range, range2=c21_range
  24143. * )
  24144. */
  24145. __pyx_t_2 = NULL;
  24146. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_curve_curve_intersections_t); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1351, __pyx_L1_error)
  24147. __Pyx_GOTREF(__pyx_t_7);
  24148. /* "fontTools/misc/bezierTools.py":1352
  24149. * found.extend(
  24150. * _curve_curve_intersections_t(
  24151. * c12, c21, precision, range1=c12_range, range2=c21_range # <<<<<<<<<<<<<<
  24152. * )
  24153. * )
  24154. */
  24155. __pyx_t_4 = 1;
  24156. #if CYTHON_UNPACK_METHODS
  24157. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  24158. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
  24159. assert(__pyx_t_2);
  24160. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  24161. __Pyx_INCREF(__pyx_t_2);
  24162. __Pyx_INCREF(__pyx__function);
  24163. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  24164. __pyx_t_4 = 0;
  24165. }
  24166. #endif
  24167. {
  24168. PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, __pyx_v_c12, __pyx_v_c21, __pyx_cur_scope->__pyx_v_precision};
  24169. __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1351, __pyx_L1_error)
  24170. __Pyx_GOTREF(__pyx_t_1);
  24171. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_range1, __pyx_v_c12_range, __pyx_t_1, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 1351, __pyx_L1_error)
  24172. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_range2, __pyx_v_c21_range, __pyx_t_1, __pyx_callargs+4, 1) < (0)) __PYX_ERR(0, 1351, __pyx_L1_error)
  24173. __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_1);
  24174. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  24175. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24176. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24177. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1351, __pyx_L1_error)
  24178. __Pyx_GOTREF(__pyx_t_3);
  24179. }
  24180. /* "fontTools/misc/bezierTools.py":1350
  24181. * )
  24182. * )
  24183. * found.extend( # <<<<<<<<<<<<<<
  24184. * _curve_curve_intersections_t(
  24185. * c12, c21, precision, range1=c12_range, range2=c21_range
  24186. */
  24187. __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_found, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1350, __pyx_L1_error)
  24188. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24189. /* "fontTools/misc/bezierTools.py":1356
  24190. * )
  24191. * found.extend(
  24192. * _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  24193. * c11, c22, precision, range1=c11_range, range2=c22_range
  24194. * )
  24195. */
  24196. __pyx_t_7 = NULL;
  24197. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_curve_curve_intersections_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1356, __pyx_L1_error)
  24198. __Pyx_GOTREF(__pyx_t_1);
  24199. /* "fontTools/misc/bezierTools.py":1357
  24200. * found.extend(
  24201. * _curve_curve_intersections_t(
  24202. * c11, c22, precision, range1=c11_range, range2=c22_range # <<<<<<<<<<<<<<
  24203. * )
  24204. * )
  24205. */
  24206. __pyx_t_4 = 1;
  24207. #if CYTHON_UNPACK_METHODS
  24208. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  24209. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
  24210. assert(__pyx_t_7);
  24211. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  24212. __Pyx_INCREF(__pyx_t_7);
  24213. __Pyx_INCREF(__pyx__function);
  24214. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  24215. __pyx_t_4 = 0;
  24216. }
  24217. #endif
  24218. {
  24219. PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_7, __pyx_v_c11, __pyx_v_c22, __pyx_cur_scope->__pyx_v_precision};
  24220. __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1356, __pyx_L1_error)
  24221. __Pyx_GOTREF(__pyx_t_2);
  24222. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_range1, __pyx_v_c11_range, __pyx_t_2, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 1356, __pyx_L1_error)
  24223. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_range2, __pyx_v_c22_range, __pyx_t_2, __pyx_callargs+4, 1) < (0)) __PYX_ERR(0, 1356, __pyx_L1_error)
  24224. __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
  24225. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  24226. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24227. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24228. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1356, __pyx_L1_error)
  24229. __Pyx_GOTREF(__pyx_t_3);
  24230. }
  24231. /* "fontTools/misc/bezierTools.py":1355
  24232. * )
  24233. * )
  24234. * found.extend( # <<<<<<<<<<<<<<
  24235. * _curve_curve_intersections_t(
  24236. * c11, c22, precision, range1=c11_range, range2=c22_range
  24237. */
  24238. __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_found, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1355, __pyx_L1_error)
  24239. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24240. /* "fontTools/misc/bezierTools.py":1361
  24241. * )
  24242. * found.extend(
  24243. * _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  24244. * c12, c22, precision, range1=c12_range, range2=c22_range
  24245. * )
  24246. */
  24247. __pyx_t_1 = NULL;
  24248. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_curve_curve_intersections_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1361, __pyx_L1_error)
  24249. __Pyx_GOTREF(__pyx_t_2);
  24250. /* "fontTools/misc/bezierTools.py":1362
  24251. * found.extend(
  24252. * _curve_curve_intersections_t(
  24253. * c12, c22, precision, range1=c12_range, range2=c22_range # <<<<<<<<<<<<<<
  24254. * )
  24255. * )
  24256. */
  24257. __pyx_t_4 = 1;
  24258. #if CYTHON_UNPACK_METHODS
  24259. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  24260. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  24261. assert(__pyx_t_1);
  24262. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  24263. __Pyx_INCREF(__pyx_t_1);
  24264. __Pyx_INCREF(__pyx__function);
  24265. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  24266. __pyx_t_4 = 0;
  24267. }
  24268. #endif
  24269. {
  24270. PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, __pyx_v_c12, __pyx_v_c22, __pyx_cur_scope->__pyx_v_precision};
  24271. __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1361, __pyx_L1_error)
  24272. __Pyx_GOTREF(__pyx_t_7);
  24273. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_range1, __pyx_v_c12_range, __pyx_t_7, __pyx_callargs+4, 0) < (0)) __PYX_ERR(0, 1361, __pyx_L1_error)
  24274. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_range2, __pyx_v_c22_range, __pyx_t_7, __pyx_callargs+4, 1) < (0)) __PYX_ERR(0, 1361, __pyx_L1_error)
  24275. __pyx_t_3 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (4-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
  24276. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  24277. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24278. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24279. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1361, __pyx_L1_error)
  24280. __Pyx_GOTREF(__pyx_t_3);
  24281. }
  24282. /* "fontTools/misc/bezierTools.py":1360
  24283. * )
  24284. * )
  24285. * found.extend( # <<<<<<<<<<<<<<
  24286. * _curve_curve_intersections_t(
  24287. * c12, c22, precision, range1=c12_range, range2=c22_range
  24288. */
  24289. __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_found, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1360, __pyx_L1_error)
  24290. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24291. /* "fontTools/misc/bezierTools.py":1366
  24292. * )
  24293. *
  24294. * unique_key = lambda ts: (int(ts[0] / precision), int(ts[1] / precision)) # <<<<<<<<<<<<<<
  24295. * seen = set()
  24296. * unique_values = []
  24297. */
  24298. __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_2lambda3, 0, __pyx_mstate_global->__pyx_n_u_curve_curve_intersections_t_loc_2, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1366, __pyx_L1_error)
  24299. __Pyx_GOTREF(__pyx_t_3);
  24300. __pyx_v_unique_key = __pyx_t_3;
  24301. __pyx_t_3 = 0;
  24302. /* "fontTools/misc/bezierTools.py":1367
  24303. *
  24304. * unique_key = lambda ts: (int(ts[0] / precision), int(ts[1] / precision))
  24305. * seen = set() # <<<<<<<<<<<<<<
  24306. * unique_values = []
  24307. *
  24308. */
  24309. __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1367, __pyx_L1_error)
  24310. __Pyx_GOTREF(__pyx_t_3);
  24311. __pyx_v_seen = ((PyObject*)__pyx_t_3);
  24312. __pyx_t_3 = 0;
  24313. /* "fontTools/misc/bezierTools.py":1368
  24314. * unique_key = lambda ts: (int(ts[0] / precision), int(ts[1] / precision))
  24315. * seen = set()
  24316. * unique_values = [] # <<<<<<<<<<<<<<
  24317. *
  24318. * for ts in found:
  24319. */
  24320. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1368, __pyx_L1_error)
  24321. __Pyx_GOTREF(__pyx_t_3);
  24322. __pyx_v_unique_values = ((PyObject*)__pyx_t_3);
  24323. __pyx_t_3 = 0;
  24324. /* "fontTools/misc/bezierTools.py":1370
  24325. * unique_values = []
  24326. *
  24327. * for ts in found: # <<<<<<<<<<<<<<
  24328. * key = unique_key(ts)
  24329. * if key in seen:
  24330. */
  24331. __pyx_t_3 = __pyx_v_found; __Pyx_INCREF(__pyx_t_3);
  24332. __pyx_t_10 = 0;
  24333. for (;;) {
  24334. {
  24335. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
  24336. #if !CYTHON_ASSUME_SAFE_SIZE
  24337. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1370, __pyx_L1_error)
  24338. #endif
  24339. if (__pyx_t_10 >= __pyx_temp) break;
  24340. }
  24341. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference);
  24342. ++__pyx_t_10;
  24343. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1370, __pyx_L1_error)
  24344. __Pyx_GOTREF(__pyx_t_2);
  24345. __Pyx_XDECREF_SET(__pyx_v_ts, __pyx_t_2);
  24346. __pyx_t_2 = 0;
  24347. /* "fontTools/misc/bezierTools.py":1371
  24348. *
  24349. * for ts in found:
  24350. * key = unique_key(ts) # <<<<<<<<<<<<<<
  24351. * if key in seen:
  24352. * continue
  24353. */
  24354. __pyx_t_2 = __pyx_lambda_funcdef_lambda3(__pyx_v_unique_key, __pyx_v_ts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1371, __pyx_L1_error)
  24355. __Pyx_GOTREF(__pyx_t_2);
  24356. __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_2);
  24357. __pyx_t_2 = 0;
  24358. /* "fontTools/misc/bezierTools.py":1372
  24359. * for ts in found:
  24360. * key = unique_key(ts)
  24361. * if key in seen: # <<<<<<<<<<<<<<
  24362. * continue
  24363. * seen.add(key)
  24364. */
  24365. __pyx_t_6 = (__Pyx_PySet_ContainsTF(__pyx_v_key, __pyx_v_seen, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1372, __pyx_L1_error)
  24366. if (__pyx_t_6) {
  24367. /* "fontTools/misc/bezierTools.py":1373
  24368. * key = unique_key(ts)
  24369. * if key in seen:
  24370. * continue # <<<<<<<<<<<<<<
  24371. * seen.add(key)
  24372. * unique_values.append(ts)
  24373. */
  24374. goto __pyx_L15_continue;
  24375. /* "fontTools/misc/bezierTools.py":1372
  24376. * for ts in found:
  24377. * key = unique_key(ts)
  24378. * if key in seen: # <<<<<<<<<<<<<<
  24379. * continue
  24380. * seen.add(key)
  24381. */
  24382. }
  24383. /* "fontTools/misc/bezierTools.py":1374
  24384. * if key in seen:
  24385. * continue
  24386. * seen.add(key) # <<<<<<<<<<<<<<
  24387. * unique_values.append(ts)
  24388. *
  24389. */
  24390. __pyx_t_9 = PySet_Add(__pyx_v_seen, __pyx_v_key); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1374, __pyx_L1_error)
  24391. /* "fontTools/misc/bezierTools.py":1375
  24392. * continue
  24393. * seen.add(key)
  24394. * unique_values.append(ts) # <<<<<<<<<<<<<<
  24395. *
  24396. * return unique_values
  24397. */
  24398. __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_unique_values, __pyx_v_ts); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1375, __pyx_L1_error)
  24399. /* "fontTools/misc/bezierTools.py":1370
  24400. * unique_values = []
  24401. *
  24402. * for ts in found: # <<<<<<<<<<<<<<
  24403. * key = unique_key(ts)
  24404. * if key in seen:
  24405. */
  24406. __pyx_L15_continue:;
  24407. }
  24408. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24409. /* "fontTools/misc/bezierTools.py":1377
  24410. * unique_values.append(ts)
  24411. *
  24412. * return unique_values # <<<<<<<<<<<<<<
  24413. *
  24414. *
  24415. */
  24416. __Pyx_XDECREF(__pyx_r);
  24417. __Pyx_INCREF(__pyx_v_unique_values);
  24418. __pyx_r = __pyx_v_unique_values;
  24419. goto __pyx_L0;
  24420. /* "fontTools/misc/bezierTools.py":1313
  24421. *
  24422. *
  24423. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  24424. * curve1, curve2, precision=1e-3, range1=None, range2=None
  24425. * ):
  24426. */
  24427. /* function exit code */
  24428. __pyx_L1_error:;
  24429. __Pyx_XDECREF(__pyx_t_1);
  24430. __Pyx_XDECREF(__pyx_t_2);
  24431. __Pyx_XDECREF(__pyx_t_3);
  24432. __Pyx_XDECREF(__pyx_t_7);
  24433. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24434. __pyx_r = NULL;
  24435. __pyx_L0:;
  24436. __Pyx_XDECREF(__pyx_v_bounds1);
  24437. __Pyx_XDECREF(__pyx_v_bounds2);
  24438. __Pyx_XDECREF(__pyx_v_intersects);
  24439. __Pyx_XDECREF(__pyx_v__);
  24440. __Pyx_XDECREF(__pyx_v_midpoint);
  24441. __Pyx_XDECREF(__pyx_v_c11);
  24442. __Pyx_XDECREF(__pyx_v_c12);
  24443. __Pyx_XDECREF(__pyx_v_c11_range);
  24444. __Pyx_XDECREF(__pyx_v_c12_range);
  24445. __Pyx_XDECREF(__pyx_v_c21);
  24446. __Pyx_XDECREF(__pyx_v_c22);
  24447. __Pyx_XDECREF(__pyx_v_c21_range);
  24448. __Pyx_XDECREF(__pyx_v_c22_range);
  24449. __Pyx_XDECREF(__pyx_v_found);
  24450. __Pyx_XDECREF(__pyx_v_unique_key);
  24451. __Pyx_XDECREF(__pyx_v_seen);
  24452. __Pyx_XDECREF(__pyx_v_unique_values);
  24453. __Pyx_XDECREF(__pyx_v_ts);
  24454. __Pyx_XDECREF(__pyx_v_key);
  24455. __Pyx_XDECREF(__pyx_v_range1);
  24456. __Pyx_XDECREF(__pyx_v_range2);
  24457. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  24458. __Pyx_XGIVEREF(__pyx_r);
  24459. __Pyx_RefNannyFinishContext();
  24460. return __pyx_r;
  24461. }
  24462. /* "fontTools/misc/bezierTools.py":1380
  24463. *
  24464. *
  24465. * def _is_linelike(segment): # <<<<<<<<<<<<<<
  24466. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  24467. * return all(math.isclose(p[1], 0.0) for p in maybeline)
  24468. */
  24469. /* Python wrapper */
  24470. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_87_is_linelike(PyObject *__pyx_self,
  24471. #if CYTHON_METH_FASTCALL
  24472. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  24473. #else
  24474. PyObject *__pyx_args, PyObject *__pyx_kwds
  24475. #endif
  24476. ); /*proto*/
  24477. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_86_is_linelike, "_is_linelike(segment)");
  24478. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_87_is_linelike = {"_is_linelike", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_87_is_linelike, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_86_is_linelike};
  24479. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_87_is_linelike(PyObject *__pyx_self,
  24480. #if CYTHON_METH_FASTCALL
  24481. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  24482. #else
  24483. PyObject *__pyx_args, PyObject *__pyx_kwds
  24484. #endif
  24485. ) {
  24486. PyObject *__pyx_v_segment = 0;
  24487. #if !CYTHON_METH_FASTCALL
  24488. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  24489. #endif
  24490. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  24491. PyObject* values[1] = {0};
  24492. int __pyx_lineno = 0;
  24493. const char *__pyx_filename = NULL;
  24494. int __pyx_clineno = 0;
  24495. PyObject *__pyx_r = 0;
  24496. __Pyx_RefNannyDeclarations
  24497. __Pyx_RefNannySetupContext("_is_linelike (wrapper)", 0);
  24498. #if !CYTHON_METH_FASTCALL
  24499. #if CYTHON_ASSUME_SAFE_SIZE
  24500. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  24501. #else
  24502. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  24503. #endif
  24504. #endif
  24505. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  24506. {
  24507. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_segment,0};
  24508. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  24509. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1380, __pyx_L3_error)
  24510. if (__pyx_kwds_len > 0) {
  24511. switch (__pyx_nargs) {
  24512. case 1:
  24513. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  24514. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1380, __pyx_L3_error)
  24515. CYTHON_FALLTHROUGH;
  24516. case 0: break;
  24517. default: goto __pyx_L5_argtuple_error;
  24518. }
  24519. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  24520. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_is_linelike", 0) < (0)) __PYX_ERR(0, 1380, __pyx_L3_error)
  24521. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  24522. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_is_linelike", 1, 1, 1, i); __PYX_ERR(0, 1380, __pyx_L3_error) }
  24523. }
  24524. } else if (unlikely(__pyx_nargs != 1)) {
  24525. goto __pyx_L5_argtuple_error;
  24526. } else {
  24527. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  24528. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1380, __pyx_L3_error)
  24529. }
  24530. __pyx_v_segment = values[0];
  24531. }
  24532. goto __pyx_L6_skip;
  24533. __pyx_L5_argtuple_error:;
  24534. __Pyx_RaiseArgtupleInvalid("_is_linelike", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1380, __pyx_L3_error)
  24535. __pyx_L6_skip:;
  24536. goto __pyx_L4_argument_unpacking_done;
  24537. __pyx_L3_error:;
  24538. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  24539. Py_XDECREF(values[__pyx_temp]);
  24540. }
  24541. __Pyx_AddTraceback("fontTools.misc.bezierTools._is_linelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24542. __Pyx_RefNannyFinishContext();
  24543. return NULL;
  24544. __pyx_L4_argument_unpacking_done:;
  24545. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_86_is_linelike(__pyx_self, __pyx_v_segment);
  24546. /* function exit code */
  24547. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  24548. Py_XDECREF(values[__pyx_temp]);
  24549. }
  24550. __Pyx_RefNannyFinishContext();
  24551. return __pyx_r;
  24552. }
  24553. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_12_is_linelike_2generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  24554. /* "fontTools/misc/bezierTools.py":1382
  24555. * def _is_linelike(segment):
  24556. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  24557. * return all(math.isclose(p[1], 0.0) for p in maybeline) # <<<<<<<<<<<<<<
  24558. *
  24559. *
  24560. */
  24561. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_12_is_linelike_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  24562. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *__pyx_cur_scope;
  24563. PyObject *__pyx_r = NULL;
  24564. __Pyx_RefNannyDeclarations
  24565. int __pyx_lineno = 0;
  24566. const char *__pyx_filename = NULL;
  24567. int __pyx_clineno = 0;
  24568. __Pyx_RefNannySetupContext("genexpr", 0);
  24569. __pyx_cur_scope = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr(__pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  24570. if (unlikely(!__pyx_cur_scope)) {
  24571. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *)Py_None);
  24572. __Pyx_INCREF(Py_None);
  24573. __PYX_ERR(0, 1382, __pyx_L1_error)
  24574. } else {
  24575. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  24576. }
  24577. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  24578. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  24579. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  24580. {
  24581. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_4misc_11bezierTools_12_is_linelike_2generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_is_linelike_locals_genexpr, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools); if (unlikely(!gen)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24582. __Pyx_DECREF(__pyx_cur_scope);
  24583. __Pyx_RefNannyFinishContext();
  24584. return (PyObject *) gen;
  24585. }
  24586. /* function exit code */
  24587. __pyx_L1_error:;
  24588. __Pyx_AddTraceback("fontTools.misc.bezierTools._is_linelike.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24589. __pyx_r = NULL;
  24590. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  24591. __Pyx_XGIVEREF(__pyx_r);
  24592. __Pyx_RefNannyFinishContext();
  24593. return __pyx_r;
  24594. }
  24595. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_12_is_linelike_2generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  24596. {
  24597. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *)__pyx_generator->closure);
  24598. PyObject *__pyx_r = NULL;
  24599. PyObject *__pyx_t_1 = NULL;
  24600. Py_ssize_t __pyx_t_2;
  24601. PyObject *(*__pyx_t_3)(PyObject *);
  24602. PyObject *__pyx_t_4 = NULL;
  24603. PyObject *__pyx_t_5 = NULL;
  24604. PyObject *__pyx_t_6 = NULL;
  24605. PyObject *__pyx_t_7 = NULL;
  24606. size_t __pyx_t_8;
  24607. int __pyx_t_9;
  24608. int __pyx_t_10;
  24609. int __pyx_lineno = 0;
  24610. const char *__pyx_filename = NULL;
  24611. int __pyx_clineno = 0;
  24612. __Pyx_RefNannyDeclarations
  24613. __Pyx_RefNannySetupContext("genexpr", 0);
  24614. switch (__pyx_generator->resume_label) {
  24615. case 0: goto __pyx_L3_first_run;
  24616. default: /* CPython raises the right error here */
  24617. __Pyx_RefNannyFinishContext();
  24618. return NULL;
  24619. }
  24620. __pyx_L3_first_run:;
  24621. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24622. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1382, __pyx_L1_error) }
  24623. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  24624. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  24625. __pyx_t_2 = 0;
  24626. __pyx_t_3 = NULL;
  24627. } else {
  24628. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24629. __Pyx_GOTREF(__pyx_t_1);
  24630. __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24631. }
  24632. for (;;) {
  24633. if (likely(!__pyx_t_3)) {
  24634. if (likely(PyList_CheckExact(__pyx_t_1))) {
  24635. {
  24636. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  24637. #if !CYTHON_ASSUME_SAFE_SIZE
  24638. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1382, __pyx_L1_error)
  24639. #endif
  24640. if (__pyx_t_2 >= __pyx_temp) break;
  24641. }
  24642. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  24643. ++__pyx_t_2;
  24644. } else {
  24645. {
  24646. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  24647. #if !CYTHON_ASSUME_SAFE_SIZE
  24648. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1382, __pyx_L1_error)
  24649. #endif
  24650. if (__pyx_t_2 >= __pyx_temp) break;
  24651. }
  24652. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  24653. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  24654. #else
  24655. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  24656. #endif
  24657. ++__pyx_t_2;
  24658. }
  24659. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24660. } else {
  24661. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  24662. if (unlikely(!__pyx_t_4)) {
  24663. PyObject* exc_type = PyErr_Occurred();
  24664. if (exc_type) {
  24665. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1382, __pyx_L1_error)
  24666. PyErr_Clear();
  24667. }
  24668. break;
  24669. }
  24670. }
  24671. __Pyx_GOTREF(__pyx_t_4);
  24672. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_p);
  24673. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_p, __pyx_t_4);
  24674. __Pyx_GIVEREF(__pyx_t_4);
  24675. __pyx_t_4 = 0;
  24676. __pyx_t_5 = NULL;
  24677. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24678. __Pyx_GOTREF(__pyx_t_6);
  24679. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_isclose); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24680. __Pyx_GOTREF(__pyx_t_7);
  24681. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  24682. __pyx_t_6 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_p, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24683. __Pyx_GOTREF(__pyx_t_6);
  24684. __pyx_t_8 = 1;
  24685. #if CYTHON_UNPACK_METHODS
  24686. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  24687. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
  24688. assert(__pyx_t_5);
  24689. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  24690. __Pyx_INCREF(__pyx_t_5);
  24691. __Pyx_INCREF(__pyx__function);
  24692. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  24693. __pyx_t_8 = 0;
  24694. }
  24695. #endif
  24696. {
  24697. PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_mstate_global->__pyx_float_0_0};
  24698. __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  24699. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  24700. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  24701. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24702. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24703. __Pyx_GOTREF(__pyx_t_4);
  24704. }
  24705. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1382, __pyx_L1_error)
  24706. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  24707. __pyx_t_10 = (!__pyx_t_9);
  24708. if (__pyx_t_10) {
  24709. __Pyx_XDECREF(__pyx_r);
  24710. __Pyx_INCREF(Py_False);
  24711. __pyx_r = Py_False;
  24712. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24713. goto __pyx_L0;
  24714. }
  24715. }
  24716. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24717. /*else*/ {
  24718. __Pyx_XDECREF(__pyx_r);
  24719. __Pyx_INCREF(Py_True);
  24720. __pyx_r = Py_True;
  24721. goto __pyx_L0;
  24722. }
  24723. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  24724. /* function exit code */
  24725. goto __pyx_L0;
  24726. __pyx_L1_error:;
  24727. __Pyx_XDECREF(__pyx_t_1);
  24728. __Pyx_XDECREF(__pyx_t_4);
  24729. __Pyx_XDECREF(__pyx_t_5);
  24730. __Pyx_XDECREF(__pyx_t_6);
  24731. __Pyx_XDECREF(__pyx_t_7);
  24732. if (__Pyx_PyErr_Occurred()) {
  24733. __Pyx_Generator_Replace_StopIteration(0);
  24734. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24735. }
  24736. __pyx_L0:;
  24737. __Pyx_XGIVEREF(__pyx_r);
  24738. #if !CYTHON_USE_EXC_INFO_STACK
  24739. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  24740. #endif
  24741. __pyx_generator->resume_label = -1;
  24742. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  24743. __Pyx_RefNannyFinishContext();
  24744. return __pyx_r;
  24745. }
  24746. /* "fontTools/misc/bezierTools.py":1380
  24747. *
  24748. *
  24749. * def _is_linelike(segment): # <<<<<<<<<<<<<<
  24750. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  24751. * return all(math.isclose(p[1], 0.0) for p in maybeline)
  24752. */
  24753. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_86_is_linelike(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segment) {
  24754. PyObject *__pyx_v_maybeline = NULL;
  24755. PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_12_is_linelike_2generator5 = 0;
  24756. PyObject *__pyx_r = NULL;
  24757. __Pyx_RefNannyDeclarations
  24758. PyObject *__pyx_t_1 = NULL;
  24759. PyObject *__pyx_t_2 = NULL;
  24760. PyObject *__pyx_t_3 = NULL;
  24761. PyObject *__pyx_t_4 = NULL;
  24762. PyObject *__pyx_t_5 = NULL;
  24763. size_t __pyx_t_6;
  24764. int __pyx_lineno = 0;
  24765. const char *__pyx_filename = NULL;
  24766. int __pyx_clineno = 0;
  24767. __Pyx_RefNannySetupContext("_is_linelike", 0);
  24768. /* "fontTools/misc/bezierTools.py":1381
  24769. *
  24770. * def _is_linelike(segment):
  24771. * maybeline = _alignment_transformation(segment).transformPoints(segment) # <<<<<<<<<<<<<<
  24772. * return all(math.isclose(p[1], 0.0) for p in maybeline)
  24773. *
  24774. */
  24775. __pyx_t_4 = NULL;
  24776. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_alignment_transformation); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1381, __pyx_L1_error)
  24777. __Pyx_GOTREF(__pyx_t_5);
  24778. __pyx_t_6 = 1;
  24779. #if CYTHON_UNPACK_METHODS
  24780. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  24781. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
  24782. assert(__pyx_t_4);
  24783. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  24784. __Pyx_INCREF(__pyx_t_4);
  24785. __Pyx_INCREF(__pyx__function);
  24786. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  24787. __pyx_t_6 = 0;
  24788. }
  24789. #endif
  24790. {
  24791. PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_segment};
  24792. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  24793. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  24794. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  24795. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1381, __pyx_L1_error)
  24796. __Pyx_GOTREF(__pyx_t_3);
  24797. }
  24798. __pyx_t_2 = __pyx_t_3;
  24799. __Pyx_INCREF(__pyx_t_2);
  24800. __pyx_t_6 = 0;
  24801. {
  24802. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_segment};
  24803. __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_transformPoints, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  24804. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  24805. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24806. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
  24807. __Pyx_GOTREF(__pyx_t_1);
  24808. }
  24809. __pyx_v_maybeline = __pyx_t_1;
  24810. __pyx_t_1 = 0;
  24811. /* "fontTools/misc/bezierTools.py":1382
  24812. * def _is_linelike(segment):
  24813. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  24814. * return all(math.isclose(p[1], 0.0) for p in maybeline) # <<<<<<<<<<<<<<
  24815. *
  24816. *
  24817. */
  24818. __Pyx_XDECREF(__pyx_r);
  24819. __pyx_t_1 = __pyx_pf_9fontTools_4misc_11bezierTools_12_is_linelike_genexpr(NULL, __pyx_v_maybeline); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24820. __Pyx_GOTREF(__pyx_t_1);
  24821. __pyx_t_3 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24822. __Pyx_GOTREF(__pyx_t_3);
  24823. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24824. __pyx_r = __pyx_t_3;
  24825. __pyx_t_3 = 0;
  24826. goto __pyx_L0;
  24827. /* "fontTools/misc/bezierTools.py":1380
  24828. *
  24829. *
  24830. * def _is_linelike(segment): # <<<<<<<<<<<<<<
  24831. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  24832. * return all(math.isclose(p[1], 0.0) for p in maybeline)
  24833. */
  24834. /* function exit code */
  24835. __pyx_L1_error:;
  24836. __Pyx_XDECREF(__pyx_t_1);
  24837. __Pyx_XDECREF(__pyx_t_2);
  24838. __Pyx_XDECREF(__pyx_t_3);
  24839. __Pyx_XDECREF(__pyx_t_4);
  24840. __Pyx_XDECREF(__pyx_t_5);
  24841. __Pyx_AddTraceback("fontTools.misc.bezierTools._is_linelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24842. __pyx_r = NULL;
  24843. __pyx_L0:;
  24844. __Pyx_XDECREF(__pyx_v_maybeline);
  24845. __Pyx_XDECREF(__pyx_gb_9fontTools_4misc_11bezierTools_12_is_linelike_2generator5);
  24846. __Pyx_XGIVEREF(__pyx_r);
  24847. __Pyx_RefNannyFinishContext();
  24848. return __pyx_r;
  24849. }
  24850. /* "fontTools/misc/bezierTools.py":1385
  24851. *
  24852. *
  24853. * def curveCurveIntersections(curve1, curve2): # <<<<<<<<<<<<<<
  24854. * """Finds intersections between a curve and a curve.
  24855. *
  24856. */
  24857. /* Python wrapper */
  24858. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_89curveCurveIntersections(PyObject *__pyx_self,
  24859. #if CYTHON_METH_FASTCALL
  24860. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  24861. #else
  24862. PyObject *__pyx_args, PyObject *__pyx_kwds
  24863. #endif
  24864. ); /*proto*/
  24865. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_88curveCurveIntersections, "curveCurveIntersections(curve1, curve2)\n\nFinds intersections between a curve and a curve.\n\nArgs:\n curve1: List of coordinates of the first curve segment as 2D tuples.\n curve2: List of coordinates of the second curve segment as 2D tuples.\n\nReturns:\n A list of ``Intersection`` objects, each object having ``pt``, ``t1``\n and ``t2`` attributes containing the intersection point, time on first\n segment and time on second segment respectively.\n\nExamples::\n >>> curve1 = [ (10,100), (90,30), (40,140), (220,220) ]\n >>> curve2 = [ (5,150), (180,20), (80,250), (210,190) ]\n >>> intersections = curveCurveIntersections(curve1, curve2)\n >>> len(intersections)\n 3\n >>> intersections[0].pt\n (81.7831487395506, 109.88904552375288)");
  24866. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_89curveCurveIntersections = {"curveCurveIntersections", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_89curveCurveIntersections, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_88curveCurveIntersections};
  24867. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_89curveCurveIntersections(PyObject *__pyx_self,
  24868. #if CYTHON_METH_FASTCALL
  24869. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  24870. #else
  24871. PyObject *__pyx_args, PyObject *__pyx_kwds
  24872. #endif
  24873. ) {
  24874. PyObject *__pyx_v_curve1 = 0;
  24875. PyObject *__pyx_v_curve2 = 0;
  24876. #if !CYTHON_METH_FASTCALL
  24877. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  24878. #endif
  24879. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  24880. PyObject* values[2] = {0,0};
  24881. int __pyx_lineno = 0;
  24882. const char *__pyx_filename = NULL;
  24883. int __pyx_clineno = 0;
  24884. PyObject *__pyx_r = 0;
  24885. __Pyx_RefNannyDeclarations
  24886. __Pyx_RefNannySetupContext("curveCurveIntersections (wrapper)", 0);
  24887. #if !CYTHON_METH_FASTCALL
  24888. #if CYTHON_ASSUME_SAFE_SIZE
  24889. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  24890. #else
  24891. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  24892. #endif
  24893. #endif
  24894. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  24895. {
  24896. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_curve1,&__pyx_mstate_global->__pyx_n_u_curve2,0};
  24897. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  24898. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1385, __pyx_L3_error)
  24899. if (__pyx_kwds_len > 0) {
  24900. switch (__pyx_nargs) {
  24901. case 2:
  24902. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  24903. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1385, __pyx_L3_error)
  24904. CYTHON_FALLTHROUGH;
  24905. case 1:
  24906. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  24907. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1385, __pyx_L3_error)
  24908. CYTHON_FALLTHROUGH;
  24909. case 0: break;
  24910. default: goto __pyx_L5_argtuple_error;
  24911. }
  24912. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  24913. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "curveCurveIntersections", 0) < (0)) __PYX_ERR(0, 1385, __pyx_L3_error)
  24914. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  24915. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("curveCurveIntersections", 1, 2, 2, i); __PYX_ERR(0, 1385, __pyx_L3_error) }
  24916. }
  24917. } else if (unlikely(__pyx_nargs != 2)) {
  24918. goto __pyx_L5_argtuple_error;
  24919. } else {
  24920. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  24921. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1385, __pyx_L3_error)
  24922. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  24923. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1385, __pyx_L3_error)
  24924. }
  24925. __pyx_v_curve1 = values[0];
  24926. __pyx_v_curve2 = values[1];
  24927. }
  24928. goto __pyx_L6_skip;
  24929. __pyx_L5_argtuple_error:;
  24930. __Pyx_RaiseArgtupleInvalid("curveCurveIntersections", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1385, __pyx_L3_error)
  24931. __pyx_L6_skip:;
  24932. goto __pyx_L4_argument_unpacking_done;
  24933. __pyx_L3_error:;
  24934. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  24935. Py_XDECREF(values[__pyx_temp]);
  24936. }
  24937. __Pyx_AddTraceback("fontTools.misc.bezierTools.curveCurveIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24938. __Pyx_RefNannyFinishContext();
  24939. return NULL;
  24940. __pyx_L4_argument_unpacking_done:;
  24941. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_88curveCurveIntersections(__pyx_self, __pyx_v_curve1, __pyx_v_curve2);
  24942. /* function exit code */
  24943. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  24944. Py_XDECREF(values[__pyx_temp]);
  24945. }
  24946. __Pyx_RefNannyFinishContext();
  24947. return __pyx_r;
  24948. }
  24949. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_88curveCurveIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve1, PyObject *__pyx_v_curve2) {
  24950. PyObject *__pyx_v_line1 = NULL;
  24951. PyObject *__pyx_v_line2 = NULL;
  24952. PyObject *__pyx_v_hits = NULL;
  24953. PyObject *__pyx_v_intersection_ts = NULL;
  24954. PyObject *__pyx_8genexpr8__pyx_v_x = NULL;
  24955. PyObject *__pyx_8genexpr9__pyx_v_ts = NULL;
  24956. PyObject *__pyx_r = NULL;
  24957. __Pyx_RefNannyDeclarations
  24958. PyObject *__pyx_t_1 = NULL;
  24959. PyObject *__pyx_t_2 = NULL;
  24960. PyObject *__pyx_t_3 = NULL;
  24961. size_t __pyx_t_4;
  24962. int __pyx_t_5;
  24963. Py_ssize_t __pyx_t_6;
  24964. PyObject *(*__pyx_t_7)(PyObject *);
  24965. PyObject *__pyx_t_8 = NULL;
  24966. PyObject *__pyx_t_9 = NULL;
  24967. PyObject *__pyx_t_10 = NULL;
  24968. PyObject *__pyx_t_11 = NULL;
  24969. PyObject *__pyx_t_12 = NULL;
  24970. PyObject *__pyx_t_13 = NULL;
  24971. int __pyx_lineno = 0;
  24972. const char *__pyx_filename = NULL;
  24973. int __pyx_clineno = 0;
  24974. __Pyx_RefNannySetupContext("curveCurveIntersections", 0);
  24975. /* "fontTools/misc/bezierTools.py":1406
  24976. * (81.7831487395506, 109.88904552375288)
  24977. * """
  24978. * if _is_linelike(curve1): # <<<<<<<<<<<<<<
  24979. * line1 = curve1[0], curve1[-1]
  24980. * if _is_linelike(curve2):
  24981. */
  24982. __pyx_t_2 = NULL;
  24983. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_is_linelike); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1406, __pyx_L1_error)
  24984. __Pyx_GOTREF(__pyx_t_3);
  24985. __pyx_t_4 = 1;
  24986. #if CYTHON_UNPACK_METHODS
  24987. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  24988. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  24989. assert(__pyx_t_2);
  24990. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  24991. __Pyx_INCREF(__pyx_t_2);
  24992. __Pyx_INCREF(__pyx__function);
  24993. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  24994. __pyx_t_4 = 0;
  24995. }
  24996. #endif
  24997. {
  24998. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_curve1};
  24999. __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  25000. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  25001. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25002. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1406, __pyx_L1_error)
  25003. __Pyx_GOTREF(__pyx_t_1);
  25004. }
  25005. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1406, __pyx_L1_error)
  25006. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25007. if (__pyx_t_5) {
  25008. /* "fontTools/misc/bezierTools.py":1407
  25009. * """
  25010. * if _is_linelike(curve1):
  25011. * line1 = curve1[0], curve1[-1] # <<<<<<<<<<<<<<
  25012. * if _is_linelike(curve2):
  25013. * line2 = curve2[0], curve2[-1]
  25014. */
  25015. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curve1, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1407, __pyx_L1_error)
  25016. __Pyx_GOTREF(__pyx_t_1);
  25017. __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_curve1, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1407, __pyx_L1_error)
  25018. __Pyx_GOTREF(__pyx_t_3);
  25019. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1407, __pyx_L1_error)
  25020. __Pyx_GOTREF(__pyx_t_2);
  25021. __Pyx_GIVEREF(__pyx_t_1);
  25022. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1407, __pyx_L1_error);
  25023. __Pyx_GIVEREF(__pyx_t_3);
  25024. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 1407, __pyx_L1_error);
  25025. __pyx_t_1 = 0;
  25026. __pyx_t_3 = 0;
  25027. __pyx_v_line1 = ((PyObject*)__pyx_t_2);
  25028. __pyx_t_2 = 0;
  25029. /* "fontTools/misc/bezierTools.py":1408
  25030. * if _is_linelike(curve1):
  25031. * line1 = curve1[0], curve1[-1]
  25032. * if _is_linelike(curve2): # <<<<<<<<<<<<<<
  25033. * line2 = curve2[0], curve2[-1]
  25034. * return lineLineIntersections(*line1, *line2)
  25035. */
  25036. __pyx_t_3 = NULL;
  25037. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_is_linelike); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1408, __pyx_L1_error)
  25038. __Pyx_GOTREF(__pyx_t_1);
  25039. __pyx_t_4 = 1;
  25040. #if CYTHON_UNPACK_METHODS
  25041. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  25042. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
  25043. assert(__pyx_t_3);
  25044. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  25045. __Pyx_INCREF(__pyx_t_3);
  25046. __Pyx_INCREF(__pyx__function);
  25047. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  25048. __pyx_t_4 = 0;
  25049. }
  25050. #endif
  25051. {
  25052. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_curve2};
  25053. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  25054. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25055. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25056. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1408, __pyx_L1_error)
  25057. __Pyx_GOTREF(__pyx_t_2);
  25058. }
  25059. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1408, __pyx_L1_error)
  25060. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25061. if (__pyx_t_5) {
  25062. /* "fontTools/misc/bezierTools.py":1409
  25063. * line1 = curve1[0], curve1[-1]
  25064. * if _is_linelike(curve2):
  25065. * line2 = curve2[0], curve2[-1] # <<<<<<<<<<<<<<
  25066. * return lineLineIntersections(*line1, *line2)
  25067. * else:
  25068. */
  25069. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_curve2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1409, __pyx_L1_error)
  25070. __Pyx_GOTREF(__pyx_t_2);
  25071. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curve2, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1409, __pyx_L1_error)
  25072. __Pyx_GOTREF(__pyx_t_1);
  25073. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1409, __pyx_L1_error)
  25074. __Pyx_GOTREF(__pyx_t_3);
  25075. __Pyx_GIVEREF(__pyx_t_2);
  25076. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1409, __pyx_L1_error);
  25077. __Pyx_GIVEREF(__pyx_t_1);
  25078. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1409, __pyx_L1_error);
  25079. __pyx_t_2 = 0;
  25080. __pyx_t_1 = 0;
  25081. __pyx_v_line2 = ((PyObject*)__pyx_t_3);
  25082. __pyx_t_3 = 0;
  25083. /* "fontTools/misc/bezierTools.py":1410
  25084. * if _is_linelike(curve2):
  25085. * line2 = curve2[0], curve2[-1]
  25086. * return lineLineIntersections(*line1, *line2) # <<<<<<<<<<<<<<
  25087. * else:
  25088. * hits = curveLineIntersections(curve2, line1)
  25089. */
  25090. __Pyx_XDECREF(__pyx_r);
  25091. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_lineLineIntersections); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
  25092. __Pyx_GOTREF(__pyx_t_3);
  25093. __pyx_t_1 = PyNumber_Add(__pyx_v_line1, __pyx_v_line2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1410, __pyx_L1_error)
  25094. __Pyx_GOTREF(__pyx_t_1);
  25095. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1410, __pyx_L1_error)
  25096. __Pyx_GOTREF(__pyx_t_2);
  25097. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25098. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25099. __pyx_r = __pyx_t_2;
  25100. __pyx_t_2 = 0;
  25101. goto __pyx_L0;
  25102. /* "fontTools/misc/bezierTools.py":1408
  25103. * if _is_linelike(curve1):
  25104. * line1 = curve1[0], curve1[-1]
  25105. * if _is_linelike(curve2): # <<<<<<<<<<<<<<
  25106. * line2 = curve2[0], curve2[-1]
  25107. * return lineLineIntersections(*line1, *line2)
  25108. */
  25109. }
  25110. /* "fontTools/misc/bezierTools.py":1412
  25111. * return lineLineIntersections(*line1, *line2)
  25112. * else:
  25113. * hits = curveLineIntersections(curve2, line1) # <<<<<<<<<<<<<<
  25114. * # curve is passed first to this fn but is the second segment, so
  25115. * # we need to swap t1/t2 in the result
  25116. */
  25117. /*else*/ {
  25118. __pyx_t_1 = NULL;
  25119. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_curveLineIntersections); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1412, __pyx_L1_error)
  25120. __Pyx_GOTREF(__pyx_t_3);
  25121. __pyx_t_4 = 1;
  25122. #if CYTHON_UNPACK_METHODS
  25123. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  25124. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
  25125. assert(__pyx_t_1);
  25126. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  25127. __Pyx_INCREF(__pyx_t_1);
  25128. __Pyx_INCREF(__pyx__function);
  25129. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  25130. __pyx_t_4 = 0;
  25131. }
  25132. #endif
  25133. {
  25134. PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_curve2, __pyx_v_line1};
  25135. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  25136. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25137. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25138. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1412, __pyx_L1_error)
  25139. __Pyx_GOTREF(__pyx_t_2);
  25140. }
  25141. __pyx_v_hits = __pyx_t_2;
  25142. __pyx_t_2 = 0;
  25143. /* "fontTools/misc/bezierTools.py":1415
  25144. * # curve is passed first to this fn but is the second segment, so
  25145. * # we need to swap t1/t2 in the result
  25146. * return [Intersection(pt=x.pt, t1=x.t2, t2=x.t1) for x in hits] # <<<<<<<<<<<<<<
  25147. * elif _is_linelike(curve2):
  25148. * line2 = curve2[0], curve2[-1]
  25149. */
  25150. __Pyx_XDECREF(__pyx_r);
  25151. { /* enter inner scope */
  25152. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25153. __Pyx_GOTREF(__pyx_t_2);
  25154. if (likely(PyList_CheckExact(__pyx_v_hits)) || PyTuple_CheckExact(__pyx_v_hits)) {
  25155. __pyx_t_3 = __pyx_v_hits; __Pyx_INCREF(__pyx_t_3);
  25156. __pyx_t_6 = 0;
  25157. __pyx_t_7 = NULL;
  25158. } else {
  25159. __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_hits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25160. __Pyx_GOTREF(__pyx_t_3);
  25161. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25162. }
  25163. for (;;) {
  25164. if (likely(!__pyx_t_7)) {
  25165. if (likely(PyList_CheckExact(__pyx_t_3))) {
  25166. {
  25167. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
  25168. #if !CYTHON_ASSUME_SAFE_SIZE
  25169. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1415, __pyx_L7_error)
  25170. #endif
  25171. if (__pyx_t_6 >= __pyx_temp) break;
  25172. }
  25173. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
  25174. ++__pyx_t_6;
  25175. } else {
  25176. {
  25177. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
  25178. #if !CYTHON_ASSUME_SAFE_SIZE
  25179. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1415, __pyx_L7_error)
  25180. #endif
  25181. if (__pyx_t_6 >= __pyx_temp) break;
  25182. }
  25183. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  25184. __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6));
  25185. #else
  25186. __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6);
  25187. #endif
  25188. ++__pyx_t_6;
  25189. }
  25190. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25191. } else {
  25192. __pyx_t_1 = __pyx_t_7(__pyx_t_3);
  25193. if (unlikely(!__pyx_t_1)) {
  25194. PyObject* exc_type = PyErr_Occurred();
  25195. if (exc_type) {
  25196. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1415, __pyx_L7_error)
  25197. PyErr_Clear();
  25198. }
  25199. break;
  25200. }
  25201. }
  25202. __Pyx_GOTREF(__pyx_t_1);
  25203. __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_x, __pyx_t_1);
  25204. __pyx_t_1 = 0;
  25205. __pyx_t_8 = NULL;
  25206. __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25207. __Pyx_GOTREF(__pyx_t_9);
  25208. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr8__pyx_v_x, __pyx_mstate_global->__pyx_n_u_pt); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25209. __Pyx_GOTREF(__pyx_t_10);
  25210. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr8__pyx_v_x, __pyx_mstate_global->__pyx_n_u_t2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25211. __Pyx_GOTREF(__pyx_t_11);
  25212. __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr8__pyx_v_x, __pyx_mstate_global->__pyx_n_u_t1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25213. __Pyx_GOTREF(__pyx_t_12);
  25214. __pyx_t_4 = 1;
  25215. #if CYTHON_UNPACK_METHODS
  25216. if (unlikely(PyMethod_Check(__pyx_t_9))) {
  25217. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
  25218. assert(__pyx_t_8);
  25219. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
  25220. __Pyx_INCREF(__pyx_t_8);
  25221. __Pyx_INCREF(__pyx__function);
  25222. __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
  25223. __pyx_t_4 = 0;
  25224. }
  25225. #endif
  25226. {
  25227. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_8, NULL};
  25228. __pyx_t_13 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25229. __Pyx_GOTREF(__pyx_t_13);
  25230. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pt, __pyx_t_10, __pyx_t_13, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25231. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t1, __pyx_t_11, __pyx_t_13, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25232. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t2, __pyx_t_12, __pyx_t_13, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25233. __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_9, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_13);
  25234. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  25235. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  25236. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  25237. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  25238. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  25239. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  25240. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25241. __Pyx_GOTREF(__pyx_t_1);
  25242. }
  25243. if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 1415, __pyx_L7_error)
  25244. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25245. }
  25246. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25247. __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_x); __pyx_8genexpr8__pyx_v_x = 0;
  25248. goto __pyx_L11_exit_scope;
  25249. __pyx_L7_error:;
  25250. __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_x); __pyx_8genexpr8__pyx_v_x = 0;
  25251. goto __pyx_L1_error;
  25252. __pyx_L11_exit_scope:;
  25253. } /* exit inner scope */
  25254. __pyx_r = __pyx_t_2;
  25255. __pyx_t_2 = 0;
  25256. goto __pyx_L0;
  25257. }
  25258. /* "fontTools/misc/bezierTools.py":1406
  25259. * (81.7831487395506, 109.88904552375288)
  25260. * """
  25261. * if _is_linelike(curve1): # <<<<<<<<<<<<<<
  25262. * line1 = curve1[0], curve1[-1]
  25263. * if _is_linelike(curve2):
  25264. */
  25265. }
  25266. /* "fontTools/misc/bezierTools.py":1416
  25267. * # we need to swap t1/t2 in the result
  25268. * return [Intersection(pt=x.pt, t1=x.t2, t2=x.t1) for x in hits]
  25269. * elif _is_linelike(curve2): # <<<<<<<<<<<<<<
  25270. * line2 = curve2[0], curve2[-1]
  25271. * return curveLineIntersections(curve1, line2)
  25272. */
  25273. __pyx_t_3 = NULL;
  25274. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_is_linelike); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1416, __pyx_L1_error)
  25275. __Pyx_GOTREF(__pyx_t_1);
  25276. __pyx_t_4 = 1;
  25277. #if CYTHON_UNPACK_METHODS
  25278. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  25279. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
  25280. assert(__pyx_t_3);
  25281. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  25282. __Pyx_INCREF(__pyx_t_3);
  25283. __Pyx_INCREF(__pyx__function);
  25284. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  25285. __pyx_t_4 = 0;
  25286. }
  25287. #endif
  25288. {
  25289. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_curve2};
  25290. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  25291. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25292. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25293. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1416, __pyx_L1_error)
  25294. __Pyx_GOTREF(__pyx_t_2);
  25295. }
  25296. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1416, __pyx_L1_error)
  25297. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25298. if (__pyx_t_5) {
  25299. /* "fontTools/misc/bezierTools.py":1417
  25300. * return [Intersection(pt=x.pt, t1=x.t2, t2=x.t1) for x in hits]
  25301. * elif _is_linelike(curve2):
  25302. * line2 = curve2[0], curve2[-1] # <<<<<<<<<<<<<<
  25303. * return curveLineIntersections(curve1, line2)
  25304. *
  25305. */
  25306. __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_curve2, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1417, __pyx_L1_error)
  25307. __Pyx_GOTREF(__pyx_t_2);
  25308. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curve2, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1, __Pyx_ReferenceSharing_FunctionArgument); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1417, __pyx_L1_error)
  25309. __Pyx_GOTREF(__pyx_t_1);
  25310. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1417, __pyx_L1_error)
  25311. __Pyx_GOTREF(__pyx_t_3);
  25312. __Pyx_GIVEREF(__pyx_t_2);
  25313. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1417, __pyx_L1_error);
  25314. __Pyx_GIVEREF(__pyx_t_1);
  25315. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1417, __pyx_L1_error);
  25316. __pyx_t_2 = 0;
  25317. __pyx_t_1 = 0;
  25318. __pyx_v_line2 = ((PyObject*)__pyx_t_3);
  25319. __pyx_t_3 = 0;
  25320. /* "fontTools/misc/bezierTools.py":1418
  25321. * elif _is_linelike(curve2):
  25322. * line2 = curve2[0], curve2[-1]
  25323. * return curveLineIntersections(curve1, line2) # <<<<<<<<<<<<<<
  25324. *
  25325. * intersection_ts = _curve_curve_intersections_t(curve1, curve2)
  25326. */
  25327. __Pyx_XDECREF(__pyx_r);
  25328. __pyx_t_1 = NULL;
  25329. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_curveLineIntersections); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1418, __pyx_L1_error)
  25330. __Pyx_GOTREF(__pyx_t_2);
  25331. __pyx_t_4 = 1;
  25332. #if CYTHON_UNPACK_METHODS
  25333. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  25334. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  25335. assert(__pyx_t_1);
  25336. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  25337. __Pyx_INCREF(__pyx_t_1);
  25338. __Pyx_INCREF(__pyx__function);
  25339. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  25340. __pyx_t_4 = 0;
  25341. }
  25342. #endif
  25343. {
  25344. PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_curve1, __pyx_v_line2};
  25345. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_2, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  25346. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25347. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25348. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1418, __pyx_L1_error)
  25349. __Pyx_GOTREF(__pyx_t_3);
  25350. }
  25351. __pyx_r = __pyx_t_3;
  25352. __pyx_t_3 = 0;
  25353. goto __pyx_L0;
  25354. /* "fontTools/misc/bezierTools.py":1416
  25355. * # we need to swap t1/t2 in the result
  25356. * return [Intersection(pt=x.pt, t1=x.t2, t2=x.t1) for x in hits]
  25357. * elif _is_linelike(curve2): # <<<<<<<<<<<<<<
  25358. * line2 = curve2[0], curve2[-1]
  25359. * return curveLineIntersections(curve1, line2)
  25360. */
  25361. }
  25362. /* "fontTools/misc/bezierTools.py":1420
  25363. * return curveLineIntersections(curve1, line2)
  25364. *
  25365. * intersection_ts = _curve_curve_intersections_t(curve1, curve2) # <<<<<<<<<<<<<<
  25366. * return [
  25367. * Intersection(pt=segmentPointAtT(curve1, ts[0]), t1=ts[0], t2=ts[1])
  25368. */
  25369. __pyx_t_2 = NULL;
  25370. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_curve_curve_intersections_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1420, __pyx_L1_error)
  25371. __Pyx_GOTREF(__pyx_t_1);
  25372. __pyx_t_4 = 1;
  25373. #if CYTHON_UNPACK_METHODS
  25374. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  25375. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  25376. assert(__pyx_t_2);
  25377. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  25378. __Pyx_INCREF(__pyx_t_2);
  25379. __Pyx_INCREF(__pyx__function);
  25380. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  25381. __pyx_t_4 = 0;
  25382. }
  25383. #endif
  25384. {
  25385. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_curve1, __pyx_v_curve2};
  25386. __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_1, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  25387. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  25388. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25389. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1420, __pyx_L1_error)
  25390. __Pyx_GOTREF(__pyx_t_3);
  25391. }
  25392. __pyx_v_intersection_ts = __pyx_t_3;
  25393. __pyx_t_3 = 0;
  25394. /* "fontTools/misc/bezierTools.py":1421
  25395. *
  25396. * intersection_ts = _curve_curve_intersections_t(curve1, curve2)
  25397. * return [ # <<<<<<<<<<<<<<
  25398. * Intersection(pt=segmentPointAtT(curve1, ts[0]), t1=ts[0], t2=ts[1])
  25399. * for ts in intersection_ts
  25400. */
  25401. __Pyx_XDECREF(__pyx_r);
  25402. { /* enter inner scope */
  25403. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1421, __pyx_L14_error)
  25404. __Pyx_GOTREF(__pyx_t_3);
  25405. /* "fontTools/misc/bezierTools.py":1423
  25406. * return [
  25407. * Intersection(pt=segmentPointAtT(curve1, ts[0]), t1=ts[0], t2=ts[1])
  25408. * for ts in intersection_ts # <<<<<<<<<<<<<<
  25409. * ]
  25410. *
  25411. */
  25412. if (likely(PyList_CheckExact(__pyx_v_intersection_ts)) || PyTuple_CheckExact(__pyx_v_intersection_ts)) {
  25413. __pyx_t_1 = __pyx_v_intersection_ts; __Pyx_INCREF(__pyx_t_1);
  25414. __pyx_t_6 = 0;
  25415. __pyx_t_7 = NULL;
  25416. } else {
  25417. __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_intersection_ts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L14_error)
  25418. __Pyx_GOTREF(__pyx_t_1);
  25419. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1423, __pyx_L14_error)
  25420. }
  25421. for (;;) {
  25422. if (likely(!__pyx_t_7)) {
  25423. if (likely(PyList_CheckExact(__pyx_t_1))) {
  25424. {
  25425. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  25426. #if !CYTHON_ASSUME_SAFE_SIZE
  25427. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1423, __pyx_L14_error)
  25428. #endif
  25429. if (__pyx_t_6 >= __pyx_temp) break;
  25430. }
  25431. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
  25432. ++__pyx_t_6;
  25433. } else {
  25434. {
  25435. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  25436. #if !CYTHON_ASSUME_SAFE_SIZE
  25437. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1423, __pyx_L14_error)
  25438. #endif
  25439. if (__pyx_t_6 >= __pyx_temp) break;
  25440. }
  25441. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  25442. __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6));
  25443. #else
  25444. __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6);
  25445. #endif
  25446. ++__pyx_t_6;
  25447. }
  25448. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1423, __pyx_L14_error)
  25449. } else {
  25450. __pyx_t_2 = __pyx_t_7(__pyx_t_1);
  25451. if (unlikely(!__pyx_t_2)) {
  25452. PyObject* exc_type = PyErr_Occurred();
  25453. if (exc_type) {
  25454. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1423, __pyx_L14_error)
  25455. PyErr_Clear();
  25456. }
  25457. break;
  25458. }
  25459. }
  25460. __Pyx_GOTREF(__pyx_t_2);
  25461. __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_ts, __pyx_t_2);
  25462. __pyx_t_2 = 0;
  25463. /* "fontTools/misc/bezierTools.py":1422
  25464. * intersection_ts = _curve_curve_intersections_t(curve1, curve2)
  25465. * return [
  25466. * Intersection(pt=segmentPointAtT(curve1, ts[0]), t1=ts[0], t2=ts[1]) # <<<<<<<<<<<<<<
  25467. * for ts in intersection_ts
  25468. * ]
  25469. */
  25470. __pyx_t_9 = NULL;
  25471. __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25472. __Pyx_GOTREF(__pyx_t_13);
  25473. __pyx_t_11 = NULL;
  25474. __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_segmentPointAtT); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25475. __Pyx_GOTREF(__pyx_t_10);
  25476. __pyx_t_8 = __Pyx_GetItemInt(__pyx_8genexpr9__pyx_v_ts, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25477. __Pyx_GOTREF(__pyx_t_8);
  25478. __pyx_t_4 = 1;
  25479. #if CYTHON_UNPACK_METHODS
  25480. if (unlikely(PyMethod_Check(__pyx_t_10))) {
  25481. __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
  25482. assert(__pyx_t_11);
  25483. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
  25484. __Pyx_INCREF(__pyx_t_11);
  25485. __Pyx_INCREF(__pyx__function);
  25486. __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
  25487. __pyx_t_4 = 0;
  25488. }
  25489. #endif
  25490. {
  25491. PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_v_curve1, __pyx_t_8};
  25492. __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_10, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  25493. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  25494. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  25495. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  25496. if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25497. __Pyx_GOTREF(__pyx_t_12);
  25498. }
  25499. __pyx_t_10 = __Pyx_GetItemInt(__pyx_8genexpr9__pyx_v_ts, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25500. __Pyx_GOTREF(__pyx_t_10);
  25501. __pyx_t_8 = __Pyx_GetItemInt(__pyx_8genexpr9__pyx_v_ts, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25502. __Pyx_GOTREF(__pyx_t_8);
  25503. __pyx_t_4 = 1;
  25504. #if CYTHON_UNPACK_METHODS
  25505. if (unlikely(PyMethod_Check(__pyx_t_13))) {
  25506. __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_13);
  25507. assert(__pyx_t_9);
  25508. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
  25509. __Pyx_INCREF(__pyx_t_9);
  25510. __Pyx_INCREF(__pyx__function);
  25511. __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
  25512. __pyx_t_4 = 0;
  25513. }
  25514. #endif
  25515. {
  25516. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_9, NULL};
  25517. __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25518. __Pyx_GOTREF(__pyx_t_11);
  25519. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pt, __pyx_t_12, __pyx_t_11, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25520. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t1, __pyx_t_10, __pyx_t_11, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25521. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t2, __pyx_t_8, __pyx_t_11, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25522. __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_11);
  25523. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  25524. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  25525. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  25526. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  25527. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  25528. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  25529. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25530. __Pyx_GOTREF(__pyx_t_2);
  25531. }
  25532. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 1421, __pyx_L14_error)
  25533. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25534. /* "fontTools/misc/bezierTools.py":1423
  25535. * return [
  25536. * Intersection(pt=segmentPointAtT(curve1, ts[0]), t1=ts[0], t2=ts[1])
  25537. * for ts in intersection_ts # <<<<<<<<<<<<<<
  25538. * ]
  25539. *
  25540. */
  25541. }
  25542. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25543. __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_ts); __pyx_8genexpr9__pyx_v_ts = 0;
  25544. goto __pyx_L18_exit_scope;
  25545. __pyx_L14_error:;
  25546. __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_ts); __pyx_8genexpr9__pyx_v_ts = 0;
  25547. goto __pyx_L1_error;
  25548. __pyx_L18_exit_scope:;
  25549. } /* exit inner scope */
  25550. __pyx_r = __pyx_t_3;
  25551. __pyx_t_3 = 0;
  25552. goto __pyx_L0;
  25553. /* "fontTools/misc/bezierTools.py":1385
  25554. *
  25555. *
  25556. * def curveCurveIntersections(curve1, curve2): # <<<<<<<<<<<<<<
  25557. * """Finds intersections between a curve and a curve.
  25558. *
  25559. */
  25560. /* function exit code */
  25561. __pyx_L1_error:;
  25562. __Pyx_XDECREF(__pyx_t_1);
  25563. __Pyx_XDECREF(__pyx_t_2);
  25564. __Pyx_XDECREF(__pyx_t_3);
  25565. __Pyx_XDECREF(__pyx_t_8);
  25566. __Pyx_XDECREF(__pyx_t_9);
  25567. __Pyx_XDECREF(__pyx_t_10);
  25568. __Pyx_XDECREF(__pyx_t_11);
  25569. __Pyx_XDECREF(__pyx_t_12);
  25570. __Pyx_XDECREF(__pyx_t_13);
  25571. __Pyx_AddTraceback("fontTools.misc.bezierTools.curveCurveIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25572. __pyx_r = NULL;
  25573. __pyx_L0:;
  25574. __Pyx_XDECREF(__pyx_v_line1);
  25575. __Pyx_XDECREF(__pyx_v_line2);
  25576. __Pyx_XDECREF(__pyx_v_hits);
  25577. __Pyx_XDECREF(__pyx_v_intersection_ts);
  25578. __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_x);
  25579. __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_ts);
  25580. __Pyx_XGIVEREF(__pyx_r);
  25581. __Pyx_RefNannyFinishContext();
  25582. return __pyx_r;
  25583. }
  25584. /* "fontTools/misc/bezierTools.py":1427
  25585. *
  25586. *
  25587. * def segmentSegmentIntersections(seg1, seg2): # <<<<<<<<<<<<<<
  25588. * """Finds intersections between two segments.
  25589. *
  25590. */
  25591. /* Python wrapper */
  25592. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_91segmentSegmentIntersections(PyObject *__pyx_self,
  25593. #if CYTHON_METH_FASTCALL
  25594. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  25595. #else
  25596. PyObject *__pyx_args, PyObject *__pyx_kwds
  25597. #endif
  25598. ); /*proto*/
  25599. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_90segmentSegmentIntersections, "segmentSegmentIntersections(seg1, seg2)\n\nFinds intersections between two segments.\n\nArgs:\n seg1: List of coordinates of the first segment as 2D tuples.\n seg2: List of coordinates of the second segment as 2D tuples.\n\nReturns:\n A list of ``Intersection`` objects, each object having ``pt``, ``t1``\n and ``t2`` attributes containing the intersection point, time on first\n segment and time on second segment respectively.\n\nExamples::\n >>> curve1 = [ (10,100), (90,30), (40,140), (220,220) ]\n >>> curve2 = [ (5,150), (180,20), (80,250), (210,190) ]\n >>> intersections = segmentSegmentIntersections(curve1, curve2)\n >>> len(intersections)\n 3\n >>> intersections[0].pt\n (81.7831487395506, 109.88904552375288)\n >>> curve3 = [ (100, 240), (30, 60), (210, 230), (160, 30) ]\n >>> line = [ (25, 260), (230, 20) ]\n >>> intersections = segmentSegmentIntersections(curve3, line)\n >>> len(intersections)\n 3\n >>> intersections[0].pt\n (84.9000930760723, 189.87306176459828)");
  25600. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_91segmentSegmentIntersections = {"segmentSegmentIntersections", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_91segmentSegmentIntersections, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_90segmentSegmentIntersections};
  25601. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_91segmentSegmentIntersections(PyObject *__pyx_self,
  25602. #if CYTHON_METH_FASTCALL
  25603. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  25604. #else
  25605. PyObject *__pyx_args, PyObject *__pyx_kwds
  25606. #endif
  25607. ) {
  25608. PyObject *__pyx_v_seg1 = 0;
  25609. PyObject *__pyx_v_seg2 = 0;
  25610. #if !CYTHON_METH_FASTCALL
  25611. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  25612. #endif
  25613. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  25614. PyObject* values[2] = {0,0};
  25615. int __pyx_lineno = 0;
  25616. const char *__pyx_filename = NULL;
  25617. int __pyx_clineno = 0;
  25618. PyObject *__pyx_r = 0;
  25619. __Pyx_RefNannyDeclarations
  25620. __Pyx_RefNannySetupContext("segmentSegmentIntersections (wrapper)", 0);
  25621. #if !CYTHON_METH_FASTCALL
  25622. #if CYTHON_ASSUME_SAFE_SIZE
  25623. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  25624. #else
  25625. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  25626. #endif
  25627. #endif
  25628. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  25629. {
  25630. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_seg1,&__pyx_mstate_global->__pyx_n_u_seg2,0};
  25631. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  25632. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1427, __pyx_L3_error)
  25633. if (__pyx_kwds_len > 0) {
  25634. switch (__pyx_nargs) {
  25635. case 2:
  25636. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  25637. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1427, __pyx_L3_error)
  25638. CYTHON_FALLTHROUGH;
  25639. case 1:
  25640. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  25641. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1427, __pyx_L3_error)
  25642. CYTHON_FALLTHROUGH;
  25643. case 0: break;
  25644. default: goto __pyx_L5_argtuple_error;
  25645. }
  25646. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  25647. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "segmentSegmentIntersections", 0) < (0)) __PYX_ERR(0, 1427, __pyx_L3_error)
  25648. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  25649. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("segmentSegmentIntersections", 1, 2, 2, i); __PYX_ERR(0, 1427, __pyx_L3_error) }
  25650. }
  25651. } else if (unlikely(__pyx_nargs != 2)) {
  25652. goto __pyx_L5_argtuple_error;
  25653. } else {
  25654. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  25655. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1427, __pyx_L3_error)
  25656. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  25657. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1427, __pyx_L3_error)
  25658. }
  25659. __pyx_v_seg1 = values[0];
  25660. __pyx_v_seg2 = values[1];
  25661. }
  25662. goto __pyx_L6_skip;
  25663. __pyx_L5_argtuple_error:;
  25664. __Pyx_RaiseArgtupleInvalid("segmentSegmentIntersections", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1427, __pyx_L3_error)
  25665. __pyx_L6_skip:;
  25666. goto __pyx_L4_argument_unpacking_done;
  25667. __pyx_L3_error:;
  25668. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  25669. Py_XDECREF(values[__pyx_temp]);
  25670. }
  25671. __Pyx_AddTraceback("fontTools.misc.bezierTools.segmentSegmentIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25672. __Pyx_RefNannyFinishContext();
  25673. return NULL;
  25674. __pyx_L4_argument_unpacking_done:;
  25675. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_90segmentSegmentIntersections(__pyx_self, __pyx_v_seg1, __pyx_v_seg2);
  25676. /* function exit code */
  25677. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  25678. Py_XDECREF(values[__pyx_temp]);
  25679. }
  25680. __Pyx_RefNannyFinishContext();
  25681. return __pyx_r;
  25682. }
  25683. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_90segmentSegmentIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_seg1, PyObject *__pyx_v_seg2) {
  25684. int __pyx_v_swapped;
  25685. PyObject *__pyx_v_intersections = NULL;
  25686. PyObject *__pyx_9genexpr10__pyx_v_i = NULL;
  25687. PyObject *__pyx_r = NULL;
  25688. __Pyx_RefNannyDeclarations
  25689. Py_ssize_t __pyx_t_1;
  25690. Py_ssize_t __pyx_t_2;
  25691. int __pyx_t_3;
  25692. PyObject *__pyx_t_4 = NULL;
  25693. PyObject *__pyx_t_5 = NULL;
  25694. PyObject *__pyx_t_6 = NULL;
  25695. PyObject *__pyx_t_7 = NULL;
  25696. PyObject *__pyx_t_8 = NULL;
  25697. size_t __pyx_t_9;
  25698. int __pyx_t_10;
  25699. PyObject *__pyx_t_11 = NULL;
  25700. PyObject *(*__pyx_t_12)(PyObject *);
  25701. PyObject *__pyx_t_13 = NULL;
  25702. PyObject *__pyx_t_14 = NULL;
  25703. PyObject *__pyx_t_15 = NULL;
  25704. PyObject *__pyx_t_16 = NULL;
  25705. PyObject *__pyx_t_17 = NULL;
  25706. int __pyx_lineno = 0;
  25707. const char *__pyx_filename = NULL;
  25708. int __pyx_clineno = 0;
  25709. __Pyx_RefNannySetupContext("segmentSegmentIntersections", 0);
  25710. __Pyx_INCREF(__pyx_v_seg1);
  25711. __Pyx_INCREF(__pyx_v_seg2);
  25712. /* "fontTools/misc/bezierTools.py":1457
  25713. * """
  25714. * # Arrange by degree
  25715. * swapped = False # <<<<<<<<<<<<<<
  25716. * if len(seg2) > len(seg1):
  25717. * seg2, seg1 = seg1, seg2
  25718. */
  25719. __pyx_v_swapped = 0;
  25720. /* "fontTools/misc/bezierTools.py":1458
  25721. * # Arrange by degree
  25722. * swapped = False
  25723. * if len(seg2) > len(seg1): # <<<<<<<<<<<<<<
  25724. * seg2, seg1 = seg1, seg2
  25725. * swapped = True
  25726. */
  25727. __pyx_t_1 = PyObject_Length(__pyx_v_seg2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1458, __pyx_L1_error)
  25728. __pyx_t_2 = PyObject_Length(__pyx_v_seg1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1458, __pyx_L1_error)
  25729. __pyx_t_3 = (__pyx_t_1 > __pyx_t_2);
  25730. if (__pyx_t_3) {
  25731. /* "fontTools/misc/bezierTools.py":1459
  25732. * swapped = False
  25733. * if len(seg2) > len(seg1):
  25734. * seg2, seg1 = seg1, seg2 # <<<<<<<<<<<<<<
  25735. * swapped = True
  25736. * if len(seg1) > 2:
  25737. */
  25738. __pyx_t_4 = __pyx_v_seg1;
  25739. __pyx_t_5 = __pyx_v_seg2;
  25740. __pyx_v_seg2 = __pyx_t_4;
  25741. __pyx_t_4 = 0;
  25742. __pyx_v_seg1 = __pyx_t_5;
  25743. __pyx_t_5 = 0;
  25744. /* "fontTools/misc/bezierTools.py":1460
  25745. * if len(seg2) > len(seg1):
  25746. * seg2, seg1 = seg1, seg2
  25747. * swapped = True # <<<<<<<<<<<<<<
  25748. * if len(seg1) > 2:
  25749. * if len(seg2) > 2:
  25750. */
  25751. __pyx_v_swapped = 1;
  25752. /* "fontTools/misc/bezierTools.py":1458
  25753. * # Arrange by degree
  25754. * swapped = False
  25755. * if len(seg2) > len(seg1): # <<<<<<<<<<<<<<
  25756. * seg2, seg1 = seg1, seg2
  25757. * swapped = True
  25758. */
  25759. }
  25760. /* "fontTools/misc/bezierTools.py":1461
  25761. * seg2, seg1 = seg1, seg2
  25762. * swapped = True
  25763. * if len(seg1) > 2: # <<<<<<<<<<<<<<
  25764. * if len(seg2) > 2:
  25765. * intersections = curveCurveIntersections(seg1, seg2)
  25766. */
  25767. __pyx_t_2 = PyObject_Length(__pyx_v_seg1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1461, __pyx_L1_error)
  25768. __pyx_t_3 = (__pyx_t_2 > 2);
  25769. if (__pyx_t_3) {
  25770. /* "fontTools/misc/bezierTools.py":1462
  25771. * swapped = True
  25772. * if len(seg1) > 2:
  25773. * if len(seg2) > 2: # <<<<<<<<<<<<<<
  25774. * intersections = curveCurveIntersections(seg1, seg2)
  25775. * else:
  25776. */
  25777. __pyx_t_2 = PyObject_Length(__pyx_v_seg2); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1462, __pyx_L1_error)
  25778. __pyx_t_3 = (__pyx_t_2 > 2);
  25779. if (__pyx_t_3) {
  25780. /* "fontTools/misc/bezierTools.py":1463
  25781. * if len(seg1) > 2:
  25782. * if len(seg2) > 2:
  25783. * intersections = curveCurveIntersections(seg1, seg2) # <<<<<<<<<<<<<<
  25784. * else:
  25785. * intersections = curveLineIntersections(seg1, seg2)
  25786. */
  25787. __pyx_t_7 = NULL;
  25788. __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_curveCurveIntersections); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1463, __pyx_L1_error)
  25789. __Pyx_GOTREF(__pyx_t_8);
  25790. __pyx_t_9 = 1;
  25791. #if CYTHON_UNPACK_METHODS
  25792. if (unlikely(PyMethod_Check(__pyx_t_8))) {
  25793. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
  25794. assert(__pyx_t_7);
  25795. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
  25796. __Pyx_INCREF(__pyx_t_7);
  25797. __Pyx_INCREF(__pyx__function);
  25798. __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
  25799. __pyx_t_9 = 0;
  25800. }
  25801. #endif
  25802. {
  25803. PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_seg1, __pyx_v_seg2};
  25804. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  25805. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  25806. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  25807. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1463, __pyx_L1_error)
  25808. __Pyx_GOTREF(__pyx_t_6);
  25809. }
  25810. __pyx_v_intersections = __pyx_t_6;
  25811. __pyx_t_6 = 0;
  25812. /* "fontTools/misc/bezierTools.py":1462
  25813. * swapped = True
  25814. * if len(seg1) > 2:
  25815. * if len(seg2) > 2: # <<<<<<<<<<<<<<
  25816. * intersections = curveCurveIntersections(seg1, seg2)
  25817. * else:
  25818. */
  25819. goto __pyx_L5;
  25820. }
  25821. /* "fontTools/misc/bezierTools.py":1465
  25822. * intersections = curveCurveIntersections(seg1, seg2)
  25823. * else:
  25824. * intersections = curveLineIntersections(seg1, seg2) # <<<<<<<<<<<<<<
  25825. * elif len(seg1) == 2 and len(seg2) == 2:
  25826. * intersections = lineLineIntersections(*seg1, *seg2)
  25827. */
  25828. /*else*/ {
  25829. __pyx_t_8 = NULL;
  25830. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_curveLineIntersections); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1465, __pyx_L1_error)
  25831. __Pyx_GOTREF(__pyx_t_7);
  25832. __pyx_t_9 = 1;
  25833. #if CYTHON_UNPACK_METHODS
  25834. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  25835. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
  25836. assert(__pyx_t_8);
  25837. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  25838. __Pyx_INCREF(__pyx_t_8);
  25839. __Pyx_INCREF(__pyx__function);
  25840. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  25841. __pyx_t_9 = 0;
  25842. }
  25843. #endif
  25844. {
  25845. PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_v_seg1, __pyx_v_seg2};
  25846. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  25847. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  25848. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  25849. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1465, __pyx_L1_error)
  25850. __Pyx_GOTREF(__pyx_t_6);
  25851. }
  25852. __pyx_v_intersections = __pyx_t_6;
  25853. __pyx_t_6 = 0;
  25854. }
  25855. __pyx_L5:;
  25856. /* "fontTools/misc/bezierTools.py":1461
  25857. * seg2, seg1 = seg1, seg2
  25858. * swapped = True
  25859. * if len(seg1) > 2: # <<<<<<<<<<<<<<
  25860. * if len(seg2) > 2:
  25861. * intersections = curveCurveIntersections(seg1, seg2)
  25862. */
  25863. goto __pyx_L4;
  25864. }
  25865. /* "fontTools/misc/bezierTools.py":1466
  25866. * else:
  25867. * intersections = curveLineIntersections(seg1, seg2)
  25868. * elif len(seg1) == 2 and len(seg2) == 2: # <<<<<<<<<<<<<<
  25869. * intersections = lineLineIntersections(*seg1, *seg2)
  25870. * else:
  25871. */
  25872. __pyx_t_2 = PyObject_Length(__pyx_v_seg1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1466, __pyx_L1_error)
  25873. __pyx_t_10 = (__pyx_t_2 == 2);
  25874. if (__pyx_t_10) {
  25875. } else {
  25876. __pyx_t_3 = __pyx_t_10;
  25877. goto __pyx_L6_bool_binop_done;
  25878. }
  25879. __pyx_t_2 = PyObject_Length(__pyx_v_seg2); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1466, __pyx_L1_error)
  25880. __pyx_t_10 = (__pyx_t_2 == 2);
  25881. __pyx_t_3 = __pyx_t_10;
  25882. __pyx_L6_bool_binop_done:;
  25883. if (likely(__pyx_t_3)) {
  25884. /* "fontTools/misc/bezierTools.py":1467
  25885. * intersections = curveLineIntersections(seg1, seg2)
  25886. * elif len(seg1) == 2 and len(seg2) == 2:
  25887. * intersections = lineLineIntersections(*seg1, *seg2) # <<<<<<<<<<<<<<
  25888. * else:
  25889. * raise ValueError("Couldn't work out which intersection function to use")
  25890. */
  25891. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_lineLineIntersections); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1467, __pyx_L1_error)
  25892. __Pyx_GOTREF(__pyx_t_6);
  25893. __pyx_t_7 = __Pyx_PySequence_Tuple(__pyx_v_seg1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1467, __pyx_L1_error)
  25894. __Pyx_GOTREF(__pyx_t_7);
  25895. __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_v_seg2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1467, __pyx_L1_error)
  25896. __Pyx_GOTREF(__pyx_t_8);
  25897. __pyx_t_11 = PyNumber_Add(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1467, __pyx_L1_error)
  25898. __Pyx_GOTREF(__pyx_t_11);
  25899. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  25900. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  25901. __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1467, __pyx_L1_error)
  25902. __Pyx_GOTREF(__pyx_t_8);
  25903. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  25904. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  25905. __pyx_v_intersections = __pyx_t_8;
  25906. __pyx_t_8 = 0;
  25907. /* "fontTools/misc/bezierTools.py":1466
  25908. * else:
  25909. * intersections = curveLineIntersections(seg1, seg2)
  25910. * elif len(seg1) == 2 and len(seg2) == 2: # <<<<<<<<<<<<<<
  25911. * intersections = lineLineIntersections(*seg1, *seg2)
  25912. * else:
  25913. */
  25914. goto __pyx_L4;
  25915. }
  25916. /* "fontTools/misc/bezierTools.py":1469
  25917. * intersections = lineLineIntersections(*seg1, *seg2)
  25918. * else:
  25919. * raise ValueError("Couldn't work out which intersection function to use") # <<<<<<<<<<<<<<
  25920. * if not swapped:
  25921. * return intersections
  25922. */
  25923. /*else*/ {
  25924. __pyx_t_11 = NULL;
  25925. __pyx_t_9 = 1;
  25926. {
  25927. PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_Couldn_t_work_out_which_intersec};
  25928. __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  25929. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  25930. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1469, __pyx_L1_error)
  25931. __Pyx_GOTREF(__pyx_t_8);
  25932. }
  25933. __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  25934. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  25935. __PYX_ERR(0, 1469, __pyx_L1_error)
  25936. }
  25937. __pyx_L4:;
  25938. /* "fontTools/misc/bezierTools.py":1470
  25939. * else:
  25940. * raise ValueError("Couldn't work out which intersection function to use")
  25941. * if not swapped: # <<<<<<<<<<<<<<
  25942. * return intersections
  25943. * return [Intersection(pt=i.pt, t1=i.t2, t2=i.t1) for i in intersections]
  25944. */
  25945. __pyx_t_3 = (!__pyx_v_swapped);
  25946. if (__pyx_t_3) {
  25947. /* "fontTools/misc/bezierTools.py":1471
  25948. * raise ValueError("Couldn't work out which intersection function to use")
  25949. * if not swapped:
  25950. * return intersections # <<<<<<<<<<<<<<
  25951. * return [Intersection(pt=i.pt, t1=i.t2, t2=i.t1) for i in intersections]
  25952. *
  25953. */
  25954. __Pyx_XDECREF(__pyx_r);
  25955. __Pyx_INCREF(__pyx_v_intersections);
  25956. __pyx_r = __pyx_v_intersections;
  25957. goto __pyx_L0;
  25958. /* "fontTools/misc/bezierTools.py":1470
  25959. * else:
  25960. * raise ValueError("Couldn't work out which intersection function to use")
  25961. * if not swapped: # <<<<<<<<<<<<<<
  25962. * return intersections
  25963. * return [Intersection(pt=i.pt, t1=i.t2, t2=i.t1) for i in intersections]
  25964. */
  25965. }
  25966. /* "fontTools/misc/bezierTools.py":1472
  25967. * if not swapped:
  25968. * return intersections
  25969. * return [Intersection(pt=i.pt, t1=i.t2, t2=i.t1) for i in intersections] # <<<<<<<<<<<<<<
  25970. *
  25971. *
  25972. */
  25973. __Pyx_XDECREF(__pyx_r);
  25974. { /* enter inner scope */
  25975. __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1472, __pyx_L11_error)
  25976. __Pyx_GOTREF(__pyx_t_8);
  25977. if (likely(PyList_CheckExact(__pyx_v_intersections)) || PyTuple_CheckExact(__pyx_v_intersections)) {
  25978. __pyx_t_11 = __pyx_v_intersections; __Pyx_INCREF(__pyx_t_11);
  25979. __pyx_t_2 = 0;
  25980. __pyx_t_12 = NULL;
  25981. } else {
  25982. __pyx_t_2 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_intersections); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1472, __pyx_L11_error)
  25983. __Pyx_GOTREF(__pyx_t_11);
  25984. __pyx_t_12 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1472, __pyx_L11_error)
  25985. }
  25986. for (;;) {
  25987. if (likely(!__pyx_t_12)) {
  25988. if (likely(PyList_CheckExact(__pyx_t_11))) {
  25989. {
  25990. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11);
  25991. #if !CYTHON_ASSUME_SAFE_SIZE
  25992. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1472, __pyx_L11_error)
  25993. #endif
  25994. if (__pyx_t_2 >= __pyx_temp) break;
  25995. }
  25996. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_11, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  25997. ++__pyx_t_2;
  25998. } else {
  25999. {
  26000. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_11);
  26001. #if !CYTHON_ASSUME_SAFE_SIZE
  26002. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1472, __pyx_L11_error)
  26003. #endif
  26004. if (__pyx_t_2 >= __pyx_temp) break;
  26005. }
  26006. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  26007. __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_2));
  26008. #else
  26009. __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_11, __pyx_t_2);
  26010. #endif
  26011. ++__pyx_t_2;
  26012. }
  26013. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26014. } else {
  26015. __pyx_t_6 = __pyx_t_12(__pyx_t_11);
  26016. if (unlikely(!__pyx_t_6)) {
  26017. PyObject* exc_type = PyErr_Occurred();
  26018. if (exc_type) {
  26019. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1472, __pyx_L11_error)
  26020. PyErr_Clear();
  26021. }
  26022. break;
  26023. }
  26024. }
  26025. __Pyx_GOTREF(__pyx_t_6);
  26026. __Pyx_XDECREF_SET(__pyx_9genexpr10__pyx_v_i, __pyx_t_6);
  26027. __pyx_t_6 = 0;
  26028. __pyx_t_7 = NULL;
  26029. __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26030. __Pyx_GOTREF(__pyx_t_13);
  26031. __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr10__pyx_v_i, __pyx_mstate_global->__pyx_n_u_pt); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26032. __Pyx_GOTREF(__pyx_t_14);
  26033. __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr10__pyx_v_i, __pyx_mstate_global->__pyx_n_u_t2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26034. __Pyx_GOTREF(__pyx_t_15);
  26035. __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr10__pyx_v_i, __pyx_mstate_global->__pyx_n_u_t1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26036. __Pyx_GOTREF(__pyx_t_16);
  26037. __pyx_t_9 = 1;
  26038. #if CYTHON_UNPACK_METHODS
  26039. if (unlikely(PyMethod_Check(__pyx_t_13))) {
  26040. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_13);
  26041. assert(__pyx_t_7);
  26042. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
  26043. __Pyx_INCREF(__pyx_t_7);
  26044. __Pyx_INCREF(__pyx__function);
  26045. __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
  26046. __pyx_t_9 = 0;
  26047. }
  26048. #endif
  26049. {
  26050. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_7, NULL};
  26051. __pyx_t_17 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26052. __Pyx_GOTREF(__pyx_t_17);
  26053. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_pt, __pyx_t_14, __pyx_t_17, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26054. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t1, __pyx_t_15, __pyx_t_17, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26055. if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_t2, __pyx_t_16, __pyx_t_17, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26056. __pyx_t_6 = __Pyx_Object_Vectorcall_CallFromBuilder((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_17);
  26057. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  26058. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  26059. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  26060. __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  26061. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  26062. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  26063. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26064. __Pyx_GOTREF(__pyx_t_6);
  26065. }
  26066. if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 1472, __pyx_L11_error)
  26067. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  26068. }
  26069. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  26070. __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_i); __pyx_9genexpr10__pyx_v_i = 0;
  26071. goto __pyx_L15_exit_scope;
  26072. __pyx_L11_error:;
  26073. __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_i); __pyx_9genexpr10__pyx_v_i = 0;
  26074. goto __pyx_L1_error;
  26075. __pyx_L15_exit_scope:;
  26076. } /* exit inner scope */
  26077. __pyx_r = __pyx_t_8;
  26078. __pyx_t_8 = 0;
  26079. goto __pyx_L0;
  26080. /* "fontTools/misc/bezierTools.py":1427
  26081. *
  26082. *
  26083. * def segmentSegmentIntersections(seg1, seg2): # <<<<<<<<<<<<<<
  26084. * """Finds intersections between two segments.
  26085. *
  26086. */
  26087. /* function exit code */
  26088. __pyx_L1_error:;
  26089. __Pyx_XDECREF(__pyx_t_6);
  26090. __Pyx_XDECREF(__pyx_t_7);
  26091. __Pyx_XDECREF(__pyx_t_8);
  26092. __Pyx_XDECREF(__pyx_t_11);
  26093. __Pyx_XDECREF(__pyx_t_13);
  26094. __Pyx_XDECREF(__pyx_t_14);
  26095. __Pyx_XDECREF(__pyx_t_15);
  26096. __Pyx_XDECREF(__pyx_t_16);
  26097. __Pyx_XDECREF(__pyx_t_17);
  26098. __Pyx_AddTraceback("fontTools.misc.bezierTools.segmentSegmentIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26099. __pyx_r = NULL;
  26100. __pyx_L0:;
  26101. __Pyx_XDECREF(__pyx_v_intersections);
  26102. __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_i);
  26103. __Pyx_XDECREF(__pyx_v_seg1);
  26104. __Pyx_XDECREF(__pyx_v_seg2);
  26105. __Pyx_XGIVEREF(__pyx_r);
  26106. __Pyx_RefNannyFinishContext();
  26107. return __pyx_r;
  26108. }
  26109. /* "fontTools/misc/bezierTools.py":1475
  26110. *
  26111. *
  26112. * def _segmentrepr(obj): # <<<<<<<<<<<<<<
  26113. * """
  26114. * >>> _segmentrepr([1, [2, 3], [], [[2, [3, 4], [0.1, 2.2]]]])
  26115. */
  26116. /* Python wrapper */
  26117. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_93_segmentrepr(PyObject *__pyx_self,
  26118. #if CYTHON_METH_FASTCALL
  26119. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  26120. #else
  26121. PyObject *__pyx_args, PyObject *__pyx_kwds
  26122. #endif
  26123. ); /*proto*/
  26124. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_92_segmentrepr, "_segmentrepr(obj)\n\n>>> _segmentrepr([1, [2, 3], [], [[2, [3, 4], [0.1, 2.2]]]])\n'(1, (2, 3), (), ((2, (3, 4), (0.1, 2.2))))'");
  26125. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_93_segmentrepr = {"_segmentrepr", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_93_segmentrepr, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_92_segmentrepr};
  26126. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_93_segmentrepr(PyObject *__pyx_self,
  26127. #if CYTHON_METH_FASTCALL
  26128. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  26129. #else
  26130. PyObject *__pyx_args, PyObject *__pyx_kwds
  26131. #endif
  26132. ) {
  26133. PyObject *__pyx_v_obj = 0;
  26134. #if !CYTHON_METH_FASTCALL
  26135. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  26136. #endif
  26137. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  26138. PyObject* values[1] = {0};
  26139. int __pyx_lineno = 0;
  26140. const char *__pyx_filename = NULL;
  26141. int __pyx_clineno = 0;
  26142. PyObject *__pyx_r = 0;
  26143. __Pyx_RefNannyDeclarations
  26144. __Pyx_RefNannySetupContext("_segmentrepr (wrapper)", 0);
  26145. #if !CYTHON_METH_FASTCALL
  26146. #if CYTHON_ASSUME_SAFE_SIZE
  26147. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  26148. #else
  26149. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  26150. #endif
  26151. #endif
  26152. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  26153. {
  26154. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_obj,0};
  26155. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  26156. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1475, __pyx_L3_error)
  26157. if (__pyx_kwds_len > 0) {
  26158. switch (__pyx_nargs) {
  26159. case 1:
  26160. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  26161. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1475, __pyx_L3_error)
  26162. CYTHON_FALLTHROUGH;
  26163. case 0: break;
  26164. default: goto __pyx_L5_argtuple_error;
  26165. }
  26166. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  26167. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_segmentrepr", 0) < (0)) __PYX_ERR(0, 1475, __pyx_L3_error)
  26168. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  26169. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_segmentrepr", 1, 1, 1, i); __PYX_ERR(0, 1475, __pyx_L3_error) }
  26170. }
  26171. } else if (unlikely(__pyx_nargs != 1)) {
  26172. goto __pyx_L5_argtuple_error;
  26173. } else {
  26174. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  26175. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1475, __pyx_L3_error)
  26176. }
  26177. __pyx_v_obj = values[0];
  26178. }
  26179. goto __pyx_L6_skip;
  26180. __pyx_L5_argtuple_error:;
  26181. __Pyx_RaiseArgtupleInvalid("_segmentrepr", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1475, __pyx_L3_error)
  26182. __pyx_L6_skip:;
  26183. goto __pyx_L4_argument_unpacking_done;
  26184. __pyx_L3_error:;
  26185. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  26186. Py_XDECREF(values[__pyx_temp]);
  26187. }
  26188. __Pyx_AddTraceback("fontTools.misc.bezierTools._segmentrepr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26189. __Pyx_RefNannyFinishContext();
  26190. return NULL;
  26191. __pyx_L4_argument_unpacking_done:;
  26192. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_92_segmentrepr(__pyx_self, __pyx_v_obj);
  26193. /* function exit code */
  26194. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  26195. Py_XDECREF(values[__pyx_temp]);
  26196. }
  26197. __Pyx_RefNannyFinishContext();
  26198. return __pyx_r;
  26199. }
  26200. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_12_segmentrepr_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  26201. /* "fontTools/misc/bezierTools.py":1485
  26202. * return "%g" % obj
  26203. * else:
  26204. * return "(%s)" % ", ".join(_segmentrepr(x) for x in it) # <<<<<<<<<<<<<<
  26205. *
  26206. *
  26207. */
  26208. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_12_segmentrepr_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  26209. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *__pyx_cur_scope;
  26210. PyObject *__pyx_r = NULL;
  26211. __Pyx_RefNannyDeclarations
  26212. int __pyx_lineno = 0;
  26213. const char *__pyx_filename = NULL;
  26214. int __pyx_clineno = 0;
  26215. __Pyx_RefNannySetupContext("genexpr", 0);
  26216. __pyx_cur_scope = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr(__pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  26217. if (unlikely(!__pyx_cur_scope)) {
  26218. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *)Py_None);
  26219. __Pyx_INCREF(Py_None);
  26220. __PYX_ERR(0, 1485, __pyx_L1_error)
  26221. } else {
  26222. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  26223. }
  26224. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  26225. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  26226. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  26227. {
  26228. __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9fontTools_4misc_11bezierTools_12_segmentrepr_2generator6, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_segmentrepr_locals_genexpr, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools); if (unlikely(!gen)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26229. __Pyx_DECREF(__pyx_cur_scope);
  26230. __Pyx_RefNannyFinishContext();
  26231. return (PyObject *) gen;
  26232. }
  26233. /* function exit code */
  26234. __pyx_L1_error:;
  26235. __Pyx_AddTraceback("fontTools.misc.bezierTools._segmentrepr.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26236. __pyx_r = NULL;
  26237. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  26238. __Pyx_XGIVEREF(__pyx_r);
  26239. __Pyx_RefNannyFinishContext();
  26240. return __pyx_r;
  26241. }
  26242. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_12_segmentrepr_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  26243. {
  26244. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *)__pyx_generator->closure);
  26245. PyObject *__pyx_r = NULL;
  26246. PyObject *__pyx_t_1 = NULL;
  26247. Py_ssize_t __pyx_t_2;
  26248. PyObject *(*__pyx_t_3)(PyObject *);
  26249. PyObject *__pyx_t_4 = NULL;
  26250. PyObject *__pyx_t_5 = NULL;
  26251. PyObject *__pyx_t_6 = NULL;
  26252. size_t __pyx_t_7;
  26253. int __pyx_lineno = 0;
  26254. const char *__pyx_filename = NULL;
  26255. int __pyx_clineno = 0;
  26256. __Pyx_RefNannyDeclarations
  26257. __Pyx_RefNannySetupContext("genexpr", 0);
  26258. switch (__pyx_generator->resume_label) {
  26259. case 0: goto __pyx_L3_first_run;
  26260. default: /* CPython raises the right error here */
  26261. __Pyx_RefNannyFinishContext();
  26262. return NULL;
  26263. }
  26264. __pyx_L3_first_run:;
  26265. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26266. __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26267. __Pyx_GOTREF(__pyx_r);
  26268. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1485, __pyx_L1_error) }
  26269. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  26270. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  26271. __pyx_t_2 = 0;
  26272. __pyx_t_3 = NULL;
  26273. } else {
  26274. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26275. __Pyx_GOTREF(__pyx_t_1);
  26276. __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26277. }
  26278. for (;;) {
  26279. if (likely(!__pyx_t_3)) {
  26280. if (likely(PyList_CheckExact(__pyx_t_1))) {
  26281. {
  26282. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  26283. #if !CYTHON_ASSUME_SAFE_SIZE
  26284. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1485, __pyx_L1_error)
  26285. #endif
  26286. if (__pyx_t_2 >= __pyx_temp) break;
  26287. }
  26288. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  26289. ++__pyx_t_2;
  26290. } else {
  26291. {
  26292. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  26293. #if !CYTHON_ASSUME_SAFE_SIZE
  26294. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1485, __pyx_L1_error)
  26295. #endif
  26296. if (__pyx_t_2 >= __pyx_temp) break;
  26297. }
  26298. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  26299. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  26300. #else
  26301. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  26302. #endif
  26303. ++__pyx_t_2;
  26304. }
  26305. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26306. } else {
  26307. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  26308. if (unlikely(!__pyx_t_4)) {
  26309. PyObject* exc_type = PyErr_Occurred();
  26310. if (exc_type) {
  26311. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1485, __pyx_L1_error)
  26312. PyErr_Clear();
  26313. }
  26314. break;
  26315. }
  26316. }
  26317. __Pyx_GOTREF(__pyx_t_4);
  26318. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
  26319. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, __pyx_t_4);
  26320. __Pyx_GIVEREF(__pyx_t_4);
  26321. __pyx_t_4 = 0;
  26322. __pyx_t_5 = NULL;
  26323. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_segmentrepr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26324. __Pyx_GOTREF(__pyx_t_6);
  26325. __pyx_t_7 = 1;
  26326. #if CYTHON_UNPACK_METHODS
  26327. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  26328. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
  26329. assert(__pyx_t_5);
  26330. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  26331. __Pyx_INCREF(__pyx_t_5);
  26332. __Pyx_INCREF(__pyx__function);
  26333. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  26334. __pyx_t_7 = 0;
  26335. }
  26336. #endif
  26337. {
  26338. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_x};
  26339. __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  26340. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  26341. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  26342. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26343. __Pyx_GOTREF(__pyx_t_4);
  26344. }
  26345. if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 1485, __pyx_L1_error)
  26346. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26347. }
  26348. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  26349. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  26350. /* function exit code */
  26351. goto __pyx_L0;
  26352. __pyx_L1_error:;
  26353. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  26354. __Pyx_XDECREF(__pyx_t_1);
  26355. __Pyx_XDECREF(__pyx_t_4);
  26356. __Pyx_XDECREF(__pyx_t_5);
  26357. __Pyx_XDECREF(__pyx_t_6);
  26358. if (__Pyx_PyErr_Occurred()) {
  26359. __Pyx_Generator_Replace_StopIteration(0);
  26360. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26361. }
  26362. __pyx_L0:;
  26363. __Pyx_XGIVEREF(__pyx_r);
  26364. #if !CYTHON_USE_EXC_INFO_STACK
  26365. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  26366. #endif
  26367. __pyx_generator->resume_label = -1;
  26368. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  26369. __Pyx_RefNannyFinishContext();
  26370. return __pyx_r;
  26371. }
  26372. /* "fontTools/misc/bezierTools.py":1475
  26373. *
  26374. *
  26375. * def _segmentrepr(obj): # <<<<<<<<<<<<<<
  26376. * """
  26377. * >>> _segmentrepr([1, [2, 3], [], [[2, [3, 4], [0.1, 2.2]]]])
  26378. */
  26379. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_92_segmentrepr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
  26380. PyObject *__pyx_v_it = NULL;
  26381. PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_12_segmentrepr_2generator6 = 0;
  26382. PyObject *__pyx_r = NULL;
  26383. __Pyx_RefNannyDeclarations
  26384. PyObject *__pyx_t_1 = NULL;
  26385. PyObject *__pyx_t_2 = NULL;
  26386. PyObject *__pyx_t_3 = NULL;
  26387. PyObject *__pyx_t_4 = NULL;
  26388. PyObject *__pyx_t_5 = NULL;
  26389. int __pyx_t_6;
  26390. PyObject *__pyx_t_7 = NULL;
  26391. PyObject *__pyx_t_8 = NULL;
  26392. int __pyx_lineno = 0;
  26393. const char *__pyx_filename = NULL;
  26394. int __pyx_clineno = 0;
  26395. __Pyx_RefNannySetupContext("_segmentrepr", 0);
  26396. /* "fontTools/misc/bezierTools.py":1480
  26397. * '(1, (2, 3), (), ((2, (3, 4), (0.1, 2.2))))'
  26398. * """
  26399. * try: # <<<<<<<<<<<<<<
  26400. * it = iter(obj)
  26401. * except TypeError:
  26402. */
  26403. {
  26404. __Pyx_PyThreadState_declare
  26405. __Pyx_PyThreadState_assign
  26406. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  26407. __Pyx_XGOTREF(__pyx_t_1);
  26408. __Pyx_XGOTREF(__pyx_t_2);
  26409. __Pyx_XGOTREF(__pyx_t_3);
  26410. /*try:*/ {
  26411. /* "fontTools/misc/bezierTools.py":1481
  26412. * """
  26413. * try:
  26414. * it = iter(obj) # <<<<<<<<<<<<<<
  26415. * except TypeError:
  26416. * return "%g" % obj
  26417. */
  26418. __pyx_t_4 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1481, __pyx_L3_error)
  26419. __Pyx_GOTREF(__pyx_t_4);
  26420. __pyx_v_it = __pyx_t_4;
  26421. __pyx_t_4 = 0;
  26422. /* "fontTools/misc/bezierTools.py":1480
  26423. * '(1, (2, 3), (), ((2, (3, 4), (0.1, 2.2))))'
  26424. * """
  26425. * try: # <<<<<<<<<<<<<<
  26426. * it = iter(obj)
  26427. * except TypeError:
  26428. */
  26429. }
  26430. /* "fontTools/misc/bezierTools.py":1485
  26431. * return "%g" % obj
  26432. * else:
  26433. * return "(%s)" % ", ".join(_segmentrepr(x) for x in it) # <<<<<<<<<<<<<<
  26434. *
  26435. *
  26436. */
  26437. /*else:*/ {
  26438. __Pyx_XDECREF(__pyx_r);
  26439. __pyx_t_4 = __pyx_pf_9fontTools_4misc_11bezierTools_12_segmentrepr_genexpr(NULL, __pyx_v_it); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L5_except_error)
  26440. __Pyx_GOTREF(__pyx_t_4);
  26441. __pyx_t_5 = __Pyx_Generator_GetInlinedResult(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1485, __pyx_L5_except_error)
  26442. __Pyx_GOTREF(__pyx_t_5);
  26443. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26444. __pyx_t_4 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u_, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L5_except_error)
  26445. __Pyx_GOTREF(__pyx_t_4);
  26446. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26447. __pyx_t_5 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_s_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1485, __pyx_L5_except_error)
  26448. __Pyx_GOTREF(__pyx_t_5);
  26449. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26450. __pyx_r = __pyx_t_5;
  26451. __pyx_t_5 = 0;
  26452. goto __pyx_L6_except_return;
  26453. }
  26454. __pyx_L3_error:;
  26455. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  26456. /* "fontTools/misc/bezierTools.py":1482
  26457. * try:
  26458. * it = iter(obj)
  26459. * except TypeError: # <<<<<<<<<<<<<<
  26460. * return "%g" % obj
  26461. * else:
  26462. */
  26463. __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError))));
  26464. if (__pyx_t_6) {
  26465. __Pyx_AddTraceback("fontTools.misc.bezierTools._segmentrepr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26466. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 1482, __pyx_L5_except_error)
  26467. __Pyx_XGOTREF(__pyx_t_5);
  26468. __Pyx_XGOTREF(__pyx_t_4);
  26469. __Pyx_XGOTREF(__pyx_t_7);
  26470. /* "fontTools/misc/bezierTools.py":1483
  26471. * it = iter(obj)
  26472. * except TypeError:
  26473. * return "%g" % obj # <<<<<<<<<<<<<<
  26474. * else:
  26475. * return "(%s)" % ", ".join(_segmentrepr(x) for x in it)
  26476. */
  26477. __Pyx_XDECREF(__pyx_r);
  26478. __pyx_t_8 = __Pyx_PyUnicode_FormatSafe(__pyx_mstate_global->__pyx_kp_u_g, __pyx_v_obj); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1483, __pyx_L5_except_error)
  26479. __Pyx_GOTREF(__pyx_t_8);
  26480. __pyx_r = __pyx_t_8;
  26481. __pyx_t_8 = 0;
  26482. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26483. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26484. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  26485. goto __pyx_L6_except_return;
  26486. }
  26487. goto __pyx_L5_except_error;
  26488. /* "fontTools/misc/bezierTools.py":1480
  26489. * '(1, (2, 3), (), ((2, (3, 4), (0.1, 2.2))))'
  26490. * """
  26491. * try: # <<<<<<<<<<<<<<
  26492. * it = iter(obj)
  26493. * except TypeError:
  26494. */
  26495. __pyx_L5_except_error:;
  26496. __Pyx_XGIVEREF(__pyx_t_1);
  26497. __Pyx_XGIVEREF(__pyx_t_2);
  26498. __Pyx_XGIVEREF(__pyx_t_3);
  26499. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  26500. goto __pyx_L1_error;
  26501. __pyx_L6_except_return:;
  26502. __Pyx_XGIVEREF(__pyx_t_1);
  26503. __Pyx_XGIVEREF(__pyx_t_2);
  26504. __Pyx_XGIVEREF(__pyx_t_3);
  26505. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  26506. goto __pyx_L0;
  26507. }
  26508. /* "fontTools/misc/bezierTools.py":1475
  26509. *
  26510. *
  26511. * def _segmentrepr(obj): # <<<<<<<<<<<<<<
  26512. * """
  26513. * >>> _segmentrepr([1, [2, 3], [], [[2, [3, 4], [0.1, 2.2]]]])
  26514. */
  26515. /* function exit code */
  26516. __pyx_L1_error:;
  26517. __Pyx_XDECREF(__pyx_t_4);
  26518. __Pyx_XDECREF(__pyx_t_5);
  26519. __Pyx_XDECREF(__pyx_t_7);
  26520. __Pyx_XDECREF(__pyx_t_8);
  26521. __Pyx_AddTraceback("fontTools.misc.bezierTools._segmentrepr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26522. __pyx_r = NULL;
  26523. __pyx_L0:;
  26524. __Pyx_XDECREF(__pyx_v_it);
  26525. __Pyx_XDECREF(__pyx_gb_9fontTools_4misc_11bezierTools_12_segmentrepr_2generator6);
  26526. __Pyx_XGIVEREF(__pyx_r);
  26527. __Pyx_RefNannyFinishContext();
  26528. return __pyx_r;
  26529. }
  26530. /* "fontTools/misc/bezierTools.py":1488
  26531. *
  26532. *
  26533. * def printSegments(segments): # <<<<<<<<<<<<<<
  26534. * """Helper for the doctests, displaying each segment in a list of
  26535. * segments on a single line as a tuple.
  26536. */
  26537. /* Python wrapper */
  26538. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_95printSegments(PyObject *__pyx_self,
  26539. #if CYTHON_METH_FASTCALL
  26540. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  26541. #else
  26542. PyObject *__pyx_args, PyObject *__pyx_kwds
  26543. #endif
  26544. ); /*proto*/
  26545. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_94printSegments, "printSegments(segments)\n\nHelper for the doctests, displaying each segment in a list of\nsegments on a single line as a tuple.");
  26546. static PyMethodDef __pyx_mdef_9fontTools_4misc_11bezierTools_95printSegments = {"printSegments", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9fontTools_4misc_11bezierTools_95printSegments, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9fontTools_4misc_11bezierTools_94printSegments};
  26547. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_95printSegments(PyObject *__pyx_self,
  26548. #if CYTHON_METH_FASTCALL
  26549. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  26550. #else
  26551. PyObject *__pyx_args, PyObject *__pyx_kwds
  26552. #endif
  26553. ) {
  26554. PyObject *__pyx_v_segments = 0;
  26555. #if !CYTHON_METH_FASTCALL
  26556. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  26557. #endif
  26558. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  26559. PyObject* values[1] = {0};
  26560. int __pyx_lineno = 0;
  26561. const char *__pyx_filename = NULL;
  26562. int __pyx_clineno = 0;
  26563. PyObject *__pyx_r = 0;
  26564. __Pyx_RefNannyDeclarations
  26565. __Pyx_RefNannySetupContext("printSegments (wrapper)", 0);
  26566. #if !CYTHON_METH_FASTCALL
  26567. #if CYTHON_ASSUME_SAFE_SIZE
  26568. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  26569. #else
  26570. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  26571. #endif
  26572. #endif
  26573. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  26574. {
  26575. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_segments,0};
  26576. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  26577. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1488, __pyx_L3_error)
  26578. if (__pyx_kwds_len > 0) {
  26579. switch (__pyx_nargs) {
  26580. case 1:
  26581. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  26582. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1488, __pyx_L3_error)
  26583. CYTHON_FALLTHROUGH;
  26584. case 0: break;
  26585. default: goto __pyx_L5_argtuple_error;
  26586. }
  26587. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  26588. if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "printSegments", 0) < (0)) __PYX_ERR(0, 1488, __pyx_L3_error)
  26589. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  26590. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("printSegments", 1, 1, 1, i); __PYX_ERR(0, 1488, __pyx_L3_error) }
  26591. }
  26592. } else if (unlikely(__pyx_nargs != 1)) {
  26593. goto __pyx_L5_argtuple_error;
  26594. } else {
  26595. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  26596. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1488, __pyx_L3_error)
  26597. }
  26598. __pyx_v_segments = values[0];
  26599. }
  26600. goto __pyx_L6_skip;
  26601. __pyx_L5_argtuple_error:;
  26602. __Pyx_RaiseArgtupleInvalid("printSegments", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1488, __pyx_L3_error)
  26603. __pyx_L6_skip:;
  26604. goto __pyx_L4_argument_unpacking_done;
  26605. __pyx_L3_error:;
  26606. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  26607. Py_XDECREF(values[__pyx_temp]);
  26608. }
  26609. __Pyx_AddTraceback("fontTools.misc.bezierTools.printSegments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26610. __Pyx_RefNannyFinishContext();
  26611. return NULL;
  26612. __pyx_L4_argument_unpacking_done:;
  26613. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_94printSegments(__pyx_self, __pyx_v_segments);
  26614. /* function exit code */
  26615. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  26616. Py_XDECREF(values[__pyx_temp]);
  26617. }
  26618. __Pyx_RefNannyFinishContext();
  26619. return __pyx_r;
  26620. }
  26621. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_94printSegments(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segments) {
  26622. PyObject *__pyx_v_segment = NULL;
  26623. PyObject *__pyx_r = NULL;
  26624. __Pyx_RefNannyDeclarations
  26625. PyObject *__pyx_t_1 = NULL;
  26626. Py_ssize_t __pyx_t_2;
  26627. PyObject *(*__pyx_t_3)(PyObject *);
  26628. PyObject *__pyx_t_4 = NULL;
  26629. PyObject *__pyx_t_5 = NULL;
  26630. PyObject *__pyx_t_6 = NULL;
  26631. PyObject *__pyx_t_7 = NULL;
  26632. PyObject *__pyx_t_8 = NULL;
  26633. size_t __pyx_t_9;
  26634. int __pyx_lineno = 0;
  26635. const char *__pyx_filename = NULL;
  26636. int __pyx_clineno = 0;
  26637. __Pyx_RefNannySetupContext("printSegments", 0);
  26638. /* "fontTools/misc/bezierTools.py":1492
  26639. * segments on a single line as a tuple.
  26640. * """
  26641. * for segment in segments: # <<<<<<<<<<<<<<
  26642. * print(_segmentrepr(segment))
  26643. *
  26644. */
  26645. if (likely(PyList_CheckExact(__pyx_v_segments)) || PyTuple_CheckExact(__pyx_v_segments)) {
  26646. __pyx_t_1 = __pyx_v_segments; __Pyx_INCREF(__pyx_t_1);
  26647. __pyx_t_2 = 0;
  26648. __pyx_t_3 = NULL;
  26649. } else {
  26650. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_segments); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1492, __pyx_L1_error)
  26651. __Pyx_GOTREF(__pyx_t_1);
  26652. __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1492, __pyx_L1_error)
  26653. }
  26654. for (;;) {
  26655. if (likely(!__pyx_t_3)) {
  26656. if (likely(PyList_CheckExact(__pyx_t_1))) {
  26657. {
  26658. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  26659. #if !CYTHON_ASSUME_SAFE_SIZE
  26660. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1492, __pyx_L1_error)
  26661. #endif
  26662. if (__pyx_t_2 >= __pyx_temp) break;
  26663. }
  26664. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  26665. ++__pyx_t_2;
  26666. } else {
  26667. {
  26668. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  26669. #if !CYTHON_ASSUME_SAFE_SIZE
  26670. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1492, __pyx_L1_error)
  26671. #endif
  26672. if (__pyx_t_2 >= __pyx_temp) break;
  26673. }
  26674. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  26675. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  26676. #else
  26677. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  26678. #endif
  26679. ++__pyx_t_2;
  26680. }
  26681. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1492, __pyx_L1_error)
  26682. } else {
  26683. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  26684. if (unlikely(!__pyx_t_4)) {
  26685. PyObject* exc_type = PyErr_Occurred();
  26686. if (exc_type) {
  26687. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1492, __pyx_L1_error)
  26688. PyErr_Clear();
  26689. }
  26690. break;
  26691. }
  26692. }
  26693. __Pyx_GOTREF(__pyx_t_4);
  26694. __Pyx_XDECREF_SET(__pyx_v_segment, __pyx_t_4);
  26695. __pyx_t_4 = 0;
  26696. /* "fontTools/misc/bezierTools.py":1493
  26697. * """
  26698. * for segment in segments:
  26699. * print(_segmentrepr(segment)) # <<<<<<<<<<<<<<
  26700. *
  26701. *
  26702. */
  26703. __pyx_t_5 = NULL;
  26704. __pyx_t_7 = NULL;
  26705. __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_segmentrepr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1493, __pyx_L1_error)
  26706. __Pyx_GOTREF(__pyx_t_8);
  26707. __pyx_t_9 = 1;
  26708. #if CYTHON_UNPACK_METHODS
  26709. if (unlikely(PyMethod_Check(__pyx_t_8))) {
  26710. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
  26711. assert(__pyx_t_7);
  26712. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
  26713. __Pyx_INCREF(__pyx_t_7);
  26714. __Pyx_INCREF(__pyx__function);
  26715. __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
  26716. __pyx_t_9 = 0;
  26717. }
  26718. #endif
  26719. {
  26720. PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_segment};
  26721. __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  26722. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  26723. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  26724. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1493, __pyx_L1_error)
  26725. __Pyx_GOTREF(__pyx_t_6);
  26726. }
  26727. __pyx_t_9 = 1;
  26728. {
  26729. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6};
  26730. __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_print, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  26731. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  26732. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  26733. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1493, __pyx_L1_error)
  26734. __Pyx_GOTREF(__pyx_t_4);
  26735. }
  26736. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26737. /* "fontTools/misc/bezierTools.py":1492
  26738. * segments on a single line as a tuple.
  26739. * """
  26740. * for segment in segments: # <<<<<<<<<<<<<<
  26741. * print(_segmentrepr(segment))
  26742. *
  26743. */
  26744. }
  26745. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  26746. /* "fontTools/misc/bezierTools.py":1488
  26747. *
  26748. *
  26749. * def printSegments(segments): # <<<<<<<<<<<<<<
  26750. * """Helper for the doctests, displaying each segment in a list of
  26751. * segments on a single line as a tuple.
  26752. */
  26753. /* function exit code */
  26754. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  26755. goto __pyx_L0;
  26756. __pyx_L1_error:;
  26757. __Pyx_XDECREF(__pyx_t_1);
  26758. __Pyx_XDECREF(__pyx_t_4);
  26759. __Pyx_XDECREF(__pyx_t_5);
  26760. __Pyx_XDECREF(__pyx_t_6);
  26761. __Pyx_XDECREF(__pyx_t_7);
  26762. __Pyx_XDECREF(__pyx_t_8);
  26763. __Pyx_AddTraceback("fontTools.misc.bezierTools.printSegments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26764. __pyx_r = NULL;
  26765. __pyx_L0:;
  26766. __Pyx_XDECREF(__pyx_v_segment);
  26767. __Pyx_XGIVEREF(__pyx_r);
  26768. __Pyx_RefNannyFinishContext();
  26769. return __pyx_r;
  26770. }
  26771. /* #### Code section: module_exttypes ### */
  26772. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_defaults(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  26773. PyObject *o;
  26774. o = __Pyx_AllocateExtensionType(t, 1);
  26775. if (unlikely(!o)) return 0;
  26776. return o;
  26777. }
  26778. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_defaults(PyObject *o) {
  26779. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  26780. #if CYTHON_USE_TP_FINALIZE
  26781. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  26782. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_defaults) {
  26783. if (PyObject_CallFinalizerFromDealloc(o)) return;
  26784. }
  26785. }
  26786. #endif
  26787. PyObject_GC_UnTrack(o);
  26788. Py_CLEAR(p->arg0);
  26789. PyTypeObject *tp = Py_TYPE(o);
  26790. #if CYTHON_USE_TYPE_SLOTS
  26791. (*tp->tp_free)(o);
  26792. #else
  26793. {
  26794. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  26795. if (tp_free) tp_free(o);
  26796. }
  26797. #endif
  26798. #if CYTHON_USE_TYPE_SPECS
  26799. Py_DECREF(tp);
  26800. #endif
  26801. }
  26802. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_defaults(PyObject *o, visitproc v, void *a) {
  26803. int e;
  26804. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  26805. {
  26806. e = __Pyx_call_type_traverse(o, 1, v, a);
  26807. if (e) return e;
  26808. }
  26809. if (p->arg0) {
  26810. e = (*v)(p->arg0, a); if (e) return e;
  26811. }
  26812. return 0;
  26813. }
  26814. static int __pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_defaults(PyObject *o) {
  26815. PyObject* tmp;
  26816. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  26817. tmp = ((PyObject*)p->arg0);
  26818. p->arg0 = Py_None; Py_INCREF(Py_None);
  26819. Py_XDECREF(tmp);
  26820. return 0;
  26821. }
  26822. #if CYTHON_USE_TYPE_SPECS
  26823. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults_slots[] = {
  26824. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_defaults},
  26825. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_defaults},
  26826. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_defaults},
  26827. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_defaults},
  26828. {0, 0},
  26829. };
  26830. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults_spec = {
  26831. "fontTools.misc.bezierTools.__pyx_defaults",
  26832. sizeof(struct __pyx_defaults),
  26833. 0,
  26834. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  26835. __pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults_slots,
  26836. };
  26837. #else
  26838. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults = {
  26839. PyVarObject_HEAD_INIT(0, 0)
  26840. "fontTools.misc.bezierTools.""__pyx_defaults", /*tp_name*/
  26841. sizeof(struct __pyx_defaults), /*tp_basicsize*/
  26842. 0, /*tp_itemsize*/
  26843. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_defaults, /*tp_dealloc*/
  26844. 0, /*tp_vectorcall_offset*/
  26845. 0, /*tp_getattr*/
  26846. 0, /*tp_setattr*/
  26847. 0, /*tp_as_async*/
  26848. 0, /*tp_repr*/
  26849. 0, /*tp_as_number*/
  26850. 0, /*tp_as_sequence*/
  26851. 0, /*tp_as_mapping*/
  26852. 0, /*tp_hash*/
  26853. 0, /*tp_call*/
  26854. 0, /*tp_str*/
  26855. 0, /*tp_getattro*/
  26856. 0, /*tp_setattro*/
  26857. 0, /*tp_as_buffer*/
  26858. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  26859. 0, /*tp_doc*/
  26860. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_defaults, /*tp_traverse*/
  26861. __pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_defaults, /*tp_clear*/
  26862. 0, /*tp_richcompare*/
  26863. 0, /*tp_weaklistoffset*/
  26864. 0, /*tp_iter*/
  26865. 0, /*tp_iternext*/
  26866. 0, /*tp_methods*/
  26867. 0, /*tp_members*/
  26868. 0, /*tp_getset*/
  26869. 0, /*tp_base*/
  26870. 0, /*tp_dict*/
  26871. 0, /*tp_descr_get*/
  26872. 0, /*tp_descr_set*/
  26873. #if !CYTHON_USE_TYPE_SPECS
  26874. 0, /*tp_dictoffset*/
  26875. #endif
  26876. 0, /*tp_init*/
  26877. 0, /*tp_alloc*/
  26878. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_defaults, /*tp_new*/
  26879. 0, /*tp_free*/
  26880. 0, /*tp_is_gc*/
  26881. 0, /*tp_bases*/
  26882. 0, /*tp_mro*/
  26883. 0, /*tp_cache*/
  26884. 0, /*tp_subclasses*/
  26885. 0, /*tp_weaklist*/
  26886. 0, /*tp_del*/
  26887. 0, /*tp_version_tag*/
  26888. #if CYTHON_USE_TP_FINALIZE
  26889. 0, /*tp_finalize*/
  26890. #else
  26891. NULL, /*tp_finalize*/
  26892. #endif
  26893. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  26894. 0, /*tp_vectorcall*/
  26895. #endif
  26896. #if __PYX_NEED_TP_PRINT_SLOT == 1
  26897. 0, /*tp_print*/
  26898. #endif
  26899. #if PY_VERSION_HEX >= 0x030C0000
  26900. 0, /*tp_watched*/
  26901. #endif
  26902. #if PY_VERSION_HEX >= 0x030d00A4
  26903. 0, /*tp_versions_used*/
  26904. #endif
  26905. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  26906. 0, /*tp_pypy_flags*/
  26907. #endif
  26908. };
  26909. #endif
  26910. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  26911. PyObject *o;
  26912. #if CYTHON_USE_FREELISTS
  26913. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr))))
  26914. {
  26915. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr[--__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr];
  26916. #if CYTHON_USE_TYPE_SPECS
  26917. Py_DECREF(Py_TYPE(o));
  26918. #endif
  26919. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr));
  26920. #if CYTHON_COMPILING_IN_LIMITED_API
  26921. (void) PyObject_Init(o, t);
  26922. #else
  26923. (void) PyObject_INIT(o, t);
  26924. #endif
  26925. PyObject_GC_Track(o);
  26926. } else
  26927. #endif
  26928. {
  26929. o = __Pyx_AllocateExtensionType(t, 1);
  26930. if (unlikely(!o)) return 0;
  26931. }
  26932. return o;
  26933. }
  26934. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr(PyObject *o) {
  26935. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *)o;
  26936. #if CYTHON_USE_TP_FINALIZE
  26937. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  26938. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr) {
  26939. if (PyObject_CallFinalizerFromDealloc(o)) return;
  26940. }
  26941. }
  26942. #endif
  26943. PyObject_GC_UnTrack(o);
  26944. Py_CLEAR(p->__pyx_genexpr_arg_0);
  26945. Py_CLEAR(p->__pyx_v_t);
  26946. #if CYTHON_USE_FREELISTS
  26947. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr))))
  26948. {
  26949. __pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr[__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr++] = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *)o);
  26950. } else
  26951. #endif
  26952. {
  26953. PyTypeObject *tp = Py_TYPE(o);
  26954. #if CYTHON_USE_TYPE_SLOTS
  26955. (*tp->tp_free)(o);
  26956. #else
  26957. {
  26958. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  26959. if (tp_free) tp_free(o);
  26960. }
  26961. #endif
  26962. #if CYTHON_USE_TYPE_SPECS
  26963. Py_DECREF(tp);
  26964. #endif
  26965. }
  26966. }
  26967. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) {
  26968. int e;
  26969. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *)o;
  26970. {
  26971. e = __Pyx_call_type_traverse(o, 1, v, a);
  26972. if (e) return e;
  26973. }
  26974. if (p->__pyx_genexpr_arg_0) {
  26975. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  26976. }
  26977. if (p->__pyx_v_t) {
  26978. e = (*v)(p->__pyx_v_t, a); if (e) return e;
  26979. }
  26980. return 0;
  26981. }
  26982. #if CYTHON_USE_TYPE_SPECS
  26983. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr_slots[] = {
  26984. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr},
  26985. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr},
  26986. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr},
  26987. {0, 0},
  26988. };
  26989. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr_spec = {
  26990. "fontTools.misc.bezierTools.__pyx_scope_struct__genexpr",
  26991. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr),
  26992. 0,
  26993. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  26994. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr_slots,
  26995. };
  26996. #else
  26997. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr = {
  26998. PyVarObject_HEAD_INIT(0, 0)
  26999. "fontTools.misc.bezierTools.""__pyx_scope_struct__genexpr", /*tp_name*/
  27000. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr), /*tp_basicsize*/
  27001. 0, /*tp_itemsize*/
  27002. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr, /*tp_dealloc*/
  27003. 0, /*tp_vectorcall_offset*/
  27004. 0, /*tp_getattr*/
  27005. 0, /*tp_setattr*/
  27006. 0, /*tp_as_async*/
  27007. 0, /*tp_repr*/
  27008. 0, /*tp_as_number*/
  27009. 0, /*tp_as_sequence*/
  27010. 0, /*tp_as_mapping*/
  27011. 0, /*tp_hash*/
  27012. 0, /*tp_call*/
  27013. 0, /*tp_str*/
  27014. 0, /*tp_getattro*/
  27015. 0, /*tp_setattro*/
  27016. 0, /*tp_as_buffer*/
  27017. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27018. 0, /*tp_doc*/
  27019. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr, /*tp_traverse*/
  27020. 0, /*tp_clear*/
  27021. 0, /*tp_richcompare*/
  27022. 0, /*tp_weaklistoffset*/
  27023. 0, /*tp_iter*/
  27024. 0, /*tp_iternext*/
  27025. 0, /*tp_methods*/
  27026. 0, /*tp_members*/
  27027. 0, /*tp_getset*/
  27028. 0, /*tp_base*/
  27029. 0, /*tp_dict*/
  27030. 0, /*tp_descr_get*/
  27031. 0, /*tp_descr_set*/
  27032. #if !CYTHON_USE_TYPE_SPECS
  27033. 0, /*tp_dictoffset*/
  27034. #endif
  27035. 0, /*tp_init*/
  27036. 0, /*tp_alloc*/
  27037. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr, /*tp_new*/
  27038. 0, /*tp_free*/
  27039. 0, /*tp_is_gc*/
  27040. 0, /*tp_bases*/
  27041. 0, /*tp_mro*/
  27042. 0, /*tp_cache*/
  27043. 0, /*tp_subclasses*/
  27044. 0, /*tp_weaklist*/
  27045. 0, /*tp_del*/
  27046. 0, /*tp_version_tag*/
  27047. #if CYTHON_USE_TP_FINALIZE
  27048. 0, /*tp_finalize*/
  27049. #else
  27050. NULL, /*tp_finalize*/
  27051. #endif
  27052. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27053. 0, /*tp_vectorcall*/
  27054. #endif
  27055. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27056. 0, /*tp_print*/
  27057. #endif
  27058. #if PY_VERSION_HEX >= 0x030C0000
  27059. 0, /*tp_watched*/
  27060. #endif
  27061. #if PY_VERSION_HEX >= 0x030d00A4
  27062. 0, /*tp_versions_used*/
  27063. #endif
  27064. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27065. 0, /*tp_pypy_flags*/
  27066. #endif
  27067. };
  27068. #endif
  27069. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27070. PyObject *o;
  27071. #if CYTHON_USE_FREELISTS
  27072. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr))))
  27073. {
  27074. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr[--__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr];
  27075. #if CYTHON_USE_TYPE_SPECS
  27076. Py_DECREF(Py_TYPE(o));
  27077. #endif
  27078. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr));
  27079. #if CYTHON_COMPILING_IN_LIMITED_API
  27080. (void) PyObject_Init(o, t);
  27081. #else
  27082. (void) PyObject_INIT(o, t);
  27083. #endif
  27084. PyObject_GC_Track(o);
  27085. } else
  27086. #endif
  27087. {
  27088. o = __Pyx_AllocateExtensionType(t, 1);
  27089. if (unlikely(!o)) return 0;
  27090. }
  27091. return o;
  27092. }
  27093. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr(PyObject *o) {
  27094. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *)o;
  27095. #if CYTHON_USE_TP_FINALIZE
  27096. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27097. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr) {
  27098. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27099. }
  27100. }
  27101. #endif
  27102. PyObject_GC_UnTrack(o);
  27103. Py_CLEAR(p->__pyx_genexpr_arg_0);
  27104. Py_CLEAR(p->__pyx_v_t);
  27105. #if CYTHON_USE_FREELISTS
  27106. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr))))
  27107. {
  27108. __pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr[__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *)o);
  27109. } else
  27110. #endif
  27111. {
  27112. PyTypeObject *tp = Py_TYPE(o);
  27113. #if CYTHON_USE_TYPE_SLOTS
  27114. (*tp->tp_free)(o);
  27115. #else
  27116. {
  27117. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27118. if (tp_free) tp_free(o);
  27119. }
  27120. #endif
  27121. #if CYTHON_USE_TYPE_SPECS
  27122. Py_DECREF(tp);
  27123. #endif
  27124. }
  27125. }
  27126. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  27127. int e;
  27128. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *)o;
  27129. {
  27130. e = __Pyx_call_type_traverse(o, 1, v, a);
  27131. if (e) return e;
  27132. }
  27133. if (p->__pyx_genexpr_arg_0) {
  27134. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  27135. }
  27136. if (p->__pyx_v_t) {
  27137. e = (*v)(p->__pyx_v_t, a); if (e) return e;
  27138. }
  27139. return 0;
  27140. }
  27141. #if CYTHON_USE_TYPE_SPECS
  27142. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr_slots[] = {
  27143. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr},
  27144. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr},
  27145. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr},
  27146. {0, 0},
  27147. };
  27148. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr_spec = {
  27149. "fontTools.misc.bezierTools.__pyx_scope_struct_1_genexpr",
  27150. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr),
  27151. 0,
  27152. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27153. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr_slots,
  27154. };
  27155. #else
  27156. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr = {
  27157. PyVarObject_HEAD_INIT(0, 0)
  27158. "fontTools.misc.bezierTools.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  27159. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  27160. 0, /*tp_itemsize*/
  27161. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  27162. 0, /*tp_vectorcall_offset*/
  27163. 0, /*tp_getattr*/
  27164. 0, /*tp_setattr*/
  27165. 0, /*tp_as_async*/
  27166. 0, /*tp_repr*/
  27167. 0, /*tp_as_number*/
  27168. 0, /*tp_as_sequence*/
  27169. 0, /*tp_as_mapping*/
  27170. 0, /*tp_hash*/
  27171. 0, /*tp_call*/
  27172. 0, /*tp_str*/
  27173. 0, /*tp_getattro*/
  27174. 0, /*tp_setattro*/
  27175. 0, /*tp_as_buffer*/
  27176. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27177. 0, /*tp_doc*/
  27178. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  27179. 0, /*tp_clear*/
  27180. 0, /*tp_richcompare*/
  27181. 0, /*tp_weaklistoffset*/
  27182. 0, /*tp_iter*/
  27183. 0, /*tp_iternext*/
  27184. 0, /*tp_methods*/
  27185. 0, /*tp_members*/
  27186. 0, /*tp_getset*/
  27187. 0, /*tp_base*/
  27188. 0, /*tp_dict*/
  27189. 0, /*tp_descr_get*/
  27190. 0, /*tp_descr_set*/
  27191. #if !CYTHON_USE_TYPE_SPECS
  27192. 0, /*tp_dictoffset*/
  27193. #endif
  27194. 0, /*tp_init*/
  27195. 0, /*tp_alloc*/
  27196. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr, /*tp_new*/
  27197. 0, /*tp_free*/
  27198. 0, /*tp_is_gc*/
  27199. 0, /*tp_bases*/
  27200. 0, /*tp_mro*/
  27201. 0, /*tp_cache*/
  27202. 0, /*tp_subclasses*/
  27203. 0, /*tp_weaklist*/
  27204. 0, /*tp_del*/
  27205. 0, /*tp_version_tag*/
  27206. #if CYTHON_USE_TP_FINALIZE
  27207. 0, /*tp_finalize*/
  27208. #else
  27209. NULL, /*tp_finalize*/
  27210. #endif
  27211. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27212. 0, /*tp_vectorcall*/
  27213. #endif
  27214. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27215. 0, /*tp_print*/
  27216. #endif
  27217. #if PY_VERSION_HEX >= 0x030C0000
  27218. 0, /*tp_watched*/
  27219. #endif
  27220. #if PY_VERSION_HEX >= 0x030d00A4
  27221. 0, /*tp_versions_used*/
  27222. #endif
  27223. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27224. 0, /*tp_pypy_flags*/
  27225. #endif
  27226. };
  27227. #endif
  27228. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27229. PyObject *o;
  27230. #if CYTHON_USE_FREELISTS
  27231. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC))))
  27232. {
  27233. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC[--__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC];
  27234. #if CYTHON_USE_TYPE_SPECS
  27235. Py_DECREF(Py_TYPE(o));
  27236. #endif
  27237. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC));
  27238. #if CYTHON_COMPILING_IN_LIMITED_API
  27239. (void) PyObject_Init(o, t);
  27240. #else
  27241. (void) PyObject_INIT(o, t);
  27242. #endif
  27243. PyObject_GC_Track(o);
  27244. } else
  27245. #endif
  27246. {
  27247. o = __Pyx_AllocateExtensionType(t, 1);
  27248. if (unlikely(!o)) return 0;
  27249. }
  27250. return o;
  27251. }
  27252. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC(PyObject *o) {
  27253. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *)o;
  27254. #if CYTHON_USE_TP_FINALIZE
  27255. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27256. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC) {
  27257. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27258. }
  27259. }
  27260. #endif
  27261. PyObject_GC_UnTrack(o);
  27262. Py_CLEAR(p->__pyx_v_ts);
  27263. #if CYTHON_USE_FREELISTS
  27264. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC))))
  27265. {
  27266. __pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC[__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC++] = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *)o);
  27267. } else
  27268. #endif
  27269. {
  27270. PyTypeObject *tp = Py_TYPE(o);
  27271. #if CYTHON_USE_TYPE_SLOTS
  27272. (*tp->tp_free)(o);
  27273. #else
  27274. {
  27275. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27276. if (tp_free) tp_free(o);
  27277. }
  27278. #endif
  27279. #if CYTHON_USE_TYPE_SPECS
  27280. Py_DECREF(tp);
  27281. #endif
  27282. }
  27283. }
  27284. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC(PyObject *o, visitproc v, void *a) {
  27285. int e;
  27286. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *)o;
  27287. {
  27288. e = __Pyx_call_type_traverse(o, 1, v, a);
  27289. if (e) return e;
  27290. }
  27291. if (p->__pyx_v_ts) {
  27292. e = (*v)(p->__pyx_v_ts, a); if (e) return e;
  27293. }
  27294. return 0;
  27295. }
  27296. #if CYTHON_USE_TYPE_SPECS
  27297. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC_slots[] = {
  27298. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC},
  27299. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC},
  27300. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC},
  27301. {0, 0},
  27302. };
  27303. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC_spec = {
  27304. "fontTools.misc.bezierTools.__pyx_scope_struct_2_splitCubicAtTC",
  27305. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC),
  27306. 0,
  27307. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27308. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC_slots,
  27309. };
  27310. #else
  27311. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC = {
  27312. PyVarObject_HEAD_INIT(0, 0)
  27313. "fontTools.misc.bezierTools.""__pyx_scope_struct_2_splitCubicAtTC", /*tp_name*/
  27314. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC), /*tp_basicsize*/
  27315. 0, /*tp_itemsize*/
  27316. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC, /*tp_dealloc*/
  27317. 0, /*tp_vectorcall_offset*/
  27318. 0, /*tp_getattr*/
  27319. 0, /*tp_setattr*/
  27320. 0, /*tp_as_async*/
  27321. 0, /*tp_repr*/
  27322. 0, /*tp_as_number*/
  27323. 0, /*tp_as_sequence*/
  27324. 0, /*tp_as_mapping*/
  27325. 0, /*tp_hash*/
  27326. 0, /*tp_call*/
  27327. 0, /*tp_str*/
  27328. 0, /*tp_getattro*/
  27329. 0, /*tp_setattro*/
  27330. 0, /*tp_as_buffer*/
  27331. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27332. 0, /*tp_doc*/
  27333. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC, /*tp_traverse*/
  27334. 0, /*tp_clear*/
  27335. 0, /*tp_richcompare*/
  27336. 0, /*tp_weaklistoffset*/
  27337. 0, /*tp_iter*/
  27338. 0, /*tp_iternext*/
  27339. 0, /*tp_methods*/
  27340. 0, /*tp_members*/
  27341. 0, /*tp_getset*/
  27342. 0, /*tp_base*/
  27343. 0, /*tp_dict*/
  27344. 0, /*tp_descr_get*/
  27345. 0, /*tp_descr_set*/
  27346. #if !CYTHON_USE_TYPE_SPECS
  27347. 0, /*tp_dictoffset*/
  27348. #endif
  27349. 0, /*tp_init*/
  27350. 0, /*tp_alloc*/
  27351. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC, /*tp_new*/
  27352. 0, /*tp_free*/
  27353. 0, /*tp_is_gc*/
  27354. 0, /*tp_bases*/
  27355. 0, /*tp_mro*/
  27356. 0, /*tp_cache*/
  27357. 0, /*tp_subclasses*/
  27358. 0, /*tp_weaklist*/
  27359. 0, /*tp_del*/
  27360. 0, /*tp_version_tag*/
  27361. #if CYTHON_USE_TP_FINALIZE
  27362. 0, /*tp_finalize*/
  27363. #else
  27364. NULL, /*tp_finalize*/
  27365. #endif
  27366. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27367. 0, /*tp_vectorcall*/
  27368. #endif
  27369. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27370. 0, /*tp_print*/
  27371. #endif
  27372. #if PY_VERSION_HEX >= 0x030C0000
  27373. 0, /*tp_watched*/
  27374. #endif
  27375. #if PY_VERSION_HEX >= 0x030d00A4
  27376. 0, /*tp_versions_used*/
  27377. #endif
  27378. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27379. 0, /*tp_pypy_flags*/
  27380. #endif
  27381. };
  27382. #endif
  27383. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27384. PyObject *o;
  27385. #if CYTHON_USE_FREELISTS
  27386. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC))))
  27387. {
  27388. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC[--__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC];
  27389. #if CYTHON_USE_TYPE_SPECS
  27390. Py_DECREF(Py_TYPE(o));
  27391. #endif
  27392. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC));
  27393. #if CYTHON_COMPILING_IN_LIMITED_API
  27394. (void) PyObject_Init(o, t);
  27395. #else
  27396. (void) PyObject_INIT(o, t);
  27397. #endif
  27398. PyObject_GC_Track(o);
  27399. } else
  27400. #endif
  27401. {
  27402. o = __Pyx_AllocateExtensionType(t, 1);
  27403. if (unlikely(!o)) return 0;
  27404. }
  27405. return o;
  27406. }
  27407. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC(PyObject *o) {
  27408. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *)o;
  27409. #if CYTHON_USE_TP_FINALIZE
  27410. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27411. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC) {
  27412. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27413. }
  27414. }
  27415. #endif
  27416. PyObject_GC_UnTrack(o);
  27417. Py_CLEAR(p->__pyx_v_i);
  27418. Py_CLEAR(p->__pyx_v_pt1);
  27419. Py_CLEAR(p->__pyx_v_pt2);
  27420. Py_CLEAR(p->__pyx_v_pt3);
  27421. Py_CLEAR(p->__pyx_v_pt4);
  27422. Py_CLEAR(p->__pyx_v_ts);
  27423. Py_CLEAR(p->__pyx_t_0);
  27424. #if CYTHON_USE_FREELISTS
  27425. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC))))
  27426. {
  27427. __pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC[__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC++] = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *)o);
  27428. } else
  27429. #endif
  27430. {
  27431. PyTypeObject *tp = Py_TYPE(o);
  27432. #if CYTHON_USE_TYPE_SLOTS
  27433. (*tp->tp_free)(o);
  27434. #else
  27435. {
  27436. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27437. if (tp_free) tp_free(o);
  27438. }
  27439. #endif
  27440. #if CYTHON_USE_TYPE_SPECS
  27441. Py_DECREF(tp);
  27442. #endif
  27443. }
  27444. }
  27445. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC(PyObject *o, visitproc v, void *a) {
  27446. int e;
  27447. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *)o;
  27448. {
  27449. e = __Pyx_call_type_traverse(o, 1, v, a);
  27450. if (e) return e;
  27451. }
  27452. if (p->__pyx_v_i) {
  27453. e = (*v)(p->__pyx_v_i, a); if (e) return e;
  27454. }
  27455. if (p->__pyx_v_pt1) {
  27456. e = (*v)(p->__pyx_v_pt1, a); if (e) return e;
  27457. }
  27458. if (p->__pyx_v_pt2) {
  27459. e = (*v)(p->__pyx_v_pt2, a); if (e) return e;
  27460. }
  27461. if (p->__pyx_v_pt3) {
  27462. e = (*v)(p->__pyx_v_pt3, a); if (e) return e;
  27463. }
  27464. if (p->__pyx_v_pt4) {
  27465. e = (*v)(p->__pyx_v_pt4, a); if (e) return e;
  27466. }
  27467. if (p->__pyx_v_ts) {
  27468. e = (*v)(p->__pyx_v_ts, a); if (e) return e;
  27469. }
  27470. if (p->__pyx_t_0) {
  27471. e = (*v)(p->__pyx_t_0, a); if (e) return e;
  27472. }
  27473. return 0;
  27474. }
  27475. #if CYTHON_USE_TYPE_SPECS
  27476. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC_slots[] = {
  27477. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC},
  27478. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC},
  27479. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC},
  27480. {0, 0},
  27481. };
  27482. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC_spec = {
  27483. "fontTools.misc.bezierTools.__pyx_scope_struct_3__splitCubicAtTC",
  27484. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC),
  27485. 0,
  27486. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27487. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC_slots,
  27488. };
  27489. #else
  27490. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC = {
  27491. PyVarObject_HEAD_INIT(0, 0)
  27492. "fontTools.misc.bezierTools.""__pyx_scope_struct_3__splitCubicAtTC", /*tp_name*/
  27493. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC), /*tp_basicsize*/
  27494. 0, /*tp_itemsize*/
  27495. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC, /*tp_dealloc*/
  27496. 0, /*tp_vectorcall_offset*/
  27497. 0, /*tp_getattr*/
  27498. 0, /*tp_setattr*/
  27499. 0, /*tp_as_async*/
  27500. 0, /*tp_repr*/
  27501. 0, /*tp_as_number*/
  27502. 0, /*tp_as_sequence*/
  27503. 0, /*tp_as_mapping*/
  27504. 0, /*tp_hash*/
  27505. 0, /*tp_call*/
  27506. 0, /*tp_str*/
  27507. 0, /*tp_getattro*/
  27508. 0, /*tp_setattro*/
  27509. 0, /*tp_as_buffer*/
  27510. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27511. 0, /*tp_doc*/
  27512. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC, /*tp_traverse*/
  27513. 0, /*tp_clear*/
  27514. 0, /*tp_richcompare*/
  27515. 0, /*tp_weaklistoffset*/
  27516. 0, /*tp_iter*/
  27517. 0, /*tp_iternext*/
  27518. 0, /*tp_methods*/
  27519. 0, /*tp_members*/
  27520. 0, /*tp_getset*/
  27521. 0, /*tp_base*/
  27522. 0, /*tp_dict*/
  27523. 0, /*tp_descr_get*/
  27524. 0, /*tp_descr_set*/
  27525. #if !CYTHON_USE_TYPE_SPECS
  27526. 0, /*tp_dictoffset*/
  27527. #endif
  27528. 0, /*tp_init*/
  27529. 0, /*tp_alloc*/
  27530. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC, /*tp_new*/
  27531. 0, /*tp_free*/
  27532. 0, /*tp_is_gc*/
  27533. 0, /*tp_bases*/
  27534. 0, /*tp_mro*/
  27535. 0, /*tp_cache*/
  27536. 0, /*tp_subclasses*/
  27537. 0, /*tp_weaklist*/
  27538. 0, /*tp_del*/
  27539. 0, /*tp_version_tag*/
  27540. #if CYTHON_USE_TP_FINALIZE
  27541. 0, /*tp_finalize*/
  27542. #else
  27543. NULL, /*tp_finalize*/
  27544. #endif
  27545. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27546. 0, /*tp_vectorcall*/
  27547. #endif
  27548. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27549. 0, /*tp_print*/
  27550. #endif
  27551. #if PY_VERSION_HEX >= 0x030C0000
  27552. 0, /*tp_watched*/
  27553. #endif
  27554. #if PY_VERSION_HEX >= 0x030d00A4
  27555. 0, /*tp_versions_used*/
  27556. #endif
  27557. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27558. 0, /*tp_pypy_flags*/
  27559. #endif
  27560. };
  27561. #endif
  27562. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27563. PyObject *o;
  27564. #if CYTHON_USE_FREELISTS
  27565. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr))))
  27566. {
  27567. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr[--__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr];
  27568. #if CYTHON_USE_TYPE_SPECS
  27569. Py_DECREF(Py_TYPE(o));
  27570. #endif
  27571. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr));
  27572. #if CYTHON_COMPILING_IN_LIMITED_API
  27573. (void) PyObject_Init(o, t);
  27574. #else
  27575. (void) PyObject_INIT(o, t);
  27576. #endif
  27577. PyObject_GC_Track(o);
  27578. } else
  27579. #endif
  27580. {
  27581. o = __Pyx_AllocateExtensionType(t, 1);
  27582. if (unlikely(!o)) return 0;
  27583. }
  27584. return o;
  27585. }
  27586. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr(PyObject *o) {
  27587. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *)o;
  27588. #if CYTHON_USE_TP_FINALIZE
  27589. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27590. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr) {
  27591. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27592. }
  27593. }
  27594. #endif
  27595. PyObject_GC_UnTrack(o);
  27596. Py_CLEAR(p->__pyx_genexpr_arg_0);
  27597. Py_CLEAR(p->__pyx_v_i);
  27598. #if CYTHON_USE_FREELISTS
  27599. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr))))
  27600. {
  27601. __pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr[__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *)o);
  27602. } else
  27603. #endif
  27604. {
  27605. PyTypeObject *tp = Py_TYPE(o);
  27606. #if CYTHON_USE_TYPE_SLOTS
  27607. (*tp->tp_free)(o);
  27608. #else
  27609. {
  27610. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27611. if (tp_free) tp_free(o);
  27612. }
  27613. #endif
  27614. #if CYTHON_USE_TYPE_SPECS
  27615. Py_DECREF(tp);
  27616. #endif
  27617. }
  27618. }
  27619. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  27620. int e;
  27621. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *)o;
  27622. {
  27623. e = __Pyx_call_type_traverse(o, 1, v, a);
  27624. if (e) return e;
  27625. }
  27626. if (p->__pyx_genexpr_arg_0) {
  27627. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  27628. }
  27629. if (p->__pyx_v_i) {
  27630. e = (*v)(p->__pyx_v_i, a); if (e) return e;
  27631. }
  27632. return 0;
  27633. }
  27634. #if CYTHON_USE_TYPE_SPECS
  27635. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr_slots[] = {
  27636. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr},
  27637. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr},
  27638. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr},
  27639. {0, 0},
  27640. };
  27641. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr_spec = {
  27642. "fontTools.misc.bezierTools.__pyx_scope_struct_4_genexpr",
  27643. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr),
  27644. 0,
  27645. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27646. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr_slots,
  27647. };
  27648. #else
  27649. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr = {
  27650. PyVarObject_HEAD_INIT(0, 0)
  27651. "fontTools.misc.bezierTools.""__pyx_scope_struct_4_genexpr", /*tp_name*/
  27652. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  27653. 0, /*tp_itemsize*/
  27654. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr, /*tp_dealloc*/
  27655. 0, /*tp_vectorcall_offset*/
  27656. 0, /*tp_getattr*/
  27657. 0, /*tp_setattr*/
  27658. 0, /*tp_as_async*/
  27659. 0, /*tp_repr*/
  27660. 0, /*tp_as_number*/
  27661. 0, /*tp_as_sequence*/
  27662. 0, /*tp_as_mapping*/
  27663. 0, /*tp_hash*/
  27664. 0, /*tp_call*/
  27665. 0, /*tp_str*/
  27666. 0, /*tp_getattro*/
  27667. 0, /*tp_setattro*/
  27668. 0, /*tp_as_buffer*/
  27669. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27670. 0, /*tp_doc*/
  27671. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  27672. 0, /*tp_clear*/
  27673. 0, /*tp_richcompare*/
  27674. 0, /*tp_weaklistoffset*/
  27675. 0, /*tp_iter*/
  27676. 0, /*tp_iternext*/
  27677. 0, /*tp_methods*/
  27678. 0, /*tp_members*/
  27679. 0, /*tp_getset*/
  27680. 0, /*tp_base*/
  27681. 0, /*tp_dict*/
  27682. 0, /*tp_descr_get*/
  27683. 0, /*tp_descr_set*/
  27684. #if !CYTHON_USE_TYPE_SPECS
  27685. 0, /*tp_dictoffset*/
  27686. #endif
  27687. 0, /*tp_init*/
  27688. 0, /*tp_alloc*/
  27689. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr, /*tp_new*/
  27690. 0, /*tp_free*/
  27691. 0, /*tp_is_gc*/
  27692. 0, /*tp_bases*/
  27693. 0, /*tp_mro*/
  27694. 0, /*tp_cache*/
  27695. 0, /*tp_subclasses*/
  27696. 0, /*tp_weaklist*/
  27697. 0, /*tp_del*/
  27698. 0, /*tp_version_tag*/
  27699. #if CYTHON_USE_TP_FINALIZE
  27700. 0, /*tp_finalize*/
  27701. #else
  27702. NULL, /*tp_finalize*/
  27703. #endif
  27704. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27705. 0, /*tp_vectorcall*/
  27706. #endif
  27707. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27708. 0, /*tp_print*/
  27709. #endif
  27710. #if PY_VERSION_HEX >= 0x030C0000
  27711. 0, /*tp_watched*/
  27712. #endif
  27713. #if PY_VERSION_HEX >= 0x030d00A4
  27714. 0, /*tp_versions_used*/
  27715. #endif
  27716. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27717. 0, /*tp_pypy_flags*/
  27718. #endif
  27719. };
  27720. #endif
  27721. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27722. PyObject *o;
  27723. #if CYTHON_USE_FREELISTS
  27724. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t))))
  27725. {
  27726. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t[--__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t];
  27727. #if CYTHON_USE_TYPE_SPECS
  27728. Py_DECREF(Py_TYPE(o));
  27729. #endif
  27730. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t));
  27731. #if CYTHON_COMPILING_IN_LIMITED_API
  27732. (void) PyObject_Init(o, t);
  27733. #else
  27734. (void) PyObject_INIT(o, t);
  27735. #endif
  27736. PyObject_GC_Track(o);
  27737. } else
  27738. #endif
  27739. {
  27740. o = __Pyx_AllocateExtensionType(t, 1);
  27741. if (unlikely(!o)) return 0;
  27742. }
  27743. return o;
  27744. }
  27745. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t(PyObject *o) {
  27746. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *)o;
  27747. #if CYTHON_USE_TP_FINALIZE
  27748. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27749. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t) {
  27750. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27751. }
  27752. }
  27753. #endif
  27754. PyObject_GC_UnTrack(o);
  27755. Py_CLEAR(p->__pyx_v_precision);
  27756. #if CYTHON_USE_FREELISTS
  27757. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t))))
  27758. {
  27759. __pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t[__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t++] = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *)o);
  27760. } else
  27761. #endif
  27762. {
  27763. PyTypeObject *tp = Py_TYPE(o);
  27764. #if CYTHON_USE_TYPE_SLOTS
  27765. (*tp->tp_free)(o);
  27766. #else
  27767. {
  27768. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27769. if (tp_free) tp_free(o);
  27770. }
  27771. #endif
  27772. #if CYTHON_USE_TYPE_SPECS
  27773. Py_DECREF(tp);
  27774. #endif
  27775. }
  27776. }
  27777. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t(PyObject *o, visitproc v, void *a) {
  27778. int e;
  27779. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *)o;
  27780. {
  27781. e = __Pyx_call_type_traverse(o, 1, v, a);
  27782. if (e) return e;
  27783. }
  27784. if (p->__pyx_v_precision) {
  27785. e = (*v)(p->__pyx_v_precision, a); if (e) return e;
  27786. }
  27787. return 0;
  27788. }
  27789. static int __pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t(PyObject *o) {
  27790. PyObject* tmp;
  27791. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *)o;
  27792. tmp = ((PyObject*)p->__pyx_v_precision);
  27793. p->__pyx_v_precision = Py_None; Py_INCREF(Py_None);
  27794. Py_XDECREF(tmp);
  27795. return 0;
  27796. }
  27797. #if CYTHON_USE_TYPE_SPECS
  27798. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t_slots[] = {
  27799. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t},
  27800. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t},
  27801. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t},
  27802. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t},
  27803. {0, 0},
  27804. };
  27805. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t_spec = {
  27806. "fontTools.misc.bezierTools.__pyx_scope_struct_5__curve_curve_intersections_t",
  27807. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t),
  27808. 0,
  27809. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27810. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t_slots,
  27811. };
  27812. #else
  27813. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t = {
  27814. PyVarObject_HEAD_INIT(0, 0)
  27815. "fontTools.misc.bezierTools.""__pyx_scope_struct_5__curve_curve_intersections_t", /*tp_name*/
  27816. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t), /*tp_basicsize*/
  27817. 0, /*tp_itemsize*/
  27818. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, /*tp_dealloc*/
  27819. 0, /*tp_vectorcall_offset*/
  27820. 0, /*tp_getattr*/
  27821. 0, /*tp_setattr*/
  27822. 0, /*tp_as_async*/
  27823. 0, /*tp_repr*/
  27824. 0, /*tp_as_number*/
  27825. 0, /*tp_as_sequence*/
  27826. 0, /*tp_as_mapping*/
  27827. 0, /*tp_hash*/
  27828. 0, /*tp_call*/
  27829. 0, /*tp_str*/
  27830. 0, /*tp_getattro*/
  27831. 0, /*tp_setattro*/
  27832. 0, /*tp_as_buffer*/
  27833. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27834. 0, /*tp_doc*/
  27835. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, /*tp_traverse*/
  27836. __pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, /*tp_clear*/
  27837. 0, /*tp_richcompare*/
  27838. 0, /*tp_weaklistoffset*/
  27839. 0, /*tp_iter*/
  27840. 0, /*tp_iternext*/
  27841. 0, /*tp_methods*/
  27842. 0, /*tp_members*/
  27843. 0, /*tp_getset*/
  27844. 0, /*tp_base*/
  27845. 0, /*tp_dict*/
  27846. 0, /*tp_descr_get*/
  27847. 0, /*tp_descr_set*/
  27848. #if !CYTHON_USE_TYPE_SPECS
  27849. 0, /*tp_dictoffset*/
  27850. #endif
  27851. 0, /*tp_init*/
  27852. 0, /*tp_alloc*/
  27853. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, /*tp_new*/
  27854. 0, /*tp_free*/
  27855. 0, /*tp_is_gc*/
  27856. 0, /*tp_bases*/
  27857. 0, /*tp_mro*/
  27858. 0, /*tp_cache*/
  27859. 0, /*tp_subclasses*/
  27860. 0, /*tp_weaklist*/
  27861. 0, /*tp_del*/
  27862. 0, /*tp_version_tag*/
  27863. #if CYTHON_USE_TP_FINALIZE
  27864. 0, /*tp_finalize*/
  27865. #else
  27866. NULL, /*tp_finalize*/
  27867. #endif
  27868. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27869. 0, /*tp_vectorcall*/
  27870. #endif
  27871. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27872. 0, /*tp_print*/
  27873. #endif
  27874. #if PY_VERSION_HEX >= 0x030C0000
  27875. 0, /*tp_watched*/
  27876. #endif
  27877. #if PY_VERSION_HEX >= 0x030d00A4
  27878. 0, /*tp_versions_used*/
  27879. #endif
  27880. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27881. 0, /*tp_pypy_flags*/
  27882. #endif
  27883. };
  27884. #endif
  27885. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27886. PyObject *o;
  27887. #if CYTHON_USE_FREELISTS
  27888. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr))))
  27889. {
  27890. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr[--__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr];
  27891. #if CYTHON_USE_TYPE_SPECS
  27892. Py_DECREF(Py_TYPE(o));
  27893. #endif
  27894. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr));
  27895. #if CYTHON_COMPILING_IN_LIMITED_API
  27896. (void) PyObject_Init(o, t);
  27897. #else
  27898. (void) PyObject_INIT(o, t);
  27899. #endif
  27900. PyObject_GC_Track(o);
  27901. } else
  27902. #endif
  27903. {
  27904. o = __Pyx_AllocateExtensionType(t, 1);
  27905. if (unlikely(!o)) return 0;
  27906. }
  27907. return o;
  27908. }
  27909. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr(PyObject *o) {
  27910. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *)o;
  27911. #if CYTHON_USE_TP_FINALIZE
  27912. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27913. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr) {
  27914. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27915. }
  27916. }
  27917. #endif
  27918. PyObject_GC_UnTrack(o);
  27919. Py_CLEAR(p->__pyx_genexpr_arg_0);
  27920. Py_CLEAR(p->__pyx_v_p);
  27921. #if CYTHON_USE_FREELISTS
  27922. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr))))
  27923. {
  27924. __pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr[__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *)o);
  27925. } else
  27926. #endif
  27927. {
  27928. PyTypeObject *tp = Py_TYPE(o);
  27929. #if CYTHON_USE_TYPE_SLOTS
  27930. (*tp->tp_free)(o);
  27931. #else
  27932. {
  27933. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27934. if (tp_free) tp_free(o);
  27935. }
  27936. #endif
  27937. #if CYTHON_USE_TYPE_SPECS
  27938. Py_DECREF(tp);
  27939. #endif
  27940. }
  27941. }
  27942. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
  27943. int e;
  27944. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *)o;
  27945. {
  27946. e = __Pyx_call_type_traverse(o, 1, v, a);
  27947. if (e) return e;
  27948. }
  27949. if (p->__pyx_genexpr_arg_0) {
  27950. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  27951. }
  27952. if (p->__pyx_v_p) {
  27953. e = (*v)(p->__pyx_v_p, a); if (e) return e;
  27954. }
  27955. return 0;
  27956. }
  27957. #if CYTHON_USE_TYPE_SPECS
  27958. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr_slots[] = {
  27959. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr},
  27960. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr},
  27961. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr},
  27962. {0, 0},
  27963. };
  27964. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr_spec = {
  27965. "fontTools.misc.bezierTools.__pyx_scope_struct_6_genexpr",
  27966. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr),
  27967. 0,
  27968. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27969. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr_slots,
  27970. };
  27971. #else
  27972. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr = {
  27973. PyVarObject_HEAD_INIT(0, 0)
  27974. "fontTools.misc.bezierTools.""__pyx_scope_struct_6_genexpr", /*tp_name*/
  27975. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
  27976. 0, /*tp_itemsize*/
  27977. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
  27978. 0, /*tp_vectorcall_offset*/
  27979. 0, /*tp_getattr*/
  27980. 0, /*tp_setattr*/
  27981. 0, /*tp_as_async*/
  27982. 0, /*tp_repr*/
  27983. 0, /*tp_as_number*/
  27984. 0, /*tp_as_sequence*/
  27985. 0, /*tp_as_mapping*/
  27986. 0, /*tp_hash*/
  27987. 0, /*tp_call*/
  27988. 0, /*tp_str*/
  27989. 0, /*tp_getattro*/
  27990. 0, /*tp_setattro*/
  27991. 0, /*tp_as_buffer*/
  27992. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27993. 0, /*tp_doc*/
  27994. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr, /*tp_traverse*/
  27995. 0, /*tp_clear*/
  27996. 0, /*tp_richcompare*/
  27997. 0, /*tp_weaklistoffset*/
  27998. 0, /*tp_iter*/
  27999. 0, /*tp_iternext*/
  28000. 0, /*tp_methods*/
  28001. 0, /*tp_members*/
  28002. 0, /*tp_getset*/
  28003. 0, /*tp_base*/
  28004. 0, /*tp_dict*/
  28005. 0, /*tp_descr_get*/
  28006. 0, /*tp_descr_set*/
  28007. #if !CYTHON_USE_TYPE_SPECS
  28008. 0, /*tp_dictoffset*/
  28009. #endif
  28010. 0, /*tp_init*/
  28011. 0, /*tp_alloc*/
  28012. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr, /*tp_new*/
  28013. 0, /*tp_free*/
  28014. 0, /*tp_is_gc*/
  28015. 0, /*tp_bases*/
  28016. 0, /*tp_mro*/
  28017. 0, /*tp_cache*/
  28018. 0, /*tp_subclasses*/
  28019. 0, /*tp_weaklist*/
  28020. 0, /*tp_del*/
  28021. 0, /*tp_version_tag*/
  28022. #if CYTHON_USE_TP_FINALIZE
  28023. 0, /*tp_finalize*/
  28024. #else
  28025. NULL, /*tp_finalize*/
  28026. #endif
  28027. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  28028. 0, /*tp_vectorcall*/
  28029. #endif
  28030. #if __PYX_NEED_TP_PRINT_SLOT == 1
  28031. 0, /*tp_print*/
  28032. #endif
  28033. #if PY_VERSION_HEX >= 0x030C0000
  28034. 0, /*tp_watched*/
  28035. #endif
  28036. #if PY_VERSION_HEX >= 0x030d00A4
  28037. 0, /*tp_versions_used*/
  28038. #endif
  28039. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  28040. 0, /*tp_pypy_flags*/
  28041. #endif
  28042. };
  28043. #endif
  28044. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  28045. PyObject *o;
  28046. #if CYTHON_USE_FREELISTS
  28047. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr > 0) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr))))
  28048. {
  28049. o = (PyObject*)__pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr[--__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr];
  28050. #if CYTHON_USE_TYPE_SPECS
  28051. Py_DECREF(Py_TYPE(o));
  28052. #endif
  28053. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr));
  28054. #if CYTHON_COMPILING_IN_LIMITED_API
  28055. (void) PyObject_Init(o, t);
  28056. #else
  28057. (void) PyObject_INIT(o, t);
  28058. #endif
  28059. PyObject_GC_Track(o);
  28060. } else
  28061. #endif
  28062. {
  28063. o = __Pyx_AllocateExtensionType(t, 1);
  28064. if (unlikely(!o)) return 0;
  28065. }
  28066. return o;
  28067. }
  28068. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr(PyObject *o) {
  28069. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *)o;
  28070. #if CYTHON_USE_TP_FINALIZE
  28071. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  28072. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr) {
  28073. if (PyObject_CallFinalizerFromDealloc(o)) return;
  28074. }
  28075. }
  28076. #endif
  28077. PyObject_GC_UnTrack(o);
  28078. Py_CLEAR(p->__pyx_genexpr_arg_0);
  28079. Py_CLEAR(p->__pyx_v_x);
  28080. #if CYTHON_USE_FREELISTS
  28081. if (likely((int)(__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr < 8) & __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(Py_TYPE(o), __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr))))
  28082. {
  28083. __pyx_mstate_global->__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr[__pyx_mstate_global->__pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *)o);
  28084. } else
  28085. #endif
  28086. {
  28087. PyTypeObject *tp = Py_TYPE(o);
  28088. #if CYTHON_USE_TYPE_SLOTS
  28089. (*tp->tp_free)(o);
  28090. #else
  28091. {
  28092. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  28093. if (tp_free) tp_free(o);
  28094. }
  28095. #endif
  28096. #if CYTHON_USE_TYPE_SPECS
  28097. Py_DECREF(tp);
  28098. #endif
  28099. }
  28100. }
  28101. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  28102. int e;
  28103. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *)o;
  28104. {
  28105. e = __Pyx_call_type_traverse(o, 1, v, a);
  28106. if (e) return e;
  28107. }
  28108. if (p->__pyx_genexpr_arg_0) {
  28109. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  28110. }
  28111. if (p->__pyx_v_x) {
  28112. e = (*v)(p->__pyx_v_x, a); if (e) return e;
  28113. }
  28114. return 0;
  28115. }
  28116. #if CYTHON_USE_TYPE_SPECS
  28117. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr_slots[] = {
  28118. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr},
  28119. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr},
  28120. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr},
  28121. {0, 0},
  28122. };
  28123. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr_spec = {
  28124. "fontTools.misc.bezierTools.__pyx_scope_struct_7_genexpr",
  28125. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr),
  28126. 0,
  28127. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  28128. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr_slots,
  28129. };
  28130. #else
  28131. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr = {
  28132. PyVarObject_HEAD_INIT(0, 0)
  28133. "fontTools.misc.bezierTools.""__pyx_scope_struct_7_genexpr", /*tp_name*/
  28134. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  28135. 0, /*tp_itemsize*/
  28136. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr, /*tp_dealloc*/
  28137. 0, /*tp_vectorcall_offset*/
  28138. 0, /*tp_getattr*/
  28139. 0, /*tp_setattr*/
  28140. 0, /*tp_as_async*/
  28141. 0, /*tp_repr*/
  28142. 0, /*tp_as_number*/
  28143. 0, /*tp_as_sequence*/
  28144. 0, /*tp_as_mapping*/
  28145. 0, /*tp_hash*/
  28146. 0, /*tp_call*/
  28147. 0, /*tp_str*/
  28148. 0, /*tp_getattro*/
  28149. 0, /*tp_setattro*/
  28150. 0, /*tp_as_buffer*/
  28151. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  28152. 0, /*tp_doc*/
  28153. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr, /*tp_traverse*/
  28154. 0, /*tp_clear*/
  28155. 0, /*tp_richcompare*/
  28156. 0, /*tp_weaklistoffset*/
  28157. 0, /*tp_iter*/
  28158. 0, /*tp_iternext*/
  28159. 0, /*tp_methods*/
  28160. 0, /*tp_members*/
  28161. 0, /*tp_getset*/
  28162. 0, /*tp_base*/
  28163. 0, /*tp_dict*/
  28164. 0, /*tp_descr_get*/
  28165. 0, /*tp_descr_set*/
  28166. #if !CYTHON_USE_TYPE_SPECS
  28167. 0, /*tp_dictoffset*/
  28168. #endif
  28169. 0, /*tp_init*/
  28170. 0, /*tp_alloc*/
  28171. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr, /*tp_new*/
  28172. 0, /*tp_free*/
  28173. 0, /*tp_is_gc*/
  28174. 0, /*tp_bases*/
  28175. 0, /*tp_mro*/
  28176. 0, /*tp_cache*/
  28177. 0, /*tp_subclasses*/
  28178. 0, /*tp_weaklist*/
  28179. 0, /*tp_del*/
  28180. 0, /*tp_version_tag*/
  28181. #if CYTHON_USE_TP_FINALIZE
  28182. 0, /*tp_finalize*/
  28183. #else
  28184. NULL, /*tp_finalize*/
  28185. #endif
  28186. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  28187. 0, /*tp_vectorcall*/
  28188. #endif
  28189. #if __PYX_NEED_TP_PRINT_SLOT == 1
  28190. 0, /*tp_print*/
  28191. #endif
  28192. #if PY_VERSION_HEX >= 0x030C0000
  28193. 0, /*tp_watched*/
  28194. #endif
  28195. #if PY_VERSION_HEX >= 0x030d00A4
  28196. 0, /*tp_versions_used*/
  28197. #endif
  28198. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  28199. 0, /*tp_pypy_flags*/
  28200. #endif
  28201. };
  28202. #endif
  28203. static PyMethodDef __pyx_methods[] = {
  28204. {0, 0, 0, 0}
  28205. };
  28206. /* #### Code section: initfunc_declarations ### */
  28207. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28208. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28209. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
  28210. static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28211. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28212. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28213. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28214. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28215. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28216. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28217. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28218. static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28219. /* #### Code section: init_module ### */
  28220. static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  28221. __Pyx_RefNannyDeclarations
  28222. CYTHON_UNUSED_VAR(__pyx_mstate);
  28223. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  28224. /*--- Global init code ---*/
  28225. __Pyx_RefNannyFinishContext();
  28226. return 0;
  28227. }
  28228. static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  28229. __Pyx_RefNannyDeclarations
  28230. CYTHON_UNUSED_VAR(__pyx_mstate);
  28231. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  28232. /*--- Variable export code ---*/
  28233. __Pyx_RefNannyFinishContext();
  28234. return 0;
  28235. }
  28236. static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  28237. __Pyx_RefNannyDeclarations
  28238. CYTHON_UNUSED_VAR(__pyx_mstate);
  28239. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  28240. /*--- Function export code ---*/
  28241. __Pyx_RefNannyFinishContext();
  28242. return 0;
  28243. }
  28244. static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  28245. __Pyx_RefNannyDeclarations
  28246. CYTHON_UNUSED_VAR(__pyx_mstate);
  28247. int __pyx_lineno = 0;
  28248. const char *__pyx_filename = NULL;
  28249. int __pyx_clineno = 0;
  28250. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  28251. /*--- Type init code ---*/
  28252. #if CYTHON_USE_TYPE_SPECS
  28253. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults)) __PYX_ERR(0, 815, __pyx_L1_error)
  28254. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults_spec, __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults) < (0)) __PYX_ERR(0, 815, __pyx_L1_error)
  28255. #else
  28256. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults;
  28257. #endif
  28258. #if !CYTHON_COMPILING_IN_LIMITED_API
  28259. #endif
  28260. #if !CYTHON_USE_TYPE_SPECS
  28261. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults) < (0)) __PYX_ERR(0, 815, __pyx_L1_error)
  28262. #endif
  28263. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28264. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults);
  28265. #endif
  28266. #if !CYTHON_COMPILING_IN_LIMITED_API
  28267. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults->tp_getattro == PyObject_GenericGetAttr)) {
  28268. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults->tp_getattro = PyObject_GenericGetAttr;
  28269. }
  28270. #endif
  28271. #if CYTHON_USE_TYPE_SPECS
  28272. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr)) __PYX_ERR(0, 546, __pyx_L1_error)
  28273. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr_spec, __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr) < (0)) __PYX_ERR(0, 546, __pyx_L1_error)
  28274. #else
  28275. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr;
  28276. #endif
  28277. #if !CYTHON_COMPILING_IN_LIMITED_API
  28278. #endif
  28279. #if !CYTHON_USE_TYPE_SPECS
  28280. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr) < (0)) __PYX_ERR(0, 546, __pyx_L1_error)
  28281. #endif
  28282. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28283. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr);
  28284. #endif
  28285. #if !CYTHON_COMPILING_IN_LIMITED_API
  28286. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  28287. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr->tp_getattro = PyObject_GenericGetAttr;
  28288. }
  28289. #endif
  28290. #if CYTHON_USE_TYPE_SPECS
  28291. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 583, __pyx_L1_error)
  28292. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 583, __pyx_L1_error)
  28293. #else
  28294. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr;
  28295. #endif
  28296. #if !CYTHON_COMPILING_IN_LIMITED_API
  28297. #endif
  28298. #if !CYTHON_USE_TYPE_SPECS
  28299. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 583, __pyx_L1_error)
  28300. #endif
  28301. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28302. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr);
  28303. #endif
  28304. #if !CYTHON_COMPILING_IN_LIMITED_API
  28305. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  28306. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr->tp_getattro = PyObject_GenericGetAttr;
  28307. }
  28308. #endif
  28309. #if CYTHON_USE_TYPE_SPECS
  28310. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC)) __PYX_ERR(0, 644, __pyx_L1_error)
  28311. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC_spec, __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC) < (0)) __PYX_ERR(0, 644, __pyx_L1_error)
  28312. #else
  28313. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC;
  28314. #endif
  28315. #if !CYTHON_COMPILING_IN_LIMITED_API
  28316. #endif
  28317. #if !CYTHON_USE_TYPE_SPECS
  28318. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC) < (0)) __PYX_ERR(0, 644, __pyx_L1_error)
  28319. #endif
  28320. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28321. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC);
  28322. #endif
  28323. #if !CYTHON_COMPILING_IN_LIMITED_API
  28324. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC->tp_getattro == PyObject_GenericGetAttr)) {
  28325. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC->tp_getattro = PyObject_GenericGetAttr;
  28326. }
  28327. #endif
  28328. #if CYTHON_USE_TYPE_SPECS
  28329. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC)) __PYX_ERR(0, 770, __pyx_L1_error)
  28330. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC_spec, __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC) < (0)) __PYX_ERR(0, 770, __pyx_L1_error)
  28331. #else
  28332. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC;
  28333. #endif
  28334. #if !CYTHON_COMPILING_IN_LIMITED_API
  28335. #endif
  28336. #if !CYTHON_USE_TYPE_SPECS
  28337. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC) < (0)) __PYX_ERR(0, 770, __pyx_L1_error)
  28338. #endif
  28339. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28340. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC);
  28341. #endif
  28342. #if !CYTHON_COMPILING_IN_LIMITED_API
  28343. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC->tp_getattro == PyObject_GenericGetAttr)) {
  28344. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC->tp_getattro = PyObject_GenericGetAttr;
  28345. }
  28346. #endif
  28347. #if CYTHON_USE_TYPE_SPECS
  28348. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 1252, __pyx_L1_error)
  28349. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr_spec, __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 1252, __pyx_L1_error)
  28350. #else
  28351. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr;
  28352. #endif
  28353. #if !CYTHON_COMPILING_IN_LIMITED_API
  28354. #endif
  28355. #if !CYTHON_USE_TYPE_SPECS
  28356. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 1252, __pyx_L1_error)
  28357. #endif
  28358. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28359. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr);
  28360. #endif
  28361. #if !CYTHON_COMPILING_IN_LIMITED_API
  28362. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  28363. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr->tp_getattro = PyObject_GenericGetAttr;
  28364. }
  28365. #endif
  28366. #if CYTHON_USE_TYPE_SPECS
  28367. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t)) __PYX_ERR(0, 1313, __pyx_L1_error)
  28368. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t_spec, __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t) < (0)) __PYX_ERR(0, 1313, __pyx_L1_error)
  28369. #else
  28370. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t;
  28371. #endif
  28372. #if !CYTHON_COMPILING_IN_LIMITED_API
  28373. #endif
  28374. #if !CYTHON_USE_TYPE_SPECS
  28375. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t) < (0)) __PYX_ERR(0, 1313, __pyx_L1_error)
  28376. #endif
  28377. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28378. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t);
  28379. #endif
  28380. #if !CYTHON_COMPILING_IN_LIMITED_API
  28381. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t->tp_getattro == PyObject_GenericGetAttr)) {
  28382. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t->tp_getattro = PyObject_GenericGetAttr;
  28383. }
  28384. #endif
  28385. #if CYTHON_USE_TYPE_SPECS
  28386. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr)) __PYX_ERR(0, 1382, __pyx_L1_error)
  28387. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr_spec, __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 1382, __pyx_L1_error)
  28388. #else
  28389. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr;
  28390. #endif
  28391. #if !CYTHON_COMPILING_IN_LIMITED_API
  28392. #endif
  28393. #if !CYTHON_USE_TYPE_SPECS
  28394. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 1382, __pyx_L1_error)
  28395. #endif
  28396. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28397. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr);
  28398. #endif
  28399. #if !CYTHON_COMPILING_IN_LIMITED_API
  28400. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  28401. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr->tp_getattro = PyObject_GenericGetAttr;
  28402. }
  28403. #endif
  28404. #if CYTHON_USE_TYPE_SPECS
  28405. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr)) __PYX_ERR(0, 1485, __pyx_L1_error)
  28406. if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr_spec, __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr) < (0)) __PYX_ERR(0, 1485, __pyx_L1_error)
  28407. #else
  28408. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr;
  28409. #endif
  28410. #if !CYTHON_COMPILING_IN_LIMITED_API
  28411. #endif
  28412. #if !CYTHON_USE_TYPE_SPECS
  28413. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr) < (0)) __PYX_ERR(0, 1485, __pyx_L1_error)
  28414. #endif
  28415. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28416. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr);
  28417. #endif
  28418. #if !CYTHON_COMPILING_IN_LIMITED_API
  28419. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
  28420. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr->tp_getattro = PyObject_GenericGetAttr;
  28421. }
  28422. #endif
  28423. __Pyx_RefNannyFinishContext();
  28424. return 0;
  28425. __pyx_L1_error:;
  28426. __Pyx_RefNannyFinishContext();
  28427. return -1;
  28428. }
  28429. static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  28430. __Pyx_RefNannyDeclarations
  28431. CYTHON_UNUSED_VAR(__pyx_mstate);
  28432. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  28433. /*--- Type import code ---*/
  28434. __Pyx_RefNannyFinishContext();
  28435. return 0;
  28436. }
  28437. static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
  28438. __Pyx_RefNannyDeclarations
  28439. CYTHON_UNUSED_VAR(__pyx_mstate);
  28440. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  28441. /*--- Variable import code ---*/
  28442. __Pyx_RefNannyFinishContext();
  28443. return 0;
  28444. }
  28445. static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  28446. __Pyx_RefNannyDeclarations
  28447. CYTHON_UNUSED_VAR(__pyx_mstate);
  28448. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  28449. /*--- Function import code ---*/
  28450. __Pyx_RefNannyFinishContext();
  28451. return 0;
  28452. }
  28453. #if CYTHON_PEP489_MULTI_PHASE_INIT
  28454. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  28455. static int __pyx_pymod_exec_bezierTools(PyObject* module); /*proto*/
  28456. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  28457. {Py_mod_create, (void*)__pyx_pymod_create},
  28458. {Py_mod_exec, (void*)__pyx_pymod_exec_bezierTools},
  28459. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  28460. {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE},
  28461. #endif
  28462. #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  28463. {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  28464. #endif
  28465. {0, NULL}
  28466. };
  28467. #endif
  28468. #ifdef __cplusplus
  28469. namespace {
  28470. struct PyModuleDef __pyx_moduledef =
  28471. #else
  28472. static struct PyModuleDef __pyx_moduledef =
  28473. #endif
  28474. {
  28475. PyModuleDef_HEAD_INIT,
  28476. "bezierTools",
  28477. __pyx_k_fontTools_misc_bezierTools_py_to, /* m_doc */
  28478. #if CYTHON_USE_MODULE_STATE
  28479. sizeof(__pyx_mstatetype), /* m_size */
  28480. #else
  28481. (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
  28482. #endif
  28483. __pyx_methods /* m_methods */,
  28484. #if CYTHON_PEP489_MULTI_PHASE_INIT
  28485. __pyx_moduledef_slots, /* m_slots */
  28486. #else
  28487. NULL, /* m_reload */
  28488. #endif
  28489. #if CYTHON_USE_MODULE_STATE
  28490. __pyx_m_traverse, /* m_traverse */
  28491. __pyx_m_clear, /* m_clear */
  28492. NULL /* m_free */
  28493. #else
  28494. NULL, /* m_traverse */
  28495. NULL, /* m_clear */
  28496. NULL /* m_free */
  28497. #endif
  28498. };
  28499. #ifdef __cplusplus
  28500. } /* anonymous namespace */
  28501. #endif
  28502. /* PyModInitFuncType */
  28503. #ifndef CYTHON_NO_PYINIT_EXPORT
  28504. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  28505. #else
  28506. #ifdef __cplusplus
  28507. #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  28508. #else
  28509. #define __Pyx_PyMODINIT_FUNC PyObject *
  28510. #endif
  28511. #endif
  28512. __Pyx_PyMODINIT_FUNC PyInit_bezierTools(void) CYTHON_SMALL_CODE; /*proto*/
  28513. __Pyx_PyMODINIT_FUNC PyInit_bezierTools(void)
  28514. #if CYTHON_PEP489_MULTI_PHASE_INIT
  28515. {
  28516. return PyModuleDef_Init(&__pyx_moduledef);
  28517. }
  28518. /* ModuleCreationPEP489 */
  28519. #if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
  28520. || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
  28521. static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
  28522. {
  28523. PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
  28524. if (!module) {
  28525. PyErr_Clear(); // just try the 3.8-3.12 version
  28526. module = PyImport_ImportModule("_xxsubinterpreters");
  28527. if (!module) goto bad;
  28528. }
  28529. PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
  28530. Py_DECREF(module);
  28531. if (!current) goto bad;
  28532. if (PyTuple_Check(current)) {
  28533. PyObject *new_current = PySequence_GetItem(current, 0);
  28534. Py_DECREF(current);
  28535. current = new_current;
  28536. if (!new_current) goto bad;
  28537. }
  28538. long long as_c_int = PyLong_AsLongLong(current);
  28539. Py_DECREF(current);
  28540. return as_c_int;
  28541. }
  28542. bad:
  28543. PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
  28544. return -1;
  28545. }
  28546. #endif
  28547. #if !CYTHON_USE_MODULE_STATE
  28548. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  28549. static PY_INT64_T main_interpreter_id = -1;
  28550. #if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  28551. PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
  28552. #elif CYTHON_COMPILING_IN_GRAAL
  28553. PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
  28554. #elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
  28555. || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
  28556. PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
  28557. #elif CYTHON_COMPILING_IN_LIMITED_API
  28558. PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
  28559. #else
  28560. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  28561. #endif
  28562. if (unlikely(current_id == -1)) {
  28563. return -1;
  28564. }
  28565. if (main_interpreter_id == -1) {
  28566. main_interpreter_id = current_id;
  28567. return 0;
  28568. } else if (unlikely(main_interpreter_id != current_id)) {
  28569. PyErr_SetString(
  28570. PyExc_ImportError,
  28571. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  28572. return -1;
  28573. }
  28574. return 0;
  28575. }
  28576. #endif
  28577. static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
  28578. {
  28579. PyObject *value = PyObject_GetAttrString(spec, from_name);
  28580. int result = 0;
  28581. if (likely(value)) {
  28582. if (allow_none || value != Py_None) {
  28583. result = PyDict_SetItemString(moddict, to_name, value);
  28584. }
  28585. Py_DECREF(value);
  28586. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  28587. PyErr_Clear();
  28588. } else {
  28589. result = -1;
  28590. }
  28591. return result;
  28592. }
  28593. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
  28594. PyObject *module = NULL, *moddict, *modname;
  28595. CYTHON_UNUSED_VAR(def);
  28596. #if !CYTHON_USE_MODULE_STATE
  28597. if (__Pyx_check_single_interpreter())
  28598. return NULL;
  28599. #endif
  28600. if (__pyx_m)
  28601. return __Pyx_NewRef(__pyx_m);
  28602. modname = PyObject_GetAttrString(spec, "name");
  28603. if (unlikely(!modname)) goto bad;
  28604. module = PyModule_NewObject(modname);
  28605. Py_DECREF(modname);
  28606. if (unlikely(!module)) goto bad;
  28607. moddict = PyModule_GetDict(module);
  28608. if (unlikely(!moddict)) goto bad;
  28609. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  28610. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  28611. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  28612. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  28613. return module;
  28614. bad:
  28615. Py_XDECREF(module);
  28616. return NULL;
  28617. }
  28618. static CYTHON_SMALL_CODE int __pyx_pymod_exec_bezierTools(PyObject *__pyx_pyinit_module)
  28619. #endif
  28620. {
  28621. int stringtab_initialized = 0;
  28622. #if CYTHON_USE_MODULE_STATE
  28623. int pystate_addmodule_run = 0;
  28624. #endif
  28625. __pyx_mstatetype *__pyx_mstate = NULL;
  28626. PyObject *__pyx_t_1 = NULL;
  28627. PyObject *__pyx_t_2 = NULL;
  28628. Py_ssize_t __pyx_t_3;
  28629. PyObject *__pyx_t_4 = NULL;
  28630. PyObject *__pyx_t_5 = NULL;
  28631. PyObject *__pyx_t_6 = NULL;
  28632. PyObject *__pyx_t_7 = NULL;
  28633. PyObject *__pyx_t_8 = NULL;
  28634. size_t __pyx_t_9;
  28635. int __pyx_t_10;
  28636. PyObject *__pyx_t_11 = NULL;
  28637. PyObject *__pyx_t_12 = NULL;
  28638. PyObject *__pyx_t_13 = NULL;
  28639. int __pyx_lineno = 0;
  28640. const char *__pyx_filename = NULL;
  28641. int __pyx_clineno = 0;
  28642. __Pyx_RefNannyDeclarations
  28643. #if CYTHON_PEP489_MULTI_PHASE_INIT
  28644. if (__pyx_m) {
  28645. if (__pyx_m == __pyx_pyinit_module) return 0;
  28646. PyErr_SetString(PyExc_RuntimeError, "Module 'bezierTools' has already been imported. Re-initialisation is not supported.");
  28647. return -1;
  28648. }
  28649. #else
  28650. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  28651. #endif
  28652. /*--- Module creation code ---*/
  28653. #if CYTHON_PEP489_MULTI_PHASE_INIT
  28654. __pyx_t_1 = __pyx_pyinit_module;
  28655. Py_INCREF(__pyx_t_1);
  28656. #else
  28657. __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  28658. #endif
  28659. #if CYTHON_USE_MODULE_STATE
  28660. {
  28661. int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
  28662. __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "bezierTools" pseudovariable */
  28663. if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  28664. pystate_addmodule_run = 1;
  28665. }
  28666. #else
  28667. __pyx_m = __pyx_t_1;
  28668. #endif
  28669. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  28670. PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
  28671. #endif
  28672. __pyx_mstate = __pyx_mstate_global;
  28673. CYTHON_UNUSED_VAR(__pyx_t_1);
  28674. __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  28675. Py_INCREF(__pyx_mstate->__pyx_d);
  28676. __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  28677. __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  28678. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  28679. /* ImportRefnannyAPI */
  28680. #if CYTHON_REFNANNY
  28681. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  28682. if (!__Pyx_RefNanny) {
  28683. PyErr_Clear();
  28684. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  28685. if (!__Pyx_RefNanny)
  28686. Py_FatalError("failed to import 'refnanny' module");
  28687. }
  28688. #endif
  28689. __Pyx_RefNannySetupContext("PyInit_bezierTools", 0);
  28690. __Pyx_init_runtime_version();
  28691. if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28692. __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  28693. __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  28694. __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  28695. /*--- Library function declarations ---*/
  28696. /*--- Initialize various global constants etc. ---*/
  28697. if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28698. stringtab_initialized = 1;
  28699. if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28700. if (__pyx_module_is_main_fontTools__misc__bezierTools) {
  28701. if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28702. }
  28703. {
  28704. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  28705. if (!PyDict_GetItemString(modules, "fontTools.misc.bezierTools")) {
  28706. if (unlikely((PyDict_SetItemString(modules, "fontTools.misc.bezierTools", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  28707. }
  28708. }
  28709. /*--- Builtin init code ---*/
  28710. if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28711. /*--- Constants init code ---*/
  28712. if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28713. if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28714. /*--- Global type/function init code ---*/
  28715. (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  28716. (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  28717. (void)__Pyx_modinit_function_export_code(__pyx_mstate);
  28718. if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  28719. (void)__Pyx_modinit_type_import_code(__pyx_mstate);
  28720. (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  28721. (void)__Pyx_modinit_function_import_code(__pyx_mstate);
  28722. /*--- Execution code ---*/
  28723. /* "fontTools/misc/bezierTools.py":5
  28724. * """
  28725. *
  28726. * from fontTools.misc.arrayTools import calcBounds, sectRect, rectArea # <<<<<<<<<<<<<<
  28727. * from fontTools.misc.transform import Identity
  28728. * import math
  28729. */
  28730. {
  28731. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_calcBounds,__pyx_mstate_global->__pyx_n_u_sectRect,__pyx_mstate_global->__pyx_n_u_rectArea};
  28732. __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_fontTools_misc_arrayTools, __pyx_imported_names, 3, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
  28733. }
  28734. __pyx_t_2 = __pyx_t_1;
  28735. __Pyx_GOTREF(__pyx_t_2);
  28736. {
  28737. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_calcBounds,__pyx_mstate_global->__pyx_n_u_sectRect,__pyx_mstate_global->__pyx_n_u_rectArea};
  28738. for (__pyx_t_3=0; __pyx_t_3 < 3; __pyx_t_3++) {
  28739. __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5, __pyx_L1_error)
  28740. __Pyx_GOTREF(__pyx_t_4);
  28741. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 5, __pyx_L1_error)
  28742. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  28743. }
  28744. }
  28745. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28746. /* "fontTools/misc/bezierTools.py":6
  28747. *
  28748. * from fontTools.misc.arrayTools import calcBounds, sectRect, rectArea
  28749. * from fontTools.misc.transform import Identity # <<<<<<<<<<<<<<
  28750. * import math
  28751. * from collections import namedtuple
  28752. */
  28753. {
  28754. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Identity};
  28755. __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_fontTools_misc_transform, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  28756. }
  28757. __pyx_t_2 = __pyx_t_1;
  28758. __Pyx_GOTREF(__pyx_t_2);
  28759. {
  28760. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Identity};
  28761. __pyx_t_3 = 0; {
  28762. __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 6, __pyx_L1_error)
  28763. __Pyx_GOTREF(__pyx_t_4);
  28764. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 6, __pyx_L1_error)
  28765. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  28766. }
  28767. }
  28768. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28769. /* "fontTools/misc/bezierTools.py":7
  28770. * from fontTools.misc.arrayTools import calcBounds, sectRect, rectArea
  28771. * from fontTools.misc.transform import Identity
  28772. * import math # <<<<<<<<<<<<<<
  28773. * from collections import namedtuple
  28774. *
  28775. */
  28776. __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_math, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  28777. __pyx_t_2 = __pyx_t_1;
  28778. __Pyx_GOTREF(__pyx_t_2);
  28779. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_math, __pyx_t_2) < (0)) __PYX_ERR(0, 7, __pyx_L1_error)
  28780. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28781. /* "fontTools/misc/bezierTools.py":8
  28782. * from fontTools.misc.transform import Identity
  28783. * import math
  28784. * from collections import namedtuple # <<<<<<<<<<<<<<
  28785. *
  28786. * try:
  28787. */
  28788. {
  28789. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_namedtuple};
  28790. __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  28791. }
  28792. __pyx_t_2 = __pyx_t_1;
  28793. __Pyx_GOTREF(__pyx_t_2);
  28794. {
  28795. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_namedtuple};
  28796. __pyx_t_3 = 0; {
  28797. __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 8, __pyx_L1_error)
  28798. __Pyx_GOTREF(__pyx_t_4);
  28799. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 8, __pyx_L1_error)
  28800. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  28801. }
  28802. }
  28803. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28804. /* "fontTools/misc/bezierTools.py":10
  28805. * from collections import namedtuple
  28806. *
  28807. * try: # <<<<<<<<<<<<<<
  28808. * import cython
  28809. * except (AttributeError, ImportError):
  28810. */
  28811. {
  28812. (void)__pyx_t_1; (void)__pyx_t_5; (void)__pyx_t_6; /* mark used */
  28813. /*try:*/ {
  28814. /* "fontTools/misc/bezierTools.py":11
  28815. *
  28816. * try:
  28817. * import cython # <<<<<<<<<<<<<<
  28818. * except (AttributeError, ImportError):
  28819. * # if cython not installed, use mock module with no-op decorators and types
  28820. */
  28821. }
  28822. }
  28823. /* "fontTools/misc/bezierTools.py":15
  28824. * # if cython not installed, use mock module with no-op decorators and types
  28825. * from fontTools.misc import cython
  28826. * COMPILED = cython.compiled # <<<<<<<<<<<<<<
  28827. *
  28828. *
  28829. */
  28830. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_COMPILED, Py_True) < (0)) __PYX_ERR(0, 15, __pyx_L1_error)
  28831. /* "fontTools/misc/bezierTools.py":18
  28832. *
  28833. *
  28834. * EPSILON = 1e-9 # <<<<<<<<<<<<<<
  28835. *
  28836. *
  28837. */
  28838. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EPSILON, __pyx_mstate_global->__pyx_float_1eneg_9) < (0)) __PYX_ERR(0, 18, __pyx_L1_error)
  28839. /* "fontTools/misc/bezierTools.py":21
  28840. *
  28841. *
  28842. * Intersection = namedtuple("Intersection", ["pt", "t1", "t2"]) # <<<<<<<<<<<<<<
  28843. *
  28844. *
  28845. */
  28846. __pyx_t_4 = NULL;
  28847. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_namedtuple); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __pyx_L1_error)
  28848. __Pyx_GOTREF(__pyx_t_7);
  28849. __pyx_t_8 = __Pyx_PyList_Pack(3, __pyx_mstate_global->__pyx_n_u_pt, __pyx_mstate_global->__pyx_n_u_t1, __pyx_mstate_global->__pyx_n_u_t2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 21, __pyx_L1_error)
  28850. __Pyx_GOTREF(__pyx_t_8);
  28851. __pyx_t_9 = 1;
  28852. {
  28853. PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Intersection, __pyx_t_8};
  28854. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_7, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  28855. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  28856. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  28857. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  28858. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
  28859. __Pyx_GOTREF(__pyx_t_2);
  28860. }
  28861. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Intersection, __pyx_t_2) < (0)) __PYX_ERR(0, 21, __pyx_L1_error)
  28862. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28863. /* "fontTools/misc/bezierTools.py":24
  28864. *
  28865. *
  28866. * __all__ = [ # <<<<<<<<<<<<<<
  28867. * "approximateCubicArcLength",
  28868. * "approximateCubicArcLengthC",
  28869. */
  28870. __pyx_t_2 = __Pyx_PyList_Pack(28, __pyx_mstate_global->__pyx_n_u_approximateCubicArcLength, __pyx_mstate_global->__pyx_n_u_approximateCubicArcLengthC, __pyx_mstate_global->__pyx_n_u_approximateQuadraticArcLength, __pyx_mstate_global->__pyx_n_u_approximateQuadraticArcLengthC, __pyx_mstate_global->__pyx_n_u_calcCubicArcLength, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthC, __pyx_mstate_global->__pyx_n_u_calcQuadraticArcLength, __pyx_mstate_global->__pyx_n_u_calcQuadraticArcLengthC, __pyx_mstate_global->__pyx_n_u_calcCubicBounds, __pyx_mstate_global->__pyx_n_u_calcQuadraticBounds, __pyx_mstate_global->__pyx_n_u_splitLine, __pyx_mstate_global->__pyx_n_u_splitQuadratic, __pyx_mstate_global->__pyx_n_u_splitCubic, __pyx_mstate_global->__pyx_n_u_splitQuadraticAtT_2, __pyx_mstate_global->__pyx_n_u_splitCubicAtT_2, __pyx_mstate_global->__pyx_n_u_splitCubicAtTC, __pyx_mstate_global->__pyx_n_u_splitCubicIntoTwoAtTC, __pyx_mstate_global->__pyx_n_u_solveQuadratic, __pyx_mstate_global->__pyx_n_u_solveCubic, __pyx_mstate_global->__pyx_n_u_quadraticPointAtT, __pyx_mstate_global->__pyx_n_u_cubicPointAtT, __pyx_mstate_global->__pyx_n_u_cubicPointAtTC, __pyx_mstate_global->__pyx_n_u_linePointAtT, __pyx_mstate_global->__pyx_n_u_segmentPointAtT, __pyx_mstate_global->__pyx_n_u_lineLineIntersections, __pyx_mstate_global->__pyx_n_u_curveLineIntersections, __pyx_mstate_global->__pyx_n_u_curveCurveIntersections, __pyx_mstate_global->__pyx_n_u_segmentSegmentIntersections); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
  28871. __Pyx_GOTREF(__pyx_t_2);
  28872. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_all, __pyx_t_2) < (0)) __PYX_ERR(0, 24, __pyx_L1_error)
  28873. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28874. /* "fontTools/misc/bezierTools.py":56
  28875. *
  28876. *
  28877. * def calcCubicArcLength(pt1, pt2, pt3, pt4, tolerance=0.005): # <<<<<<<<<<<<<<
  28878. * """Calculates the arc length for a cubic Bezier segment.
  28879. *
  28880. */
  28881. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_1calcCubicArcLength, 0, __pyx_mstate_global->__pyx_n_u_calcCubicArcLength, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
  28882. __Pyx_GOTREF(__pyx_t_2);
  28883. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28884. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28885. #endif
  28886. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[2]);
  28887. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcCubicArcLength, __pyx_t_2) < (0)) __PYX_ERR(0, 56, __pyx_L1_error)
  28888. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28889. /* "fontTools/misc/bezierTools.py":75
  28890. *
  28891. *
  28892. * def _split_cubic_into_two(p0, p1, p2, p3): # <<<<<<<<<<<<<<
  28893. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  28894. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  28895. */
  28896. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_3_split_cubic_into_two, 0, __pyx_mstate_global->__pyx_n_u_split_cubic_into_two, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
  28897. __Pyx_GOTREF(__pyx_t_2);
  28898. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28899. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28900. #endif
  28901. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_split_cubic_into_two, __pyx_t_2) < (0)) __PYX_ERR(0, 75, __pyx_L1_error)
  28902. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28903. /* "fontTools/misc/bezierTools.py":84
  28904. *
  28905. *
  28906. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  28907. * @cython.locals(
  28908. * p0=cython.complex,
  28909. */
  28910. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_5_calcCubicArcLengthCRecurse, 0, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthCRecurse, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
  28911. __Pyx_GOTREF(__pyx_t_2);
  28912. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28913. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28914. #endif
  28915. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthCRecurse, __pyx_t_2) < (0)) __PYX_ERR(0, 84, __pyx_L1_error)
  28916. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28917. /* "fontTools/misc/bezierTools.py":115
  28918. * mult=cython.double,
  28919. * )
  28920. * def calcCubicArcLengthC(pt1, pt2, pt3, pt4, tolerance=0.005): # <<<<<<<<<<<<<<
  28921. * """Calculates the arc length for a cubic Bezier segment.
  28922. *
  28923. */
  28924. __pyx_t_2 = PyFloat_FromDouble(((double)0.005)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
  28925. __Pyx_GOTREF(__pyx_t_2);
  28926. /* "fontTools/misc/bezierTools.py":104
  28927. *
  28928. *
  28929. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  28930. * @cython.locals(
  28931. * pt1=cython.complex,
  28932. */
  28933. __pyx_t_7 = PyTuple_Pack(1, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 104, __pyx_L1_error)
  28934. __Pyx_GOTREF(__pyx_t_7);
  28935. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28936. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_7calcCubicArcLengthC, 0, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthC, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
  28937. __Pyx_GOTREF(__pyx_t_2);
  28938. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28939. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28940. #endif
  28941. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_7);
  28942. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  28943. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthC, __pyx_t_2) < (0)) __PYX_ERR(0, 104, __pyx_L1_error)
  28944. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28945. /* "fontTools/misc/bezierTools.py":129
  28946. *
  28947. *
  28948. * epsilonDigits = 6 # <<<<<<<<<<<<<<
  28949. * epsilon = 1e-10
  28950. *
  28951. */
  28952. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_epsilonDigits, __pyx_mstate_global->__pyx_int_6) < (0)) __PYX_ERR(0, 129, __pyx_L1_error)
  28953. /* "fontTools/misc/bezierTools.py":130
  28954. *
  28955. * epsilonDigits = 6
  28956. * epsilon = 1e-10 # <<<<<<<<<<<<<<
  28957. *
  28958. *
  28959. */
  28960. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_epsilon, __pyx_mstate_global->__pyx_float_1eneg_10) < (0)) __PYX_ERR(0, 130, __pyx_L1_error)
  28961. /* "fontTools/misc/bezierTools.py":151
  28962. *
  28963. *
  28964. * def calcQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  28965. * """Calculates the arc length for a quadratic Bezier segment.
  28966. *
  28967. */
  28968. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_9calcQuadraticArcLength, 0, __pyx_mstate_global->__pyx_n_u_calcQuadraticArcLength, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
  28969. __Pyx_GOTREF(__pyx_t_2);
  28970. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28971. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28972. #endif
  28973. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcQuadraticArcLength, __pyx_t_2) < (0)) __PYX_ERR(0, 151, __pyx_L1_error)
  28974. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28975. /* "fontTools/misc/bezierTools.py":186
  28976. *
  28977. *
  28978. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  28979. * @cython.locals(
  28980. * pt1=cython.complex,
  28981. */
  28982. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_11calcQuadraticArcLengthC, 0, __pyx_mstate_global->__pyx_n_u_calcQuadraticArcLengthC, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
  28983. __Pyx_GOTREF(__pyx_t_2);
  28984. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28985. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28986. #endif
  28987. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcQuadraticArcLengthC, __pyx_t_2) < (0)) __PYX_ERR(0, 186, __pyx_L1_error)
  28988. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28989. /* "fontTools/misc/bezierTools.py":237
  28990. *
  28991. *
  28992. * def approximateQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  28993. * """Calculates the arc length for a quadratic Bezier segment.
  28994. *
  28995. */
  28996. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_13approximateQuadraticArcLength, 0, __pyx_mstate_global->__pyx_n_u_approximateQuadraticArcLength, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
  28997. __Pyx_GOTREF(__pyx_t_2);
  28998. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28999. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29000. #endif
  29001. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_approximateQuadraticArcLength, __pyx_t_2) < (0)) __PYX_ERR(0, 237, __pyx_L1_error)
  29002. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29003. /* "fontTools/misc/bezierTools.py":254
  29004. *
  29005. *
  29006. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  29007. * @cython.locals(
  29008. * pt1=cython.complex,
  29009. */
  29010. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_15approximateQuadraticArcLengthC, 0, __pyx_mstate_global->__pyx_n_u_approximateQuadraticArcLengthC, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error)
  29011. __Pyx_GOTREF(__pyx_t_2);
  29012. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29013. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29014. #endif
  29015. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_approximateQuadraticArcLengthC, __pyx_t_2) < (0)) __PYX_ERR(0, 254, __pyx_L1_error)
  29016. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29017. /* "fontTools/misc/bezierTools.py":298
  29018. *
  29019. *
  29020. * def calcQuadraticBounds(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  29021. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  29022. *
  29023. */
  29024. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_17calcQuadraticBounds, 0, __pyx_mstate_global->__pyx_n_u_calcQuadraticBounds, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error)
  29025. __Pyx_GOTREF(__pyx_t_2);
  29026. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29027. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29028. #endif
  29029. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcQuadraticBounds, __pyx_t_2) < (0)) __PYX_ERR(0, 298, __pyx_L1_error)
  29030. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29031. /* "fontTools/misc/bezierTools.py":332
  29032. *
  29033. *
  29034. * def approximateCubicArcLength(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  29035. * """Approximates the arc length for a cubic Bezier segment.
  29036. *
  29037. */
  29038. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_19approximateCubicArcLength, 0, __pyx_mstate_global->__pyx_n_u_approximateCubicArcLength, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error)
  29039. __Pyx_GOTREF(__pyx_t_2);
  29040. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29041. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29042. #endif
  29043. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_approximateCubicArcLength, __pyx_t_2) < (0)) __PYX_ERR(0, 332, __pyx_L1_error)
  29044. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29045. /* "fontTools/misc/bezierTools.py":362
  29046. *
  29047. *
  29048. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  29049. * @cython.locals(
  29050. * pt1=cython.complex,
  29051. */
  29052. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_21approximateCubicArcLengthC, 0, __pyx_mstate_global->__pyx_n_u_approximateCubicArcLengthC, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
  29053. __Pyx_GOTREF(__pyx_t_2);
  29054. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29055. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29056. #endif
  29057. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_approximateCubicArcLengthC, __pyx_t_2) < (0)) __PYX_ERR(0, 362, __pyx_L1_error)
  29058. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29059. /* "fontTools/misc/bezierTools.py":412
  29060. *
  29061. *
  29062. * def calcCubicBounds(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  29063. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  29064. *
  29065. */
  29066. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_23calcCubicBounds, 0, __pyx_mstate_global->__pyx_n_u_calcCubicBounds, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error)
  29067. __Pyx_GOTREF(__pyx_t_2);
  29068. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29069. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29070. #endif
  29071. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcCubicBounds, __pyx_t_2) < (0)) __PYX_ERR(0, 412, __pyx_L1_error)
  29072. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29073. /* "fontTools/misc/bezierTools.py":450
  29074. *
  29075. *
  29076. * def splitLine(pt1, pt2, where, isHorizontal): # <<<<<<<<<<<<<<
  29077. * """Split a line at a given coordinate.
  29078. *
  29079. */
  29080. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_25splitLine, 0, __pyx_mstate_global->__pyx_n_u_splitLine, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L1_error)
  29081. __Pyx_GOTREF(__pyx_t_2);
  29082. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29083. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29084. #endif
  29085. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_splitLine, __pyx_t_2) < (0)) __PYX_ERR(0, 450, __pyx_L1_error)
  29086. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29087. /* "fontTools/misc/bezierTools.py":507
  29088. *
  29089. *
  29090. * def splitQuadratic(pt1, pt2, pt3, where, isHorizontal): # <<<<<<<<<<<<<<
  29091. * """Split a quadratic Bezier curve at a given coordinate.
  29092. *
  29093. */
  29094. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_27splitQuadratic, 0, __pyx_mstate_global->__pyx_n_u_splitQuadratic, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error)
  29095. __Pyx_GOTREF(__pyx_t_2);
  29096. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29097. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29098. #endif
  29099. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_splitQuadratic, __pyx_t_2) < (0)) __PYX_ERR(0, 507, __pyx_L1_error)
  29100. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29101. /* "fontTools/misc/bezierTools.py":552
  29102. *
  29103. *
  29104. * def splitCubic(pt1, pt2, pt3, pt4, where, isHorizontal): # <<<<<<<<<<<<<<
  29105. * """Split a cubic Bezier curve at a given coordinate.
  29106. *
  29107. */
  29108. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_29splitCubic, 0, __pyx_mstate_global->__pyx_n_u_splitCubic, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error)
  29109. __Pyx_GOTREF(__pyx_t_2);
  29110. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29111. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29112. #endif
  29113. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_splitCubic, __pyx_t_2) < (0)) __PYX_ERR(0, 552, __pyx_L1_error)
  29114. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29115. /* "fontTools/misc/bezierTools.py":589
  29116. *
  29117. *
  29118. * def splitQuadraticAtT(pt1, pt2, pt3, *ts): # <<<<<<<<<<<<<<
  29119. * """Split a quadratic Bezier curve at one or more values of t.
  29120. *
  29121. */
  29122. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_31splitQuadraticAtT, 0, __pyx_mstate_global->__pyx_n_u_splitQuadraticAtT_2, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 589, __pyx_L1_error)
  29123. __Pyx_GOTREF(__pyx_t_2);
  29124. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29125. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29126. #endif
  29127. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_splitQuadraticAtT_2, __pyx_t_2) < (0)) __PYX_ERR(0, 589, __pyx_L1_error)
  29128. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29129. /* "fontTools/misc/bezierTools.py":613
  29130. *
  29131. *
  29132. * def splitCubicAtT(pt1, pt2, pt3, pt4, *ts): # <<<<<<<<<<<<<<
  29133. * """Split a cubic Bezier curve at one or more values of t.
  29134. *
  29135. */
  29136. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_33splitCubicAtT, 0, __pyx_mstate_global->__pyx_n_u_splitCubicAtT_2, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error)
  29137. __Pyx_GOTREF(__pyx_t_2);
  29138. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29139. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29140. #endif
  29141. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_splitCubicAtT_2, __pyx_t_2) < (0)) __PYX_ERR(0, 613, __pyx_L1_error)
  29142. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29143. /* "fontTools/misc/bezierTools.py":644
  29144. *
  29145. *
  29146. * @cython.locals( # <<<<<<<<<<<<<<
  29147. * pt1=cython.complex,
  29148. * pt2=cython.complex,
  29149. */
  29150. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_35splitCubicAtTC, 0, __pyx_mstate_global->__pyx_n_u_splitCubicAtTC, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 644, __pyx_L1_error)
  29151. __Pyx_GOTREF(__pyx_t_2);
  29152. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29153. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29154. #endif
  29155. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_splitCubicAtTC, __pyx_t_2) < (0)) __PYX_ERR(0, 644, __pyx_L1_error)
  29156. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29157. /* "fontTools/misc/bezierTools.py":668
  29158. *
  29159. *
  29160. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  29161. * @cython.locals(
  29162. * t=cython.double,
  29163. */
  29164. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_38splitCubicIntoTwoAtTC, 0, __pyx_mstate_global->__pyx_n_u_splitCubicIntoTwoAtTC, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error)
  29165. __Pyx_GOTREF(__pyx_t_2);
  29166. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29167. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29168. #endif
  29169. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_splitCubicIntoTwoAtTC, __pyx_t_2) < (0)) __PYX_ERR(0, 668, __pyx_L1_error)
  29170. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29171. /* "fontTools/misc/bezierTools.py":708
  29172. *
  29173. *
  29174. * def _splitQuadraticAtT(a, b, c, *ts): # <<<<<<<<<<<<<<
  29175. * ts = list(ts)
  29176. * segments = []
  29177. */
  29178. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_40_splitQuadraticAtT, 0, __pyx_mstate_global->__pyx_n_u_splitQuadraticAtT, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error)
  29179. __Pyx_GOTREF(__pyx_t_2);
  29180. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29181. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29182. #endif
  29183. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_splitQuadraticAtT, __pyx_t_2) < (0)) __PYX_ERR(0, 708, __pyx_L1_error)
  29184. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29185. /* "fontTools/misc/bezierTools.py":735
  29186. *
  29187. *
  29188. * def _splitCubicAtT(a, b, c, d, *ts): # <<<<<<<<<<<<<<
  29189. * ts = list(ts)
  29190. * ts.insert(0, 0.0)
  29191. */
  29192. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_42_splitCubicAtT, 0, __pyx_mstate_global->__pyx_n_u_splitCubicAtT, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error)
  29193. __Pyx_GOTREF(__pyx_t_2);
  29194. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29195. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29196. #endif
  29197. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_splitCubicAtT, __pyx_t_2) < (0)) __PYX_ERR(0, 735, __pyx_L1_error)
  29198. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29199. /* "fontTools/misc/bezierTools.py":770
  29200. *
  29201. *
  29202. * @cython.locals( # <<<<<<<<<<<<<<
  29203. * a=cython.complex,
  29204. * b=cython.complex,
  29205. */
  29206. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_44_splitCubicAtTC, 0, __pyx_mstate_global->__pyx_n_u_splitCubicAtTC_2, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error)
  29207. __Pyx_GOTREF(__pyx_t_2);
  29208. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29209. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29210. #endif
  29211. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_splitCubicAtTC_2, __pyx_t_2) < (0)) __PYX_ERR(0, 770, __pyx_L1_error)
  29212. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29213. /* "fontTools/misc/bezierTools.py":812
  29214. * #
  29215. *
  29216. * from math import sqrt, acos, cos, pi # <<<<<<<<<<<<<<
  29217. *
  29218. *
  29219. */
  29220. {
  29221. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_sqrt,__pyx_mstate_global->__pyx_n_u_acos,__pyx_mstate_global->__pyx_n_u_cos,__pyx_mstate_global->__pyx_n_u_pi};
  29222. __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_math, __pyx_imported_names, 4, NULL, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 812, __pyx_L1_error)
  29223. }
  29224. __pyx_t_2 = __pyx_t_6;
  29225. __Pyx_GOTREF(__pyx_t_2);
  29226. {
  29227. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_sqrt,__pyx_mstate_global->__pyx_n_u_acos,__pyx_mstate_global->__pyx_n_u_cos,__pyx_mstate_global->__pyx_n_u_pi};
  29228. for (__pyx_t_3=0; __pyx_t_3 < 4; __pyx_t_3++) {
  29229. __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 812, __pyx_L1_error)
  29230. __Pyx_GOTREF(__pyx_t_7);
  29231. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_7) < (0)) __PYX_ERR(0, 812, __pyx_L1_error)
  29232. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  29233. }
  29234. }
  29235. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29236. /* "fontTools/misc/bezierTools.py":815
  29237. *
  29238. *
  29239. * def solveQuadratic(a, b, c, sqrt=sqrt): # <<<<<<<<<<<<<<
  29240. * """Solve a quadratic equation.
  29241. *
  29242. */
  29243. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_47solveQuadratic, 0, __pyx_mstate_global->__pyx_n_u_solveQuadratic, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 815, __pyx_L1_error)
  29244. __Pyx_GOTREF(__pyx_t_2);
  29245. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29246. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29247. #endif
  29248. if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults)) __PYX_ERR(0, 815, __pyx_L1_error)
  29249. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_sqrt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 815, __pyx_L1_error)
  29250. __Pyx_GOTREF(__pyx_t_7);
  29251. __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_t_2)->arg0 = __pyx_t_7;
  29252. __Pyx_GIVEREF(__pyx_t_7);
  29253. __pyx_t_7 = 0;
  29254. __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_9fontTools_4misc_11bezierTools_96__defaults__);
  29255. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_solveQuadratic, __pyx_t_2) < (0)) __PYX_ERR(0, 815, __pyx_L1_error)
  29256. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29257. /* "fontTools/misc/bezierTools.py":848
  29258. *
  29259. *
  29260. * def solveCubic(a, b, c, d): # <<<<<<<<<<<<<<
  29261. * """Solve a cubic equation.
  29262. *
  29263. */
  29264. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_49solveCubic, 0, __pyx_mstate_global->__pyx_n_u_solveCubic, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error)
  29265. __Pyx_GOTREF(__pyx_t_2);
  29266. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29267. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29268. #endif
  29269. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_solveCubic, __pyx_t_2) < (0)) __PYX_ERR(0, 848, __pyx_L1_error)
  29270. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29271. /* "fontTools/misc/bezierTools.py":945
  29272. *
  29273. *
  29274. * def calcQuadraticParameters(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  29275. * x2, y2 = pt2
  29276. * x3, y3 = pt3
  29277. */
  29278. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_51calcQuadraticParameters, 0, __pyx_mstate_global->__pyx_n_u_calcQuadraticParameters, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 945, __pyx_L1_error)
  29279. __Pyx_GOTREF(__pyx_t_2);
  29280. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29281. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29282. #endif
  29283. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcQuadraticParameters, __pyx_t_2) < (0)) __PYX_ERR(0, 945, __pyx_L1_error)
  29284. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29285. /* "fontTools/misc/bezierTools.py":956
  29286. *
  29287. *
  29288. * def calcCubicParameters(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  29289. * x2, y2 = pt2
  29290. * x3, y3 = pt3
  29291. */
  29292. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_53calcCubicParameters, 0, __pyx_mstate_global->__pyx_n_u_calcCubicParameters, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L1_error)
  29293. __Pyx_GOTREF(__pyx_t_2);
  29294. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29295. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29296. #endif
  29297. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcCubicParameters, __pyx_t_2) < (0)) __PYX_ERR(0, 956, __pyx_L1_error)
  29298. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29299. /* "fontTools/misc/bezierTools.py":988
  29300. *
  29301. *
  29302. * def calcQuadraticPoints(a, b, c): # <<<<<<<<<<<<<<
  29303. * ax, ay = a
  29304. * bx, by = b
  29305. */
  29306. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_55calcQuadraticPoints, 0, __pyx_mstate_global->__pyx_n_u_calcQuadraticPoints, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 988, __pyx_L1_error)
  29307. __Pyx_GOTREF(__pyx_t_2);
  29308. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29309. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29310. #endif
  29311. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcQuadraticPoints, __pyx_t_2) < (0)) __PYX_ERR(0, 988, __pyx_L1_error)
  29312. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29313. /* "fontTools/misc/bezierTools.py":1001
  29314. *
  29315. *
  29316. * def calcCubicPoints(a, b, c, d): # <<<<<<<<<<<<<<
  29317. * ax, ay = a
  29318. * bx, by = b
  29319. */
  29320. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_57calcCubicPoints, 0, __pyx_mstate_global->__pyx_n_u_calcCubicPoints, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1001, __pyx_L1_error)
  29321. __Pyx_GOTREF(__pyx_t_2);
  29322. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29323. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29324. #endif
  29325. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_calcCubicPoints, __pyx_t_2) < (0)) __PYX_ERR(0, 1001, __pyx_L1_error)
  29326. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29327. /* "fontTools/misc/bezierTools.py":1040
  29328. *
  29329. *
  29330. * def linePointAtT(pt1, pt2, t): # <<<<<<<<<<<<<<
  29331. * """Finds the point at time `t` on a line.
  29332. *
  29333. */
  29334. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_59linePointAtT, 0, __pyx_mstate_global->__pyx_n_u_linePointAtT, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1040, __pyx_L1_error)
  29335. __Pyx_GOTREF(__pyx_t_2);
  29336. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29337. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29338. #endif
  29339. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_linePointAtT, __pyx_t_2) < (0)) __PYX_ERR(0, 1040, __pyx_L1_error)
  29340. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29341. /* "fontTools/misc/bezierTools.py":1053
  29342. *
  29343. *
  29344. * def quadraticPointAtT(pt1, pt2, pt3, t): # <<<<<<<<<<<<<<
  29345. * """Finds the point at time `t` on a quadratic curve.
  29346. *
  29347. */
  29348. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_61quadraticPointAtT, 0, __pyx_mstate_global->__pyx_n_u_quadraticPointAtT, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1053, __pyx_L1_error)
  29349. __Pyx_GOTREF(__pyx_t_2);
  29350. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29351. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29352. #endif
  29353. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_quadraticPointAtT, __pyx_t_2) < (0)) __PYX_ERR(0, 1053, __pyx_L1_error)
  29354. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29355. /* "fontTools/misc/bezierTools.py":1068
  29356. *
  29357. *
  29358. * def cubicPointAtT(pt1, pt2, pt3, pt4, t): # <<<<<<<<<<<<<<
  29359. * """Finds the point at time `t` on a cubic curve.
  29360. *
  29361. */
  29362. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_63cubicPointAtT, 0, __pyx_mstate_global->__pyx_n_u_cubicPointAtT, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1068, __pyx_L1_error)
  29363. __Pyx_GOTREF(__pyx_t_2);
  29364. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29365. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29366. #endif
  29367. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cubicPointAtT, __pyx_t_2) < (0)) __PYX_ERR(0, 1068, __pyx_L1_error)
  29368. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29369. /* "fontTools/misc/bezierTools.py":1094
  29370. *
  29371. *
  29372. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  29373. * @cython.locals(
  29374. * t=cython.double,
  29375. */
  29376. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_65cubicPointAtTC, 0, __pyx_mstate_global->__pyx_n_u_cubicPointAtTC, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1094, __pyx_L1_error)
  29377. __Pyx_GOTREF(__pyx_t_2);
  29378. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29379. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29380. #endif
  29381. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_cubicPointAtTC, __pyx_t_2) < (0)) __PYX_ERR(0, 1094, __pyx_L1_error)
  29382. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29383. /* "fontTools/misc/bezierTools.py":1119
  29384. *
  29385. *
  29386. * def segmentPointAtT(seg, t): # <<<<<<<<<<<<<<
  29387. * if len(seg) == 2:
  29388. * return linePointAtT(*seg, t)
  29389. */
  29390. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_67segmentPointAtT, 0, __pyx_mstate_global->__pyx_n_u_segmentPointAtT, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error)
  29391. __Pyx_GOTREF(__pyx_t_2);
  29392. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29393. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29394. #endif
  29395. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_segmentPointAtT, __pyx_t_2) < (0)) __PYX_ERR(0, 1119, __pyx_L1_error)
  29396. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29397. /* "fontTools/misc/bezierTools.py":1134
  29398. *
  29399. *
  29400. * def _line_t_of_pt(s, e, pt): # <<<<<<<<<<<<<<
  29401. * sx, sy = s
  29402. * ex, ey = e
  29403. */
  29404. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_69_line_t_of_pt, 0, __pyx_mstate_global->__pyx_n_u_line_t_of_pt, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1134, __pyx_L1_error)
  29405. __Pyx_GOTREF(__pyx_t_2);
  29406. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29407. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29408. #endif
  29409. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_line_t_of_pt, __pyx_t_2) < (0)) __PYX_ERR(0, 1134, __pyx_L1_error)
  29410. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29411. /* "fontTools/misc/bezierTools.py":1148
  29412. *
  29413. *
  29414. * def _both_points_are_on_same_side_of_origin(a, b, origin): # <<<<<<<<<<<<<<
  29415. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0])
  29416. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1])
  29417. */
  29418. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_71_both_points_are_on_same_side_of_origin, 0, __pyx_mstate_global->__pyx_n_u_both_points_are_on_same_side_of, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1148, __pyx_L1_error)
  29419. __Pyx_GOTREF(__pyx_t_2);
  29420. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29421. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29422. #endif
  29423. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_both_points_are_on_same_side_of, __pyx_t_2) < (0)) __PYX_ERR(0, 1148, __pyx_L1_error)
  29424. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29425. /* "fontTools/misc/bezierTools.py":1154
  29426. *
  29427. *
  29428. * def lineLineIntersections(s1, e1, s2, e2): # <<<<<<<<<<<<<<
  29429. * """Finds intersections between two line segments.
  29430. *
  29431. */
  29432. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_73lineLineIntersections, 0, __pyx_mstate_global->__pyx_n_u_lineLineIntersections, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1154, __pyx_L1_error)
  29433. __Pyx_GOTREF(__pyx_t_2);
  29434. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29435. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29436. #endif
  29437. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_lineLineIntersections, __pyx_t_2) < (0)) __PYX_ERR(0, 1154, __pyx_L1_error)
  29438. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29439. /* "fontTools/misc/bezierTools.py":1232
  29440. *
  29441. *
  29442. * def _alignment_transformation(segment): # <<<<<<<<<<<<<<
  29443. * # Returns a transformation which aligns a segment horizontally at the
  29444. * # origin. Apply this transformation to curves and root-find to find
  29445. */
  29446. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_75_alignment_transformation, 0, __pyx_mstate_global->__pyx_n_u_alignment_transformation, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1232, __pyx_L1_error)
  29447. __Pyx_GOTREF(__pyx_t_2);
  29448. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29449. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29450. #endif
  29451. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_alignment_transformation, __pyx_t_2) < (0)) __PYX_ERR(0, 1232, __pyx_L1_error)
  29452. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29453. /* "fontTools/misc/bezierTools.py":1242
  29454. *
  29455. *
  29456. * def _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  29457. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  29458. * if len(curve) == 3:
  29459. */
  29460. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_77_curve_line_intersections_t, 0, __pyx_mstate_global->__pyx_n_u_curve_line_intersections_t, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1242, __pyx_L1_error)
  29461. __Pyx_GOTREF(__pyx_t_2);
  29462. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29463. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29464. #endif
  29465. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_curve_line_intersections_t, __pyx_t_2) < (0)) __PYX_ERR(0, 1242, __pyx_L1_error)
  29466. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29467. /* "fontTools/misc/bezierTools.py":1255
  29468. *
  29469. *
  29470. * def curveLineIntersections(curve, line): # <<<<<<<<<<<<<<
  29471. * """Finds intersections between a curve and a line.
  29472. *
  29473. */
  29474. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_79curveLineIntersections, 0, __pyx_mstate_global->__pyx_n_u_curveLineIntersections, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1255, __pyx_L1_error)
  29475. __Pyx_GOTREF(__pyx_t_2);
  29476. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29477. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29478. #endif
  29479. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_curveLineIntersections, __pyx_t_2) < (0)) __PYX_ERR(0, 1255, __pyx_L1_error)
  29480. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29481. /* "fontTools/misc/bezierTools.py":1293
  29482. *
  29483. *
  29484. * def _curve_bounds(c): # <<<<<<<<<<<<<<
  29485. * if len(c) == 3:
  29486. * return calcQuadraticBounds(*c)
  29487. */
  29488. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_81_curve_bounds, 0, __pyx_mstate_global->__pyx_n_u_curve_bounds, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1293, __pyx_L1_error)
  29489. __Pyx_GOTREF(__pyx_t_2);
  29490. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29491. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29492. #endif
  29493. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_curve_bounds, __pyx_t_2) < (0)) __PYX_ERR(0, 1293, __pyx_L1_error)
  29494. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29495. /* "fontTools/misc/bezierTools.py":1301
  29496. *
  29497. *
  29498. * def _split_segment_at_t(c, t): # <<<<<<<<<<<<<<
  29499. * if len(c) == 2:
  29500. * s, e = c
  29501. */
  29502. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_83_split_segment_at_t, 0, __pyx_mstate_global->__pyx_n_u_split_segment_at_t, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1301, __pyx_L1_error)
  29503. __Pyx_GOTREF(__pyx_t_2);
  29504. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29505. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29506. #endif
  29507. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_split_segment_at_t, __pyx_t_2) < (0)) __PYX_ERR(0, 1301, __pyx_L1_error)
  29508. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29509. /* "fontTools/misc/bezierTools.py":1313
  29510. *
  29511. *
  29512. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  29513. * curve1, curve2, precision=1e-3, range1=None, range2=None
  29514. * ):
  29515. */
  29516. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_85_curve_curve_intersections_t, 0, __pyx_mstate_global->__pyx_n_u_curve_curve_intersections_t, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L1_error)
  29517. __Pyx_GOTREF(__pyx_t_2);
  29518. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29519. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29520. #endif
  29521. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[3]);
  29522. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_curve_curve_intersections_t, __pyx_t_2) < (0)) __PYX_ERR(0, 1313, __pyx_L1_error)
  29523. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29524. /* "fontTools/misc/bezierTools.py":1380
  29525. *
  29526. *
  29527. * def _is_linelike(segment): # <<<<<<<<<<<<<<
  29528. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  29529. * return all(math.isclose(p[1], 0.0) for p in maybeline)
  29530. */
  29531. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_87_is_linelike, 0, __pyx_mstate_global->__pyx_n_u_is_linelike, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1380, __pyx_L1_error)
  29532. __Pyx_GOTREF(__pyx_t_2);
  29533. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29534. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29535. #endif
  29536. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_is_linelike, __pyx_t_2) < (0)) __PYX_ERR(0, 1380, __pyx_L1_error)
  29537. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29538. /* "fontTools/misc/bezierTools.py":1385
  29539. *
  29540. *
  29541. * def curveCurveIntersections(curve1, curve2): # <<<<<<<<<<<<<<
  29542. * """Finds intersections between a curve and a curve.
  29543. *
  29544. */
  29545. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_89curveCurveIntersections, 0, __pyx_mstate_global->__pyx_n_u_curveCurveIntersections, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1385, __pyx_L1_error)
  29546. __Pyx_GOTREF(__pyx_t_2);
  29547. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29548. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29549. #endif
  29550. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_curveCurveIntersections, __pyx_t_2) < (0)) __PYX_ERR(0, 1385, __pyx_L1_error)
  29551. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29552. /* "fontTools/misc/bezierTools.py":1427
  29553. *
  29554. *
  29555. * def segmentSegmentIntersections(seg1, seg2): # <<<<<<<<<<<<<<
  29556. * """Finds intersections between two segments.
  29557. *
  29558. */
  29559. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_91segmentSegmentIntersections, 0, __pyx_mstate_global->__pyx_n_u_segmentSegmentIntersections, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1427, __pyx_L1_error)
  29560. __Pyx_GOTREF(__pyx_t_2);
  29561. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29562. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29563. #endif
  29564. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_segmentSegmentIntersections, __pyx_t_2) < (0)) __PYX_ERR(0, 1427, __pyx_L1_error)
  29565. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29566. /* "fontTools/misc/bezierTools.py":1475
  29567. *
  29568. *
  29569. * def _segmentrepr(obj): # <<<<<<<<<<<<<<
  29570. * """
  29571. * >>> _segmentrepr([1, [2, 3], [], [[2, [3, 4], [0.1, 2.2]]]])
  29572. */
  29573. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_93_segmentrepr, 0, __pyx_mstate_global->__pyx_n_u_segmentrepr, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1475, __pyx_L1_error)
  29574. __Pyx_GOTREF(__pyx_t_2);
  29575. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29576. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29577. #endif
  29578. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_segmentrepr, __pyx_t_2) < (0)) __PYX_ERR(0, 1475, __pyx_L1_error)
  29579. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29580. /* "fontTools/misc/bezierTools.py":1488
  29581. *
  29582. *
  29583. * def printSegments(segments): # <<<<<<<<<<<<<<
  29584. * """Helper for the doctests, displaying each segment in a list of
  29585. * segments on a single line as a tuple.
  29586. */
  29587. __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9fontTools_4misc_11bezierTools_95printSegments, 0, __pyx_mstate_global->__pyx_n_u_printSegments, NULL, __pyx_mstate_global->__pyx_n_u_fontTools_misc_bezierTools, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1488, __pyx_L1_error)
  29588. __Pyx_GOTREF(__pyx_t_2);
  29589. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29590. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29591. #endif
  29592. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_printSegments, __pyx_t_2) < (0)) __PYX_ERR(0, 1488, __pyx_L1_error)
  29593. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29594. /* "fontTools/misc/bezierTools.py":1496
  29595. *
  29596. *
  29597. * if __name__ == "__main__": # <<<<<<<<<<<<<<
  29598. * import sys
  29599. * import doctest
  29600. */
  29601. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1496, __pyx_L1_error)
  29602. __Pyx_GOTREF(__pyx_t_2);
  29603. __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_main, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 1496, __pyx_L1_error)
  29604. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29605. if (__pyx_t_10) {
  29606. /* "fontTools/misc/bezierTools.py":1497
  29607. *
  29608. * if __name__ == "__main__":
  29609. * import sys # <<<<<<<<<<<<<<
  29610. * import doctest
  29611. *
  29612. */
  29613. __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_sys, 0, 0, NULL, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1497, __pyx_L1_error)
  29614. __pyx_t_2 = __pyx_t_6;
  29615. __Pyx_GOTREF(__pyx_t_2);
  29616. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sys, __pyx_t_2) < (0)) __PYX_ERR(0, 1497, __pyx_L1_error)
  29617. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29618. /* "fontTools/misc/bezierTools.py":1498
  29619. * if __name__ == "__main__":
  29620. * import sys
  29621. * import doctest # <<<<<<<<<<<<<<
  29622. *
  29623. * sys.exit(doctest.testmod().failed)
  29624. */
  29625. __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_doctest, 0, 0, NULL, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1498, __pyx_L1_error)
  29626. __pyx_t_2 = __pyx_t_6;
  29627. __Pyx_GOTREF(__pyx_t_2);
  29628. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_doctest, __pyx_t_2) < (0)) __PYX_ERR(0, 1498, __pyx_L1_error)
  29629. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29630. /* "fontTools/misc/bezierTools.py":1500
  29631. * import doctest
  29632. *
  29633. * sys.exit(doctest.testmod().failed) # <<<<<<<<<<<<<<
  29634. */
  29635. __pyx_t_7 = NULL;
  29636. __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29637. __Pyx_GOTREF(__pyx_t_8);
  29638. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29639. __Pyx_GOTREF(__pyx_t_4);
  29640. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  29641. __pyx_t_11 = NULL;
  29642. __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_doctest); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29643. __Pyx_GOTREF(__pyx_t_12);
  29644. __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_testmod); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29645. __Pyx_GOTREF(__pyx_t_13);
  29646. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  29647. __pyx_t_9 = 1;
  29648. {
  29649. PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL};
  29650. __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_13, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  29651. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  29652. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  29653. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29654. __Pyx_GOTREF(__pyx_t_8);
  29655. }
  29656. __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_failed); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29657. __Pyx_GOTREF(__pyx_t_13);
  29658. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  29659. __pyx_t_9 = 1;
  29660. {
  29661. PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_13};
  29662. __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
  29663. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  29664. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  29665. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  29666. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29667. __Pyx_GOTREF(__pyx_t_2);
  29668. }
  29669. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29670. /* "fontTools/misc/bezierTools.py":1496
  29671. *
  29672. *
  29673. * if __name__ == "__main__": # <<<<<<<<<<<<<<
  29674. * import sys
  29675. * import doctest
  29676. */
  29677. }
  29678. /* "fontTools/misc/bezierTools.py":1
  29679. * # -*- coding: utf-8 -*- # <<<<<<<<<<<<<<
  29680. * """fontTools.misc.bezierTools.py -- tools for working with Bezier path segments.
  29681. * """
  29682. */
  29683. __pyx_t_2 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  29684. __Pyx_GOTREF(__pyx_t_2);
  29685. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_calcQuadraticArcLength_line_151, __pyx_mstate_global->__pyx_kp_u_Calculates_the_arc_length_for_a) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29686. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_calcQuadraticBounds_line_298, __pyx_mstate_global->__pyx_kp_u_Calculates_the_bounding_rectangl) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29687. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_approximateCubicArcLength_line_3, __pyx_mstate_global->__pyx_kp_u_Approximates_the_arc_length_for) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29688. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_calcCubicBounds_line_412, __pyx_mstate_global->__pyx_kp_u_Calculates_the_bounding_rectangl_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29689. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_splitLine_line_450, __pyx_mstate_global->__pyx_kp_u_Split_a_line_at_a_given_coordina) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29690. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_splitQuadratic_line_507, __pyx_mstate_global->__pyx_kp_u_Split_a_quadratic_Bezier_curve_a) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29691. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_splitCubic_line_552, __pyx_mstate_global->__pyx_kp_u_Split_a_cubic_Bezier_curve_at_a) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29692. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_splitQuadraticAtT_line_589, __pyx_mstate_global->__pyx_kp_u_Split_a_quadratic_Bezier_curve_a_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29693. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_splitCubicAtT_line_613, __pyx_mstate_global->__pyx_kp_u_Split_a_cubic_Bezier_curve_at_on) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29694. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_solveCubic_line_848, __pyx_mstate_global->__pyx_kp_u_Solve_a_cubic_equation_Solves_a) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29695. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_lineLineIntersections_line_1154, __pyx_mstate_global->__pyx_kp_u_Finds_intersections_between_two) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29696. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_curveLineIntersections_line_1255, __pyx_mstate_global->__pyx_kp_u_Finds_intersections_between_a_cu) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29697. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_curveCurveIntersections_line_138, __pyx_mstate_global->__pyx_kp_u_Finds_intersections_between_a_cu_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29698. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_segmentSegmentIntersections_line, __pyx_mstate_global->__pyx_kp_u_Finds_intersections_between_two_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29699. if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_segmentrepr_line_1475, __pyx_mstate_global->__pyx_kp_u_segmentrepr_1_2_3_2_3_4_0_1_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29700. if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  29701. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29702. /*--- Wrapped vars code ---*/
  29703. goto __pyx_L0;
  29704. __pyx_L1_error:;
  29705. __Pyx_XDECREF(__pyx_t_2);
  29706. __Pyx_XDECREF(__pyx_t_4);
  29707. __Pyx_XDECREF(__pyx_t_7);
  29708. __Pyx_XDECREF(__pyx_t_8);
  29709. __Pyx_XDECREF(__pyx_t_11);
  29710. __Pyx_XDECREF(__pyx_t_12);
  29711. __Pyx_XDECREF(__pyx_t_13);
  29712. if (__pyx_m) {
  29713. if (__pyx_mstate->__pyx_d && stringtab_initialized) {
  29714. __Pyx_AddTraceback("init fontTools.misc.bezierTools", __pyx_clineno, __pyx_lineno, __pyx_filename);
  29715. }
  29716. #if !CYTHON_USE_MODULE_STATE
  29717. Py_CLEAR(__pyx_m);
  29718. #else
  29719. Py_DECREF(__pyx_m);
  29720. if (pystate_addmodule_run) {
  29721. PyObject *tp, *value, *tb;
  29722. PyErr_Fetch(&tp, &value, &tb);
  29723. PyState_RemoveModule(&__pyx_moduledef);
  29724. PyErr_Restore(tp, value, tb);
  29725. }
  29726. #endif
  29727. } else if (!PyErr_Occurred()) {
  29728. PyErr_SetString(PyExc_ImportError, "init fontTools.misc.bezierTools");
  29729. }
  29730. __pyx_L0:;
  29731. __Pyx_RefNannyFinishContext();
  29732. #if CYTHON_PEP489_MULTI_PHASE_INIT
  29733. return (__pyx_m != NULL) ? 0 : -1;
  29734. #else
  29735. return __pyx_m;
  29736. #endif
  29737. }
  29738. /* #### Code section: pystring_table ### */
  29739. /* #### Code section: cached_builtins ### */
  29740. static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  29741. CYTHON_UNUSED_VAR(__pyx_mstate);
  29742. __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_round); if (!__pyx_builtin_round) __PYX_ERR(0, 906, __pyx_L1_error)
  29743. __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 1493, __pyx_L1_error)
  29744. /* Cached unbound methods */
  29745. __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  29746. __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  29747. __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  29748. __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  29749. __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  29750. __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  29751. return 0;
  29752. __pyx_L1_error:;
  29753. return -1;
  29754. }
  29755. /* #### Code section: cached_constants ### */
  29756. static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  29757. __Pyx_RefNannyDeclarations
  29758. CYTHON_UNUSED_VAR(__pyx_mstate);
  29759. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  29760. /* "fontTools/misc/bezierTools.py":639
  29761. * # segment should always start at pt1 and the last segment should end at pt4,
  29762. * # so we set those values directly before returning.
  29763. * split[0] = (pt1, *split[0][1:]) # <<<<<<<<<<<<<<
  29764. * split[-1] = (*split[-1][:-1], pt4)
  29765. * return split
  29766. */
  29767. __pyx_mstate_global->__pyx_slice[0] = PySlice_New(__pyx_mstate_global->__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 639, __pyx_L1_error)
  29768. __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]);
  29769. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
  29770. /* "fontTools/misc/bezierTools.py":640
  29771. * # so we set those values directly before returning.
  29772. * split[0] = (pt1, *split[0][1:])
  29773. * split[-1] = (*split[-1][:-1], pt4) # <<<<<<<<<<<<<<
  29774. * return split
  29775. *
  29776. */
  29777. __pyx_mstate_global->__pyx_slice[1] = PySlice_New(Py_None, __pyx_mstate_global->__pyx_int_neg_1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[1])) __PYX_ERR(0, 640, __pyx_L1_error)
  29778. __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]);
  29779. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]);
  29780. /* "fontTools/misc/bezierTools.py":711
  29781. * ts = list(ts)
  29782. * segments = []
  29783. * ts.insert(0, 0.0) # <<<<<<<<<<<<<<
  29784. * ts.append(1.0)
  29785. * ax, ay = a
  29786. */
  29787. __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_float_0_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 711, __pyx_L1_error)
  29788. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  29789. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);
  29790. /* "fontTools/misc/bezierTools.py":1320
  29791. *
  29792. * if not range1:
  29793. * range1 = (0.0, 1.0) # <<<<<<<<<<<<<<
  29794. * if not range2:
  29795. * range2 = (0.0, 1.0)
  29796. */
  29797. __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_float_0_0, __pyx_mstate_global->__pyx_float_1_0); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 1320, __pyx_L1_error)
  29798. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  29799. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);
  29800. /* "fontTools/misc/bezierTools.py":56
  29801. *
  29802. *
  29803. * def calcCubicArcLength(pt1, pt2, pt3, pt4, tolerance=0.005): # <<<<<<<<<<<<<<
  29804. * """Calculates the arc length for a cubic Bezier segment.
  29805. *
  29806. */
  29807. __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(1, ((PyObject*)__pyx_mstate_global->__pyx_float_0_005)); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 56, __pyx_L1_error)
  29808. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  29809. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);
  29810. /* "fontTools/misc/bezierTools.py":1313
  29811. *
  29812. *
  29813. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  29814. * curve1, curve2, precision=1e-3, range1=None, range2=None
  29815. * ):
  29816. */
  29817. __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(3, ((PyObject*)__pyx_mstate_global->__pyx_float_1eneg_3), Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 1313, __pyx_L1_error)
  29818. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  29819. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);
  29820. #if CYTHON_IMMORTAL_CONSTANTS
  29821. {
  29822. PyObject **table = __pyx_mstate->__pyx_tuple;
  29823. for (Py_ssize_t i=0; i<4; ++i) {
  29824. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  29825. #if PY_VERSION_HEX < 0x030E0000
  29826. if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
  29827. #else
  29828. if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
  29829. #endif
  29830. {
  29831. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  29832. }
  29833. #else
  29834. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  29835. #endif
  29836. }
  29837. }
  29838. #endif
  29839. #if CYTHON_IMMORTAL_CONSTANTS
  29840. {
  29841. PyObject **table = __pyx_mstate->__pyx_slice;
  29842. for (Py_ssize_t i=0; i<2; ++i) {
  29843. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  29844. #if PY_VERSION_HEX < 0x030E0000
  29845. if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
  29846. #else
  29847. if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
  29848. #endif
  29849. {
  29850. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  29851. }
  29852. #else
  29853. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  29854. #endif
  29855. }
  29856. }
  29857. #endif
  29858. __Pyx_RefNannyFinishContext();
  29859. return 0;
  29860. __pyx_L1_error:;
  29861. __Pyx_RefNannyFinishContext();
  29862. return -1;
  29863. }
  29864. /* #### Code section: init_constants ### */
  29865. static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  29866. CYTHON_UNUSED_VAR(__pyx_mstate);
  29867. {
  29868. const struct { const unsigned int length: 11; } index[] = {{2},{942},{1182},{542},{600},{52},{742},{779},{749},{1065},{33},{884},{1246},{768},{1293},{1557},{661},{20},{1},{1},{36},{26},{33},{30},{35},{34},{7},{6},{2},{2},{9},{33},{4},{39},{119},{24},{21},{24},{21},{20},{28},{25},{4},{6},{8},{8},{2},{7},{8},{12},{3},{20},{1},{2},{1},{2},{5},{1},{1},{2},{4},{3},{3},{2},{2},{4},{13},{25},{7},{5},{6},{25},{26},{29},{30},{4},{5},{18},{5},{2},{3},{3},{2},{3},{3},{1},{2},{3},{3},{39},{7},{7},{3},{2},{3},{2},{3},{1},{2},{3},{9},{3},{9},{3},{3},{3},{9},{3},{9},{10},{18},{19},{27},{15},{19},{15},{22},{23},{19},{23},{19},{17},{18},{5},{11},{3},{13},{14},{5},{6},{6},{23},{22},{13},{28},{46},{46},{27},{44},{2},{2},{1},{2},{2},{3},{3},{5},{7},{7},{6},{7},{2},{2},{1},{2},{3},{3},{2},{3},{3},{3},{7},{13},{2},{4},{2},{6},{25},{26},{24},{5},{8},{7},{4},{1},{6},{15},{13},{10},{12},{13},{12},{29},{7},{2},{5},{3},{8},{4},{5},{5},{21},{12},{6},{13},{8},{4},{9},{3},{5},{8},{10},{4},{1},{8},{10},{4},{3},{4},{4},{3},{8},{6},{1},{2},{2},{2},{2},{2},{8},{11},{6},{3},{9},{5},{13},{2},{3},{4},{4},{3},{4},{4},{3},{3},{2},{2},{17},{12},{1},{3},{3},{6},{6},{8},{5},{6},{5},{1},{2},{3},{3},{2},{3},{3},{5},{8},{4},{3},{4},{4},{7},{15},{27},{12},{29},{8},{4},{12},{10},{7},{7},{9},{10},{14},{5},{10},{14},{14},{15},{13},{21},{27},{9},{14},{18},{17},{31},{21},{19},{4},{5},{7},{2},{2},{3},{1},{2},{4},{4},{2},{8},{7},{5},{5},{9},{15},{9},{2},{3},{10},{13},{2},{2},{2},{2},{2},{5},{6},{5},{1},{2},{2},{2},{2},{2},{5},{6},{1},{2},{2},{2},{2},{5},{6},{205},{2},{204},{22},{42},{24},{87},{182},{141},{37},{127},{95},{40},{31},{106},{31},{61},{172},{23},{105},{94},{92},{151},{651},{404},{145},{155},{92},{102},{120},{386},{269},{87},{145},{244},{30},{252},{187},{43},{2},{2},{2},{179},{2},{568},{143},{104},{54},{80},{129},{38},{90}};
  29869. #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (6697 bytes) */
  29870. const char* const cstring = "BZh91AY&SYl\266\355\314\000\014\337\377\377\377\377\377\337\177\377\377\377\377\347\377\357\377\377\377\367\300@@@@@X@P@@@@\000@\000`\036\357wy}\267\276\357+\324<\356\327\336\032\273\271\336=\356\357{z\361f\301<\037z\311\\\362\341D\372\373\275\034\373\026o\226\357\273\236\236\236\200\367\261\362:)\356\364s\327N\215\034@M\203{\300( E\013\342\200 \037\tB \204\023\324\236M1\265\006\247\264\001\032jz\236\023\010S\324z\233ML#L\230A\210h\006\215\000\323M\000\006\202I\023\002i\2414\ni4\315I\345\033)\211\3523SF\236\246\200\315!\220\006\200h\000\320\000\014\232\000\r\002S@IE=#\322\206\020\306\232!\223LG\240\023?M)\244`@a\001\210\014\002i\202\006\231\006\023L\t4\222EOD\324\336\223D\364\323SOMM\030\232\033Q\210h\321\223cM\"6I\241\240\000i\241\240\311\221\351\032\000\000\010\244H\323F\232MS\304\365O\324\361'\222\203z\221\243\030\240\3204\315#@z@\000h\320\000d\003@\332\231\r\000$D!4\t\202b\t\204dL\3214\247\236\245\017\0014!\240\323@\003@\000\000\001\223@\000Q'P}Z\227U\331\231\320,Zu6\333\034f\334\304e\240\260f\276\343:v%\205U\023\374\333\257\333t\256E|\256w7w\311\213]^\261\276H7\377d\353\026\236\271\374\275\213m0\224\220J\222\232\n0\224:E\037\"!\245\304\230\240\247&\036\032\323\003u\207\004\201L\301$\224E\"\265\n\223\230\004\320\246\004\3479\314\377\241\354\263033@PP \261`\240\306AH\214\210\301`\n\002\222*\300TE\001`\260\006<\240\010J\210\252*\225B\265=\262\004Y!JR\222$\211X\227q/\374%e\343\022\024\305\006&!]\366HU4\306\010\301\001\245\2446\206\300\030\311\030\202\213\010\260\005\200\240\252\013\025d\016\021LGT\210\001m\"\006\254\314\303z]\311\370d\304\201\231\005\366\271\332\001\345C\236\000\374!y\352k\215\007r.\364\262\361\350\026l+Lt\346\222\347I\020C\314\204\005\316\263\236y\226\001|\252\211\370M\203\310\362qs\327\353\317|\013\330\345\301\237\014\217\"\213Fx\306r,8\003!GdPQf\326\340W\t\034\205\366\003\342\373\257AM\216l\245Q\321\003Cm\355\006\2771}\325\315\332\013\264\355@\306\220v\372\375t\027\247\317zW\336\001Pc\001\244\337\247\017HJ\273\301\203h\210\301w\207L4\304\355""\245\262\250\244Pp:\233O\026rtl\026c\001\246\226\177\005\365ld\265\220\330C\024\031\256\252W\332\301f\233\023HrH{\307%\026ET\245\031@\363\206H\232\211\257\223\252\244&\t\203(\262\240\273\221/}P\244a\202\243\035\264E\223M8\264\"\227RU\235J\257sh$[;\335\221\235A#$\202\251\031\010\262FH}\225\222\n\225=\004\325*\211\n\265Y\235\352\032\006\354\262\003<\267\022W\025\322\270]\\\214+T\252k\211\000E@\245\026\241\246x\342\225\212\225\014\252@\203\003\301\364\244\310]P\242\223\232\216UR<A>1\221\300}\235s\274\222I\002\230\225\311\002\210\367G3B\036\207Q\316\211\365\020\212A\n\260B;\220\262 \0206\222\230\016\257\347(\213\277\211\322\"\312/=v\350\252\364`\016D\004\003\202\"#\030\000\376\335\361W\267\317\213n\022l\025\001U!\014ci\374\220\001\360\271`\376\347\211\0317\237\021\355\310fg\014\227\202\326\006\330\263[R>\375vC\020\005\013S\320\272\353!B^\003\035f \375\002\241\2543\2535\342r\337\230\265\001\321@\302\230\271\262\203\222C~\010\242\276\370BJ\231\331\016\235\210\032\032\021\206\315\336\207\356\3518\264-1\201\240\332\363\200\373L\221\262\331\rz\005T\356\270/\336\266\027\000\305\213\204u\246\235p\312\214\317&\302\240Xn\006\206\354c\244\205\016\037|\305f\022\013\2637\036'\341!\242\333`\252\235\305\273\027\203\263`\300\030%aM\350\272\030\271\246\026\256;\016\261\203\215vz\236\242#K\225\316>\007\206\201\021\004\006L&L\215\311\223\226@1\202\204}i0\034\304G\315pb@\276\254-i\006\204j\2707\0030\0237\262\250\177w\026b\014\207\005Cx\361R\005q\026\030\"b\321^\304\342\340T3\014\205@\222\001\203\"\002\0245\245H\3032+\233R4\\\265O\235F\251\2646[+j\207v\370\312/\217\266Z\333\332\345\021\311F\023i\016gx5\204\356m\315\272g\013\252\"\244yF\312f\307\205\226\020\357\364;\236\026\301\221\021{\313\252\244TE\013\026\303\334\010\367\306\"\026)b\202\001D^\224\357\224\241EOP\367\341\351\330\013\026W22X\227\357\262\347\266h\314\365\r\267\347\231\232\276\314\371\026@\276\263\270\376^\233\225.\310d2\036\276<\377\007\320u\005!m\006\210\230\371K\224\006\023H\335\032\206\260\331\024\346\246\344\222\3541I""\315\024\201\023\nX\262\213\330\321\201\r\"\310\002\301a\005\204\322\022\211 \254\030\304\202\300PP\240\326E\017\013\271\244&2\010VB\034s\262\367|n\214\265\234<\374|\275\351\264*\236.\344\222\370A\335YqgNL\003*^\003\343K\007\035\001\352E@`\222N\222d\223\010pBL\006\202c\031B%\341\267$\210/v\272\033@\332\002\262\002\222\025\r\314.P\352}*Bj\013\246U\010\240\310a\316\007\010,?\317$J\362\"\325|)N\224v\267\372>\247g\262{>\316\265\345\322L\331\234\267\362L\322\361x\263x_\036w:\250f\205Lp\200\230\003,D\0242\276\232\001&\204\023\021\rs\367liXEEUE$\010\004\005Y\326\365\220s\262\344[\t\235\005\324m\263D\314\351\225\032\336n03v\261*B\2501\202\210\263q\036\201\224X\203m1\225\273&\031+f\223c\177\2357A\336\0336\366YZ\0023\351\237\005\t\207\240\3403(f\032E\342\300X\006\337\263\312\261}\304\022H\331-\214O\357\363\372\217:\361\347\362\375\030\233\023le\344r\266\327\324\351\032\244\260hou\275\2647\016\321`\203\330\031i\340\232\016s\337\275\343\321\347\332\232L-9\3557^r\232\035\271\366M\317<\260\222\332\215\263F\250B\004\030>!\004\250\201\332qL\224\032\202\344\333e\202{N\326\330l\311\032q^\323\367\272o\260\364\363L\314\037=E\251l\363\004A_\335\3768\356\257\270u\3719N \330\337\227i\255\267\300\302wjD\334ZT\030\250s^r\006\225\223H\245Z(\250\266P\215\021j\033\2317\032/xSyL\tL\224\320\233\230\006H\320(^v\363A\200\260\027O\"T\301\217\277D\312\005C\221\301\232\024\272\3032\230\342\"\333%\020\250\002\220-\220\2536\222\220\246(\r\206\033\204\3406\300\251\220u.\250\260\205BRw\020\224M\362\2070\2570\031q\220f$\324\2559\334\3530\263\3102]\361>l\221RZX\227\t\002fb\363\007'Z\221|a\014^\363\030\302e\3078~es\211\213\261\221#\003+\003\007\237\364\377\307s\323\337\33018plNv\211\324\351J2\r\202.\\\306\330\347\304\220\304\237\004\220y\303\004\022\001\206@2\316\354\342\231\267Q\374\272\307S\032\205!ye3wC\345\tTg\0243$\362D\233\022\004`\214g$\323\320\211\n\266d\315\t\035\017\220\306&7<\033\303\310l\363\376\211\341\207c\234xJ\236\033\036\016\275_;?\257\327\313+cIS\267\031JR\212-t\310\274\345U\021\220\030""\013\210b\016\316\004\3428x\211\221\307\0334\301\201\206\"\207Q&Lj\241\320\237\007\222E\002vS\ru\014\350\310\217\263\316\346\034\304l\352S\241\316\243V\223V\234\272Y\202G)\n\260BFF\265L\302\024\2461\026vl\320\232\352\004d@\236p)\3330 K,N\334\013O\267\006\300\311\222f!@\007\247\254\206\224\206p\354\350^\246n\201J\302\017\305\361-]\265M\332\362\360H^\265{\216\226\273`\360\245Sj\256\243\243\215\371\323\024\261bw\221\363g\315\216\316d1\3059\316t\240\025\001\022\232\010TD\227\341\360\325\n\311^\303kl\355\2059\372\273\034\332.)\245;\021sB\241\034\332\263\211\245aI\245r\001\310\264{\204/\333\204\267aI\342H\236z\274\276\351\315\314\031ey]\244e\014\037\221\2269\352\320(\371\341^\\\345\245Z\225'K2\244\327\276\030eD\t@IBT\225\tiQ\r\372\272\271T\364\362\365\320:jy\013\350t\026\260uZ\353\257'\243\003\n\343\325\324S\014\320\303-ns8^s\3415$W\\d\306rD\225yy\202\317'\036<x\243\212G\020\342\035\351\316\356\271~\217\017\010\274\305\323e\254\304\304b\3439\211\231J\270ss\023]\333\n\006\000\322\312\262\210\312\t[,g4\2477y\261\356\003\203H\304\274\201-\370\025+\t \2446\301\217&R\323%\320\265\211U\213H\244\006\300g\306Hu\3512\2622$S\001\316\234\353\206\022#B\317S\037\274\336\006\361o\336|\356\007W\265\344p\335\313y\313y\r\374X\334q(?\223\250E\271\0238\224\254\251X\006\030\034\253\t\365\241\027\3111\0260\246\025\253+ai\363\\\316k\231\315~.k\236\273y.\313n\020fq\236\374\r[\226\330\014l\034\225\010\306s\217\026a\344\214'\034h[\002\353K7$6\235\035r\201\014\253Q\014\251\224\225r\307\034\n\301\3630\234\030\203qG\036\007\r\341m\014\350\327\321\343e\224X4\314\300c\221=\036mlj\362&6\334a2\020\265\025 \2462\251\021\2529\316b\024}\211\031?p\265Z^%h;9\372\273\326\244b?SL\315F\304\322s(?\rd\234\324-9J\231-22\263\006l\205s\227\367~\220\227\243\300\022\312\256oN?*r2\324\034\rX\225\367\336>\237\032\331\r\215\025\333\305u\371}W\007W\227g{J\372`\203\276\007r1Qs\222(\030\026\005\003\2659p\240\026\365K\325\341*6i\006\266k\020\2741\022\204\243\342\210C\016\363\337\364\346B\324#0\252/p\367\025\256\263\313\216""\322\034\035\357R\351\304\325\004\307\360\247h\032\266@\246_i\231n>\230\030\260\211\202\301\"\010\010\211M\025\242\354dd\373\371\247\245\2719;0\036\343\016\370c\005'\010\253d`\243C\206N\0318@\341\207\014\3419G\201\236\251\013\366}\017\204\335>St\360]\370j\203P\321h\032\032z\262\242\344%@\242[P\350\212\\e\305\211\315O\"\231tVF.=\240<)B\220\365\275\177Y\353\207\2004Z\262a\231\216\266*\377<\347\200\205\276IHMQvu\251\353\344uF\030\334\377\2019s\376\035W}\317J:\365#\223\222\017\267\212=\271\217g\263\315\364\323\360\263\030\245\210\214\255\270C\023\216SK5\2001wv\007*UG\232\236erB\272\034\014j\305K\2124M\244z\271\240\206&\245\0341Vf \207\243^\307(3\344Z\"&\306\316\224\340\0031\000\317A.+\201\2707nE\355\222H\263\205\341+ \260X\025Q\277\035\371\357\013\010\3110\272\215w;\273t\234\216\357t\321\006\200h\221\2747\233\240y\227\336<D\302d\3050\231\261\343wW\361\245(\346`r\221\367uL\317\031A\220nL\335\355\300\336s\370\325&\362\2263\246\363\205D\340eT\337\216\223\202\022Z2u\024t\375\361U\324\354A\360\037F\357o\267\327\205\237\256\037\221\325\341]S\211\222\236\212z\352V\267\304\016\252=\332\224\240\262\347\204Z\205Q\016a\373\277#\246\254\355\306\233\274\374\376\030\330\307Nr\276\026Yr\262\013\213\314\271Y\245\207_\314\003F\022(\025\010\nar\201\3208\003\353\213\342P@\360^\337\334\225\355\214\233\031pp\363\0270\032\370qF+S\326C\232_\276U\374 \231\245\242\027-mS\t\212\346b\375\226E\332\027\353[\317\232\006\202\266\250\302`\026\363~z\2415~\201\342\300.\340s\177\235c\3542:y6\370#\276p\212\301\261\207\241`\300\022\305SS\2216\213\265r\350\326\202\004a\000E\340\346\200#4\360\300)\273\357eG\000iP!I\031\244\235\205.\332V^z\n\010:\272] \013\303\367\210\210\024X\225q2\202\023;\031\020$\210\226M+\"S\331\213\232|\037G\261\343\354+\255\355\270\370\311 \302\336\301\374\372z\240\nh;\201\323\020\354]\375\030j\032\026\303\250\222\342\002\346#z\016\002\340\270/\214\343\225#3\346C\022\206v\007!\237\233\322\365SUi\307n\010H\355cHyD&\224\010&\002\273\272\275y\375\272U\244\231AY\2318sr\255\231\234\306\263d""\202\310HMHg\345\331h\324>J\354mBB\302\n\235V\256\005\202FC\014\355\006F\222\025\341\343v\033\026{Y\010\367\236\341\201\004L\204o\212N\331\331\021\223 \215\262l\341\330\220\035\211v\001\330\227`v\021\350\210\274\2614\007#\n\010\266\260h\346\350i\304ETj/,\346I\247\007\034U\326\031\272H\004\2073'\035WA\212\004TA_#y\264\360\340\034\022\340\267\371\321\347V\363sf\003x\314\343\001\373\335\340\266\021\270d\234\226\t\033%\t\260\251X\003\263\002\207i\023K\227\0016\314\220#Sg\005\025\030\340O=!6\306\233U\205\361\375\256\024\266\n\342e\336\312(\202`PG\243<\207\344tA5\364\366\363T,\316\273[\262\3250\306-\251JQ\231Q&\003\rRC\033lm\214\222)\265B(\333\036\207\246M\330Z\245d^ti\010\302\250\217F\220\315,\017\367\010\206\014i\241\"\315h\n\007\327\227\237H\262=\261y~\214\207\322\366\337\360\005\331r\353\362\251\004\260\006\222b\006\233\227\316,\320\324J\320\031\0255\307B\344*\231\225\037b2\032\264\354\025\2540bM\210\266\260\016\364\322\013\314\360\000g\330':,\013c\r\014X\302Et\215\244%\247\026\3409\214\t\242!U\261$\300\376J)\352$\250\317\026F\222\226\034D\267\205Z\205\\\032\307z.d\273\035@K\246\311\244t\272C\273x\232e\323vU\312\300\204\r6\330\274\023S\370\007T\235\234\252dj\342\252\200t\357>\031D.\230\010_7\2777\036\316d\205\210c\327\"\361/i\351\250\260UE\302\000\221\364\t9I*}\200\343\303\202\315\322v\203\030\332\006!;\342\360\302\022B\357Hi97\2303\276\344Oxx{\203n\204T\0220`\252\202\304\021\210\212\214D\030\250\242\212\253\023\301'6f}\036\367\222+J\377\221#J\361\033\261\210\237\270^\317\202\017@,@\237\214\037G\221v \037\320\214\r\215\002bb\030\232W\264\207\036\260\366q\3460\013\00786\245h\314\226^\276\344\032\332CH\031\265\013\336y\030\020\0145#\001\332\310\016r\001A\222A\246\227Xq]T\261\003\232\302\313w@_#\210\034D\302\305\210\027\3324\234w\357\314\207\313\321x]\225\205\024\007WJ\016\320\321G\314c\257\226\360\347\016d\263@7\376\006\036\325\205\020\004,\341\274\3474\260\033J\224\303=NdY\243,\010X-\205\016\224\223B\347d\370\314\346~:4\354>G\245\014\360c1+\211\n\346il\235\275-\210""\344d5\246\211 \030\232\252a\340H**\006\375\377\303$=\031A9\346\300\240\r\033\304\007\026\000A]\267\363x\007\2621\326\257\022\2619\310Zh\240\204\327L \317\214\"\002B\264\344\251\331\3351\003\266\334hq\203\232k\355\273\215\211y\014\230p\2155\320\301(!\031!\241!\016\036_o\201\2417\310\310M\362\025V@R\357SI\337Z\270\003P\260\215\311\324\316!\232\204\320\200\235\205\006F\003 `5hL\311'\220\240 0@F\n\272\226\2245%,\020\022\002#\025\036\343\226\210*Kj\370\\\200/.N\347\3039\363bHwG\225\340t!8\201Y#m\275Icx\275<\211u|m\003\324\031\201\200\301\243K3\264^\225\0175h\002)\2000=\320\177P]\351ZR%\246\363\237!C?&\031S\014\\v`\200\340\272\230-6\360\007EVg\006.qFZ\371\276>\201\342\2341\300<\324\232j\354\324\016I\036S\031\271\202\317\267\351\347\346\246\201\205H\371\373\204pI\202\032\354%\264\006\304rf\316L\034\270-\341\355\013\360\247K\204\033f\031\027\006wT:\260\233\002e\217\004{P[u~\330\250\2747\322\202\241H\r\372\276\270k\337\366sd\247\"2;\364o^\357\213\371>o\231\312E\002\005D\276\224|\365*\3304V\"\030V\013\013M\206\345\304[\036\253Z\363\275\361\320\003\267 3\241\n\021J\017\247\345\251&\216\233\312tt\353\n\205ru\240F\325\226\207X\330\204\362\347@ew\322\010\225,WZ\331d3/I\343\230(Xi1;\357\022\232\006\"\201\"\220\206\326)*%lx\332\306K\301JZ-\006\r T+Z\032h;\023\355\200\255\270 \033\246%\036\002\2060\3069\000\340\231^x\374C\024\273\303\234\344\322\220HD \201@kJ\200\340\250\230\025L u\252\030H\201\204\243\353H\267\262D\237\251\036\213\253\325\333Jv\365\323\021.\261,\206)b\226p\250P\210\303,\222'\317\323|\205\216\313\3423R\373\335DxQ\303\245*\275 U\322\355\254\\\014\220a\361\234u\364C\222\332\227\266{\256a\337\241mL\024V&\020o\020\344\350\326\257\305\036,\007\336\276.\256\026]\347q1\007\001\017\206\274\2478\341\270\301\326\204\005\301\316F\016p\350\315\212\321L+\321\263\344\264\260l\231\266\000\346i\005#\213\301Q7\016\373\353\315S\270A\334%\334.\344w\007j\347F\215\341\244\314\232r#\235\242\201\260\031\262T\002cbj\244lL*S\240\233\321k\232>zQ4Wq\013\225z\263 \354\362x\004\362\262\255""\007\256\201\010\r8\013\014\242P\206\003hS\302RG\202\023\006*\252Z\232\235\316\253\241\314\352\260r)\0057\205\376\352{\262\021RZA\"\335v@\331Y\025F\220-\301 \263b\342\356\360lH\310\326\014`\205>J\310\300F.\000\300\310mU\306\364\320\\\301\264(\030%l\263u\003\313\276\230\254XQ6\357E\373n\263r\204\002\200\311Q0\200\2602\333\321\034\236\331\350\325\3037\300\302N\334\3319\345\242\267\"\3026d\201\322H\034*GIt\241\320.\2014\007\033G\245\310H\025\210`\313\034C\200\020\010A\021\005\367e\030\215\304\014U[V\337\205\\\275\\\262\252\220n~~q%\001\205\362\001\002\005\2311+2\377\206\346\014\312\367nF\340\334\033\205\270\366\232>\037G\037G\243R:|\236\316\215m\t\014\006\201\264\213\322\264\355F\275z\326\277V\301\352\301p\r\321\355^\241VEF\352/[\2278\254Lq\357Y\306\014\3678G?\030\343\307~\203\330u\365\337\316}\002Y'\035q\326\374\257=\365\004\322\231\363\304p\242\350\335\320v\362\234\336E\2450\325\034\231;.Yx\374\353\3149mJ\214b\356,q\312\3340|\334\347\230d\347\t\035!\307\303E\265\331\035\264C\277\363\206\217\361\346\245G\301\332N\257W\255*Y\304\271ob\013P\275\321\274\363\312\030\n \300X!\003\357\376&A\210\261N\222T\205aS\224 W\342\014\261\345Bv\262\004\261\023\207\327\310R\204\366\372$\277\307\327\222\305GI\243\230\\K\006\025+\252X\232\205\225=\255\217d\020?e\242\010\300\362\3540Ly\300\223f\025\247\257\345\373\226\372\332)p\315g\300\260\203\021\230\260\321\242`v\251\210G\277\373;Q\233\202\206\323y\223\",D\351\035\021}\224\355\t\311\321\321\325_HCdLK\260\315\006\354\224\035]\260\034=\203v\227f\032N#{\341\005\257\221\346{9\r\226\313Aa\252\027k,d\304\"x\226%\016T\020\002\376\252\010\007\233\034)vo\345~\022;\270ND\177\240z\246\242\324}]\027%:Y\203\262\352\224O\017Gl\233\350\177,78\355\325\351>W\343O\037\322\361v5\344 \256\333`;\250`T\337\201E\nQ\355[\030n\325\024\306\360A\202*\221\021\3619\036\256\2751\370\347\006\331\232S\344X\210\231\177\\O6\354;M\333\267R\354X\271\361\275o\365\344\366\241\343\357'\222\207\313\r\203}20\351\3503\ne\2718<\242\351\220\3632\212\032\025\2233\321\301u^+t>#""\213\367\236^\370_N\334\2244K\210\345a\345\np\340\321T\205C\241\3071\341C\327\335m\337\310\341\206\200\344\004\0335A\276F\223{\314\\\014#\227C\301\337\021\273\275\027\"97\323\020\316(\204\327r\241\302<\302(\226d\2416J\241\314\032\330t\304z\233\26699 \375\220\320\241\334t\210\345\202a\023.\232Sxd\301\014\343\016\n\213=\000\364w\206\356\361\267o7\262\240\345p^\315\022L\306H\302\023bS\352\234\234\236\2653\356\336\233\242E\202\272\014\266\177\237B\356w\010m\324,\336'V\235?O\347z\335i\3258\216\313P\373[\212\030\203\306T\353\205\2315\037\357\340u\375N\244z\374g\024+\256>\273*\360\026h0\330a\257?[\304f\326)\270p\353t\372\217[2\034O\031\356\021:\365\362j\237\002\244w\304t\177\377\376\035\217\027\331\360\374o\032\236P\361\343\300\374\317\356\364\031\216Z\2146\326\331h\233\316.?\350\237U\017\366\207\375\354^\307`\316\347\262lr&\273#\225\366\251Y\360~\207d=\0272S\263Q.^\310\206\276\355\343\354\177/?\3204\214=KV\\\364!\227\321\030\211\211\277\213\214\343\274~7\235\347M\220v\271\272\263-\037l<\376\267L\361\347W\252qkI\220\320j\234L0x\373\216\242y\223\315\0310\366\204\350\245\017\367\340\252&\335\033\217\004\337\313\320\0274p^\n\267v\227\034\201PJ8t\0317\326\271\215q\212\356\363\323&Q\360\261\332Q\223\264\333\326?\234\001\227\023d\236\347\014\203\3312(*\017p\361\3300\371\023\200\357\3424\227'\201C\272\344\216bv\314^\261\274\354\216TU\036\212\212\236\000\301\214\366l\246.\3434\n*\246L\252\252\212\350]\213\312b\367r\343\034/n\023x\267\220\242J\336@\352\034\375\275\377~r\300\217\210\336\341)\331\017\314\357\267\373\233\371\003y\231 EF7\262\344\306\273\217\030\306\370\030\201\356\200\313\223\251|\237\177\250n\375\354\301\214\352\251\000\252]\276a0\273\n0\270wE\031U/w\327\006&V\302\247\207\033\n\220\0306;\367\261\376M\3108b\021W\246\306<\212\347;\241D\337/_\025\373\256\302\257\344\277J\370\233\2528R\261\376\267x\035|\323\351\206\0073\225y\367\305]\004\347w/^G\251x\267\350q\363\312+y.\333\267n\343\230\270\254\367y\316_^\332\266\340\345rV\257\236\326m\026\236\370\034\356\023\252\276""\225\255\240\360[\266\177\026x\226\337Kr\345\262\001Wkk\207\275qU\316}\233In\255ql\214\245\253#\337Z\266U\377\252\225r\265\213\025S\303^\266uB\220\250\246l\233>;\362H7e$/I\321\327\3175\222Mb\355\335s\203[_\\\354kj\026\213r&\251\347\263@\325\241\245\251\352\034\304\323\371vj\223Gu\2217\317\022*\321\230v\016AS\305\224\346wt\017L\212NN#\004Z|\\t(\311\253\320\227\307Ma,\003\364p\2256+\226\327\244-'\333\275\320QN^C\264c\262\233\302i\310\204\\:I\231\246\234M.\321Y)N\006\004S9\216\321\216'{L\202\305\rBT\256\262b!\016g\014i\245\2574E,(\215<\2172\232\356\320\236^\310\203\007\251\232\230\234\353\350\300\220{\274\321j]B5\334jI3cD\350\223\365pN\245\tp4\022K\355\253\235U\216\367\211\331\256\266h\"\322\314\225g\327\202\226\235;\313^\311\365\253e\005F\031\0253A\201owS\212\235\344\314FJr\3038\242K@\352\240\034\247P<\353\211j\313\3321=\333\352L\307\245\232\231-l#\t|\rB\204\313l\211\333\"/\206\207\227c\362\"\370\\\023\377\027rE8P\220l\266\355\314";
  29871. PyObject *data = __Pyx_DecompressString(cstring, 6697, 2);
  29872. if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
  29873. const char* const bytes = __Pyx_PyBytes_AsString(data);
  29874. #if !CYTHON_ASSUME_SAFE_MACROS
  29875. if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
  29876. #endif
  29877. #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (6885 bytes) */
  29878. const char* const cstring = "x\332\355[KW\033I\22666\270\260\r\266\301\330\3453]\335'1\270\014nP)\362\241\007]\345i\036v\227\317qU\233WU\365q\327\210\224\224\200\272\204Rd\246@\352\3233\343\245\226Zj\251\245\226:3\033-uf\305RK\226\374\204\372\t\363\335\210L\275%\300\217\251\3563\215!32\0367n\334\270\367\273\367F\246\027\244\345t\3322\263\211\003\3351l\311\3317$\335\212II#\265\347\354K\273\246%\351R,\023M\304\244\025\343\257\t\303\222lc\357\300H9\276\2337%\374l\333\030\364\007=c\333\213\257\314\250\3568\246t\230\321\343\226\356d,C:N\200F\352+MJ\233\211\224\003\352\246\2447gk\231\310\307\211m\032\206\264\264\233I\305\226vbz2\266J\323.[\261W\274\313\216\313\214\2354\217\301F4\343H\007&\346\320c\261\214E\324,\303\316$=\276\226\255={\211\227\350'\355\260\205\264#\343O\301\237\272$\255\232)\3072\223\036_\346._\270\273B\335\226\3445\311\311\244\223\206\355\222\3330\260\236T\013\305\345\246\214\216\364d\306p\373=\317\352\007\030\266\264t\263\321\363\331\263g\255\213n_\324\334\234\177A\362\317/Hs\262\266 1?/\006\233E\334\250}\276A\215\205\375>\277\252(r8\020\n+r\210\005/;\221\346\0258m\255Y\244)[&\322T_(\244\311\376\240\032V\265\260_y\277yDI\324\315K3R2\2212~'\031Y=\346\270\033'\331\373f&\031\227\242\006\346\366\373\232\214\250a_\270\365\207}\000N\026\233\234\3042v\372\202\234(\001_X\016\004\003\001\231i\001% \277\037#\213Z/V\3327\300\037RC*\013hJ\320\257\211\235^\205ad\222\375m\325\265\276~\366\332e\027K\322\246\243[\216\260\204\376\206\340k\031#/I_\353\251x\322\270\314 eIz\236\212\237?\342C\230\033\201\307\272'\207\036\373\320v'\301\033\007i'\347I\252A\n\226v)\262\215\355\r5w\324L\222\246\353\226\2134\rz\241\313\022o\330*\n\241\336\304\245#\303\302`=\371\356\263\320\022\344\246\212\252\347\254\202\371\203\276\240\237\300\210\251r \354\367\207.\273\246\2768\007\355\367\313\341`\200iZ@\325\344\200\362n\322\352&,\373}0\337\020\223U%\034R\375\301\300\245\005\264\310\032\273\254\265\221\366\313>M\221\203J\210\005TU\013\311\332\245H\253\rpR\373\352\317\002jZ<\227df\034;\0217\032\363\004\002\276@\353O\360""\3358\0300\177\3224\323\211\324\236\024\325c?5\210\253\236\236u\240S\324\314\244\342\324\3332b\216\236\332\003d|\024\224\322\337\r\247\364w@*\375|\254\302\0323\326b\3021\016DG\254>\r\317\202\345\221(\372\310egg.\373M\"\265 \345\3705\373\215\236\245\262\236\235\337\331\271\004\332\255\020e\273]_\373\331\030\357\304\233I\221}\376\371\213\223m\361\351\335\241\303\034h-H\374\322h\375\250\332\361\241c\273_`\003y\310\320)\345\013\306\204\255\373\030\324z\355cO\352\027\014\004\373\356\2467A\332\202\234\347\036=\336\225\274\337G\322\343\356i\265>\250\357\226\335(\250IZ\321|\032\"-U\241\271\371\217\024P}\010}\203Z\220/\223\377\010\275\242p-\365\304\221\216M\353'\302D\351x?\021\333\227\300\227a\331\330\241\204\231\222(\257\340\005$!\031\333x\221\000Wm=l\004|\316\261a\244x\306c\035!\270\002\014\350<T\355\251y\274\323\222\364*as\234\210\231\246\005\235\340\352\355*\235 \343jo\207\356yT\210\374@\"\324\241\017\215~\372\233t\251\355\354\274lY\340\316\216dF\377\2022`\334\320!\037\361$\355\353G\244\312;;iggg\001w\207\355\3544\250\221\020P%c4\322;+\201\304\013\274\221\033\322\023)\317\036\332$\315\roAr\022\007\206D\202OXv3\250j,\004d\275\036\030h\342\321k\202\251\245\211\324\221\221\314\265[\216\275\264\324\256\333\\\276_Io\\]\222U\256K\n\212\001aA\214j\025\241m\001\224Q\224~l\243\301\305+h\220\275\311\356@EDB\035\235\333\365\345+\301\300+Ph\225\263=\307\253\0278\351v[A\014;\327F\243E\337\373O\364\306\377\243/\335\024\341\\H\365!\326\362\207\025D/\376\240\254\300\210Ba_(\250\370\003,\210h)\034\222C\202\360\305\265\234\227\373\2539\033\250\242|\213/\244\355\274\217<\220\230\253\r\203\250\375S\357iK<\305_p!4\354_P\2748\216\tK\220e\377\202\334\255\306b\027\304xm\201\271\330\217\200V\366\"[Yk\330\017\013_\314\014V\351\322\303\016\330\202;\337G1\005\346\013\206\024\246B\371\303\232\346\017\220?\201)\204\302~U\323d\370\n9t\001Sp\216\3156\230\265{\032\202\215\225\220!\254\3663\000N\242\267\336\3332\306\312=\307\272Z\320c\360\377G5o?S\201n\221\\\272\021\026 \017\325TBa\256\357\032 P\226e""\256\261\2410\312\032\343\365j\020\210\037\010\316wk\236\336\222\266\365\3256\314\256C\341\372\266\267i\242\022Dt\242\206BrX\223U\000p\230\346f\212/\250 \025T\202~\026\014*Lk\347\244\315\000|\010d\333\311;r[\030\246B\277\303\214!#Fn\251\252\001\215\3022M\365\207\230\246\004\0030\000UV.\250\354\203\365\334\330\273\010\334\017\006z\264^\010\346\377\t\360\377\010\000\357\256`S\334\376~A\276m\375\312/\031\031\236+1\345\227\216\017y\377W\211\350\027\273P\371-\323L\332_\034$\354\330\027Q\236)\363\n_:\267i&)Ft\337\001\031H\31594\211\321\274\321\226\236\352O\263\364O\372\255\024u\3571~\215C\020\376\247\310\306\014zQ\263 E\241%\334@\020qZ\224V\353\311\236\010\244/\301\016\215\335\335D,a\210C\230\247\331\377\371\357\247\215\366h\257\366\377j\266\307z\2647[\343\324\232\262\221\267;\022\244xp.\332X\246\t\250\224\2765\035\003\240\240;\034\031,\336\337\210\213^\t[J\031\t\324[\322^F\267@\332@\223c6Y\006\342\231\226\203\312\224iQ\016\352\002\215\224I%\0163\2068\326\266\247\007\373C\233\344\315\263\3529\030\034~\027\003\22457\372\274YT(O_\344\331\272\354\353p]-\243\027\031\357\262\030\246\253\032\342e9\354k#%\373\340I\031\317\373\007Q\"\305\322\032\244\202\276\000\331\312\242\034\362\005\265\016j\214)a\371\002$y\207E\325\007:\001\037\247\255\370\2246j\214\332\274\313\200E\312|\252Ps\251\350\356\367\313J@cLVZ\010\372}\302\231\362K_\202\215z\237\317\307\357\341\306\321\210\020'\255>\014?\254)L\326\214E\277\3266b^\372\n`\"6\247ym\316\266ee\304I\356f:\231p:\337\273\272\311\032\325\357\301\203\244Z|\352\007?\027\363hp\303]\222^\233v\202;@\335;Y\201\376\332\234\311\306)GsP\302\376\332\264\022\177%\365N.Ik\t\313\365\236\356\204\226\236\023c\033\207ib\274\364\022\355\220\300B\203\020\375\354\354p\036\340\243\023n<\223\206\341\301\212\370Q\354\237Z\204\360;)\261+\355\352I\033\2117\250\246.N&%\375\320-\314\001p@\001T[vjKs<\354hOY\243\006-\220\216\022\233\242m\252\\\242\365\204\350\030l\330\231X\314\260\355\335L2\351\nhA\342\247\241|\332\216\260\004\002\336\003\267\311\366\274z\3601#?\247s""\375\221=\307g\020j}\261\363\306\005\211\277\276}A\022n=\036\274\354i\345\007ae0'\260{\315;\321T\230\217h\001>\334CF\224Z\307\270Uh\014\2048\330\210\207P\260I\342\343,\201\232\311\342{\313\322\007\034\t\002\177\303>\026\324X\220\007}\276`8\344WA\t\274\371C\234\315\240O\r\252L%jmtZ\353]!\204B\360\025aF\357\207\202\336r\031ui\251\013Cp\262\026\356\"\327ZO\3354\237\354\227\333\030\t\323\213\300\200\334\306\2608\336\365\005\203\001%`,2\217\344`t3S\244\335\342\323\016\341\023\271\311}4\210{\352\330M\200\263\007#\334y\300\360\256\240pN\026\334O\325\226\235\255\013k\033\334\332\337\235\251\\\222\177\272\004?\344*\2640\205\025\035k\3427\316E\320\247\250J\010d\003\276N\353jo\"\031h\2760\247\245*\356\360\260\302\311\211\3466\261x\372/\016|.\343\317\273\336\202v\236\031u\274\375l{\215\331\277\357\305\274\274x\r\362\316N\236\017\377\307\362\361m'\202\2565\267\275\214\021\306L]\373;x>\340\375\375{\313K\250\213\273w:6\353xg+\354\212l\240\257\357\321:\277k\230\363\252z\277 \274\354\344\274\330w\366\0170\301 \362\235\257N?\360\274\375c\222\0176q\363\325\373\300X\250\331M\353\232Z\353\303\324y\013vA\271e\336^rn\366\322\272V\254uN\353\201a\327+\377\367Hw\376\231\352\3742\251\216\263o\031\306\337m\256\323\370\226e\320\3071\347&9\203\276\247y\277\211\317O\256\264\363\3419x\351H\354\202\334\321\374\347%\\\"\326\241\236J\260#\334lTR\240\305;\007\265\217\304e_\350G\320&\313\n\035\206\252\276\200\252\212\024E\024\273\022\236\326\372f\030)\002=E\343\257\233\332\007\264\326\213D*\020\014\006\333\347\362\213#\"\346\327T\245%\037\362\226=#\375\360\303\017\322\313'\007R\312t8\362%\223\260\024\344A\256\375\354\232\311\244y\314?\2763\350\325\006,\006&\0367\354\204\245Ga\003\037P\021\373'\246\027\323\303\256\322\245\324\365|\247\360\216Y\342?N\206\330\211\245\227O\021\233\037z\266\246Y\2756\274_n\370\3611\347\"\254\rH\373.\310`\240%;\014\366B\247`\013:\211l\266G\332\266\235\372)e\036\247\334\335\212\033{\330 \337\277\366\375\352_\232\343\221\277\242\310\363\035\237\302\271-*\023-\335\037\344\272""\035\230\306\346{|\204\351\266\312\341\320|\237\317.\274\361JH\233\357\375\201\222\327C\326\264\371x\302&\3640Rt}\274\267\027K\330\242\034\357\371\346\335\033\3124u~\356\261=?\340=\227\327U\225\203B\204\244\016\021w\000}R9\367\206-Hod\010\377G\334\351\217\036\336\000EUz\360\373\030\275\305\220\177\304\217 \360\204^{\314\321\000\332\036\372\243\2079\032\300\343Jw\300<~\236\360\001\255\2635\330\20165\017\365\335\332\220\032\232o;\231p\353\003Li\251w+5M\236oD\306\336vB\277\272\224\333\353\037\nw\264y\r\376\340|\204E\034\376'\343\037/\255\376\361\233\327/_=_[[{\376z\363\345\253?~\3732N\237\236:\271V\351BU\"\221\327\271,\376\326\0221'\362\255\221u6\214\335\365uecC\336\220#\353JD\327\231\316\"\212\316\262:\313\351\262\256\3501\323\326\223\211\275\224\021\217p\305\210\360'\022P\304\261\364\224\275kZ\007\374\375^\004-I\\\350\313V\250\270\221\212\367U\364\276\r\253--\335J>\260qU\267b\373\272\235H\341\222K\305\022\246/fZf\006a\264a\353\216\236\222\365\254\236\305E\321szN\326sJ4\312\242,\033e\271H\324t\366#\002\335#\272eD\260\026[?0\"\364\231|\304\334\215\210h\222\177\277k3q\223\243f6\212\177r4\027\315\311\261\030\2131\372\215@\"{F\214\311\370\365\312\331\030\313\305d\206_\267F\226\361\353\226a\253\302D\273\377\363Zw\315j\244G\335\206\201m\261\215\016\300h<\276\326-,\205t\240Y\305W\332\033Gz\327\256\366\300\224\266\252\366Y\232\325B\246\221XR\267\355\310\236\341\320\367\321\364\210M\211$R\244@1\203\376W@,i\322w\017\311\244\013\003P\272X\203U\030E\333\303*\327C\361\t\201\370\200\240\017\250\365\0062W\215\305>\272\017\342\332\366\202\034v5\240\315\367e\322\304R\355g\276\203D\234\253\316\305z\177\231\324\017\242q\375\231\333\317\025D\257i{55\351\354\031)#\233\266b\331X.\036\367\307Y\234e\343,\0277\222\216\316/\021Y\334\224\270a%\216\224\270\031s\014\333\211g\3439\303`\006\313\032,g\310\206\2345\344\034\014\325H\333\211$\342#q[\203\266;\266\2215\262\330\256\334\256\236\000\2567\336\367\373\350}\277O\267\220\247\362\347\216\206\226\017\001:Z\032`\261K\202\217D\350\333\352H\304]""\307>&L$R6\375g\244\226%GP\333*\201\306\203\335\232EG\022\330F\317\326\351\201D\227L\374\324V\356\022\035x\"\245Kp\235\264\1772r\336\326\210\021)\203\321E\356\351\320\250\322\323F\276ON\304\275\001-\322N$r\200\\\224\256\316\376\201\236\213rr\320\023\374\276v\032\372\02290\343\231\244\201{&\351\240w\212 \207_\343<\200\003\227\216\031\375\213\271\273\313\360'c{\010\207\326\020\025\n<J\247\375i\226\226\323J:\221vy\341w\372\216\013\t<7\275\264\t\3104\340\236\3015\017\252\332\"\253\264\2038\027\277Y\374\345\020\356\342\027E\031E%\355\250\351l:w\330f\311\230!\022AUR\260jYkk\326\272\314\201\214\361\253L\207\031\313\226\241\363\257\037,\323\001R[\334\316lf\263\254\315r\266l\313Y[\316\021N\030$\316\r\332MD\022p\272\364\r\031}\002\346\205\272\342\346\315< hh\365\330\255\345\256=\367(#Z\201\006\332\206\343\n\035\245\270\261\253c\037\354\244\2316\230\314o\212\n\227\237\34134}?/5\000\216{\350\246\257\217\264\205\003m\017\253\355m\253}zb]\346\326\261\331\336\243{\035^ \321\036!D\272\202\211s*\272\010\013\n\021\016\267\004>f\30496\335JWx\021\035\216\337>\264\034\233\336+\330\307\344\352\343v\326\316\341\237\3430\207Ed\374)\216\034\211\020\344\210+T\035\031\017\324a\3372\217\0353i@]bF\003\022\204\237\340\217\364_}P<6\3057.\021\030\246[\0229\333\221\377\210\035\311G\312\221\312\237E%?\275\312f\375Y\226\225\263JV\315\256%vw\263\033\244\204\271\034\313\3119%\247\346\250.\307\353\336\016\375\354\2772r3?\231\227\363\353\247\303\267p\333\310\037\236\016\217\347\267\013\217\n\313\247\303w\362Va\262 \0276\n\250\0359\035\245\347\373\205hq\270\270R\214\226\256\225\202\345G\345\225r\2642\\Y\251\030U\271\272Y\273Z{\\\263N\356\235\254\234D\353\2577\352\033\233g \033\004\265\265\342\325\342|I.m\225'\313\n\206\014\235\366k8\033\276\231\237\315\307\nS\2306\203\211\364\323\316\212\263\341\261\3742x|\\8*\376\271\374/\225@\365~U/2,\347\351\225\221\321\267\177+00?z\267p\275\240\027\234b\2404Yb\247\243\267\362_\026\016\213C\247cS\205\027\305\351\242Z<*m\224\016O\307\356\325\357\315\225\257\226\347*""\323gT\236/OP\371\347\353W\306\247@\347Ui\250t\257\264\\\332.\317\224\327\313FE\251\350\225Lu\2556R[?\275q\277\260^\320\273&\272S\277\363\270\264^\332/\203\317\007\365\007re\272\022\2522Z.\032\247\n\313\205\315\342\235\322ay\264r\025-Z\365\032\344\266^\215\327fj\033\265\303\223\241\323\321\261\374\213\3024\3262ze\344F\376V\001\203\306\363\353\371$xf\365+\277-\263\237?\27322V\277\365\033\010\206o\310\203\30216\343zi\257\274Q>\252|_]\251\356\326\226\337B\276w\353w\371j\352\362Jm\272\006\016~\305e\364\371\300-\027\233\362\2748\t\tYX\220\302\351Z\225\311\212Z\261 \347h\355ZM\256m\237<:Y=\261\352\353\233\365\315\355\372\366w ;5\220l\213\362\\+\262\"\266\347f\376Q~5\177\214\212\253\305G\305\325\342!\364I\206\234\037\225W1\335\275\312re\235:\315\200\020)\241\002\021\037\236}0:c\030s\330\312\365f\341\032Wt\273\205\310F\311\346\n\036\303\352\345\312F\305\256NW\025H\340j\355Qm\245\026=\271v\302N\260\266\033\357K\300cF\346\033\013\345\351\267\261::M\242S^\311\353y[H\226\226\266\016\353\230,\250\005\253x\257\270\\\334,]-\315\226\242\345ke\306e0q:\374\311\333L~%o\200\301\037\320<D:;\322\260&\350\327wd\004C\345\251\362Ve\212\344\005\035~Z\236.\007+\217+V=\274U\337\332\206\241\024\330[n\265J>Z\270Z\230\201\036_-\316\202\303\341\322J\tFz\2333\241\360\235\221\213[\334\030h\277n\344\3577\330\273_\214\227\036\225\276./\237\336\270\235\217c\001/\033\334\216\224\327\261\272\007W\026}\264)cy\025\022\230\022\310s\253~\353\363\222^:*o\203\237L\025\312\355\332\000\251\367\023\3106P\375\0242\375\374\344\023R\311\r4\007\010\007lHf\253>1\313\315\367q9S\201\264\356\026n\026\247\211\247\211\374\027\305\t\330\324\277b\231\254\374\307*\253.W\377\355D>Y\207\321\222\212\220\314\034\262X\241nFQ+\361\305?\303\250\0310}\255\244\226h\317~?\3049yT\232\346h\370\242\362\244:Y\r\324>=\271z2-\364k\034X\265Y\030*\334+\254B\002\223E\205C'+\255\226\254\362}\250\306De\246\262Y\275Z}T]\255Z\265{\265\345\332\246;\370\031)\347=\014\337\202\3704H{\232\224\r\025\247\243\277\202\210I\257\3537?\343\020\331\243t&\372""\362\301$\373\251\342F1#\266\352\335\210p\016\316\\\005 e'\005\230\001\325\303\267\313$'G\030\027\337\376\365\242^$\361\254\014\271k\020\263A+\3523\032,\301\251\312\365\257^{.\342F\237U\022\013P\230\372l\240\022\255\016WW\352\317\334!\200gn\005\202\017R\234\027Cb\313g\353\267\t}\215\262F.\346n\3416\255\246s\273\277\205\260\227\373m4\343\n\367k,!\006\350_+\017\t,\036\317\377\201\373\025\030\334\0230\312\310l\3278\362\333\240K\233:\202y\343\334O\220\275k\325\241\352\004iL\250\020$\354.\276(=-/s'\302*kh\204\317\252\222\210\276\006\347\267@sB\220\236 q\334\307\312\206N\275\002\325L\320\023o\233\342\332\204\342'o-!&\3019\337\327\007\200\205\331B\014k\375\002\376\224\235\272\235\326\n\334\346\005B\221*\220\325=\342\312\340\216N\024\217K\200\002\227\024\330z\345\nt\232\213y\010\022\277q7\377\037\256T \206\321\374\010pG\367\340o\275\273 \366u\245a\374\244\200\207\247|\005\033\034\275V9`\361-\346\326p\017Pi\000(\267`B\354\254\223\036\341\367\204\220\tQ\374\2524\344=L`\311\321\342xi]\340\272%\204\303\315\037\020\262I\236\202\334\352st\234\346\0005R\344\020{\010\201@eOo\334\001;s\300\355\3453\010i\030\240\264\001\3377\305\325(\000\370\034\275\315\241s\2134\210\306\t\344\005ln\271\016\345\250aZ\215\312h\361\272\013\215q\300\302s(\004;\247\221\324\351\026\3714X\t\346>\033m\032\332\017\250\272\207\3361\276\247c\023. ]-\315\270.f\r\301\304\343\312\341\351\370]\216\314\204\232n/\271\025`E%\305*\254\253\253\250\3555\352\254\263\275\253\310e9\214Pn\350l\224;3<,\027\276\307\326\306J\023\234\314\325\3624\255p\205\273\016.\275[\334g\"\036\273K\332\354\355\317\243\302\n\264w\222\243-\247\n\353;\235\232-}S\301\236\336\316\037p\237\357\025\316<\323\235D(\3304d\376D\0101\0016\276\206<\377D\230\327\260r\212\"\310\240G\337fA\377\006&[B\360\371\0208<O\241\2300\210\207\330\353\371R\010X\261L\212\370\240~\207\020>D\0265\001\307|\210\020\370k\370\225uz\024}\003\360E\323\227\353\213(\226T\370S2Nx)!\321\237J\237\226oU\202U\nA\001\235\037\276\021K\237$C\272M\306\213x\364\014\246|\035eh\371_\212C""\305\t\332\032\025:>}:6.\264\222\357\317}\354\347rq\235\360\237\307\001\334\376\373\334D\270\345\0204\367}\330\202\340Y\217\212&f\220\235\014\365\250\000\003\034y\343\305\317aC/\312\263e\375<\206<\374\364\346\313@\315\364\236\017\377w\254\365\027R\223,\353xh\247\277\334\227\366E\326\373\376\263|\322p\017\303 \271\017\034\237\001f\022H\251\024v\022\230\016\235u\364\212\361\370\211\034\201\353\217\266\340\002V\001\267\274{[\305\333!\341,\270\227\271\376v\217\207\271\023^Q\247\364\364p\360\266\323m\233c>\341\024\017v\306)1!\313\020\005\027\214\304\314\300\334\311\302\347<\002i\026\032p\357\026\310\021\336q%5z\333+\334q\223\213\326\340\367\"\225\236\037&\241\005\204\0378\267\203\230Ts\203\257\214\333(\222\352\301\215\343n\322\034A\000>>Yx\202x|\017\261\361\223\312\375\212N\342\377\204\207\350FI+\013]n\333\001.\355^\333\360\241E\177\373\275\244\353\356V\273\034l\310\260w\345\031\027\312\347\365\207\277-\313\310/\236 ,\333Cz;}\332\"\016\326\020\006e\342\"\363\022g\0106\200^D\362\017\312\207\225\213t\270\225\327`Y1\004C[\245\007\360\335\323Dv\252>\265H\221a]Y\255\261\332\262gYA\370\347\365S\036\007\304\353\223\363\334\371\217>,\336F.t\310\263\265\365\262^v\020NR\216{\203\316D\276GLu(F\304\nS\365\373s\302\361>,\336\344|,\303\321\301\363\300<\301\013ez\025\275rx\326\000~\370\247\t~\364\360{\036\265O\211\034\376\206W\030\315_\023\361\330h\376*\222n/q\245@\365\223\267G\334\231s\371O\363ho\2024\306A\310\274*\\3-h\211\207\033\334\277\210x\201\"3$\226-J\342\372\036l\222\233\337\337\345\212\262\322\310\357m7nu\0253\346%\211\035\217\"-\246\360\351wHE\034$\343o\260\344\373\310#n \307zq2s\262)R\t\276\267\205\317(-&\025\342{\365\031\022\262!\nByJ\006 \372y\366\312\310\365\267[\010\257\235B\000{\367\035\262\277\243\372\342\357kC\265\3735\343D\253\277^?s\321\365\360tPa\23435\\x^\374\r\366p\004\0327[\211a&\245\032\257M\237\333<\206\034\204l\205\372\235\2155O\347(\255lB\005E[3\356\241\r\304{\241ng\"\376:\275>\232\037BL\255\223T\226\350x\253\307\332\3533K\325\351\252\306\317\300z,\221G5""\024m)y\036\017\177\217Pp\235\007u\254\177=\026D\032\354\305\207\"\010\224a\244NI\341\234\212\203\306k\374\030\305\252z\361\242\027F\"\334\354\311\372M\260.\302n(\366\351\2551RP\356\376(\3239\346'\231\317K\277&']\230\246\353\317_^\031\271\223\327=}\rx\007F\004\035{\205\357\212<\272\234nmf\302\332\364\374\221\010\245?\253\177\246\300\"_T\247\317\250L\247\177\001\260\313\255\363;\216V\303\374x\350:p\031\354?\254?\\\304\036\034\023\3766\314\260\031\252\n_\374\n\325t\260\263\315\375\253\0014\327\313\031\344\220#\325\365\002e\220>\262\326\007\302V{\334FHX_C\332\333\305\307\220\247Z\312\302\374G*\333\325Yh\325lm\377D?\311\324\267\266\317\304\204\227\353M\254\206`\344\317\371\321\316,\235z\362\203\226\313\265\362\355D\365=\367\220(\206\004\210\016g9'\342\324\204\262\035\3277L\210\361c\017\021q\335\245!vq\021\3262\214,h\004\206;^[\257\305OfOt\n\203G?\366\034\210\246\357\362\270m\033>\305=\364\272\323Y\341\255\364\245\233w\322\326<l\311\212\263\300\234)\250A\246\262Z\311\022\342\020\306\216\272\351z\343\014|\206\307\\\365O|e\335\215\313O\257\337\254\337d\310\\f+\361\352\364%\3042\226g\365+\323\245\t:GkI\362=]\346>\364ll\212G;\343\367\271\241\022\376Rfq\343\266{\222*\302bY\304r\302\343L\234\216M\"\027'\203\301`\230YC\254\224\003\016\227\2279\334\334\027\2079U\335%\336\360\256^\244\030+\270I\310!m\327\227\3740U\361\216*\356\025^\225n\226\247;z\337\251\337\221x>\354:B:\215\345&\364\357\"\t%\371=\245ut\315s\207\3225\212\016\332\307\375'\022\364\241\036\2434\257\303\337\260\364m\250\313\r\361.\202{j\227\213\307P\253\266j\316\005\217#\032\364\304\253\212\026/\377\200\016\"Z|\370\203B+$L\025\304\221K}\234\316i?\025\301\334\033l\311\023l\"6e\262\360k~V\314\221\365\317\020z\240\324\310\331\376\014\237?S\336\252\334\203v\331P\023!\356\237\347z\035\230u\235|\315\365;I\035\313\177\313\317\275\334\256\004\2657\363\023\371\317\021\335\030\360\334+t\000(\216n\002\000\337\307\356\321g\274$\346\377_\376\243\024\271";
  29879. PyObject *data = __Pyx_DecompressString(cstring, 6885, 1);
  29880. if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
  29881. const char* const bytes = __Pyx_PyBytes_AsString(data);
  29882. #if !CYTHON_ASSUME_SAFE_MACROS
  29883. if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
  29884. #endif
  29885. #else /* compression: none (22843 bytes) */
  29886. const char* const bytes = ", Approximates the arc length for a cubic Bezier segment.\n\n Uses Gauss-Lobatto quadrature with n=5 points to approximate arc length.\n See :func:`calcCubicArcLength` for a slower but more accurate result.\n\n Args:\n pt1,pt2,pt3,pt4: Control points of the Bezier as 2D tuples.\n\n Returns:\n Arc length value.\n\n Example::\n\n >>> approximateCubicArcLength((0, 0), (25, 100), (75, 100), (100, 0))\n 190.04332968932817\n >>> approximateCubicArcLength((0, 0), (50, 0), (100, 50), (100, 100))\n 154.8852074945903\n >>> approximateCubicArcLength((0, 0), (50, 0), (100, 0), (150, 0)) # line; exact result should be 150.\n 149.99999999999991\n >>> approximateCubicArcLength((0, 0), (50, 0), (100, 0), (-50, 0)) # cusp; exact result should be 150.\n 136.9267662156362\n >>> approximateCubicArcLength((0, 0), (50, 0), (100, -50), (-50, 0)) # cusp\n 154.80848416537057\n Calculates the arc length for a quadratic Bezier segment.\n\n Args:\n pt1: Start point of the Bezier as 2D tuple.\n pt2: Handle point of the Bezier as 2D tuple.\n pt3: End point of the Bezier as 2D tuple.\n\n Returns:\n Arc length value.\n\n Example::\n\n >>> calcQuadraticArcLength((0, 0), (0, 0), (0, 0)) # empty segment\n 0.0\n >>> calcQuadraticArcLength((0, 0), (50, 0), (80, 0)) # collinear points\n 80.0\n >>> calcQuadraticArcLength((0, 0), (0, 50), (0, 80)) # collinear points vertical\n 80.0\n >>> calcQuadraticArcLength((0, 0), (50, 20), (100, 40)) # collinear points\n 107.70329614269008\n >>> calcQuadraticArcLength((0, 0), (0, 100), (100, 0))\n 154.02976155645263\n >>> calcQuadraticArcLength((0, 0), (0, 50), (100, 0))\n 120.21581243984076\n >>> calcQuadraticArcLength((0, 0), (50, -10), (80, 50))\n 102.53273816445825\n >>> calcQuadraticArcLength((0, 0), (40, 0), (-40, 0)) # c""ollinear points, control point outside\n 66.66666666666667\n >>> calcQuadraticArcLength((0, 0), (40, 0), (0, 0)) # collinear points, looping back\n 40.0\n Calculates the bounding rectangle for a quadratic Bezier segment.\n\n Args:\n pt1: Start point of the Bezier as a 2D tuple.\n pt2: Handle point of the Bezier as a 2D tuple.\n pt3: End point of the Bezier as a 2D tuple.\n\n Returns:\n A four-item tuple representing the bounding rectangle ``(xMin, yMin, xMax, yMax)``.\n\n Example::\n\n >>> calcQuadraticBounds((0, 0), (50, 100), (100, 0))\n (0, 0, 100, 50.0)\n >>> calcQuadraticBounds((0, 0), (100, 0), (100, 100))\n (0.0, 0.0, 100, 100)\n Calculates the bounding rectangle for a quadratic Bezier segment.\n\n Args:\n pt1,pt2,pt3,pt4: Control points of the Bezier as 2D tuples.\n\n Returns:\n A four-item tuple representing the bounding rectangle ``(xMin, yMin, xMax, yMax)``.\n\n Example::\n\n >>> calcCubicBounds((0, 0), (25, 100), (75, 100), (100, 0))\n (0, 0, 100, 75.0)\n >>> calcCubicBounds((0, 0), (50, 0), (100, 50), (100, 100))\n (0.0, 0.0, 100, 100)\n >>> print(\"%f %f %f %f\" % calcCubicBounds((50, 0), (0, 100), (100, 100), (50, 0)))\n 35.566243 0.000000 64.433757 75.000000\n Couldn't work out which intersection function to useFinds intersections between a curve and a line.\n\n Args:\n curve: List of coordinates of the curve segment as 2D tuples.\n line: List of coordinates of the line segment as 2D tuples.\n\n Returns:\n A list of ``Intersection`` objects, each object having ``pt``, ``t1``\n and ``t2`` attributes containing the intersection point, time on first\n segment and time on second segment respectively.\n\n Examples::\n >>> curve = [ (100, 240), (30, 60), (210, 230), (160, 30) ]\n >>> line = [ (25, 260), (230, 20) ]\n >>> intersections"" = curveLineIntersections(curve, line)\n >>> len(intersections)\n 3\n >>> intersections[0].pt\n (84.9000930760723, 189.87306176459828)\n Finds intersections between a curve and a curve.\n\n Args:\n curve1: List of coordinates of the first curve segment as 2D tuples.\n curve2: List of coordinates of the second curve segment as 2D tuples.\n\n Returns:\n A list of ``Intersection`` objects, each object having ``pt``, ``t1``\n and ``t2`` attributes containing the intersection point, time on first\n segment and time on second segment respectively.\n\n Examples::\n >>> curve1 = [ (10,100), (90,30), (40,140), (220,220) ]\n >>> curve2 = [ (5,150), (180,20), (80,250), (210,190) ]\n >>> intersections = curveCurveIntersections(curve1, curve2)\n >>> len(intersections)\n 3\n >>> intersections[0].pt\n (81.7831487395506, 109.88904552375288)\n Finds intersections between two line segments.\n\n Args:\n s1, e1: Coordinates of the first line as 2D tuples.\n s2, e2: Coordinates of the second line as 2D tuples.\n\n Returns:\n A list of ``Intersection`` objects, each object having ``pt``, ``t1``\n and ``t2`` attributes containing the intersection point, time on first\n segment and time on second segment respectively.\n\n Examples::\n\n >>> a = lineLineIntersections( (310,389), (453, 222), (289, 251), (447, 367))\n >>> len(a)\n 1\n >>> intersection = a[0]\n >>> intersection.pt\n (374.44882952482897, 313.73458370177315)\n >>> (intersection.t1, intersection.t2)\n (0.45069111555824465, 0.5408153767394238)\n Finds intersections between two segments.\n\n Args:\n seg1: List of coordinates of the first segment as 2D tuples.\n seg2: List of coordinates of the second segment as 2D tuples.\n\n Returns:\n A list of ``Intersection`` objects, each ob""ject having ``pt``, ``t1``\n and ``t2`` attributes containing the intersection point, time on first\n segment and time on second segment respectively.\n\n Examples::\n >>> curve1 = [ (10,100), (90,30), (40,140), (220,220) ]\n >>> curve2 = [ (5,150), (180,20), (80,250), (210,190) ]\n >>> intersections = segmentSegmentIntersections(curve1, curve2)\n >>> len(intersections)\n 3\n >>> intersections[0].pt\n (81.7831487395506, 109.88904552375288)\n >>> curve3 = [ (100, 240), (30, 60), (210, 230), (160, 30) ]\n >>> line = [ (25, 260), (230, 20) ]\n >>> intersections = segmentSegmentIntersections(curve3, line)\n >>> len(intersections)\n 3\n >>> intersections[0].pt\n (84.9000930760723, 189.87306176459828)\n\n Lib/fontTools/misc/bezierTools.pySolve a cubic equation.\n\n Solves *a*x*x*x + b*x*x + c*x + d = 0* where a, b, c and d are real.\n\n Args:\n a: coefficient of *x\302\263*\n b: coefficient of *x\302\262*\n c: coefficient of *x*\n d: constant term\n\n Returns:\n A list of roots. Note that the returned list is neither guaranteed to\n be sorted nor to contain unique values!\n\n Examples::\n\n >>> solveCubic(1, 1, -6, 0)\n [-3.0, -0.0, 2.0]\n >>> solveCubic(-10.0, -9.0, 48.0, -29.0)\n [-2.9, 1.0, 1.0]\n >>> solveCubic(-9.875, -9.0, 47.625, -28.75)\n [-2.911392, 1.0, 1.0]\n >>> solveCubic(1.0, -4.5, 6.75, -3.375)\n [1.5, 1.5, 1.5]\n >>> solveCubic(-12.0, 18.0, -9.0, 1.50023651123)\n [0.5, 0.5, 0.5]\n >>> solveCubic(\n ... 9.0, 0.0, 0.0, -7.62939453125e-05\n ... ) == [-0.0, -0.0, -0.0]\n True\n Split a cubic Bezier curve at a given coordinate.\n\n Args:\n pt1,pt2,pt3,pt4: Control points of the Bezier as 2D tuples.\n where: Position at which to split the curve.\n isHorizontal: Dire""ction of the ray splitting the curve. If true,\n ``where`` is interpreted as a Y coordinate; if false, then\n ``where`` is interpreted as an X coordinate.\n\n Returns:\n A list of two curve segments (each curve segment being four 2D tuples)\n if the curve was successfully split, or a list containing the original\n curve.\n\n Example::\n\n >>> printSegments(splitCubic((0, 0), (25, 100), (75, 100), (100, 0), 150, False))\n ((0, 0), (25, 100), (75, 100), (100, 0))\n >>> printSegments(splitCubic((0, 0), (25, 100), (75, 100), (100, 0), 50, False))\n ((0, 0), (12.5, 50), (31.25, 75), (50, 75))\n ((50, 75), (68.75, 75), (87.5, 50), (100, 0))\n >>> printSegments(splitCubic((0, 0), (25, 100), (75, 100), (100, 0), 25, True))\n ((0, 0), (2.29379, 9.17517), (4.79804, 17.5085), (7.47414, 25))\n ((7.47414, 25), (31.2886, 91.6667), (68.7114, 91.6667), (92.5259, 25))\n ((92.5259, 25), (95.202, 17.5085), (97.7062, 9.17517), (100, 1.77636e-15))\n Split a cubic Bezier curve at one or more values of t.\n\n Args:\n pt1,pt2,pt3,pt4: Control points of the Bezier as 2D tuples.\n *ts: Positions at which to split the curve.\n\n Returns:\n A list of curve segments (each curve segment being four 2D tuples).\n\n Examples::\n\n >>> printSegments(splitCubicAtT((0, 0), (25, 100), (75, 100), (100, 0), 0.5))\n ((0, 0), (12.5, 50), (31.25, 75), (50, 75))\n ((50, 75), (68.75, 75), (87.5, 50), (100, 0))\n >>> printSegments(splitCubicAtT((0, 0), (25, 100), (75, 100), (100, 0), 0.5, 0.75))\n ((0, 0), (12.5, 50), (31.25, 75), (50, 75))\n ((50, 75), (59.375, 75), (68.75, 68.75), (77.3438, 56.25))\n ((77.3438, 56.25), (85.9375, 43.75), (93.75, 25), (100, 0))\n Split a line at a given coordinate.\n\n Args:\n pt1: Start point of line as 2D tuple.\n pt2: End point of line as 2D tuple.\n where:"" Position at which to split the line.\n isHorizontal: Direction of the ray splitting the line. If true,\n ``where`` is interpreted as a Y coordinate; if false, then\n ``where`` is interpreted as an X coordinate.\n\n Returns:\n A list of two line segments (each line segment being two 2D tuples)\n if the line was successfully split, or a list containing the original\n line.\n\n Example::\n\n >>> printSegments(splitLine((0, 0), (100, 100), 50, True))\n ((0, 0), (50, 50))\n ((50, 50), (100, 100))\n >>> printSegments(splitLine((0, 0), (100, 100), 100, True))\n ((0, 0), (100, 100))\n >>> printSegments(splitLine((0, 0), (100, 100), 0, True))\n ((0, 0), (0, 0))\n ((0, 0), (100, 100))\n >>> printSegments(splitLine((0, 0), (100, 100), 0, False))\n ((0, 0), (0, 0))\n ((0, 0), (100, 100))\n >>> printSegments(splitLine((100, 0), (0, 0), 50, False))\n ((100, 0), (50, 0))\n ((50, 0), (0, 0))\n >>> printSegments(splitLine((0, 100), (0, 0), 50, True))\n ((0, 100), (0, 50))\n ((0, 50), (0, 0))\n Split a quadratic Bezier curve at a given coordinate.\n\n Args:\n pt1,pt2,pt3: Control points of the Bezier as 2D tuples.\n where: Position at which to split the curve.\n isHorizontal: Direction of the ray splitting the curve. If true,\n ``where`` is interpreted as a Y coordinate; if false, then\n ``where`` is interpreted as an X coordinate.\n\n Returns:\n A list of two curve segments (each curve segment being three 2D tuples)\n if the curve was successfully split, or a list containing the original\n curve.\n\n Example::\n\n >>> printSegments(splitQuadratic((0, 0), (50, 100), (100, 0), 150, False))\n ((0, 0), (50, 100), (100, 0))\n >>> printSegments(splitQuadratic((0, 0), (50, 100), (100, 0), 50, False))\n ((0, 0), (25"", 50), (50, 50))\n ((50, 50), (75, 50), (100, 0))\n >>> printSegments(splitQuadratic((0, 0), (50, 100), (100, 0), 25, False))\n ((0, 0), (12.5, 25), (25, 37.5))\n ((25, 37.5), (62.5, 75), (100, 0))\n >>> printSegments(splitQuadratic((0, 0), (50, 100), (100, 0), 25, True))\n ((0, 0), (7.32233, 14.6447), (14.6447, 25))\n ((14.6447, 25), (50, 75), (85.3553, 25))\n ((85.3553, 25), (92.6777, 14.6447), (100, -7.10543e-15))\n >>> # XXX I'm not at all sure if the following behavior is desirable:\n >>> printSegments(splitQuadratic((0, 0), (50, 100), (100, 0), 50, True))\n ((0, 0), (25, 50), (50, 50))\n ((50, 50), (50, 50), (50, 50))\n ((50, 50), (75, 50), (100, 0))\n Split a quadratic Bezier curve at one or more values of t.\n\n Args:\n pt1,pt2,pt3: Control points of the Bezier as 2D tuples.\n *ts: Positions at which to split the curve.\n\n Returns:\n A list of curve segments (each curve segment being three 2D tuples).\n\n Examples::\n\n >>> printSegments(splitQuadraticAtT((0, 0), (50, 100), (100, 0), 0.5))\n ((0, 0), (25, 50), (50, 50))\n ((50, 50), (75, 50), (100, 0))\n >>> printSegments(splitQuadraticAtT((0, 0), (50, 100), (100, 0), 0.5, 0.75))\n ((0, 0), (25, 50), (50, 50))\n ((50, 50), (62.5, 50), (75, 37.5))\n ((75, 37.5), (87.5, 25), (100, 0))\n Unknown curve degree.?approximateCubicArcLength (line 332)calcCubicBounds (line 412)calcQuadraticArcLength (line 151)calcQuadraticBounds (line 298)curveCurveIntersections (line 1385)curveLineIntersections (line 1255)disableenable%ggcisenabledlineLineIntersections (line 1154)(%s)segmentSegmentIntersections (line 1427)\n >>> _segmentrepr([1, [2, 3], [], [[2, [3, 4], [0.1, 2.2]]]])\n '(1, (2, 3), (), ((2, (3, 4), (0.1, 2.2))))'\n _segmentrepr (line 1475)solveCubic (line 848)splitCubicAtT (line 613)splitCubic (line 552)splitLine (line 450)splitQuadr""aticAtT (line 589)splitQuadratic (line 507)_1_t_1_t_2_2_t_1_tCOMPILEDDDEPSILONIdentityIntersectionLen__Pyx_PyDict_NextRefQQ3RR2R2_Q3_aa1a1_3a1xa1ya2a3acosaligned_curve_alignment_transformation__all__angleappendapproximateCubicArcLengthapproximateCubicArcLengthCapproximateQuadraticArcLengthapproximateQuadraticArcLengthCarchasinhasyncio.coroutinesatan2axax2ax3ayay2ay3bb1b1xb1y_both_points_are_on_same_side_of_originbounds1bounds2boxbxbx2byby2cc1c11c11_rangec12c12_rangec1xc1yc21c21_rangec22c22_rangecalcBoundscalcCubicArcLengthcalcCubicArcLengthC_calcCubicArcLengthCRecursecalcCubicBoundscalcCubicParameterscalcCubicPointscalcQuadraticArcLengthcalcQuadraticArcLengthCcalcQuadraticBoundscalcQuadraticParameterscalcQuadraticPoints__class_getitem__cline_in_tracebackclosecollectionscoscubicPointAtTcubicPointAtTCcurvecurve1curve2curveCurveIntersectionscurveLineIntersections_curve_bounds_curve_curve_intersections_t_curve_curve_intersections_t.<locals>.midpoint_curve_curve_intersections_t.<locals>.<lambda>_curve_line_intersections_t_curve_line_intersections_t.<locals>.genexprcxcydd0d1d1xd1ydeltadelta_2delta_3deriv3doctestdxdyee1e1xe1ye2e2xe2yendepsilonepsilonDigitsexexiteyfailedfontTools.misc.arrayToolsfontTools.misc.bezierToolsfontTools.misc.transformfound__func__genexprhitsiinsertintersection_tsintersectionsintersectsisHorizontal_is_coroutine_is_linelike_is_linelike.<locals>.genexpriscloseititemskey<lambda>lineline1line2lineLineIntersectionslinePointAtTline_t_line_t_of_pt__main__mathmaybelinemidmidPtmidpoint__module__multn__name__namedtuplenextobjoff1off2oneorigDistoriginpp0p1p2p3pipointAtTpointFinderpointspopprecisionprintprintSegmentsptpt1pt1xpt1ypt2pt2xpt2ypt3pt4pxpyquadraticPointAtT__qualname__rrDDrQ2range1range2rectArearootsrotateroundss1s1xs1ys2s2xs2yscalesectRectseensegseg1seg2segmentsegmentPointAtTsegmentSegmentIntersections_segmentrepr_segmentrepr.<locals>.genexprsegmentssend__set_name__setdefaultslope12slope34solutionssolveCubicsolveQuadraticsplitsplitCubic_splitCubicAt""TsplitCubicAtTC_splitCubicAtTCsplitCubicAtTsplitCubicIntoTwoAtTCsplitCubic.<locals>.genexprsplitLinesplitQuadratic_splitQuadraticAtTsplitQuadraticAtTsplitQuadratic.<locals>.genexpr_split_cubic_into_two_split_segment_at_tsqrtstartswappedsxsysystt1t1_2t1_3t2__test__testmodthetathrowtolerancetransformPointstranslatetstwounique_keyunique_valuesv0v1v2v3v4valuevalueswherexx0x1x2x3x4xDiffxRootsyy1y2y3y4yDiffyRoots\200\001\3600\000\005\n\210\022\2102\210Q\330\004\013\2102\210R\210q\330\004\r\210U\220\"\220A\330\004\017\210r\220\022\2202\220R\220q\330\004\005\330\010\017\210r\220\025\220b\230\004\230B\230b\240\003\2407\250\"\250B\250b\260\004\260B\260e\2702\270S\300\002\300%\300r\310\023\310B\310b\320PR\320RS\340\004\013\2107\220\"\220D\230\002\230)\2402\240T\250\022\2503\250b\260\001\330\004\013\2107\220\"\220D\230\002\230)\2402\240T\250\022\2503\250b\260\001\340\004\n\210$\210c\220\024\220R\220u\230B\230a\330\004\n\210$\210c\220\024\220R\220u\230B\230a\340\004\014\210A\210U\220%\220v\230\\\250\032\2606\270\025\270a\2301\200\001\360*\000\005\010\200|\2201\220A\330\010\020\220\006\220a\220t\2306\240\022\2401\330\010\013\210<\220q\230\001\330\014\024\220F\230!\2304\230v\240R\240q\330\014\023\320\023(\250\002\250(\260!\340\014\023\320\023)\250\021\250(\260!\360\006\000\r\024\2201\220L\240\001\240\023\240A\240U\250#\250Q\250e\2603\260a\260u\270D\300\005\300Q\330\t\025\220Q\220a\330\010\020\220\006\220a\220t\2306\240\022\2401\330\010\017\320\017%\240Q\240h\250a\340\004\026\320\0262\260!\2608\2701\330\004\013\2101\330\010\024\220A\220S\230\017\240q\250\010\260\002\260!\2605\270\003\2702\270Q\270d\300#\300R\300q\310\001\330\010\014\210F\220!\200\001\360\010\000\005\t\210\013\2201\330\010\r\210Q\210l\230!\2301\320\000+\2501\360\034\000\005\014\320\013\036\230a\330\010\017\210r\220\026\220w\230b\240\006\240g\250R\250v\260W\270B\270f\300A\200\001\330\004\020\320\020)\250\021\250(\3202B\300!\3001\330\004\033\2301\200\001\360&\000\005\n\210\022\2102\210Q\330\004\013\2102\210R\210q\330""\004\r\210U\220\"\220A\330\004\013\2107\220\"\220E\230\022\2304\230r\240\022\2403\240g\250R\250r\260\022\2604\260r\270\025\270b\300\003\3002\300U\310\"\310C\310r\320QS\320SU\320UV\200\001\360\024\000\005\n\210\022\2102\210Q\330\004\013\2102\210R\210q\330\004\r\210U\220\"\220A\330\004\005\330\010\017\210r\220\025\220b\230\003\2301\230A\330\010\n\210\"\210C\210w\220b\230\002\230\"\230C\230q\240\003\2402\240U\250\"\250C\250r\260\023\260A\260Q\330\010\n\210#\210R\210r\220\022\2203\220a\220q\340\004\005\330\010\017\210r\220\025\220b\230\003\2301\230A\330\010\n\210\"\210C\210w\220b\230\002\230\"\230C\230q\240\003\2402\240U\250\"\250C\250r\260\023\260A\260Q\330\010\n\210#\210R\210r\220\022\2203\220a\220q\340\004\014\210C\210q\200\001\360\024\000\005\n\210\022\2102\210S\220\003\2202\220R\220s\230\"\230C\230q\240\003\2402\240R\240s\250\"\250B\250c\260\022\2602\260R\260s\270!\2703\270b\300\002\300\"\300B\300b\310\003\3101\310A\330\004\t\210\022\2102\210S\220\003\2202\220R\220s\230\"\230C\230q\240\003\2402\240R\240s\250\"\250B\250c\260\022\2602\260R\260s\270!\2703\270b\300\002\300\"\300B\300b\310\003\3101\310A\330\004\014\210C\210q\200\001\3602\000\005\014\320\013%\240Q\330\010\017\210r\220\026\220w\230b\240\006\240g\250R\250v\260W\270B\270a\200\001\360\022\000\005\014\2103\210a\210s\220\"\220A\330\004\n\210#\210Q\210c\220\022\2204\220r\230\023\230A\230S\240\002\240$\240b\250\003\2501\250C\250r\260\021\330\004\007\200u\210B\210e\2202\220X\230S\240\001\330\010\020\220\005\220R\220u\230B\230a\340\010\r\210V\320\023(\250\001\250\024\250T\260\024\260Q\330\010\017\320\017*\250!\2507\260%\260r\3209T\320TU\330\014\023\2201\200\001\330\004\013\2103\210b\220\002\220#\220S\230\002\230$\230b\240\004\240B\240a\330\004\016\210c\220\022\2203\220b\230\003\2302\230T\240\022\2401\330\004\005\330\010\t\210\025\210c\220\022\2204\220r\230\025\230d\240\"\240H\250A\330\t\016\210d\220\"\220I\230S\240\002\240$\240b\250\005\250Q\200\001\360\026\000-.\360\024\000\005\014\2104\210r\220\024\220R\220q""\330\004\013\320\013&\240a\240v\250U\260%\260u\270A\200\001\360\034\000\005\014\320\013)\250\021\250'\260\022\2606\270\027\300\002\300&\310\007\310r\320QR\200\001\3606\000\005\010\200s\210#\210T\320\021$\240A\240U\250%\250u\260A\330\004\020\220\n\230!\330\010\t\210\021\210/\230\021\230!\230?\250!\2501\250O\2701\270A\270^\3102\310Q\340\004\026\220a\220q\330\004\007\200t\2101\330\010\017\210r\220\025\220e\2305\240\001\330\004\013\210>\230\021\230#\230S\240\003\2404\240q\200\001\360@\001\000\005\014\320\013\"\240!\2407\250\"\250F\260'\270\022\2706\300\027\310\002\310!\200\001\360\024\000\005\r\210A\210S\220\001\220\023\220C\220r\230\022\2303\230b\240\003\2401\240C\240r\250\025\250c\260\021\260#\260S\270\002\270\"\270C\270r\300\023\300A\300S\310\002\310!\200\001\360>\000\005\n\210\023\210A\210T\220\022\2205\230\002\230!\330\004\t\210\023\210A\330\010\033\2302\230Q\330\010\n\320\n\034\230B\230a\330\010\n\320\n\034\230B\230a\330\010\n\320\n\034\230B\230a\340\004\t\210\023\210A\210T\220\022\2204\220r\230\024\230R\230u\240B\240a\330\004\t\210\023\210A\330\010\033\2302\230Q\330\010\n\320\n\034\230B\230a\330\010\n\320\n\034\230B\230a\330\010\n\320\n\034\230B\230a\340\004\t\210\023\210A\210T\220\022\2205\230\002\230!\340\004\013\2103\210b\220\003\2202\220S\230\002\230#\230R\230q\200A\330\010\017\210t\2203\220a\220q\230\003\2302\230Q\230a\230q\200\001\360B\001\000\005\n\210\023\210A\330\010\033\2302\230T\240\022\320#5\260R\260t\2702\320=P\320PR\320RS\340\004\t\210\023\210A\210T\220\022\2205\230\002\230!\330\004\t\210\023\210A\330\010\034\230B\230d\240\"\320$6\260b\270\004\270B\320>P\320PR\320RS\360\006\000\005\014\2103\210b\220\003\2202\220Q\200\001\360F\001\000\005\010\200s\210$\320\016%\240Q\240e\2505\260\001\330\004\020\220\016\230a\330\010\t\210\021\210/\230\021\230!\230?\250!\2501\250N\270\"\270A\340\004\026\220a\220q\330\004\007\200t\2101\330\010\017\210r\220\025\220e\2301\330\004\013\320\013\035\230Q\230c\240\023\240D\250\001\200\001\360\010\000\005\r\210G\2201\220A\330""\004\n\210'\220\022\2201\330\004\014\210D\220\006\220a\220s\230!\2303\230b\240\005\240Q\240d\250#\250Q\250c\260\022\2605\270\001\270\021\330\004\013\2108\2207\230!\2301\230F\240*\250A\250Q\250e\2601\260D\270\001\270\025\270a\270q\200\001\360H\001\000\005\013\210'\220\021\330\004\n\210'\220\021\340\004\t\210\025\210b\220\001\330\004\t\210\025\210b\220\001\340\004\t\210\021\330\004\t\210\021\340\004\t\210\024\210S\220\001\220\021\340\004\007\200r\210\023\210A\330\010\017\210r\220\025\220a\330\004\t\210\026\210s\220$\220c\230\021\230/\250\022\2501\330\004\007\200r\210\023\210D\220\001\330\010\020\220\003\2202\220R\220r\230\024\230S\240\002\240\"\240B\240a\330\010\017\210r\220\025\220i\230w\240a\340\010\017\210r\220\025\220a\200\001\360L\001\000\005\010\200s\210!\2103\210b\220\001\360\006\000\t\020\210~\230Q\230c\240\023\240A\330\004\010\210\005\210Q\210a\330\004\t\210\022\2102\210Q\330\004\t\210\022\2102\210Q\330\004\t\210\022\2102\210Q\340\004\t\210\023\210B\210c\220\022\2204\220r\230\024\230R\230q\330\004\t\210\024\210R\210s\220\"\220C\220r\230\023\230B\230d\240\"\240C\240r\250\023\250B\250e\2602\260T\270\022\2701\340\004\t\210\022\2102\210Q\330\004\t\210\022\2102\210R\210r\220\021\330\004\t\210\025\210c\220\022\220=\240\001\330\004\t\210\025\210c\220\021\220$\220b\230\r\240Q\340\004\014\210C\210r\220\021\340\004\007\200s\210#\210T\220\024\220S\230\003\2301\330\010\014\210E\220\021\220!\2203\220b\230\005\230Q\330\010\017\210q\220\003\2203\220a\330\t\017\210s\220(\230\"\230A\340\010\020\220\004\220I\230R\230r\240\024\240Q\240e\2506\260\021\330\010\016\210e\2202\220T\230\021\230!\330\010\017\210s\220\"\220A\330\010\r\210T\220\022\2203\220a\220v\230R\230u\240B\240a\330\010\r\210T\220\022\2203\220b\230\006\230b\240\004\240B\240d\250\"\250E\260\022\2601\330\010\r\210T\220\022\2203\220b\230\006\230b\240\004\240B\240d\250\"\250E\260\022\2601\330\010\014\210D\220\013\2301\230A\230T\240\024\240Q\340\010\013\2103\210b\220\003\2202\220X\230T\240\023\240B\240c\250\022\2501\330""\014\021\220\025\220e\2305\240\002\240#\240R\240s\250\"\250D\260\002\260%\260q\330\r\020\220\002\220#\220R\220q\330\014\021\220\025\220e\2302\230S\240\002\240$\240b\250\005\250Q\330\014\021\220\025\220a\220t\2301\330\r\020\220\002\220#\220R\220q\330\014\021\220\025\220a\220t\2301\330\014\021\220\025\220e\2302\230S\240\002\240$\240b\250\005\250Q\340\014\021\220\025\220a\220t\2301\330\014\021\220\025\220a\220t\2301\330\014\021\220\025\220a\220t\2301\330\010\017\210q\220\004\220D\230\001\340\010\014\210C\210q\220\004\220A\220W\230B\230c\240\021\240$\240b\250\002\250!\330\010\014\210B\210b\220\002\220\"\220A\330\010\013\2102\210S\220\001\330\014\020\220\001\220\021\330\010\014\210E\220\021\220\"\220B\220c\230\022\2305\240\001\330\010\017\210q\220\001\200\001\330\024$\240M\260\021\340\004\016\210m\2301\230A\330\004\016\210m\2301\230A\340\004\007\200t\2101\330\010\022\220%\220q\330\004\007\200t\2101\330\010\022\220%\220q\360\006\000\005\021\220\004\220H\230A\230Y\240a\330\004\007\200t\2101\330\010\017\210q\340\004\005\360\010\000\005\010\200x\210q\220\t\230\022\230:\240T\250\030\260\021\260)\2702\270Q\330\010\017\210r\220\030\230\021\230)\2408\2501\250A\340\004\t\210\026\320\017\"\240!\2408\2501\330\004\021\220\026\220q\230\004\230H\240A\240Q\330\004\021\220\030\230\021\230)\2406\250\021\250!\340\004\t\210\026\320\017\"\240!\2408\2501\330\004\021\220\026\220q\230\004\230H\240A\240Q\330\004\021\220\030\230\021\230)\2406\250\021\250!\340\004\014\210A\330\004\t\210\027\220\001\330\010$\240A\330\014\021\220\025\220k\240\027\250\013\2607\270!\360\006\000\005\n\210\027\220\001\330\010$\240A\330\014\021\220\025\220k\240\027\250\013\2607\270!\360\006\000\005\n\210\027\220\001\330\010$\240A\330\014\021\220\025\220k\240\027\250\013\2607\270!\360\006\000\005\n\210\027\220\001\330\010$\240A\330\014\021\220\025\220k\240\027\250\013\2607\270!\360\010\000\005\022\220\021\330\004\016\210a\330\004\024\220A\340\004\010\210\006\210a\330\010\016\210j\230\001\230\021\330\010\013\2104\210s""\220!\330\014\r\330\010\014\210D\220\001\220\021\330\010\025\220W\230A\230Q\340\004\013\2101\200\001\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\n\210#\210R\210t\2202\220Q\330\004\n\210#\210R\210t\2202\220Q\330\004\n\210#\210R\210t\2202\220T\230\022\2301\330\004\n\210#\210R\210t\2202\220T\230\022\2301\330\004\t\210\023\210B\210c\220\022\2203\220b\230\001\330\004\t\210\023\210B\210c\220\022\2203\220b\230\001\330\004\013\2101\210D\220\006\220d\230&\240\004\240F\250$\250a\200\001\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\t\210\021\330\004\t\210\021\330\004\n\210#\210R\210u\220B\220a\330\004\n\210#\210R\210u\220B\220a\330\004\n\210#\210R\210t\2202\220T\230\022\2301\330\004\n\210#\210R\210t\2202\220T\230\022\2301\330\004\t\210\023\210B\210c\220\022\2203\220b\230\001\330\004\t\210\023\210B\210c\220\022\2203\220b\230\001\330\004\013\2101\210D\220\006\220d\230&\240\004\240F\250$\250a\200\001\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\n\210#\210R\210t\2202\220Q\330\004\n\210#\210R\210t\2202\220Q\330\004\t\210\023\210B\210c\220\022\2201\330\004\t\210\023\210B\210c\220\022\2201\330\004\013\2101\210D\220\006\220d\230&\240\004\240A\200\001\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\t\210\021\330\004\t\210\021\330\004\n\210#\210R\210u\220B\220a\330\004\n\210#\210R\210u\220B\220a\330\004\t\210\023\210B\210c\220\022\2201\330\004\t\210\023\210B\210c\220\022\2201\330\004\013\2101\210D\220\006\220d\230&\240\004\240A\200\001\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\007\200s\210!\2103\210b\220\004\220B\220h\230d\240#\240Q\240c\250\022\2504\250r\260\021\340\010\020\220\001\340\004\007\200s\210!\2103\210b\220\004\220B\220c\230\021\230#\230R\230q\330\010\020\220\003\2202\220T\230\023\230C\230r\240\021\340\010\020\220\003\2202\220T\230\023""\230C\230r\240\021\200\001\330\004\t\210\024\210Q\210a\330\004\006\200g\210Q\210c\220\021\330\004\006\200g\210Q\210a\330\004\017\210q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210U\220!\2203\220a\220t\2302\230Q\330\010\r\210R\210q\220\001\330\010\r\210R\210q\220\002\220\"\220A\330\010\020\220\003\2202\220Q\340\010\022\220&\230\002\230!\330\010\022\220&\230\002\230!\330\010\017\210s\220\"\220A\330\010\017\210s\220\"\220A\360\006\000\t\017\210c\220\022\2201\330\010\016\210c\220\022\2201\330\010\017\210r\220\022\2203\220b\230\003\2302\230T\240\022\2401\330\010\017\210r\220\022\2203\220b\230\003\2302\230T\240\022\2401\330\010\017\210r\220\022\2203\220b\230\003\2302\230S\240\002\240\"\240B\240c\250\022\2506\260\022\2601\330\010\017\210r\220\022\2203\220b\230\003\2302\230S\240\002\240\"\240B\240c\250\022\2506\260\022\2601\330\010\016\210c\220\022\2205\230\002\230#\230R\230u\240B\240c\250\022\2503\250b\260\001\330\010\016\210c\220\022\2205\230\002\230#\230R\230u\240B\240c\250\022\2503\250b\260\001\330\010\r\210U\220%\220v\230_\250A\330\r\022\220'\230\025\230g\240U\250'\260\025\260a\340\010\020\220\007\220r\230\025\230e\2405\250\001\330\004\013\2101\200\001\330\004\t\210\024\210Q\210a\330\004\017\210q\330\004\006\200g\210Q\210c\220\021\330\004\006\200g\210Q\210a\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210Q\330\004\010\210\005\210U\220!\2203\220a\220t\2302\230Q\330\010\r\210R\210q\220\001\330\010\r\210R\210q\220\002\220\"\220A\330\010\020\220\003\2202\220Q\340\010\022\220&\230\002\230!\330\010\016\210c\220\022\2201\330\010\016\210c\220\022\2201\330\010\017\210r\220\022\2203\220b\230\003\2302\230T\240\022\2401\330\010\017\210r\220\022\2203\220b\230\003\2302\230T\240\022\2401\330\010\017\210s\220\"\220A\330\010\016\210c\220\022\2205\230\002\230#\230R\230s\240\"\240A\330\010\016\210c\220\022\2205\230\002\230#\230R\230s\240\"\240A\340\010\r\210U\220&\320\030+\2502\250U""\260'\270\025\270g\300U\310!\330\010\020\220\007\220r\230\025\230e\2401\330\004\013\2101\200\001\330\004\r\210Q\210a\210s\220\"\220F\230!\2304\230s\240!\2401\240C\240r\250\026\250q\260\001\330\004\r\210Q\210a\210s\220\"\220F\230!\2304\230s\240!\2401\240C\240r\250\026\250q\260\001\330\004\013\2105\220\006\220c\230\024\230T\240\026\240s\250!\200\001\330\004\024\320\024-\250Q\250e\3203C\3001\300A\330\004\007\200s\210!\2107\220#\220Q\330\010\013\2103\210d\320\022)\250\022\2501\330\010\030\230\016\240a\240q\250\001\250\024\250Q\250a\250t\2601\260A\260Q\330\t\014\210A\210W\220C\220q\330\010\013\2103\210c\220\024\320\025(\250\002\250!\330\010\030\230\n\240!\2401\240A\240T\250\021\250!\2504\250q\260\001\260\024\260Q\260a\260q\340\010\016\210j\230\001\230\021\330\004\021\220\021\220!\200\001\360@\001\000\005\n\210\024\210R\210q\330\004\t\210\024\210R\210q\330\004\010\210\003\2102\210Q\330\004\010\210\002\210\"\210A\330\004\014\210C\210q\220\001\330\004\007\200v\210S\220\001\330\010\017\210s\220!\2204\220r\230\021\330\004\017\210t\2201\220C\220q\330\004\007\200s\210!\210:\220R\220q\330\010\013\2104\210q\220\004\220D\230\003\2301\330\014\023\2203\220a\220t\2302\230Q\330\010\013\2104\210s\220!\2205\230\003\2301\230A\330\010\020\220\002\220\"\220B\220b\230\002\230\"\230C\230s\240\"\240B\240a\330\004\t\210\024\210Q\210c\220\024\220R\220q\330\004\t\210\024\210Q\210c\220\024\220R\220q\330\004\n\210#\210Q\210b\220\003\220;\230a\230t\2402\240[\260\001\260\025\260b\270\t\300\023\300F\310#\310S\320PR\320RS\330\004\013\2101\220\034\230S\240\001\240\022\2401\240C\240r\250\034\260S\270\001\270\022\2701\270C\270r\300\021\200\001\360$\000\005\006\200T\210\026\210t\2206\230\024\230V\2404\240v\320-@\300\001\300\025\300e\3105\320PQ\340\004\n\210#\210R\210q\330\004\n\210#\210R\210q\330\004\n\210#\210R\210q\330\004\n\210#\210R\210q\330\004\r\210Q\210b\220\004\220E\230\036\240q\250\005\250U\260$\260c\270\022\2703\270d\300!\330\004\r\210Q\210b\220\004\220E\230\036\240q\250\005\250U\260$\260c\270""\022\2703\270d\300!\330\004\014\210G\2202\220Q\340\004\r\210Q\340\014\017\210r\220\022\2202\220R\220r\230\022\2302\230S\240\002\240\"\240B\240b\250\002\250#\250R\250r\260\022\2601\330\014\017\210r\220\022\2202\220R\220r\230\022\2302\230S\240\002\240\"\240B\240b\250\002\250#\250R\250r\260\022\2601\340\010\014\210E\220\021\330\006\010\210\001\210\025\210a\330\004\013\210:\220Q\220a\200\001\360$\000\005\006\200T\210\026\210t\2206\230\024\230V\320#:\270!\2705\300\005\300Q\330\004\n\210#\210R\210q\330\004\n\210#\210R\210q\330\004\014\210A\330\004\007\200t\2103\210a\330\010\r\210W\220A\220Q\220c\230\022\2301\330\004\007\200t\2103\210a\330\010\r\210W\220A\220Q\220c\230\022\2301\330\004\r\210Q\330\t\014\210B\210b\220\002\220\"\220B\220c\230\022\2302\230R\230t\2403\240b\250\002\250\"\250B\250b\260\003\2602\260R\260r\270\021\330\010\014\210E\220\021\330\010\013\2102\210S\220\004\220A\330\006\010\210\001\210\025\210a\330\004\013\210:\220Q\220a\200\001\360\n\000\005\006\330\010\r\210T\220\021\220!\330\013\014\330\010\017\210u\220B\220a\340\010\017\210w\220b\230\004\230E\240\035\250a\200\001\220!\250a\200\001\360<\000\005\017\210a\330\004\007\200s\210!\2106\220\022\2203\220a\220q\330\010\016\210g\220V\2301\330\010\022\220!\330\004\007\200s\210!\2106\220\022\2201\330\010\013\2103\210a\210v\220R\220q\330\014\034\320\0343\2601\260F\270!\340\014\034\320\0342\260!\2606\270\021\330\t\014\210A\210V\2203\220b\230\004\230C\230q\240\006\240c\250\021\330\010\030\320\030-\250R\250w\260a\340\010\016\210j\230\001\230\021\330\004\007\200t\2101\330\010\017\210q\330\004\013\2101\210L\230\001\230\023\230A\230U\240#\240Q\240e\2503\250a\250u\260D\270\005\270Q\220q\200\001\360.\000\005\n\210\026\210q\330\004\t\210\026\210q\330\004\t\210\026\210q\330\004\t\210\026\210q\330\004\005\330\010\014\210H\220A\220U\230%\230t\2404\240x\250q\260\005\260U\270$\270d\300$\300h\310a\310u\320TU\340\010\017\210q\330\004\005\330\010\014\210H\220A\220U\230%\230t\2404\240x\250q\260\005\260U\270$\270d\300$\300h\310a""\310u\320TU\340\010\017\210q\330\004\007\200t\2108\2201\220E\230\025\230d\240$\240h\250a\250u\260A\330\010\017\210q\330\004\007\200t\2108\2201\220E\230\025\230d\240$\240h\250a\250u\260A\330\010\017\210q\330\004\007\200t\2108\2201\220E\230\021\330\010\014\210A\330\010\023\2204\220r\230\025\230c\240\024\240R\240q\330\010\014\210H\220C\220r\230\022\2305\240\002\240!\330\010\016\210c\220\021\330\010\017\210q\330\014\030\230\001\330\020\023\2204\220s\230-\240q\250\004\250D\260\005\260S\270\r\300Q\300d\310$\310a\360\006\000\005\010\200t\2108\2201\220E\230\021\330\010\014\210A\330\010\023\2204\220r\230\025\230c\240\024\240R\240q\330\010\014\210H\220C\220r\230\022\2305\240\002\240!\330\010\016\210c\220\021\330\010\017\210q\330\014\030\230\001\330\020\023\2204\220s\230-\240q\250\004\250D\260\005\260S\270\r\300Q\300d\310$\310a\360\010\000\005\020\210t\2202\220U\230#\230T\240\022\2401\330\004\017\210t\2202\220U\230#\230T\240\022\2401\330\004\007\200t\2108\2201\220I\230Q\330\010\017\210q\330\004\t\210\030\220\022\2204\220r\230\024\230R\230x\240r\250\024\250R\250u\260C\260x\270r\300\021\330\004\010\210\010\220\003\2202\220R\220u\230B\230a\330\004\n\210#\210Q\330\004\007\320\007.\250a\330\010\014\210D\220\001\330\006\n\320\n1\260\021\260$\260d\270!\330\010\017\210q\330\014\030\230\001\330\020\023\2204\220s\230-\240q\250\004\250D\260\005\260S\270\r\300Q\300d\310$\310a\360\006\000\005\014\2101\320\000!\240\021\360\034\000\005\010\200s\210!\2103\210b\220\001\330\010\013\2103\210a\210s\220\"\220A\340\014\024\220A\360\006\000\r\025\220A\220Q\220b\230\002\230!\360\006\000\t\016\210R\210r\220\022\2202\220T\230\022\2302\230R\230q\330\010\013\2103\210c\220\021\330\014\022\220$\220a\220q\330\014\024\220B\220a\220r\230\022\2305\240\002\240$\240b\250\004\250A\250R\250r\260\025\260b\270\004\270B\270a\360\006\000\r\025\220A\330\004\013\2101\200\001\330\004\007\200s\210!\2103\210c\220\021\330\010\013\2104\210q\330\010\023\220<\230q\240\003\2403\240a\330\010\017\210r\220\023\220L\240\n\250!\330""\004\007\200s\210!\2103\210c\220\021\330\010\017\320\017 \240\002\240#\240Q\330\t\014\210A\210S\220\003\2201\330\010\017\210}\230B\230c\240\021\330\004\n\210*\220A\220Q\200\001\330\004\007\200s\210!\2103\210c\220\021\330\010\017\320\017\"\240\"\240A\330\t\014\210A\210S\220\003\2201\330\010\017\210\177\230b\240\001\330\004\n\210*\220A\220Q\200\001\330\004\007\200s\210!\2105\220\003\2201\330\010\017\210|\2302\230U\240!\330\t\014\210A\210U\220#\220Q\330\010\017\320\017 \240\002\240%\240q\330\t\014\210A\210U\220#\220Q\330\010\017\210}\230B\230e\2401\330\004\n\210*\220A\220Q\200\001\360*\000\005\010\200s\210!\2107\220#\220Q\330\010\026\220a\330\t\014\210A\210W\220C\220q\330\010\026\220a\340\010\016\210j\230\001\230\021\330\004\024\220A\330\004\010\210\005\320\r(\250\001\250\027\260\001\330\010\r\210[\230\002\230'\240\021\360\006\000\t\022\220\035\230b\240\006\240a\330\010\r\210\\\230\022\2306\240\021\330\010\025\220W\230A\230\\\250\021\250#\250T\260\023\260C\260s\270!\330\004\013\2101\200\001\360(\000\005\010\200s\210$\320\016%\240Q\240e\2505\260\001\330\004\013\320\013\035\230Q\230c\240\023\240D\250\001\200\001\360(\000\005\010\200s\210#\210T\320\021$\240A\240U\250%\250u\260A\330\004\014\210N\230!\2303\230c\240\023\240D\250\001\360\n\000\005\n\210\021\210&\220\006\220e\2301\230B\230a\230q\330\004\t\210\022\2106\220\021\220%\220r\230\022\2303\230d\240!\330\004\013\2101";
  29887. PyObject *data = NULL;
  29888. CYTHON_UNUSED_VAR(__Pyx_DecompressString);
  29889. #endif
  29890. PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
  29891. Py_ssize_t pos = 0;
  29892. for (int i = 0; i < 335; i++) {
  29893. Py_ssize_t bytes_length = index[i].length;
  29894. PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
  29895. if (likely(string) && i >= 42) PyUnicode_InternInPlace(&string);
  29896. if (unlikely(!string)) {
  29897. Py_XDECREF(data);
  29898. __PYX_ERR(0, 1, __pyx_L1_error)
  29899. }
  29900. stringtab[i] = string;
  29901. pos += bytes_length;
  29902. }
  29903. for (int i = 335; i < 387; i++) {
  29904. Py_ssize_t bytes_length = index[i].length;
  29905. PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
  29906. stringtab[i] = string;
  29907. pos += bytes_length;
  29908. if (unlikely(!string)) {
  29909. Py_XDECREF(data);
  29910. __PYX_ERR(0, 1, __pyx_L1_error)
  29911. }
  29912. }
  29913. Py_XDECREF(data);
  29914. for (Py_ssize_t i = 0; i < 387; i++) {
  29915. if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
  29916. __PYX_ERR(0, 1, __pyx_L1_error)
  29917. }
  29918. }
  29919. #if CYTHON_IMMORTAL_CONSTANTS
  29920. {
  29921. PyObject **table = stringtab + 335;
  29922. for (Py_ssize_t i=0; i<52; ++i) {
  29923. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  29924. #if PY_VERSION_HEX < 0x030E0000
  29925. if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
  29926. #else
  29927. if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
  29928. #endif
  29929. {
  29930. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  29931. }
  29932. #else
  29933. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  29934. #endif
  29935. }
  29936. }
  29937. #endif
  29938. }
  29939. {
  29940. PyObject **numbertab = __pyx_mstate->__pyx_number_tab;
  29941. double const c_constants[] = {0.0,0.5,1.0,-2.0,2.0,3.0,4.0,9.0,1e-3,1e-9,27.0,54.0,0.005,0.125,1e-10};
  29942. for (int i = 0; i < 15; i++) {
  29943. numbertab[i] = PyFloat_FromDouble(c_constants[i]);
  29944. if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
  29945. }
  29946. }
  29947. {
  29948. PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 15;
  29949. int8_t const cint_constants_1[] = {0,-1,1,2,3,6};
  29950. for (int i = 0; i < 6; i++) {
  29951. numbertab[i] = PyLong_FromLong(cint_constants_1[i - 0]);
  29952. if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
  29953. }
  29954. }
  29955. #if CYTHON_IMMORTAL_CONSTANTS
  29956. {
  29957. PyObject **table = __pyx_mstate->__pyx_number_tab;
  29958. for (Py_ssize_t i=0; i<21; ++i) {
  29959. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  29960. #if PY_VERSION_HEX < 0x030E0000
  29961. if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
  29962. #else
  29963. if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
  29964. #endif
  29965. {
  29966. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  29967. }
  29968. #else
  29969. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  29970. #endif
  29971. }
  29972. }
  29973. #endif
  29974. return 0;
  29975. __pyx_L1_error:;
  29976. return -1;
  29977. }
  29978. /* #### Code section: init_codeobjects ### */
  29979. typedef struct {
  29980. unsigned int argcount : 3;
  29981. unsigned int num_posonly_args : 1;
  29982. unsigned int num_kwonly_args : 1;
  29983. unsigned int nlocals : 6;
  29984. unsigned int flags : 10;
  29985. unsigned int first_line : 11;
  29986. } __Pyx_PyCode_New_function_description;
  29987. /* NewCodeObj.proto */
  29988. static PyObject* __Pyx_PyCode_New(
  29989. const __Pyx_PyCode_New_function_description descr,
  29990. PyObject * const *varnames,
  29991. PyObject *filename,
  29992. PyObject *funcname,
  29993. PyObject *line_table,
  29994. PyObject *tuple_dedup_map
  29995. );
  29996. static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  29997. PyObject* tuple_dedup_map = PyDict_New();
  29998. if (unlikely(!tuple_dedup_map)) return -1;
  29999. {
  30000. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 546};
  30001. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_t};
  30002. __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  30003. }
  30004. {
  30005. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 583};
  30006. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_t};
  30007. __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  30008. }
  30009. {
  30010. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_GENERATOR), 644};
  30011. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_ts, __pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_d};
  30012. __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_splitCubicAtTC, __pyx_mstate->__pyx_kp_b_iso88591__4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  30013. }
  30014. {
  30015. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 21, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_GENERATOR), 770};
  30016. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_ts, __pyx_mstate->__pyx_n_u_t1, __pyx_mstate->__pyx_n_u_t2, __pyx_mstate->__pyx_n_u_delta, __pyx_mstate->__pyx_n_u_delta_2, __pyx_mstate->__pyx_n_u_delta_3, __pyx_mstate->__pyx_n_u_a1, __pyx_mstate->__pyx_n_u_b1, __pyx_mstate->__pyx_n_u_c1, __pyx_mstate->__pyx_n_u_d1, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_t1_2, __pyx_mstate->__pyx_n_u_t1_3, __pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4};
  30017. __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_splitCubicAtTC_2, __pyx_mstate->__pyx_kp_b_iso88591__4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  30018. }
  30019. {
  30020. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1252};
  30021. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
  30022. __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591__5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
  30023. }
  30024. {
  30025. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1329};
  30026. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_r};
  30027. __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_midpoint, __pyx_mstate->__pyx_kp_b_iso88591_A_t3aq_2Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
  30028. }
  30029. {
  30030. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1366};
  30031. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_ts};
  30032. __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_lambda, __pyx_mstate->__pyx_kp_b_iso88591_S_1Cr_S_1Cr, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
  30033. }
  30034. {
  30035. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1382};
  30036. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p};
  30037. __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad;
  30038. }
  30039. {
  30040. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1485};
  30041. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_x};
  30042. __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_kp_b_iso88591_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad;
  30043. }
  30044. {
  30045. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 56};
  30046. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_tolerance};
  30047. __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcCubicArcLength, __pyx_mstate->__pyx_kp_b_iso88591_1_a_r_wb_gRvWBfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad;
  30048. }
  30049. {
  30050. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 75};
  30051. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p0, __pyx_mstate->__pyx_n_u_p1, __pyx_mstate->__pyx_n_u_p2, __pyx_mstate->__pyx_n_u_p3, __pyx_mstate->__pyx_n_u_mid, __pyx_mstate->__pyx_n_u_deriv3};
  30052. __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_split_cubic_into_two, __pyx_mstate->__pyx_kp_b_iso88591_3b_S_b_Ba_c_3b_2T_1_c_4r_d_HA_d, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad;
  30053. }
  30054. {
  30055. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 84};
  30056. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_mult, __pyx_mstate->__pyx_n_u_p0, __pyx_mstate->__pyx_n_u_p1, __pyx_mstate->__pyx_n_u_p2, __pyx_mstate->__pyx_n_u_p3, __pyx_mstate->__pyx_n_u_arch, __pyx_mstate->__pyx_n_u_box, __pyx_mstate->__pyx_n_u_one, __pyx_mstate->__pyx_n_u_two};
  30057. __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcCubicArcLengthCRecurse, __pyx_mstate->__pyx_kp_b_iso88591_3as_A_Qc_4r_AS_b_1Cr_uBe2XS_RuB, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad;
  30058. }
  30059. {
  30060. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 104};
  30061. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_mult};
  30062. __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcCubicArcLengthC, __pyx_mstate->__pyx_kp_b_iso88591_4r_Rq_avU_uA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad;
  30063. }
  30064. {
  30065. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 151};
  30066. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3};
  30067. __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcQuadraticArcLength, __pyx_mstate->__pyx_kp_b_iso88591_7_F_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad;
  30068. }
  30069. {
  30070. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 186};
  30071. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_scale, __pyx_mstate->__pyx_n_u_origDist, __pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_x0, __pyx_mstate->__pyx_n_u_x1, __pyx_mstate->__pyx_n_u_Len, __pyx_mstate->__pyx_n_u_d0, __pyx_mstate->__pyx_n_u_d1, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_n};
  30072. __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcQuadraticArcLengthC, __pyx_mstate->__pyx_kp_b_iso88591_Rq_Rq_2Q_A_Cq_vS_s_4r_t1Cq_s_Rq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad;
  30073. }
  30074. {
  30075. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 237};
  30076. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3};
  30077. __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_approximateQuadraticArcLength, __pyx_mstate->__pyx_kp_b_iso88591_6_rQR, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad;
  30078. }
  30079. {
  30080. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 254};
  30081. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_v0, __pyx_mstate->__pyx_n_u_v1, __pyx_mstate->__pyx_n_u_v2};
  30082. __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_approximateQuadraticArcLengthC, __pyx_mstate->__pyx_kp_b_iso88591_B_A_2T_5Rt2_PPRRS_AT_5_A_Bd_6b, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad;
  30083. }
  30084. {
  30085. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 298};
  30086. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_ay, __pyx_mstate->__pyx_n_u_bx, __pyx_mstate->__pyx_n_u_by, __pyx_mstate->__pyx_n_u_cx, __pyx_mstate->__pyx_n_u_cy, __pyx_mstate->__pyx_n_u_ax2, __pyx_mstate->__pyx_n_u_ay2, __pyx_mstate->__pyx_n_u_roots, __pyx_mstate->__pyx_n_u_points, __pyx_mstate->__pyx_n_u_t};
  30087. __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcQuadraticBounds, __pyx_mstate->__pyx_kp_b_iso88591_T_t6_V_5_Q_Rq_Rq_A_t3a_WAQc_1_t, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad;
  30088. }
  30089. {
  30090. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 332};
  30091. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4};
  30092. __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_approximateCubicArcLength, __pyx_mstate->__pyx_kp_b_iso88591_2_Q_r_wb_gRvWBa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad;
  30093. }
  30094. {
  30095. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 362};
  30096. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_v0, __pyx_mstate->__pyx_n_u_v1, __pyx_mstate->__pyx_n_u_v2, __pyx_mstate->__pyx_n_u_v3, __pyx_mstate->__pyx_n_u_v4};
  30097. __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_approximateCubicArcLengthC, __pyx_mstate->__pyx_kp_b_iso88591_AT_5_A_2Q_Ba_Ba_Ba_AT_4r_RuBa_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad;
  30098. }
  30099. {
  30100. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 23, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 412};
  30101. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_ay, __pyx_mstate->__pyx_n_u_bx, __pyx_mstate->__pyx_n_u_by, __pyx_mstate->__pyx_n_u_cx, __pyx_mstate->__pyx_n_u_cy, __pyx_mstate->__pyx_n_u_dx, __pyx_mstate->__pyx_n_u_dy, __pyx_mstate->__pyx_n_u_ax3, __pyx_mstate->__pyx_n_u_ay3, __pyx_mstate->__pyx_n_u_bx2, __pyx_mstate->__pyx_n_u_by2, __pyx_mstate->__pyx_n_u_xRoots, __pyx_mstate->__pyx_n_u_yRoots, __pyx_mstate->__pyx_n_u_roots, __pyx_mstate->__pyx_n_u_points, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_t};
  30102. __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcCubicBounds, __pyx_mstate->__pyx_kp_b_iso88591_T_t6_V4v_e5PQ_Rq_Rq_Rq_Rq_Qb_E, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad;
  30103. }
  30104. {
  30105. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 15, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 450};
  30106. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_where, __pyx_mstate->__pyx_n_u_isHorizontal, __pyx_mstate->__pyx_n_u_pt1x, __pyx_mstate->__pyx_n_u_pt1y, __pyx_mstate->__pyx_n_u_pt2x, __pyx_mstate->__pyx_n_u_pt2y, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_ay, __pyx_mstate->__pyx_n_u_bx, __pyx_mstate->__pyx_n_u_by, __pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_midPt};
  30107. __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_splitLine, __pyx_mstate->__pyx_kp_b_iso88591_H_b_b_S_r_A_r_a_s_c_1_r_D_2Rr_S, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad;
  30108. }
  30109. {
  30110. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 507};
  30111. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_where, __pyx_mstate->__pyx_n_u_isHorizontal, __pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_solutions, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
  30112. __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_splitQuadratic, __pyx_mstate->__pyx_kp_b_iso88591_F_s_Qe5_a_1N_A_aq_t1_r_e1_Qc_D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad;
  30113. }
  30114. {
  30115. const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 552};
  30116. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_where, __pyx_mstate->__pyx_n_u_isHorizontal, __pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_solutions, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
  30117. __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_splitCubic, __pyx_mstate->__pyx_kp_b_iso88591_6_s_T_AU_uA_1O1A_2Q_aq_t1_r_e5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad;
  30118. }
  30119. {
  30120. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 589};
  30121. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_ts, __pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c};
  30122. __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_splitQuadraticAtT_2, __pyx_mstate->__pyx_kp_b_iso88591_s_Qe5_Qc_D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad;
  30123. }
  30124. {
  30125. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 613};
  30126. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_ts, __pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_split};
  30127. __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_splitCubicAtT_2, __pyx_mstate->__pyx_kp_b_iso88591_s_T_AU_uA_N_3c_D_e1Baq_6_r_3d_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad;
  30128. }
  30129. {
  30130. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 668};
  30131. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_t2, __pyx_mstate->__pyx_n_u_1_t, __pyx_mstate->__pyx_n_u_1_t_2, __pyx_mstate->__pyx_n_u_2_t_1_t, __pyx_mstate->__pyx_n_u_pointAtT, __pyx_mstate->__pyx_n_u_off1, __pyx_mstate->__pyx_n_u_off2};
  30132. __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_splitCubicIntoTwoAtTC, __pyx_mstate->__pyx_kp_b_iso88591_0_2Q_2Rq_U_A_r_2Rq_r_b_Bb_7_Bb, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad;
  30133. }
  30134. {
  30135. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 26, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 708};
  30136. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_ts, __pyx_mstate->__pyx_n_u_segments, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_ay, __pyx_mstate->__pyx_n_u_bx, __pyx_mstate->__pyx_n_u_by, __pyx_mstate->__pyx_n_u_cx, __pyx_mstate->__pyx_n_u_cy, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_t1, __pyx_mstate->__pyx_n_u_t2, __pyx_mstate->__pyx_n_u_delta, __pyx_mstate->__pyx_n_u_delta_2, __pyx_mstate->__pyx_n_u_a1x, __pyx_mstate->__pyx_n_u_a1y, __pyx_mstate->__pyx_n_u_b1x, __pyx_mstate->__pyx_n_u_b1y, __pyx_mstate->__pyx_n_u_t1_2, __pyx_mstate->__pyx_n_u_c1x, __pyx_mstate->__pyx_n_u_c1y, __pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3};
  30137. __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_splitQuadraticAtT, __pyx_mstate->__pyx_kp_b_iso88591_Qa_q_gQc_gQa_Q_Q_Q_U_3at2Q_Rq_R, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad;
  30138. }
  30139. {
  30140. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 34, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 735};
  30141. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_ts, __pyx_mstate->__pyx_n_u_segments, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_ay, __pyx_mstate->__pyx_n_u_bx, __pyx_mstate->__pyx_n_u_by, __pyx_mstate->__pyx_n_u_cx, __pyx_mstate->__pyx_n_u_cy, __pyx_mstate->__pyx_n_u_dx, __pyx_mstate->__pyx_n_u_dy, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_t1, __pyx_mstate->__pyx_n_u_t2, __pyx_mstate->__pyx_n_u_delta, __pyx_mstate->__pyx_n_u_delta_2, __pyx_mstate->__pyx_n_u_delta_3, __pyx_mstate->__pyx_n_u_t1_2, __pyx_mstate->__pyx_n_u_t1_3, __pyx_mstate->__pyx_n_u_a1x, __pyx_mstate->__pyx_n_u_a1y, __pyx_mstate->__pyx_n_u_b1x, __pyx_mstate->__pyx_n_u_b1y, __pyx_mstate->__pyx_n_u_c1x, __pyx_mstate->__pyx_n_u_c1y, __pyx_mstate->__pyx_n_u_d1x, __pyx_mstate->__pyx_n_u_d1y, __pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4};
  30142. __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_splitCubicAtT, __pyx_mstate->__pyx_kp_b_iso88591_Qa_gQc_gQa_q_Q_Q_Q_Q_U_3at2Q_Rq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad;
  30143. }
  30144. {
  30145. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 815};
  30146. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_sqrt, __pyx_mstate->__pyx_n_u_roots, __pyx_mstate->__pyx_n_u_DD, __pyx_mstate->__pyx_n_u_rDD};
  30147. __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_solveQuadratic, __pyx_mstate->__pyx_kp_b_iso88591_s_3b_3as_A_A_AQb_Rr_2T_2Rq_3c_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad;
  30148. }
  30149. {
  30150. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 19, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 848};
  30151. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_a1, __pyx_mstate->__pyx_n_u_a2, __pyx_mstate->__pyx_n_u_a3, __pyx_mstate->__pyx_n_u_Q, __pyx_mstate->__pyx_n_u_R, __pyx_mstate->__pyx_n_u_R2, __pyx_mstate->__pyx_n_u_Q3, __pyx_mstate->__pyx_n_u_R2_Q3, __pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_theta, __pyx_mstate->__pyx_n_u_rQ2, __pyx_mstate->__pyx_n_u_a1_3, __pyx_mstate->__pyx_n_u_x0, __pyx_mstate->__pyx_n_u_x1, __pyx_mstate->__pyx_n_u_x2};
  30152. __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_solveCubic, __pyx_mstate->__pyx_kp_b_iso88591_L_s_3b_Qc_A_Qa_2Q_2Q_2Q_Bc_4r_R, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad;
  30153. }
  30154. {
  30155. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 945};
  30156. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_x2, __pyx_mstate->__pyx_n_u_y2, __pyx_mstate->__pyx_n_u_x3, __pyx_mstate->__pyx_n_u_y3, __pyx_mstate->__pyx_n_u_cx, __pyx_mstate->__pyx_n_u_cy, __pyx_mstate->__pyx_n_u_bx, __pyx_mstate->__pyx_n_u_by, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_ay};
  30157. __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcQuadraticParameters, __pyx_mstate->__pyx_kp_b_iso88591_Q_Q_Q_Rt2Q_Rt2Q_Bc_1_Bc_1_1D_d, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad;
  30158. }
  30159. {
  30160. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 18, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 956};
  30161. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_x2, __pyx_mstate->__pyx_n_u_y2, __pyx_mstate->__pyx_n_u_x3, __pyx_mstate->__pyx_n_u_y3, __pyx_mstate->__pyx_n_u_x4, __pyx_mstate->__pyx_n_u_y4, __pyx_mstate->__pyx_n_u_dx, __pyx_mstate->__pyx_n_u_dy, __pyx_mstate->__pyx_n_u_cx, __pyx_mstate->__pyx_n_u_cy, __pyx_mstate->__pyx_n_u_bx, __pyx_mstate->__pyx_n_u_by, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_ay};
  30162. __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcCubicParameters, __pyx_mstate->__pyx_kp_b_iso88591_Q_Q_Q_Q_Rt2Q_Rt2Q_Rt2T_1_Rt2T_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad;
  30163. }
  30164. {
  30165. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 15, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 988};
  30166. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_ay, __pyx_mstate->__pyx_n_u_bx, __pyx_mstate->__pyx_n_u_by, __pyx_mstate->__pyx_n_u_cx, __pyx_mstate->__pyx_n_u_cy, __pyx_mstate->__pyx_n_u_x1, __pyx_mstate->__pyx_n_u_y1, __pyx_mstate->__pyx_n_u_x2, __pyx_mstate->__pyx_n_u_y2, __pyx_mstate->__pyx_n_u_x3, __pyx_mstate->__pyx_n_u_y3};
  30167. __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcQuadraticPoints, __pyx_mstate->__pyx_kp_b_iso88591_Q_Q_Q_RuBa_RuBa_Bc_1_Bc_1_1D_d, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad;
  30168. }
  30169. {
  30170. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 20, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1001};
  30171. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_ax, __pyx_mstate->__pyx_n_u_ay, __pyx_mstate->__pyx_n_u_bx, __pyx_mstate->__pyx_n_u_by, __pyx_mstate->__pyx_n_u_cx, __pyx_mstate->__pyx_n_u_cy, __pyx_mstate->__pyx_n_u_dx, __pyx_mstate->__pyx_n_u_dy, __pyx_mstate->__pyx_n_u_x1, __pyx_mstate->__pyx_n_u_y1, __pyx_mstate->__pyx_n_u_x2, __pyx_mstate->__pyx_n_u_y2, __pyx_mstate->__pyx_n_u_x3, __pyx_mstate->__pyx_n_u_y3, __pyx_mstate->__pyx_n_u_x4, __pyx_mstate->__pyx_n_u_y4};
  30172. __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_calcCubicPoints, __pyx_mstate->__pyx_kp_b_iso88591_Q_Q_Q_Q_RuBa_RuBa_Rt2T_1_Rt2T_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad;
  30173. }
  30174. {
  30175. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1040};
  30176. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_t};
  30177. __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_linePointAtT, __pyx_mstate->__pyx_kp_b_iso88591_AS_Cr_3b_1Cr_c_S_Cr_AS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad;
  30178. }
  30179. {
  30180. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1053};
  30181. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_y};
  30182. __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_quadraticPointAtT, __pyx_mstate->__pyx_kp_b_iso88591_2S_2Rs_Cq_2Rs_Bc_2Rs_3b_Bb_1A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad;
  30183. }
  30184. {
  30185. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1068};
  30186. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_t2, __pyx_mstate->__pyx_n_u_1_t, __pyx_mstate->__pyx_n_u_1_t_2, __pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_y};
  30187. __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_cubicPointAtT, __pyx_mstate->__pyx_kp_b_iso88591_2Q_2Rq_U_A_r_b_1A_Cwb_Cq_2U_Cr, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad;
  30188. }
  30189. {
  30190. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1094};
  30191. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3, __pyx_mstate->__pyx_n_u_pt4, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_t2, __pyx_mstate->__pyx_n_u_1_t, __pyx_mstate->__pyx_n_u_1_t_2};
  30192. __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_cubicPointAtTC, __pyx_mstate->__pyx_kp_b_iso88591_2Q_2Rq_U_A_7_E_4r_3gRr_4r_b_2U, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad;
  30193. }
  30194. {
  30195. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1119};
  30196. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_seg, __pyx_mstate->__pyx_n_u_t};
  30197. __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_segmentPointAtT, __pyx_mstate->__pyx_kp_b_iso88591_s_5_1_2U_AU_Q_q_AU_Q_Be1_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad;
  30198. }
  30199. {
  30200. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1134};
  30201. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_pt, __pyx_mstate->__pyx_n_u_sx, __pyx_mstate->__pyx_n_u_sy, __pyx_mstate->__pyx_n_u_ex, __pyx_mstate->__pyx_n_u_ey, __pyx_mstate->__pyx_n_u_px, __pyx_mstate->__pyx_n_u_py};
  30202. __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_line_t_of_pt, __pyx_mstate->__pyx_kp_b_iso88591_Q_Q_Q_s_3b_Bhd_Qc_4r_s_3b_Bc_Rq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad;
  30203. }
  30204. {
  30205. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1148};
  30206. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_origin, __pyx_mstate->__pyx_n_u_xDiff, __pyx_mstate->__pyx_n_u_yDiff};
  30207. __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_both_points_are_on_same_side_of, __pyx_mstate->__pyx_kp_b_iso88591_Qas_F_4s_1Cr_q_Qas_F_4s_1Cr_q_5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad;
  30208. }
  30209. {
  30210. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 17, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1154};
  30211. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_s1, __pyx_mstate->__pyx_n_u_e1, __pyx_mstate->__pyx_n_u_s2, __pyx_mstate->__pyx_n_u_e2, __pyx_mstate->__pyx_n_u_s1x, __pyx_mstate->__pyx_n_u_s1y, __pyx_mstate->__pyx_n_u_e1x, __pyx_mstate->__pyx_n_u_e1y, __pyx_mstate->__pyx_n_u_s2x, __pyx_mstate->__pyx_n_u_s2y, __pyx_mstate->__pyx_n_u_e2x, __pyx_mstate->__pyx_n_u_e2y, __pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_slope34, __pyx_mstate->__pyx_n_u_y, __pyx_mstate->__pyx_n_u_pt, __pyx_mstate->__pyx_n_u_slope12};
  30212. __pyx_mstate_global->__pyx_codeobj_tab[42] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_lineLineIntersections, __pyx_mstate->__pyx_kp_b_iso88591_q_q_q_q_HAU_t4xq_U_d_hauTU_q_HA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[42])) goto bad;
  30213. }
  30214. {
  30215. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1232};
  30216. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_segment, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_end, __pyx_mstate->__pyx_n_u_angle};
  30217. __pyx_mstate_global->__pyx_codeobj_tab[43] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_alignment_transformation, __pyx_mstate->__pyx_kp_b_iso88591_G1A_1_D_as_3b_Qd_Qc_5_87_1F_AQe, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[43])) goto bad;
  30218. }
  30219. {
  30220. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1242};
  30221. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_curve, __pyx_mstate->__pyx_n_u_line, __pyx_mstate->__pyx_n_u_aligned_curve, __pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_b, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_intersections, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
  30222. __pyx_mstate_global->__pyx_codeobj_tab[44] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_curve_line_intersections_t, __pyx_mstate->__pyx_kp_b_iso88591_Qe3C1A_s_7_Q_3d_1_aq_Qat1AQ_AWC, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[44])) goto bad;
  30223. }
  30224. {
  30225. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1255};
  30226. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_curve, __pyx_mstate->__pyx_n_u_line, __pyx_mstate->__pyx_n_u_pointFinder, __pyx_mstate->__pyx_n_u_intersections, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_pt, __pyx_mstate->__pyx_n_u_line_t};
  30227. __pyx_mstate_global->__pyx_codeobj_tab[45] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_curveLineIntersections, __pyx_mstate->__pyx_kp_b_iso88591_s_7_Q_a_AWCq_a_j_A_b_a_6_WA_T_C, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[45])) goto bad;
  30228. }
  30229. {
  30230. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1293};
  30231. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c};
  30232. __pyx_mstate_global->__pyx_codeobj_tab[46] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_curve_bounds, __pyx_mstate->__pyx_kp_b_iso88591_s_3c_A_AS_1_b_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[46])) goto bad;
  30233. }
  30234. {
  30235. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1301};
  30236. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_t, __pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_midpoint};
  30237. __pyx_mstate_global->__pyx_codeobj_tab[47] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_split_segment_at_t, __pyx_mstate->__pyx_kp_b_iso88591_s_3c_4q_q_3a_r_L_s_3c_Q_AS_1_Bc, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[47])) goto bad;
  30238. }
  30239. {
  30240. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 25, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1313};
  30241. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_curve1, __pyx_mstate->__pyx_n_u_curve2, __pyx_mstate->__pyx_n_u_precision, __pyx_mstate->__pyx_n_u_range1, __pyx_mstate->__pyx_n_u_range2, __pyx_mstate->__pyx_n_u_bounds1, __pyx_mstate->__pyx_n_u_bounds2, __pyx_mstate->__pyx_n_u_intersects, __pyx_mstate->__pyx_n_u__6, __pyx_mstate->__pyx_n_u_midpoint, __pyx_mstate->__pyx_n_u_midpoint, __pyx_mstate->__pyx_n_u_c11, __pyx_mstate->__pyx_n_u_c12, __pyx_mstate->__pyx_n_u_c11_range, __pyx_mstate->__pyx_n_u_c12_range, __pyx_mstate->__pyx_n_u_c21, __pyx_mstate->__pyx_n_u_c22, __pyx_mstate->__pyx_n_u_c21_range, __pyx_mstate->__pyx_n_u_c22_range, __pyx_mstate->__pyx_n_u_found, __pyx_mstate->__pyx_n_u_unique_key, __pyx_mstate->__pyx_n_u_seen, __pyx_mstate->__pyx_n_u_unique_values, __pyx_mstate->__pyx_n_u_ts, __pyx_mstate->__pyx_n_u_key};
  30242. __pyx_mstate_global->__pyx_codeobj_tab[48] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_curve_curve_intersections_t, __pyx_mstate->__pyx_kp_b_iso88591_M_m1A_m1A_t1_q_t1_q_HAYa_t1_q_x, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[48])) goto bad;
  30243. }
  30244. {
  30245. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1380};
  30246. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_segment, __pyx_mstate->__pyx_n_u_maybeline, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
  30247. __pyx_mstate_global->__pyx_codeobj_tab[49] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_is_linelike, __pyx_mstate->__pyx_kp_b_iso88591_2B_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[49])) goto bad;
  30248. }
  30249. {
  30250. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1385};
  30251. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_curve1, __pyx_mstate->__pyx_n_u_curve2, __pyx_mstate->__pyx_n_u_line1, __pyx_mstate->__pyx_n_u_line2, __pyx_mstate->__pyx_n_u_hits, __pyx_mstate->__pyx_n_u_intersection_ts, __pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_ts};
  30252. __pyx_mstate_global->__pyx_codeobj_tab[50] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_curveCurveIntersections, __pyx_mstate->__pyx_kp_b_iso88591_1A_at6_1_q_F_4vRq_1L_AU_Qe3auD, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[50])) goto bad;
  30253. }
  30254. {
  30255. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1427};
  30256. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_seg1, __pyx_mstate->__pyx_n_u_seg2, __pyx_mstate->__pyx_n_u_swapped, __pyx_mstate->__pyx_n_u_intersections, __pyx_mstate->__pyx_n_u_i};
  30257. __pyx_mstate_global->__pyx_codeobj_tab[51] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_segmentSegmentIntersections, __pyx_mstate->__pyx_kp_b_iso88591_a_s_6_3aq_gV1_s_6_1_3avRq_31F_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[51])) goto bad;
  30258. }
  30259. {
  30260. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1475};
  30261. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_obj, __pyx_mstate->__pyx_n_u_it, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
  30262. __pyx_mstate_global->__pyx_codeobj_tab[52] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_segmentrepr, __pyx_mstate->__pyx_kp_b_iso88591_T_uBa_wb_E_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[52])) goto bad;
  30263. }
  30264. {
  30265. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1488};
  30266. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_segments, __pyx_mstate->__pyx_n_u_segment};
  30267. __pyx_mstate_global->__pyx_codeobj_tab[53] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_misc_bezierTools_p, __pyx_mstate->__pyx_n_u_printSegments, __pyx_mstate->__pyx_kp_b_iso88591_1_Ql_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[53])) goto bad;
  30268. }
  30269. Py_DECREF(tuple_dedup_map);
  30270. return 0;
  30271. bad:
  30272. Py_DECREF(tuple_dedup_map);
  30273. return -1;
  30274. }
  30275. /* #### Code section: init_globals ### */
  30276. static int __Pyx_InitGlobals(void) {
  30277. /* PythonCompatibility.init */
  30278. if (likely(__Pyx_init_co_variables() == 0)); else
  30279. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  30280. /* CommonTypesMetaclass.init */
  30281. if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  30282. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  30283. /* Generator.init */
  30284. if (likely(__pyx_Generator_init(__pyx_m) == 0)); else
  30285. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  30286. /* CachedMethodType.init */
  30287. #if CYTHON_COMPILING_IN_LIMITED_API
  30288. {
  30289. PyObject *typesModule=NULL;
  30290. typesModule = PyImport_ImportModule("types");
  30291. if (typesModule) {
  30292. __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
  30293. Py_DECREF(typesModule);
  30294. }
  30295. } // error handling follows
  30296. #endif
  30297. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  30298. /* CythonFunctionShared.init */
  30299. if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else
  30300. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  30301. return 0;
  30302. __pyx_L1_error:;
  30303. return -1;
  30304. }
  30305. /* #### Code section: cleanup_globals ### */
  30306. /* #### Code section: cleanup_module ### */
  30307. /* #### Code section: main_method ### */
  30308. /* #### Code section: utility_code_pragmas ### */
  30309. #ifdef _MSC_VER
  30310. #pragma warning( push )
  30311. /* Warning 4127: conditional expression is constant
  30312. * Cython uses constant conditional expressions to allow in inline functions to be optimized at
  30313. * compile-time, so this warning is not useful
  30314. */
  30315. #pragma warning( disable : 4127 )
  30316. #endif
  30317. /* #### Code section: utility_code_def ### */
  30318. /* --- Runtime support code --- */
  30319. /* Refnanny */
  30320. #if CYTHON_REFNANNY
  30321. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  30322. PyObject *m = NULL, *p = NULL;
  30323. void *r = NULL;
  30324. m = PyImport_ImportModule(modname);
  30325. if (!m) goto end;
  30326. p = PyObject_GetAttrString(m, "RefNannyAPI");
  30327. if (!p) goto end;
  30328. r = PyLong_AsVoidPtr(p);
  30329. end:
  30330. Py_XDECREF(p);
  30331. Py_XDECREF(m);
  30332. return (__Pyx_RefNannyAPIStruct *)r;
  30333. }
  30334. #endif
  30335. /* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
  30336. #if CYTHON_FAST_THREAD_STATE
  30337. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  30338. Py_ssize_t i, n;
  30339. n = PyTuple_GET_SIZE(tuple);
  30340. for (i=0; i<n; i++) {
  30341. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  30342. }
  30343. for (i=0; i<n; i++) {
  30344. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  30345. }
  30346. return 0;
  30347. }
  30348. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  30349. int result;
  30350. PyObject *exc_type;
  30351. #if PY_VERSION_HEX >= 0x030C00A6
  30352. PyObject *current_exception = tstate->current_exception;
  30353. if (unlikely(!current_exception)) return 0;
  30354. exc_type = (PyObject*) Py_TYPE(current_exception);
  30355. if (exc_type == err) return 1;
  30356. #else
  30357. exc_type = tstate->curexc_type;
  30358. if (exc_type == err) return 1;
  30359. if (unlikely(!exc_type)) return 0;
  30360. #endif
  30361. #if CYTHON_AVOID_BORROWED_REFS
  30362. Py_INCREF(exc_type);
  30363. #endif
  30364. if (unlikely(PyTuple_Check(err))) {
  30365. result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  30366. } else {
  30367. result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  30368. }
  30369. #if CYTHON_AVOID_BORROWED_REFS
  30370. Py_DECREF(exc_type);
  30371. #endif
  30372. return result;
  30373. }
  30374. #endif
  30375. /* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
  30376. #if CYTHON_FAST_THREAD_STATE
  30377. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  30378. #if PY_VERSION_HEX >= 0x030C00A6
  30379. PyObject *tmp_value;
  30380. assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
  30381. if (value) {
  30382. #if CYTHON_COMPILING_IN_CPYTHON
  30383. if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
  30384. #endif
  30385. PyException_SetTraceback(value, tb);
  30386. }
  30387. tmp_value = tstate->current_exception;
  30388. tstate->current_exception = value;
  30389. Py_XDECREF(tmp_value);
  30390. Py_XDECREF(type);
  30391. Py_XDECREF(tb);
  30392. #else
  30393. PyObject *tmp_type, *tmp_value, *tmp_tb;
  30394. tmp_type = tstate->curexc_type;
  30395. tmp_value = tstate->curexc_value;
  30396. tmp_tb = tstate->curexc_traceback;
  30397. tstate->curexc_type = type;
  30398. tstate->curexc_value = value;
  30399. tstate->curexc_traceback = tb;
  30400. Py_XDECREF(tmp_type);
  30401. Py_XDECREF(tmp_value);
  30402. Py_XDECREF(tmp_tb);
  30403. #endif
  30404. }
  30405. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  30406. #if PY_VERSION_HEX >= 0x030C00A6
  30407. PyObject* exc_value;
  30408. exc_value = tstate->current_exception;
  30409. tstate->current_exception = 0;
  30410. *value = exc_value;
  30411. *type = NULL;
  30412. *tb = NULL;
  30413. if (exc_value) {
  30414. *type = (PyObject*) Py_TYPE(exc_value);
  30415. Py_INCREF(*type);
  30416. #if CYTHON_COMPILING_IN_CPYTHON
  30417. *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
  30418. Py_XINCREF(*tb);
  30419. #else
  30420. *tb = PyException_GetTraceback(exc_value);
  30421. #endif
  30422. }
  30423. #else
  30424. *type = tstate->curexc_type;
  30425. *value = tstate->curexc_value;
  30426. *tb = tstate->curexc_traceback;
  30427. tstate->curexc_type = 0;
  30428. tstate->curexc_value = 0;
  30429. tstate->curexc_traceback = 0;
  30430. #endif
  30431. }
  30432. #endif
  30433. /* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
  30434. #if CYTHON_USE_TYPE_SLOTS
  30435. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  30436. PyTypeObject* tp = Py_TYPE(obj);
  30437. if (likely(tp->tp_getattro))
  30438. return tp->tp_getattro(obj, attr_name);
  30439. return PyObject_GetAttr(obj, attr_name);
  30440. }
  30441. #endif
  30442. /* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
  30443. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  30444. static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
  30445. __Pyx_PyThreadState_declare
  30446. __Pyx_PyThreadState_assign
  30447. if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  30448. __Pyx_PyErr_Clear();
  30449. }
  30450. #endif
  30451. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
  30452. PyObject *result;
  30453. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  30454. (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
  30455. return result;
  30456. #else
  30457. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
  30458. PyTypeObject* tp = Py_TYPE(obj);
  30459. if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
  30460. return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
  30461. }
  30462. #endif
  30463. result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
  30464. if (unlikely(!result)) {
  30465. __Pyx_PyObject_GetAttrStr_ClearAttributeError();
  30466. }
  30467. return result;
  30468. #endif
  30469. }
  30470. /* GetBuiltinName */
  30471. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  30472. PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
  30473. if (unlikely(!result) && !PyErr_Occurred()) {
  30474. PyErr_Format(PyExc_NameError,
  30475. "name '%U' is not defined", name);
  30476. }
  30477. return result;
  30478. }
  30479. /* TupleAndListFromArray (used by fastcall) */
  30480. #if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
  30481. static CYTHON_INLINE PyObject *
  30482. __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
  30483. {
  30484. PyObject *res;
  30485. Py_ssize_t i;
  30486. if (n <= 0) {
  30487. return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
  30488. }
  30489. res = PyTuple_New(n);
  30490. if (unlikely(res == NULL)) return NULL;
  30491. for (i = 0; i < n; i++) {
  30492. if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
  30493. Py_DECREF(res);
  30494. return NULL;
  30495. }
  30496. Py_INCREF(src[i]);
  30497. }
  30498. return res;
  30499. }
  30500. #elif CYTHON_COMPILING_IN_CPYTHON
  30501. static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
  30502. PyObject *v;
  30503. Py_ssize_t i;
  30504. for (i = 0; i < length; i++) {
  30505. v = dest[i] = src[i];
  30506. Py_INCREF(v);
  30507. }
  30508. }
  30509. static CYTHON_INLINE PyObject *
  30510. __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
  30511. {
  30512. PyObject *res;
  30513. if (n <= 0) {
  30514. return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
  30515. }
  30516. res = PyTuple_New(n);
  30517. if (unlikely(res == NULL)) return NULL;
  30518. __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
  30519. return res;
  30520. }
  30521. static CYTHON_INLINE PyObject *
  30522. __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
  30523. {
  30524. PyObject *res;
  30525. if (n <= 0) {
  30526. return PyList_New(0);
  30527. }
  30528. res = PyList_New(n);
  30529. if (unlikely(res == NULL)) return NULL;
  30530. __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
  30531. return res;
  30532. }
  30533. #endif
  30534. /* BytesEquals (used by UnicodeEquals) */
  30535. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  30536. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
  30537. !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
  30538. return PyObject_RichCompareBool(s1, s2, equals);
  30539. #else
  30540. if (s1 == s2) {
  30541. return (equals == Py_EQ);
  30542. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  30543. const char *ps1, *ps2;
  30544. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  30545. if (length != PyBytes_GET_SIZE(s2))
  30546. return (equals == Py_NE);
  30547. ps1 = PyBytes_AS_STRING(s1);
  30548. ps2 = PyBytes_AS_STRING(s2);
  30549. if (ps1[0] != ps2[0]) {
  30550. return (equals == Py_NE);
  30551. } else if (length == 1) {
  30552. return (equals == Py_EQ);
  30553. } else {
  30554. int result;
  30555. #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
  30556. Py_hash_t hash1, hash2;
  30557. hash1 = ((PyBytesObject*)s1)->ob_shash;
  30558. hash2 = ((PyBytesObject*)s2)->ob_shash;
  30559. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  30560. return (equals == Py_NE);
  30561. }
  30562. #endif
  30563. result = memcmp(ps1, ps2, (size_t)length);
  30564. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  30565. }
  30566. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  30567. return (equals == Py_NE);
  30568. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  30569. return (equals == Py_NE);
  30570. } else {
  30571. int result;
  30572. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  30573. if (!py_result)
  30574. return -1;
  30575. result = __Pyx_PyObject_IsTrue(py_result);
  30576. Py_DECREF(py_result);
  30577. return result;
  30578. }
  30579. #endif
  30580. }
  30581. /* UnicodeEquals (used by fastcall) */
  30582. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  30583. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
  30584. return PyObject_RichCompareBool(s1, s2, equals);
  30585. #else
  30586. int s1_is_unicode, s2_is_unicode;
  30587. if (s1 == s2) {
  30588. goto return_eq;
  30589. }
  30590. s1_is_unicode = PyUnicode_CheckExact(s1);
  30591. s2_is_unicode = PyUnicode_CheckExact(s2);
  30592. if (s1_is_unicode & s2_is_unicode) {
  30593. Py_ssize_t length, length2;
  30594. int kind;
  30595. void *data1, *data2;
  30596. #if !CYTHON_COMPILING_IN_LIMITED_API
  30597. if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
  30598. return -1;
  30599. #endif
  30600. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  30601. #if !CYTHON_ASSUME_SAFE_SIZE
  30602. if (unlikely(length < 0)) return -1;
  30603. #endif
  30604. length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
  30605. #if !CYTHON_ASSUME_SAFE_SIZE
  30606. if (unlikely(length2 < 0)) return -1;
  30607. #endif
  30608. if (length != length2) {
  30609. goto return_ne;
  30610. }
  30611. #if CYTHON_USE_UNICODE_INTERNALS
  30612. {
  30613. Py_hash_t hash1, hash2;
  30614. hash1 = ((PyASCIIObject*)s1)->hash;
  30615. hash2 = ((PyASCIIObject*)s2)->hash;
  30616. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  30617. goto return_ne;
  30618. }
  30619. }
  30620. #endif
  30621. kind = __Pyx_PyUnicode_KIND(s1);
  30622. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  30623. goto return_ne;
  30624. }
  30625. data1 = __Pyx_PyUnicode_DATA(s1);
  30626. data2 = __Pyx_PyUnicode_DATA(s2);
  30627. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  30628. goto return_ne;
  30629. } else if (length == 1) {
  30630. goto return_eq;
  30631. } else {
  30632. int result = memcmp(data1, data2, (size_t)(length * kind));
  30633. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  30634. }
  30635. } else if ((s1 == Py_None) & s2_is_unicode) {
  30636. goto return_ne;
  30637. } else if ((s2 == Py_None) & s1_is_unicode) {
  30638. goto return_ne;
  30639. } else {
  30640. int result;
  30641. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  30642. if (!py_result)
  30643. return -1;
  30644. result = __Pyx_PyObject_IsTrue(py_result);
  30645. Py_DECREF(py_result);
  30646. return result;
  30647. }
  30648. return_eq:
  30649. return (equals == Py_EQ);
  30650. return_ne:
  30651. return (equals == Py_NE);
  30652. #endif
  30653. }
  30654. /* fastcall */
  30655. #if CYTHON_METH_FASTCALL
  30656. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
  30657. {
  30658. Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
  30659. #if !CYTHON_ASSUME_SAFE_SIZE
  30660. if (unlikely(n == -1)) return NULL;
  30661. #endif
  30662. for (i = 0; i < n; i++)
  30663. {
  30664. PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
  30665. #if !CYTHON_ASSUME_SAFE_MACROS
  30666. if (unlikely(!namei)) return NULL;
  30667. #endif
  30668. if (s == namei) return kwvalues[i];
  30669. }
  30670. for (i = 0; i < n; i++)
  30671. {
  30672. PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
  30673. #if !CYTHON_ASSUME_SAFE_MACROS
  30674. if (unlikely(!namei)) return NULL;
  30675. #endif
  30676. int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
  30677. if (unlikely(eq != 0)) {
  30678. if (unlikely(eq < 0)) return NULL;
  30679. return kwvalues[i];
  30680. }
  30681. }
  30682. return NULL;
  30683. }
  30684. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  30685. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
  30686. Py_ssize_t i, nkwargs;
  30687. PyObject *dict;
  30688. #if !CYTHON_ASSUME_SAFE_SIZE
  30689. nkwargs = PyTuple_Size(kwnames);
  30690. if (unlikely(nkwargs < 0)) return NULL;
  30691. #else
  30692. nkwargs = PyTuple_GET_SIZE(kwnames);
  30693. #endif
  30694. dict = PyDict_New();
  30695. if (unlikely(!dict))
  30696. return NULL;
  30697. for (i=0; i<nkwargs; i++) {
  30698. #if !CYTHON_ASSUME_SAFE_MACROS
  30699. PyObject *key = PyTuple_GetItem(kwnames, i);
  30700. if (!key) goto bad;
  30701. #else
  30702. PyObject *key = PyTuple_GET_ITEM(kwnames, i);
  30703. #endif
  30704. if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
  30705. goto bad;
  30706. }
  30707. return dict;
  30708. bad:
  30709. Py_DECREF(dict);
  30710. return NULL;
  30711. }
  30712. #endif
  30713. #endif
  30714. /* PyObjectCall (used by PyObjectFastCall) */
  30715. #if CYTHON_COMPILING_IN_CPYTHON
  30716. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  30717. PyObject *result;
  30718. ternaryfunc call = Py_TYPE(func)->tp_call;
  30719. if (unlikely(!call))
  30720. return PyObject_Call(func, arg, kw);
  30721. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  30722. return NULL;
  30723. result = (*call)(func, arg, kw);
  30724. Py_LeaveRecursiveCall();
  30725. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  30726. PyErr_SetString(
  30727. PyExc_SystemError,
  30728. "NULL result without error in PyObject_Call");
  30729. }
  30730. return result;
  30731. }
  30732. #endif
  30733. /* PyObjectCallMethO (used by PyObjectFastCall) */
  30734. #if CYTHON_COMPILING_IN_CPYTHON
  30735. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  30736. PyObject *self, *result;
  30737. PyCFunction cfunc;
  30738. cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
  30739. self = __Pyx_CyOrPyCFunction_GET_SELF(func);
  30740. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  30741. return NULL;
  30742. result = cfunc(self, arg);
  30743. Py_LeaveRecursiveCall();
  30744. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  30745. PyErr_SetString(
  30746. PyExc_SystemError,
  30747. "NULL result without error in PyObject_Call");
  30748. }
  30749. return result;
  30750. }
  30751. #endif
  30752. /* PyObjectFastCall (used by PyObjectCallOneArg) */
  30753. #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
  30754. static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
  30755. PyObject *argstuple;
  30756. PyObject *result = 0;
  30757. size_t i;
  30758. argstuple = PyTuple_New((Py_ssize_t)nargs);
  30759. if (unlikely(!argstuple)) return NULL;
  30760. for (i = 0; i < nargs; i++) {
  30761. Py_INCREF(args[i]);
  30762. if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
  30763. }
  30764. result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  30765. bad:
  30766. Py_DECREF(argstuple);
  30767. return result;
  30768. }
  30769. #endif
  30770. #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  30771. #if PY_VERSION_HEX < 0x03090000
  30772. #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  30773. #elif CYTHON_COMPILING_IN_CPYTHON
  30774. static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
  30775. PyTypeObject *tp = Py_TYPE(callable);
  30776. #if defined(__Pyx_CyFunction_USED)
  30777. if (__Pyx_CyFunction_CheckExact(callable)) {
  30778. return __Pyx_CyFunction_func_vectorcall(callable);
  30779. }
  30780. #endif
  30781. if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
  30782. return NULL;
  30783. }
  30784. assert(PyCallable_Check(callable));
  30785. Py_ssize_t offset = tp->tp_vectorcall_offset;
  30786. assert(offset > 0);
  30787. vectorcallfunc ptr;
  30788. memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
  30789. return ptr;
  30790. }
  30791. #else
  30792. #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  30793. #endif
  30794. #endif
  30795. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
  30796. Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
  30797. #if CYTHON_COMPILING_IN_CPYTHON
  30798. if (nargs == 0 && kwargs == NULL) {
  30799. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
  30800. return __Pyx_PyObject_CallMethO(func, NULL);
  30801. }
  30802. else if (nargs == 1 && kwargs == NULL) {
  30803. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
  30804. return __Pyx_PyObject_CallMethO(func, args[0]);
  30805. }
  30806. #endif
  30807. if (kwargs == NULL) {
  30808. #if CYTHON_VECTORCALL
  30809. #if CYTHON_COMPILING_IN_LIMITED_API
  30810. return PyObject_Vectorcall(func, args, _nargs, NULL);
  30811. #else
  30812. vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
  30813. if (f) {
  30814. return f(func, args, _nargs, NULL);
  30815. }
  30816. #endif
  30817. #endif
  30818. }
  30819. if (nargs == 0) {
  30820. return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
  30821. }
  30822. #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
  30823. return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
  30824. #else
  30825. return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
  30826. #endif
  30827. }
  30828. /* PyObjectCallOneArg (used by CallUnboundCMethod0) */
  30829. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  30830. PyObject *args[2] = {NULL, arg};
  30831. return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  30832. }
  30833. /* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
  30834. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
  30835. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
  30836. PyObject *result;
  30837. PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
  30838. if (unlikely(!selfless_args)) return NULL;
  30839. result = PyObject_Call(method, selfless_args, kwargs);
  30840. Py_DECREF(selfless_args);
  30841. return result;
  30842. }
  30843. #elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
  30844. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
  30845. return _PyObject_Vectorcall
  30846. (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
  30847. }
  30848. #else
  30849. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
  30850. return
  30851. #if PY_VERSION_HEX < 0x03090000
  30852. _PyObject_Vectorcall
  30853. #else
  30854. PyObject_Vectorcall
  30855. #endif
  30856. (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
  30857. }
  30858. #endif
  30859. static PyMethodDef __Pyx_UnboundCMethod_Def = {
  30860. "CythonUnboundCMethod",
  30861. __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
  30862. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
  30863. METH_VARARGS | METH_KEYWORDS,
  30864. #else
  30865. METH_FASTCALL | METH_KEYWORDS,
  30866. #endif
  30867. NULL
  30868. };
  30869. static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
  30870. PyObject *method, *result=NULL;
  30871. method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
  30872. if (unlikely(!method))
  30873. return -1;
  30874. result = method;
  30875. #if CYTHON_COMPILING_IN_CPYTHON
  30876. if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
  30877. {
  30878. PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
  30879. target->func = descr->d_method->ml_meth;
  30880. target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
  30881. } else
  30882. #endif
  30883. #if CYTHON_COMPILING_IN_PYPY
  30884. #else
  30885. if (PyCFunction_Check(method))
  30886. #endif
  30887. {
  30888. PyObject *self;
  30889. int self_found;
  30890. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  30891. self = PyObject_GetAttrString(method, "__self__");
  30892. if (!self) {
  30893. PyErr_Clear();
  30894. }
  30895. #else
  30896. self = PyCFunction_GET_SELF(method);
  30897. #endif
  30898. self_found = (self && self != Py_None);
  30899. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  30900. Py_XDECREF(self);
  30901. #endif
  30902. if (self_found) {
  30903. PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
  30904. if (unlikely(!unbound_method)) return -1;
  30905. Py_DECREF(method);
  30906. result = unbound_method;
  30907. }
  30908. }
  30909. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  30910. if (unlikely(target->method)) {
  30911. Py_DECREF(result);
  30912. } else
  30913. #endif
  30914. target->method = result;
  30915. return 0;
  30916. }
  30917. /* CallUnboundCMethod0 */
  30918. #if CYTHON_COMPILING_IN_CPYTHON
  30919. static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
  30920. int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
  30921. if (likely(was_initialized == 2 && cfunc->func)) {
  30922. if (likely(cfunc->flag == METH_NOARGS))
  30923. return __Pyx_CallCFunction(cfunc, self, NULL);
  30924. if (likely(cfunc->flag == METH_FASTCALL))
  30925. return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
  30926. if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
  30927. return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
  30928. if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
  30929. return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  30930. if (cfunc->flag == METH_VARARGS)
  30931. return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
  30932. return __Pyx__CallUnboundCMethod0(cfunc, self);
  30933. }
  30934. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  30935. else if (unlikely(was_initialized == 1)) {
  30936. __Pyx_CachedCFunction tmp_cfunc = {
  30937. #ifndef __cplusplus
  30938. 0
  30939. #endif
  30940. };
  30941. tmp_cfunc.type = cfunc->type;
  30942. tmp_cfunc.method_name = cfunc->method_name;
  30943. return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
  30944. }
  30945. #endif
  30946. PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
  30947. __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
  30948. return result;
  30949. }
  30950. #endif
  30951. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
  30952. PyObject *result;
  30953. if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
  30954. result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
  30955. return result;
  30956. }
  30957. /* py_dict_items (used by OwnedDictNext) */
  30958. static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
  30959. return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
  30960. }
  30961. /* py_dict_values (used by OwnedDictNext) */
  30962. static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
  30963. return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
  30964. }
  30965. /* OwnedDictNext (used by ParseKeywordsImpl) */
  30966. #if CYTHON_AVOID_BORROWED_REFS
  30967. static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
  30968. PyObject *next = NULL;
  30969. if (!*ppos) {
  30970. if (pvalue) {
  30971. PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
  30972. if (unlikely(!dictview)) goto bad;
  30973. *ppos = PyObject_GetIter(dictview);
  30974. Py_DECREF(dictview);
  30975. } else {
  30976. *ppos = PyObject_GetIter(p);
  30977. }
  30978. if (unlikely(!*ppos)) goto bad;
  30979. }
  30980. next = PyIter_Next(*ppos);
  30981. if (!next) {
  30982. if (PyErr_Occurred()) goto bad;
  30983. return 0;
  30984. }
  30985. if (pkey && pvalue) {
  30986. *pkey = __Pyx_PySequence_ITEM(next, 0);
  30987. if (unlikely(*pkey)) goto bad;
  30988. *pvalue = __Pyx_PySequence_ITEM(next, 1);
  30989. if (unlikely(*pvalue)) goto bad;
  30990. Py_DECREF(next);
  30991. } else if (pkey) {
  30992. *pkey = next;
  30993. } else {
  30994. assert(pvalue);
  30995. *pvalue = next;
  30996. }
  30997. return 1;
  30998. bad:
  30999. Py_XDECREF(next);
  31000. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
  31001. PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
  31002. #else
  31003. PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
  31004. #endif
  31005. if (pkey) *pkey = NULL;
  31006. if (pvalue) *pvalue = NULL;
  31007. return 0;
  31008. }
  31009. #else // !CYTHON_AVOID_BORROWED_REFS
  31010. static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
  31011. int result = PyDict_Next(p, ppos, pkey, pvalue);
  31012. if (likely(result == 1)) {
  31013. if (pkey) Py_INCREF(*pkey);
  31014. if (pvalue) Py_INCREF(*pvalue);
  31015. }
  31016. return result;
  31017. }
  31018. #endif
  31019. /* RaiseDoubleKeywords (used by ParseKeywordsImpl) */
  31020. static void __Pyx_RaiseDoubleKeywordsError(
  31021. const char* func_name,
  31022. PyObject* kw_name)
  31023. {
  31024. PyErr_Format(PyExc_TypeError,
  31025. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  31026. }
  31027. /* CallUnboundCMethod2 */
  31028. #if CYTHON_COMPILING_IN_CPYTHON
  31029. static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
  31030. int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
  31031. if (likely(was_initialized == 2 && cfunc->func)) {
  31032. PyObject *args[2] = {arg1, arg2};
  31033. if (cfunc->flag == METH_FASTCALL) {
  31034. return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
  31035. }
  31036. if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
  31037. return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
  31038. }
  31039. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  31040. else if (unlikely(was_initialized == 1)) {
  31041. __Pyx_CachedCFunction tmp_cfunc = {
  31042. #ifndef __cplusplus
  31043. 0
  31044. #endif
  31045. };
  31046. tmp_cfunc.type = cfunc->type;
  31047. tmp_cfunc.method_name = cfunc->method_name;
  31048. return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
  31049. }
  31050. #endif
  31051. PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
  31052. __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
  31053. return result;
  31054. }
  31055. #endif
  31056. static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
  31057. if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
  31058. #if CYTHON_COMPILING_IN_CPYTHON
  31059. if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
  31060. PyObject *result = NULL;
  31061. PyObject *args = PyTuple_New(2);
  31062. if (unlikely(!args)) return NULL;
  31063. Py_INCREF(arg1);
  31064. PyTuple_SET_ITEM(args, 0, arg1);
  31065. Py_INCREF(arg2);
  31066. PyTuple_SET_ITEM(args, 1, arg2);
  31067. if (cfunc->flag & METH_KEYWORDS)
  31068. result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
  31069. else
  31070. result = __Pyx_CallCFunction(cfunc, self, args);
  31071. Py_DECREF(args);
  31072. return result;
  31073. }
  31074. #endif
  31075. {
  31076. PyObject *args[4] = {NULL, self, arg1, arg2};
  31077. return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  31078. }
  31079. }
  31080. /* ParseKeywordsImpl (used by ParseKeywords) */
  31081. static int __Pyx_ValidateDuplicatePosArgs(
  31082. PyObject *kwds,
  31083. PyObject ** const argnames[],
  31084. PyObject ** const *first_kw_arg,
  31085. const char* function_name)
  31086. {
  31087. PyObject ** const *name = argnames;
  31088. while (name != first_kw_arg) {
  31089. PyObject *key = **name;
  31090. int found = PyDict_Contains(kwds, key);
  31091. if (unlikely(found)) {
  31092. if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key);
  31093. goto bad;
  31094. }
  31095. name++;
  31096. }
  31097. return 0;
  31098. bad:
  31099. return -1;
  31100. }
  31101. #if CYTHON_USE_UNICODE_INTERNALS
  31102. static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) {
  31103. int kind;
  31104. Py_ssize_t len = PyUnicode_GET_LENGTH(s1);
  31105. if (len != PyUnicode_GET_LENGTH(s2)) return 0;
  31106. kind = PyUnicode_KIND(s1);
  31107. if (kind != PyUnicode_KIND(s2)) return 0;
  31108. const void *data1 = PyUnicode_DATA(s1);
  31109. const void *data2 = PyUnicode_DATA(s2);
  31110. return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0);
  31111. }
  31112. #endif
  31113. static int __Pyx_MatchKeywordArg_str(
  31114. PyObject *key,
  31115. PyObject ** const argnames[],
  31116. PyObject ** const *first_kw_arg,
  31117. size_t *index_found,
  31118. const char *function_name)
  31119. {
  31120. PyObject ** const *name;
  31121. #if CYTHON_USE_UNICODE_INTERNALS
  31122. Py_hash_t key_hash = ((PyASCIIObject*)key)->hash;
  31123. if (unlikely(key_hash == -1)) {
  31124. key_hash = PyObject_Hash(key);
  31125. if (unlikely(key_hash == -1))
  31126. goto bad;
  31127. }
  31128. #endif
  31129. name = first_kw_arg;
  31130. while (*name) {
  31131. PyObject *name_str = **name;
  31132. #if CYTHON_USE_UNICODE_INTERNALS
  31133. if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) {
  31134. *index_found = (size_t) (name - argnames);
  31135. return 1;
  31136. }
  31137. #else
  31138. #if CYTHON_ASSUME_SAFE_SIZE
  31139. if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
  31140. #endif
  31141. {
  31142. int cmp = PyUnicode_Compare(name_str, key);
  31143. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  31144. if (cmp == 0) {
  31145. *index_found = (size_t) (name - argnames);
  31146. return 1;
  31147. }
  31148. }
  31149. #endif
  31150. name++;
  31151. }
  31152. name = argnames;
  31153. while (name != first_kw_arg) {
  31154. PyObject *name_str = **name;
  31155. #if CYTHON_USE_UNICODE_INTERNALS
  31156. if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) {
  31157. if (__Pyx_UnicodeKeywordsEqual(name_str, key))
  31158. goto arg_passed_twice;
  31159. }
  31160. #else
  31161. #if CYTHON_ASSUME_SAFE_SIZE
  31162. if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
  31163. #endif
  31164. {
  31165. if (unlikely(name_str == key)) goto arg_passed_twice;
  31166. int cmp = PyUnicode_Compare(name_str, key);
  31167. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  31168. if (cmp == 0) goto arg_passed_twice;
  31169. }
  31170. #endif
  31171. name++;
  31172. }
  31173. return 0;
  31174. arg_passed_twice:
  31175. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  31176. goto bad;
  31177. bad:
  31178. return -1;
  31179. }
  31180. static int __Pyx_MatchKeywordArg_nostr(
  31181. PyObject *key,
  31182. PyObject ** const argnames[],
  31183. PyObject ** const *first_kw_arg,
  31184. size_t *index_found,
  31185. const char *function_name)
  31186. {
  31187. PyObject ** const *name;
  31188. if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type;
  31189. name = first_kw_arg;
  31190. while (*name) {
  31191. int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
  31192. if (cmp == 1) {
  31193. *index_found = (size_t) (name - argnames);
  31194. return 1;
  31195. }
  31196. if (unlikely(cmp == -1)) goto bad;
  31197. name++;
  31198. }
  31199. name = argnames;
  31200. while (name != first_kw_arg) {
  31201. int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
  31202. if (unlikely(cmp != 0)) {
  31203. if (cmp == 1) goto arg_passed_twice;
  31204. else goto bad;
  31205. }
  31206. name++;
  31207. }
  31208. return 0;
  31209. arg_passed_twice:
  31210. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  31211. goto bad;
  31212. invalid_keyword_type:
  31213. PyErr_Format(PyExc_TypeError,
  31214. "%.200s() keywords must be strings", function_name);
  31215. goto bad;
  31216. bad:
  31217. return -1;
  31218. }
  31219. static CYTHON_INLINE int __Pyx_MatchKeywordArg(
  31220. PyObject *key,
  31221. PyObject ** const argnames[],
  31222. PyObject ** const *first_kw_arg,
  31223. size_t *index_found,
  31224. const char *function_name)
  31225. {
  31226. return likely(PyUnicode_CheckExact(key)) ?
  31227. __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) :
  31228. __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name);
  31229. }
  31230. static void __Pyx_RejectUnknownKeyword(
  31231. PyObject *kwds,
  31232. PyObject ** const argnames[],
  31233. PyObject ** const *first_kw_arg,
  31234. const char *function_name)
  31235. {
  31236. #if CYTHON_AVOID_BORROWED_REFS
  31237. PyObject *pos = NULL;
  31238. #else
  31239. Py_ssize_t pos = 0;
  31240. #endif
  31241. PyObject *key = NULL;
  31242. __Pyx_BEGIN_CRITICAL_SECTION(kwds);
  31243. while (
  31244. #if CYTHON_AVOID_BORROWED_REFS
  31245. __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL)
  31246. #else
  31247. PyDict_Next(kwds, &pos, &key, NULL)
  31248. #endif
  31249. ) {
  31250. PyObject** const *name = first_kw_arg;
  31251. while (*name && (**name != key)) name++;
  31252. if (!*name) {
  31253. size_t index_found = 0;
  31254. int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
  31255. if (cmp != 1) {
  31256. if (cmp == 0) {
  31257. PyErr_Format(PyExc_TypeError,
  31258. "%s() got an unexpected keyword argument '%U'",
  31259. function_name, key);
  31260. }
  31261. #if CYTHON_AVOID_BORROWED_REFS
  31262. Py_DECREF(key);
  31263. #endif
  31264. break;
  31265. }
  31266. }
  31267. #if CYTHON_AVOID_BORROWED_REFS
  31268. Py_DECREF(key);
  31269. #endif
  31270. }
  31271. __Pyx_END_CRITICAL_SECTION();
  31272. #if CYTHON_AVOID_BORROWED_REFS
  31273. Py_XDECREF(pos);
  31274. #endif
  31275. assert(PyErr_Occurred());
  31276. }
  31277. static int __Pyx_ParseKeywordDict(
  31278. PyObject *kwds,
  31279. PyObject ** const argnames[],
  31280. PyObject *values[],
  31281. Py_ssize_t num_pos_args,
  31282. Py_ssize_t num_kwargs,
  31283. const char* function_name,
  31284. int ignore_unknown_kwargs)
  31285. {
  31286. PyObject** const *name;
  31287. PyObject** const *first_kw_arg = argnames + num_pos_args;
  31288. Py_ssize_t extracted = 0;
  31289. #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
  31290. if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
  31291. #endif
  31292. name = first_kw_arg;
  31293. while (*name && num_kwargs > extracted) {
  31294. PyObject * key = **name;
  31295. PyObject *value;
  31296. int found = 0;
  31297. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  31298. found = PyDict_GetItemRef(kwds, key, &value);
  31299. #else
  31300. value = PyDict_GetItemWithError(kwds, key);
  31301. if (value) {
  31302. Py_INCREF(value);
  31303. found = 1;
  31304. } else {
  31305. if (unlikely(PyErr_Occurred())) goto bad;
  31306. }
  31307. #endif
  31308. if (found) {
  31309. if (unlikely(found < 0)) goto bad;
  31310. values[name-argnames] = value;
  31311. extracted++;
  31312. }
  31313. name++;
  31314. }
  31315. if (num_kwargs > extracted) {
  31316. if (ignore_unknown_kwargs) {
  31317. if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1))
  31318. goto bad;
  31319. } else {
  31320. __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name);
  31321. goto bad;
  31322. }
  31323. }
  31324. return 0;
  31325. bad:
  31326. return -1;
  31327. }
  31328. static int __Pyx_ParseKeywordDictToDict(
  31329. PyObject *kwds,
  31330. PyObject ** const argnames[],
  31331. PyObject *kwds2,
  31332. PyObject *values[],
  31333. Py_ssize_t num_pos_args,
  31334. const char* function_name)
  31335. {
  31336. PyObject** const *name;
  31337. PyObject** const *first_kw_arg = argnames + num_pos_args;
  31338. Py_ssize_t len;
  31339. #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
  31340. if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
  31341. #endif
  31342. if (PyDict_Update(kwds2, kwds) < 0) goto bad;
  31343. name = first_kw_arg;
  31344. while (*name) {
  31345. PyObject *key = **name;
  31346. PyObject *value;
  31347. #if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop))
  31348. int found = PyDict_Pop(kwds2, key, &value);
  31349. if (found) {
  31350. if (unlikely(found < 0)) goto bad;
  31351. values[name-argnames] = value;
  31352. }
  31353. #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  31354. int found = PyDict_GetItemRef(kwds2, key, &value);
  31355. if (found) {
  31356. if (unlikely(found < 0)) goto bad;
  31357. values[name-argnames] = value;
  31358. if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad;
  31359. }
  31360. #else
  31361. #if CYTHON_COMPILING_IN_CPYTHON
  31362. value = _PyDict_Pop(kwds2, key, kwds2);
  31363. #else
  31364. value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2);
  31365. #endif
  31366. if (value == kwds2) {
  31367. Py_DECREF(value);
  31368. } else {
  31369. if (unlikely(!value)) goto bad;
  31370. values[name-argnames] = value;
  31371. }
  31372. #endif
  31373. name++;
  31374. }
  31375. len = PyDict_Size(kwds2);
  31376. if (len > 0) {
  31377. return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name);
  31378. } else if (unlikely(len == -1)) {
  31379. goto bad;
  31380. }
  31381. return 0;
  31382. bad:
  31383. return -1;
  31384. }
  31385. static int __Pyx_ParseKeywordsTuple(
  31386. PyObject *kwds,
  31387. PyObject * const *kwvalues,
  31388. PyObject ** const argnames[],
  31389. PyObject *kwds2,
  31390. PyObject *values[],
  31391. Py_ssize_t num_pos_args,
  31392. Py_ssize_t num_kwargs,
  31393. const char* function_name,
  31394. int ignore_unknown_kwargs)
  31395. {
  31396. PyObject *key = NULL;
  31397. PyObject** const * name;
  31398. PyObject** const *first_kw_arg = argnames + num_pos_args;
  31399. for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) {
  31400. #if CYTHON_AVOID_BORROWED_REFS
  31401. key = __Pyx_PySequence_ITEM(kwds, pos);
  31402. #else
  31403. key = __Pyx_PyTuple_GET_ITEM(kwds, pos);
  31404. #endif
  31405. #if !CYTHON_ASSUME_SAFE_MACROS
  31406. if (unlikely(!key)) goto bad;
  31407. #endif
  31408. name = first_kw_arg;
  31409. while (*name && (**name != key)) name++;
  31410. if (*name) {
  31411. PyObject *value = kwvalues[pos];
  31412. values[name-argnames] = __Pyx_NewRef(value);
  31413. } else {
  31414. size_t index_found = 0;
  31415. int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
  31416. if (cmp == 1) {
  31417. PyObject *value = kwvalues[pos];
  31418. values[index_found] = __Pyx_NewRef(value);
  31419. } else {
  31420. if (unlikely(cmp == -1)) goto bad;
  31421. if (kwds2) {
  31422. PyObject *value = kwvalues[pos];
  31423. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  31424. } else if (!ignore_unknown_kwargs) {
  31425. goto invalid_keyword;
  31426. }
  31427. }
  31428. }
  31429. #if CYTHON_AVOID_BORROWED_REFS
  31430. Py_DECREF(key);
  31431. key = NULL;
  31432. #endif
  31433. }
  31434. return 0;
  31435. invalid_keyword:
  31436. PyErr_Format(PyExc_TypeError,
  31437. "%s() got an unexpected keyword argument '%U'",
  31438. function_name, key);
  31439. goto bad;
  31440. bad:
  31441. #if CYTHON_AVOID_BORROWED_REFS
  31442. Py_XDECREF(key);
  31443. #endif
  31444. return -1;
  31445. }
  31446. /* ParseKeywords */
  31447. static int __Pyx_ParseKeywords(
  31448. PyObject *kwds,
  31449. PyObject * const *kwvalues,
  31450. PyObject ** const argnames[],
  31451. PyObject *kwds2,
  31452. PyObject *values[],
  31453. Py_ssize_t num_pos_args,
  31454. Py_ssize_t num_kwargs,
  31455. const char* function_name,
  31456. int ignore_unknown_kwargs)
  31457. {
  31458. if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
  31459. return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
  31460. else if (kwds2)
  31461. return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
  31462. else
  31463. return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
  31464. }
  31465. /* RaiseArgTupleInvalid */
  31466. static void __Pyx_RaiseArgtupleInvalid(
  31467. const char* func_name,
  31468. int exact,
  31469. Py_ssize_t num_min,
  31470. Py_ssize_t num_max,
  31471. Py_ssize_t num_found)
  31472. {
  31473. Py_ssize_t num_expected;
  31474. const char *more_or_less;
  31475. if (num_found < num_min) {
  31476. num_expected = num_min;
  31477. more_or_less = "at least";
  31478. } else {
  31479. num_expected = num_max;
  31480. more_or_less = "at most";
  31481. }
  31482. if (exact) {
  31483. more_or_less = "exactly";
  31484. }
  31485. PyErr_Format(PyExc_TypeError,
  31486. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  31487. func_name, more_or_less, num_expected,
  31488. (num_expected == 1) ? "" : "s", num_found);
  31489. }
  31490. /* PyDictVersioning (used by GetModuleGlobalName) */
  31491. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  31492. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  31493. PyObject *dict = Py_TYPE(obj)->tp_dict;
  31494. return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  31495. }
  31496. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  31497. PyObject **dictptr = NULL;
  31498. Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  31499. if (offset) {
  31500. #if CYTHON_COMPILING_IN_CPYTHON
  31501. dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  31502. #else
  31503. dictptr = _PyObject_GetDictPtr(obj);
  31504. #endif
  31505. }
  31506. return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  31507. }
  31508. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  31509. PyObject *dict = Py_TYPE(obj)->tp_dict;
  31510. if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  31511. return 0;
  31512. return obj_dict_version == __Pyx_get_object_dict_version(obj);
  31513. }
  31514. #endif
  31515. /* GetModuleGlobalName */
  31516. #if CYTHON_USE_DICT_VERSIONS
  31517. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  31518. #else
  31519. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  31520. #endif
  31521. {
  31522. PyObject *result;
  31523. #if CYTHON_COMPILING_IN_LIMITED_API
  31524. if (unlikely(!__pyx_m)) {
  31525. if (!PyErr_Occurred())
  31526. PyErr_SetNone(PyExc_NameError);
  31527. return NULL;
  31528. }
  31529. result = PyObject_GetAttr(__pyx_m, name);
  31530. if (likely(result)) {
  31531. return result;
  31532. }
  31533. PyErr_Clear();
  31534. #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  31535. if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
  31536. __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
  31537. if (likely(result)) {
  31538. return result;
  31539. }
  31540. #else
  31541. result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
  31542. __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
  31543. if (likely(result)) {
  31544. return __Pyx_NewRef(result);
  31545. }
  31546. PyErr_Clear();
  31547. #endif
  31548. return __Pyx_GetBuiltinName(name);
  31549. }
  31550. /* PyLongBinop */
  31551. #if !CYTHON_COMPILING_IN_PYPY
  31552. static PyObject* __Pyx_Fallback___Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, int inplace) {
  31553. return (inplace ? PyNumber_InPlaceMultiply : PyNumber_Multiply)(op1, op2);
  31554. }
  31555. #if CYTHON_USE_PYLONG_INTERNALS
  31556. static PyObject* __Pyx_Unpacked___Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  31557. CYTHON_MAYBE_UNUSED_VAR(inplace);
  31558. CYTHON_UNUSED_VAR(zerodivision_check);
  31559. const long a = intval;
  31560. long b;
  31561. const PY_LONG_LONG lla = intval;
  31562. PY_LONG_LONG llb;
  31563. if (unlikely(__Pyx_PyLong_IsZero(op2))) {
  31564. return __Pyx_NewRef(op2);
  31565. }
  31566. const int is_positive = __Pyx_PyLong_IsPos(op2);
  31567. const digit* digits = __Pyx_PyLong_Digits(op2);
  31568. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op2);
  31569. if (likely(size == 1)) {
  31570. b = (long) digits[0];
  31571. if (!is_positive) b *= -1;
  31572. } else {
  31573. switch (size) {
  31574. case 2:
  31575. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) {
  31576. b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31577. if (!is_positive) b *= -1;
  31578. goto calculate_long;
  31579. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) {
  31580. llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  31581. if (!is_positive) llb *= -1;
  31582. goto calculate_long_long;
  31583. }
  31584. break;
  31585. case 3:
  31586. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) {
  31587. b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31588. if (!is_positive) b *= -1;
  31589. goto calculate_long;
  31590. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) {
  31591. llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  31592. if (!is_positive) llb *= -1;
  31593. goto calculate_long_long;
  31594. }
  31595. break;
  31596. case 4:
  31597. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) {
  31598. b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31599. if (!is_positive) b *= -1;
  31600. goto calculate_long;
  31601. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) {
  31602. llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  31603. if (!is_positive) llb *= -1;
  31604. goto calculate_long_long;
  31605. }
  31606. break;
  31607. }
  31608. return PyLong_Type.tp_as_number->nb_multiply(op1, op2);
  31609. }
  31610. calculate_long:
  31611. CYTHON_UNUSED_VAR(a);
  31612. CYTHON_UNUSED_VAR(b);
  31613. llb = b;
  31614. goto calculate_long_long;
  31615. calculate_long_long:
  31616. {
  31617. PY_LONG_LONG llx;
  31618. llx = lla * llb;
  31619. return PyLong_FromLongLong(llx);
  31620. }
  31621. }
  31622. #endif
  31623. static PyObject* __Pyx_Float___Pyx_PyLong_MultiplyCObj(PyObject *float_val, long intval, int zerodivision_check) {
  31624. CYTHON_UNUSED_VAR(zerodivision_check);
  31625. const long a = intval;
  31626. double b = __Pyx_PyFloat_AS_DOUBLE(float_val);
  31627. double result;
  31628. result = ((double)a) * (double)b;
  31629. return PyFloat_FromDouble(result);
  31630. }
  31631. static CYTHON_INLINE PyObject* __Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  31632. CYTHON_MAYBE_UNUSED_VAR(intval);
  31633. CYTHON_UNUSED_VAR(zerodivision_check);
  31634. #if CYTHON_USE_PYLONG_INTERNALS
  31635. if (likely(PyLong_CheckExact(op2))) {
  31636. return __Pyx_Unpacked___Pyx_PyLong_MultiplyCObj(op1, op2, intval, inplace, zerodivision_check);
  31637. }
  31638. #endif
  31639. if (PyFloat_CheckExact(op2)) {
  31640. return __Pyx_Float___Pyx_PyLong_MultiplyCObj(op2, intval, zerodivision_check);
  31641. }
  31642. return __Pyx_Fallback___Pyx_PyLong_MultiplyCObj(op1, op2, inplace);
  31643. }
  31644. #endif
  31645. /* RaiseTooManyValuesToUnpack */
  31646. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  31647. PyErr_Format(PyExc_ValueError,
  31648. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  31649. }
  31650. /* RaiseNeedMoreValuesToUnpack */
  31651. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  31652. PyErr_Format(PyExc_ValueError,
  31653. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  31654. index, (index == 1) ? "" : "s");
  31655. }
  31656. /* IterFinish */
  31657. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  31658. PyObject* exc_type;
  31659. __Pyx_PyThreadState_declare
  31660. __Pyx_PyThreadState_assign
  31661. exc_type = __Pyx_PyErr_CurrentExceptionType();
  31662. if (unlikely(exc_type)) {
  31663. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
  31664. return -1;
  31665. __Pyx_PyErr_Clear();
  31666. return 0;
  31667. }
  31668. return 0;
  31669. }
  31670. /* UnpackItemEndCheck */
  31671. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  31672. if (unlikely(retval)) {
  31673. Py_DECREF(retval);
  31674. __Pyx_RaiseTooManyValuesError(expected);
  31675. return -1;
  31676. }
  31677. return __Pyx_IterFinish();
  31678. }
  31679. /* PyLongBinop */
  31680. #if !CYTHON_COMPILING_IN_PYPY
  31681. static PyObject* __Pyx_Fallback___Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, int inplace) {
  31682. return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
  31683. }
  31684. #if CYTHON_USE_PYLONG_INTERNALS
  31685. static PyObject* __Pyx_Unpacked___Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  31686. CYTHON_MAYBE_UNUSED_VAR(inplace);
  31687. CYTHON_UNUSED_VAR(zerodivision_check);
  31688. const long b = intval;
  31689. long a;
  31690. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  31691. }
  31692. const int is_positive = __Pyx_PyLong_IsPos(op1);
  31693. const digit* digits = __Pyx_PyLong_Digits(op1);
  31694. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  31695. if (likely(size == 1)) {
  31696. a = (long) digits[0];
  31697. if (!is_positive) a *= -1;
  31698. } else {
  31699. switch (size) {
  31700. case 2:
  31701. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
  31702. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31703. if (!is_positive) a *= -1;
  31704. goto calculate_long;
  31705. }
  31706. break;
  31707. case 3:
  31708. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
  31709. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31710. if (!is_positive) a *= -1;
  31711. goto calculate_long;
  31712. }
  31713. break;
  31714. case 4:
  31715. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
  31716. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31717. if (!is_positive) a *= -1;
  31718. goto calculate_long;
  31719. }
  31720. break;
  31721. }
  31722. return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
  31723. }
  31724. calculate_long:
  31725. if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
  31726. || __Pyx_PyLong_DigitCount(op1) <= 52 / PyLong_SHIFT) {
  31727. return PyFloat_FromDouble((double)a / (double)b);
  31728. }
  31729. return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
  31730. }
  31731. #endif
  31732. static PyObject* __Pyx_Float___Pyx_PyLong_TrueDivideObjC(PyObject *float_val, long intval, int zerodivision_check) {
  31733. CYTHON_UNUSED_VAR(zerodivision_check);
  31734. const long b = intval;
  31735. double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
  31736. double result;
  31737. result = ((double)a) / (double)b;
  31738. return PyFloat_FromDouble(result);
  31739. }
  31740. static CYTHON_INLINE PyObject* __Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  31741. CYTHON_MAYBE_UNUSED_VAR(intval);
  31742. CYTHON_UNUSED_VAR(zerodivision_check);
  31743. #if CYTHON_USE_PYLONG_INTERNALS
  31744. if (likely(PyLong_CheckExact(op1))) {
  31745. return __Pyx_Unpacked___Pyx_PyLong_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check);
  31746. }
  31747. #endif
  31748. if (PyFloat_CheckExact(op1)) {
  31749. return __Pyx_Float___Pyx_PyLong_TrueDivideObjC(op1, intval, zerodivision_check);
  31750. }
  31751. return __Pyx_Fallback___Pyx_PyLong_TrueDivideObjC(op1, op2, inplace);
  31752. }
  31753. #endif
  31754. /* PyLongCompare */
  31755. static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
  31756. CYTHON_MAYBE_UNUSED_VAR(intval);
  31757. CYTHON_UNUSED_VAR(inplace);
  31758. if (op1 == op2) {
  31759. return 0;
  31760. }
  31761. #if CYTHON_USE_PYLONG_INTERNALS
  31762. if (likely(PyLong_CheckExact(op1))) {
  31763. int unequal;
  31764. unsigned long uintval;
  31765. Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  31766. const digit* digits = __Pyx_PyLong_Digits(op1);
  31767. if (intval == 0) {
  31768. return (__Pyx_PyLong_IsZero(op1) != 1);
  31769. } else if (intval < 0) {
  31770. if (__Pyx_PyLong_IsNonNeg(op1))
  31771. return 1;
  31772. intval = -intval;
  31773. } else {
  31774. if (__Pyx_PyLong_IsNeg(op1))
  31775. return 1;
  31776. }
  31777. uintval = (unsigned long) intval;
  31778. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  31779. if (uintval >> (PyLong_SHIFT * 4)) {
  31780. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31781. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  31782. } else
  31783. #endif
  31784. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  31785. if (uintval >> (PyLong_SHIFT * 3)) {
  31786. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31787. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  31788. } else
  31789. #endif
  31790. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  31791. if (uintval >> (PyLong_SHIFT * 2)) {
  31792. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31793. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  31794. } else
  31795. #endif
  31796. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  31797. if (uintval >> (PyLong_SHIFT * 1)) {
  31798. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31799. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  31800. } else
  31801. #endif
  31802. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  31803. return (unequal != 0);
  31804. }
  31805. #endif
  31806. if (PyFloat_CheckExact(op1)) {
  31807. const long b = intval;
  31808. double a = __Pyx_PyFloat_AS_DOUBLE(op1);
  31809. return ((double)a != (double)b);
  31810. }
  31811. return __Pyx_PyObject_IsTrueAndDecref(
  31812. PyObject_RichCompare(op1, op2, Py_NE));
  31813. }
  31814. /* GetItemInt */
  31815. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  31816. PyObject *r;
  31817. if (unlikely(!j)) return NULL;
  31818. r = PyObject_GetItem(o, j);
  31819. Py_DECREF(j);
  31820. return r;
  31821. }
  31822. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  31823. int wraparound, int boundscheck, int unsafe_shared) {
  31824. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  31825. #if CYTHON_ASSUME_SAFE_SIZE
  31826. Py_ssize_t wrapped_i = i;
  31827. if (wraparound & unlikely(i < 0)) {
  31828. wrapped_i += PyList_GET_SIZE(o);
  31829. }
  31830. if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
  31831. return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
  31832. } else
  31833. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  31834. return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
  31835. }
  31836. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  31837. #else
  31838. (void)wraparound;
  31839. (void)boundscheck;
  31840. return PySequence_GetItem(o, i);
  31841. #endif
  31842. }
  31843. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  31844. int wraparound, int boundscheck, int unsafe_shared) {
  31845. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  31846. #if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  31847. Py_ssize_t wrapped_i = i;
  31848. if (wraparound & unlikely(i < 0)) {
  31849. wrapped_i += PyTuple_GET_SIZE(o);
  31850. }
  31851. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  31852. return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
  31853. }
  31854. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  31855. #else
  31856. (void)wraparound;
  31857. (void)boundscheck;
  31858. return PySequence_GetItem(o, i);
  31859. #endif
  31860. }
  31861. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  31862. int wraparound, int boundscheck, int unsafe_shared) {
  31863. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  31864. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  31865. if (is_list || PyList_CheckExact(o)) {
  31866. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  31867. if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
  31868. return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
  31869. } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  31870. return __Pyx_NewRef(PyList_GET_ITEM(o, n));
  31871. }
  31872. } else
  31873. #if !CYTHON_AVOID_BORROWED_REFS
  31874. if (PyTuple_CheckExact(o)) {
  31875. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  31876. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  31877. return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
  31878. }
  31879. } else
  31880. #endif
  31881. #endif
  31882. #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
  31883. {
  31884. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  31885. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  31886. if (!is_list && mm && mm->mp_subscript) {
  31887. PyObject *r, *key = PyLong_FromSsize_t(i);
  31888. if (unlikely(!key)) return NULL;
  31889. r = mm->mp_subscript(o, key);
  31890. Py_DECREF(key);
  31891. return r;
  31892. }
  31893. if (is_list || likely(sm && sm->sq_item)) {
  31894. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  31895. Py_ssize_t l = sm->sq_length(o);
  31896. if (likely(l >= 0)) {
  31897. i += l;
  31898. } else {
  31899. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  31900. return NULL;
  31901. PyErr_Clear();
  31902. }
  31903. }
  31904. return sm->sq_item(o, i);
  31905. }
  31906. }
  31907. #else
  31908. if (is_list || !PyMapping_Check(o)) {
  31909. return PySequence_GetItem(o, i);
  31910. }
  31911. #endif
  31912. (void)wraparound;
  31913. (void)boundscheck;
  31914. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  31915. }
  31916. /* ObjectGetItem */
  31917. #if CYTHON_USE_TYPE_SLOTS
  31918. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
  31919. PyObject *runerr = NULL;
  31920. Py_ssize_t key_value;
  31921. key_value = __Pyx_PyIndex_AsSsize_t(index);
  31922. if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  31923. return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1);
  31924. }
  31925. if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  31926. __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index));
  31927. PyErr_Clear();
  31928. PyErr_Format(PyExc_IndexError,
  31929. "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
  31930. __Pyx_DECREF_TypeName(index_type_name);
  31931. }
  31932. return NULL;
  31933. }
  31934. static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
  31935. __Pyx_TypeName obj_type_name;
  31936. if (likely(PyType_Check(obj))) {
  31937. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem);
  31938. if (!meth) {
  31939. PyErr_Clear();
  31940. } else {
  31941. PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
  31942. Py_DECREF(meth);
  31943. return result;
  31944. }
  31945. }
  31946. obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  31947. PyErr_Format(PyExc_TypeError,
  31948. "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
  31949. __Pyx_DECREF_TypeName(obj_type_name);
  31950. return NULL;
  31951. }
  31952. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
  31953. PyTypeObject *tp = Py_TYPE(obj);
  31954. PyMappingMethods *mm = tp->tp_as_mapping;
  31955. PySequenceMethods *sm = tp->tp_as_sequence;
  31956. if (likely(mm && mm->mp_subscript)) {
  31957. return mm->mp_subscript(obj, key);
  31958. }
  31959. if (likely(sm && sm->sq_item)) {
  31960. return __Pyx_PyObject_GetIndex(obj, key);
  31961. }
  31962. return __Pyx_PyObject_GetItem_Slow(obj, key);
  31963. }
  31964. #endif
  31965. /* PyLongCompare */
  31966. static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
  31967. CYTHON_MAYBE_UNUSED_VAR(intval);
  31968. CYTHON_UNUSED_VAR(inplace);
  31969. if (op1 == op2) {
  31970. return 1;
  31971. }
  31972. #if CYTHON_USE_PYLONG_INTERNALS
  31973. if (likely(PyLong_CheckExact(op1))) {
  31974. int unequal;
  31975. unsigned long uintval;
  31976. Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  31977. const digit* digits = __Pyx_PyLong_Digits(op1);
  31978. if (intval == 0) {
  31979. return (__Pyx_PyLong_IsZero(op1) == 1);
  31980. } else if (intval < 0) {
  31981. if (__Pyx_PyLong_IsNonNeg(op1))
  31982. return 0;
  31983. intval = -intval;
  31984. } else {
  31985. if (__Pyx_PyLong_IsNeg(op1))
  31986. return 0;
  31987. }
  31988. uintval = (unsigned long) intval;
  31989. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  31990. if (uintval >> (PyLong_SHIFT * 4)) {
  31991. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31992. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  31993. } else
  31994. #endif
  31995. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  31996. if (uintval >> (PyLong_SHIFT * 3)) {
  31997. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31998. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  31999. } else
  32000. #endif
  32001. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  32002. if (uintval >> (PyLong_SHIFT * 2)) {
  32003. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  32004. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  32005. } else
  32006. #endif
  32007. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  32008. if (uintval >> (PyLong_SHIFT * 1)) {
  32009. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  32010. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  32011. } else
  32012. #endif
  32013. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  32014. return (unequal == 0);
  32015. }
  32016. #endif
  32017. if (PyFloat_CheckExact(op1)) {
  32018. const long b = intval;
  32019. double a = __Pyx_PyFloat_AS_DOUBLE(op1);
  32020. return ((double)a == (double)b);
  32021. }
  32022. return __Pyx_PyObject_IsTrueAndDecref(
  32023. PyObject_RichCompare(op1, op2, Py_EQ));
  32024. }
  32025. /* RaiseUnboundLocalError */
  32026. static void __Pyx_RaiseUnboundLocalError(const char *varname) {
  32027. PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
  32028. }
  32029. /* GetException (used by pep479) */
  32030. #if CYTHON_FAST_THREAD_STATE
  32031. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  32032. #else
  32033. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  32034. #endif
  32035. {
  32036. PyObject *local_type = NULL, *local_value, *local_tb = NULL;
  32037. #if CYTHON_FAST_THREAD_STATE
  32038. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32039. #if PY_VERSION_HEX >= 0x030C0000
  32040. local_value = tstate->current_exception;
  32041. tstate->current_exception = 0;
  32042. #else
  32043. local_type = tstate->curexc_type;
  32044. local_value = tstate->curexc_value;
  32045. local_tb = tstate->curexc_traceback;
  32046. tstate->curexc_type = 0;
  32047. tstate->curexc_value = 0;
  32048. tstate->curexc_traceback = 0;
  32049. #endif
  32050. #elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
  32051. local_value = PyErr_GetRaisedException();
  32052. #else
  32053. PyErr_Fetch(&local_type, &local_value, &local_tb);
  32054. #endif
  32055. #if __PYX_LIMITED_VERSION_HEX > 0x030C0000
  32056. if (likely(local_value)) {
  32057. local_type = (PyObject*) Py_TYPE(local_value);
  32058. Py_INCREF(local_type);
  32059. local_tb = PyException_GetTraceback(local_value);
  32060. }
  32061. #else
  32062. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  32063. #if CYTHON_FAST_THREAD_STATE
  32064. if (unlikely(tstate->curexc_type))
  32065. #else
  32066. if (unlikely(PyErr_Occurred()))
  32067. #endif
  32068. goto bad;
  32069. if (local_tb) {
  32070. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  32071. goto bad;
  32072. }
  32073. #endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
  32074. Py_XINCREF(local_tb);
  32075. Py_XINCREF(local_type);
  32076. Py_XINCREF(local_value);
  32077. *type = local_type;
  32078. *value = local_value;
  32079. *tb = local_tb;
  32080. #if CYTHON_FAST_THREAD_STATE
  32081. #if CYTHON_USE_EXC_INFO_STACK
  32082. {
  32083. _PyErr_StackItem *exc_info = tstate->exc_info;
  32084. #if PY_VERSION_HEX >= 0x030B00a4
  32085. tmp_value = exc_info->exc_value;
  32086. exc_info->exc_value = local_value;
  32087. tmp_type = NULL;
  32088. tmp_tb = NULL;
  32089. Py_XDECREF(local_type);
  32090. Py_XDECREF(local_tb);
  32091. #else
  32092. tmp_type = exc_info->exc_type;
  32093. tmp_value = exc_info->exc_value;
  32094. tmp_tb = exc_info->exc_traceback;
  32095. exc_info->exc_type = local_type;
  32096. exc_info->exc_value = local_value;
  32097. exc_info->exc_traceback = local_tb;
  32098. #endif
  32099. }
  32100. #else
  32101. tmp_type = tstate->exc_type;
  32102. tmp_value = tstate->exc_value;
  32103. tmp_tb = tstate->exc_traceback;
  32104. tstate->exc_type = local_type;
  32105. tstate->exc_value = local_value;
  32106. tstate->exc_traceback = local_tb;
  32107. #endif
  32108. Py_XDECREF(tmp_type);
  32109. Py_XDECREF(tmp_value);
  32110. Py_XDECREF(tmp_tb);
  32111. #elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  32112. PyErr_SetHandledException(local_value);
  32113. Py_XDECREF(local_value);
  32114. Py_XDECREF(local_type);
  32115. Py_XDECREF(local_tb);
  32116. #else
  32117. PyErr_SetExcInfo(local_type, local_value, local_tb);
  32118. #endif
  32119. return 0;
  32120. #if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
  32121. bad:
  32122. *type = 0;
  32123. *value = 0;
  32124. *tb = 0;
  32125. Py_XDECREF(local_type);
  32126. Py_XDECREF(local_value);
  32127. Py_XDECREF(local_tb);
  32128. return -1;
  32129. #endif
  32130. }
  32131. /* pep479 */
  32132. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
  32133. PyObject *exc, *val, *tb, *cur_exc, *new_exc;
  32134. __Pyx_PyThreadState_declare
  32135. int is_async_stopiteration = 0;
  32136. CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
  32137. __Pyx_PyThreadState_assign
  32138. cur_exc = __Pyx_PyErr_CurrentExceptionType();
  32139. if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
  32140. if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
  32141. is_async_stopiteration = 1;
  32142. } else {
  32143. return;
  32144. }
  32145. }
  32146. __Pyx_GetException(&exc, &val, &tb);
  32147. Py_XDECREF(exc);
  32148. Py_XDECREF(tb);
  32149. new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
  32150. is_async_stopiteration ? "async generator raised StopAsyncIteration" :
  32151. in_async_gen ? "async generator raised StopIteration" :
  32152. "generator raised StopIteration");
  32153. if (!new_exc) {
  32154. Py_XDECREF(val);
  32155. return;
  32156. }
  32157. PyException_SetCause(new_exc, val); // steals ref to val
  32158. PyErr_SetObject(PyExc_RuntimeError, new_exc);
  32159. }
  32160. /* SliceObject */
  32161. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
  32162. Py_ssize_t cstart, Py_ssize_t cstop,
  32163. PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
  32164. int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
  32165. __Pyx_TypeName obj_type_name;
  32166. #if CYTHON_USE_TYPE_SLOTS
  32167. PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
  32168. if (likely(mp && mp->mp_subscript))
  32169. #endif
  32170. {
  32171. PyObject* result;
  32172. PyObject *py_slice, *py_start, *py_stop;
  32173. if (_py_slice) {
  32174. py_slice = *_py_slice;
  32175. } else {
  32176. PyObject* owned_start = NULL;
  32177. PyObject* owned_stop = NULL;
  32178. if (_py_start) {
  32179. py_start = *_py_start;
  32180. } else {
  32181. if (has_cstart) {
  32182. owned_start = py_start = PyLong_FromSsize_t(cstart);
  32183. if (unlikely(!py_start)) goto bad;
  32184. } else
  32185. py_start = Py_None;
  32186. }
  32187. if (_py_stop) {
  32188. py_stop = *_py_stop;
  32189. } else {
  32190. if (has_cstop) {
  32191. owned_stop = py_stop = PyLong_FromSsize_t(cstop);
  32192. if (unlikely(!py_stop)) {
  32193. Py_XDECREF(owned_start);
  32194. goto bad;
  32195. }
  32196. } else
  32197. py_stop = Py_None;
  32198. }
  32199. py_slice = PySlice_New(py_start, py_stop, Py_None);
  32200. Py_XDECREF(owned_start);
  32201. Py_XDECREF(owned_stop);
  32202. if (unlikely(!py_slice)) goto bad;
  32203. }
  32204. #if CYTHON_USE_TYPE_SLOTS
  32205. result = mp->mp_subscript(obj, py_slice);
  32206. #else
  32207. result = PyObject_GetItem(obj, py_slice);
  32208. #endif
  32209. if (!_py_slice) {
  32210. Py_DECREF(py_slice);
  32211. }
  32212. return result;
  32213. }
  32214. obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  32215. PyErr_Format(PyExc_TypeError,
  32216. "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
  32217. __Pyx_DECREF_TypeName(obj_type_name);
  32218. bad:
  32219. return NULL;
  32220. }
  32221. /* SetItemInt */
  32222. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
  32223. int r;
  32224. if (unlikely(!j)) return -1;
  32225. r = PyObject_SetItem(o, j, v);
  32226. Py_DECREF(j);
  32227. return r;
  32228. }
  32229. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
  32230. int wraparound, int boundscheck, int unsafe_shared) {
  32231. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  32232. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
  32233. if (is_list || PyList_CheckExact(o)) {
  32234. Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
  32235. if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) {
  32236. Py_INCREF(v);
  32237. return PyList_SetItem(o, n, v);
  32238. } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
  32239. PyObject* old;
  32240. Py_INCREF(v);
  32241. old = PyList_GET_ITEM(o, n);
  32242. PyList_SET_ITEM(o, n, v);
  32243. Py_DECREF(old);
  32244. return 0;
  32245. }
  32246. } else
  32247. #endif
  32248. #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
  32249. {
  32250. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  32251. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  32252. if (!is_list && mm && mm->mp_ass_subscript) {
  32253. int r;
  32254. PyObject *key = PyLong_FromSsize_t(i);
  32255. if (unlikely(!key)) return -1;
  32256. r = mm->mp_ass_subscript(o, key, v);
  32257. Py_DECREF(key);
  32258. return r;
  32259. }
  32260. if (is_list || likely(sm && sm->sq_ass_item)) {
  32261. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  32262. Py_ssize_t l = sm->sq_length(o);
  32263. if (likely(l >= 0)) {
  32264. i += l;
  32265. } else {
  32266. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  32267. return -1;
  32268. PyErr_Clear();
  32269. }
  32270. }
  32271. return sm->sq_ass_item(o, i, v);
  32272. }
  32273. }
  32274. #else
  32275. if (is_list || !PyMapping_Check(o)) {
  32276. return PySequence_SetItem(o, i, v);
  32277. }
  32278. #endif
  32279. (void)wraparound;
  32280. (void)boundscheck;
  32281. return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
  32282. }
  32283. /* CoroutineSetYieldFrom (used by GeneratorYieldFrom) */
  32284. static void
  32285. __Pyx_Coroutine_Set_Owned_Yield_From(__pyx_CoroutineObject *gen, PyObject *yf) {
  32286. assert (!gen->yieldfrom);
  32287. #if CYTHON_USE_AM_SEND
  32288. assert (!gen->yieldfrom_am_send);
  32289. #if PY_VERSION_HEX < 0x030A00F0
  32290. if (__Pyx_PyType_HasFeature(Py_TYPE(yf), __Pyx_TPFLAGS_HAVE_AM_SEND))
  32291. #endif
  32292. {
  32293. __Pyx_pyiter_sendfunc am_send;
  32294. #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
  32295. am_send = __Pyx_PyObject_TryGetSubSlot(yf, tp_as_async, am_send, __Pyx_pyiter_sendfunc);
  32296. #else
  32297. __Pyx_PyAsyncMethodsStruct* tp_as_async = (__Pyx_PyAsyncMethodsStruct*) Py_TYPE(yf)->tp_as_async;
  32298. am_send = tp_as_async ? tp_as_async->am_send : NULL;
  32299. #endif
  32300. if (likely(am_send)) {
  32301. gen->yieldfrom_am_send = am_send;
  32302. }
  32303. }
  32304. #endif
  32305. gen->yieldfrom = yf;
  32306. }
  32307. /* dict_setdefault (used by FetchCommonType) */
  32308. static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
  32309. PyObject* value;
  32310. #if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4)
  32311. PyDict_SetDefaultRef(d, key, default_value, &value);
  32312. #elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
  32313. PyObject *args[] = {d, key, default_value};
  32314. value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  32315. #elif CYTHON_COMPILING_IN_LIMITED_API
  32316. value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
  32317. #else
  32318. value = PyDict_SetDefault(d, key, default_value);
  32319. if (unlikely(!value)) return NULL;
  32320. Py_INCREF(value);
  32321. #endif
  32322. return value;
  32323. }
  32324. /* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
  32325. #if CYTHON_COMPILING_IN_LIMITED_API
  32326. static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
  32327. PyObject *tp_dictoffset_o;
  32328. Py_ssize_t tp_dictoffset;
  32329. tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
  32330. if (unlikely(!tp_dictoffset_o)) return -1;
  32331. tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
  32332. Py_DECREF(tp_dictoffset_o);
  32333. if (unlikely(tp_dictoffset == 0)) {
  32334. PyErr_SetString(
  32335. PyExc_TypeError,
  32336. "'type' doesn't have a dictoffset");
  32337. return -1;
  32338. } else if (unlikely(tp_dictoffset < 0)) {
  32339. PyErr_SetString(
  32340. PyExc_TypeError,
  32341. "'type' has an unexpected negative dictoffset. "
  32342. "Please report this as Cython bug");
  32343. return -1;
  32344. }
  32345. return tp_dictoffset;
  32346. }
  32347. static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
  32348. static Py_ssize_t tp_dictoffset = 0;
  32349. if (unlikely(tp_dictoffset == 0)) {
  32350. tp_dictoffset = __Pyx_GetTypeDictOffset();
  32351. if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
  32352. tp_dictoffset = 0; // try again next time?
  32353. return NULL;
  32354. }
  32355. }
  32356. return *(PyObject**)((char*)tp + tp_dictoffset);
  32357. }
  32358. #endif
  32359. /* SetItemOnTypeDict (used by FixUpExtensionType) */
  32360. static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
  32361. int result;
  32362. PyObject *tp_dict;
  32363. #if CYTHON_COMPILING_IN_LIMITED_API
  32364. tp_dict = __Pyx_GetTypeDict(tp);
  32365. if (unlikely(!tp_dict)) return -1;
  32366. #else
  32367. tp_dict = tp->tp_dict;
  32368. #endif
  32369. result = PyDict_SetItem(tp_dict, k, v);
  32370. if (likely(!result)) {
  32371. PyType_Modified(tp);
  32372. if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
  32373. PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL);
  32374. if (!setNameResult) return -1;
  32375. Py_DECREF(setNameResult);
  32376. }
  32377. }
  32378. return result;
  32379. }
  32380. /* FixUpExtensionType (used by FetchCommonType) */
  32381. static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
  32382. #if __PYX_LIMITED_VERSION_HEX > 0x030900B1
  32383. CYTHON_UNUSED_VAR(spec);
  32384. CYTHON_UNUSED_VAR(type);
  32385. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  32386. #else
  32387. const PyType_Slot *slot = spec->slots;
  32388. int changed = 0;
  32389. #if !CYTHON_COMPILING_IN_LIMITED_API
  32390. while (slot && slot->slot && slot->slot != Py_tp_members)
  32391. slot++;
  32392. if (slot && slot->slot == Py_tp_members) {
  32393. #if !CYTHON_COMPILING_IN_CPYTHON
  32394. const
  32395. #endif // !CYTHON_COMPILING_IN_CPYTHON)
  32396. PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
  32397. while (memb && memb->name) {
  32398. if (memb->name[0] == '_' && memb->name[1] == '_') {
  32399. if (strcmp(memb->name, "__weaklistoffset__") == 0) {
  32400. assert(memb->type == T_PYSSIZET);
  32401. assert(memb->flags == READONLY);
  32402. type->tp_weaklistoffset = memb->offset;
  32403. changed = 1;
  32404. }
  32405. else if (strcmp(memb->name, "__dictoffset__") == 0) {
  32406. assert(memb->type == T_PYSSIZET);
  32407. assert(memb->flags == READONLY);
  32408. type->tp_dictoffset = memb->offset;
  32409. changed = 1;
  32410. }
  32411. #if CYTHON_METH_FASTCALL
  32412. else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
  32413. assert(memb->type == T_PYSSIZET);
  32414. assert(memb->flags == READONLY);
  32415. type->tp_vectorcall_offset = memb->offset;
  32416. changed = 1;
  32417. }
  32418. #endif // CYTHON_METH_FASTCALL
  32419. #if !CYTHON_COMPILING_IN_PYPY
  32420. else if (strcmp(memb->name, "__module__") == 0) {
  32421. PyObject *descr;
  32422. assert(memb->type == T_OBJECT);
  32423. assert(memb->flags == 0 || memb->flags == READONLY);
  32424. descr = PyDescr_NewMember(type, memb);
  32425. if (unlikely(!descr))
  32426. return -1;
  32427. int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
  32428. Py_DECREF(descr);
  32429. if (unlikely(set_item_result < 0)) {
  32430. return -1;
  32431. }
  32432. changed = 1;
  32433. }
  32434. #endif // !CYTHON_COMPILING_IN_PYPY
  32435. }
  32436. memb++;
  32437. }
  32438. }
  32439. #endif // !CYTHON_COMPILING_IN_LIMITED_API
  32440. #if !CYTHON_COMPILING_IN_PYPY
  32441. slot = spec->slots;
  32442. while (slot && slot->slot && slot->slot != Py_tp_getset)
  32443. slot++;
  32444. if (slot && slot->slot == Py_tp_getset) {
  32445. PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
  32446. while (getset && getset->name) {
  32447. if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
  32448. PyObject *descr = PyDescr_NewGetSet(type, getset);
  32449. if (unlikely(!descr))
  32450. return -1;
  32451. #if CYTHON_COMPILING_IN_LIMITED_API
  32452. PyObject *pyname = PyUnicode_FromString(getset->name);
  32453. if (unlikely(!pyname)) {
  32454. Py_DECREF(descr);
  32455. return -1;
  32456. }
  32457. int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
  32458. Py_DECREF(pyname);
  32459. #else
  32460. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  32461. int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
  32462. #endif
  32463. Py_DECREF(descr);
  32464. if (unlikely(set_item_result < 0)) {
  32465. return -1;
  32466. }
  32467. changed = 1;
  32468. }
  32469. ++getset;
  32470. }
  32471. }
  32472. #else
  32473. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  32474. #endif // !CYTHON_COMPILING_IN_PYPY
  32475. if (changed)
  32476. PyType_Modified(type);
  32477. #endif // PY_VERSION_HEX > 0x030900B1
  32478. return 0;
  32479. }
  32480. /* AddModuleRef (used by FetchSharedCythonModule) */
  32481. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  32482. static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
  32483. PyObject *module_dict = PyImport_GetModuleDict();
  32484. PyObject *m;
  32485. if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
  32486. return NULL;
  32487. }
  32488. if (m != NULL && PyModule_Check(m)) {
  32489. return m;
  32490. }
  32491. Py_XDECREF(m);
  32492. m = PyModule_NewObject(name);
  32493. if (m == NULL)
  32494. return NULL;
  32495. if (PyDict_CheckExact(module_dict)) {
  32496. PyObject *new_m;
  32497. (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
  32498. Py_DECREF(m);
  32499. return new_m;
  32500. } else {
  32501. if (PyObject_SetItem(module_dict, name, m) != 0) {
  32502. Py_DECREF(m);
  32503. return NULL;
  32504. }
  32505. return m;
  32506. }
  32507. }
  32508. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
  32509. PyObject *py_name = PyUnicode_FromString(name);
  32510. if (!py_name) return NULL;
  32511. PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
  32512. Py_DECREF(py_name);
  32513. return module;
  32514. }
  32515. #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  32516. #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  32517. #else
  32518. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
  32519. PyObject *module = PyImport_AddModule(name);
  32520. Py_XINCREF(module);
  32521. return module;
  32522. }
  32523. #endif
  32524. /* FetchSharedCythonModule (used by FetchCommonType) */
  32525. static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
  32526. return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
  32527. }
  32528. /* FetchCommonType (used by CommonTypesMetaclass) */
  32529. #if __PYX_LIMITED_VERSION_HEX < 0x030C0000
  32530. static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
  32531. PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
  32532. if (result && metaclass) {
  32533. PyObject *old_tp = (PyObject*)Py_TYPE(result);
  32534. Py_INCREF((PyObject*)metaclass);
  32535. #if __PYX_LIMITED_VERSION_HEX >= 0x03090000
  32536. Py_SET_TYPE(result, metaclass);
  32537. #else
  32538. result->ob_type = metaclass;
  32539. #endif
  32540. Py_DECREF(old_tp);
  32541. }
  32542. return result;
  32543. }
  32544. #else
  32545. #define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
  32546. #endif
  32547. static int __Pyx_VerifyCachedType(PyObject *cached_type,
  32548. const char *name,
  32549. Py_ssize_t expected_basicsize) {
  32550. Py_ssize_t basicsize;
  32551. if (!PyType_Check(cached_type)) {
  32552. PyErr_Format(PyExc_TypeError,
  32553. "Shared Cython type %.200s is not a type object", name);
  32554. return -1;
  32555. }
  32556. if (expected_basicsize == 0) {
  32557. return 0; // size is inherited, nothing useful to check
  32558. }
  32559. #if CYTHON_COMPILING_IN_LIMITED_API
  32560. PyObject *py_basicsize;
  32561. py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
  32562. if (unlikely(!py_basicsize)) return -1;
  32563. basicsize = PyLong_AsSsize_t(py_basicsize);
  32564. Py_DECREF(py_basicsize);
  32565. py_basicsize = NULL;
  32566. if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
  32567. #else
  32568. basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
  32569. #endif
  32570. if (basicsize != expected_basicsize) {
  32571. PyErr_Format(PyExc_TypeError,
  32572. "Shared Cython type %.200s has the wrong size, try recompiling",
  32573. name);
  32574. return -1;
  32575. }
  32576. return 0;
  32577. }
  32578. static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
  32579. PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
  32580. int get_item_ref_result;
  32581. const char* object_name = strrchr(spec->name, '.');
  32582. object_name = object_name ? object_name+1 : spec->name;
  32583. py_object_name = PyUnicode_FromString(object_name);
  32584. if (!py_object_name) return NULL;
  32585. abi_module = __Pyx_FetchSharedCythonABIModule();
  32586. if (!abi_module) goto done;
  32587. abi_module_dict = PyModule_GetDict(abi_module);
  32588. if (!abi_module_dict) goto done;
  32589. get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
  32590. if (get_item_ref_result == 1) {
  32591. if (__Pyx_VerifyCachedType(
  32592. cached_type,
  32593. object_name,
  32594. spec->basicsize) < 0) {
  32595. goto bad;
  32596. }
  32597. goto done;
  32598. } else if (unlikely(get_item_ref_result == -1)) {
  32599. goto bad;
  32600. }
  32601. cached_type = __Pyx_PyType_FromMetaclass(
  32602. metaclass,
  32603. CYTHON_USE_MODULE_STATE ? module : abi_module,
  32604. spec, bases);
  32605. if (unlikely(!cached_type)) goto bad;
  32606. if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
  32607. new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
  32608. if (unlikely(new_cached_type != cached_type)) {
  32609. if (unlikely(!new_cached_type)) goto bad;
  32610. Py_DECREF(cached_type);
  32611. cached_type = new_cached_type;
  32612. if (__Pyx_VerifyCachedType(
  32613. cached_type,
  32614. object_name,
  32615. spec->basicsize) < 0) {
  32616. goto bad;
  32617. }
  32618. goto done;
  32619. } else {
  32620. Py_DECREF(new_cached_type);
  32621. }
  32622. done:
  32623. Py_XDECREF(abi_module);
  32624. Py_DECREF(py_object_name);
  32625. assert(cached_type == NULL || PyType_Check(cached_type));
  32626. return (PyTypeObject *) cached_type;
  32627. bad:
  32628. Py_XDECREF(cached_type);
  32629. cached_type = NULL;
  32630. goto done;
  32631. }
  32632. /* CommonTypesMetaclass (used by CoroutineBase) */
  32633. static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
  32634. return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
  32635. }
  32636. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  32637. static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
  32638. PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
  32639. return NULL;
  32640. }
  32641. static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
  32642. PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
  32643. return -1;
  32644. }
  32645. #endif
  32646. static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
  32647. {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
  32648. {0, 0, 0, 0, 0}
  32649. };
  32650. static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
  32651. {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
  32652. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  32653. {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
  32654. {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
  32655. {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
  32656. #endif
  32657. {0, 0}
  32658. };
  32659. static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
  32660. __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
  32661. 0,
  32662. 0,
  32663. Py_TPFLAGS_IMMUTABLETYPE |
  32664. Py_TPFLAGS_DISALLOW_INSTANTIATION |
  32665. Py_TPFLAGS_DEFAULT,
  32666. __pyx_CommonTypesMetaclass_slots
  32667. };
  32668. static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
  32669. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  32670. PyObject *bases = PyTuple_Pack(1, &PyType_Type);
  32671. if (unlikely(!bases)) {
  32672. return -1;
  32673. }
  32674. mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
  32675. Py_DECREF(bases);
  32676. if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
  32677. return -1;
  32678. }
  32679. return 0;
  32680. }
  32681. /* RaiseException (used by CoroutineBase) */
  32682. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  32683. PyObject* owned_instance = NULL;
  32684. if (tb == Py_None) {
  32685. tb = 0;
  32686. } else if (tb && !PyTraceBack_Check(tb)) {
  32687. PyErr_SetString(PyExc_TypeError,
  32688. "raise: arg 3 must be a traceback or None");
  32689. goto bad;
  32690. }
  32691. if (value == Py_None)
  32692. value = 0;
  32693. if (PyExceptionInstance_Check(type)) {
  32694. if (value) {
  32695. PyErr_SetString(PyExc_TypeError,
  32696. "instance exception may not have a separate value");
  32697. goto bad;
  32698. }
  32699. value = type;
  32700. type = (PyObject*) Py_TYPE(value);
  32701. } else if (PyExceptionClass_Check(type)) {
  32702. PyObject *instance_class = NULL;
  32703. if (value && PyExceptionInstance_Check(value)) {
  32704. instance_class = (PyObject*) Py_TYPE(value);
  32705. if (instance_class != type) {
  32706. int is_subclass = PyObject_IsSubclass(instance_class, type);
  32707. if (!is_subclass) {
  32708. instance_class = NULL;
  32709. } else if (unlikely(is_subclass == -1)) {
  32710. goto bad;
  32711. } else {
  32712. type = instance_class;
  32713. }
  32714. }
  32715. }
  32716. if (!instance_class) {
  32717. PyObject *args;
  32718. if (!value)
  32719. args = PyTuple_New(0);
  32720. else if (PyTuple_Check(value)) {
  32721. Py_INCREF(value);
  32722. args = value;
  32723. } else
  32724. args = PyTuple_Pack(1, value);
  32725. if (!args)
  32726. goto bad;
  32727. owned_instance = PyObject_Call(type, args, NULL);
  32728. Py_DECREF(args);
  32729. if (!owned_instance)
  32730. goto bad;
  32731. value = owned_instance;
  32732. if (!PyExceptionInstance_Check(value)) {
  32733. PyErr_Format(PyExc_TypeError,
  32734. "calling %R should have returned an instance of "
  32735. "BaseException, not %R",
  32736. type, Py_TYPE(value));
  32737. goto bad;
  32738. }
  32739. }
  32740. } else {
  32741. PyErr_SetString(PyExc_TypeError,
  32742. "raise: exception class must be a subclass of BaseException");
  32743. goto bad;
  32744. }
  32745. if (cause) {
  32746. PyObject *fixed_cause;
  32747. if (cause == Py_None) {
  32748. fixed_cause = NULL;
  32749. } else if (PyExceptionClass_Check(cause)) {
  32750. fixed_cause = PyObject_CallObject(cause, NULL);
  32751. if (fixed_cause == NULL)
  32752. goto bad;
  32753. } else if (PyExceptionInstance_Check(cause)) {
  32754. fixed_cause = cause;
  32755. Py_INCREF(fixed_cause);
  32756. } else {
  32757. PyErr_SetString(PyExc_TypeError,
  32758. "exception causes must derive from "
  32759. "BaseException");
  32760. goto bad;
  32761. }
  32762. PyException_SetCause(value, fixed_cause);
  32763. }
  32764. PyErr_SetObject(type, value);
  32765. if (tb) {
  32766. #if PY_VERSION_HEX >= 0x030C00A6
  32767. PyException_SetTraceback(value, tb);
  32768. #elif CYTHON_FAST_THREAD_STATE
  32769. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  32770. PyObject* tmp_tb = tstate->curexc_traceback;
  32771. if (tb != tmp_tb) {
  32772. Py_INCREF(tb);
  32773. tstate->curexc_traceback = tb;
  32774. Py_XDECREF(tmp_tb);
  32775. }
  32776. #else
  32777. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32778. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  32779. Py_INCREF(tb);
  32780. PyErr_Restore(tmp_type, tmp_value, tb);
  32781. Py_XDECREF(tmp_tb);
  32782. #endif
  32783. }
  32784. bad:
  32785. Py_XDECREF(owned_instance);
  32786. return;
  32787. }
  32788. /* GetTopmostException (used by SaveResetException) */
  32789. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  32790. static _PyErr_StackItem *
  32791. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  32792. {
  32793. _PyErr_StackItem *exc_info = tstate->exc_info;
  32794. while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
  32795. exc_info->previous_item != NULL)
  32796. {
  32797. exc_info = exc_info->previous_item;
  32798. }
  32799. return exc_info;
  32800. }
  32801. #endif
  32802. /* SaveResetException (used by CoroutineBase) */
  32803. #if CYTHON_FAST_THREAD_STATE
  32804. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  32805. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  32806. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  32807. PyObject *exc_value = exc_info->exc_value;
  32808. if (exc_value == NULL || exc_value == Py_None) {
  32809. *value = NULL;
  32810. *type = NULL;
  32811. *tb = NULL;
  32812. } else {
  32813. *value = exc_value;
  32814. Py_INCREF(*value);
  32815. *type = (PyObject*) Py_TYPE(exc_value);
  32816. Py_INCREF(*type);
  32817. *tb = PyException_GetTraceback(exc_value);
  32818. }
  32819. #elif CYTHON_USE_EXC_INFO_STACK
  32820. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  32821. *type = exc_info->exc_type;
  32822. *value = exc_info->exc_value;
  32823. *tb = exc_info->exc_traceback;
  32824. Py_XINCREF(*type);
  32825. Py_XINCREF(*value);
  32826. Py_XINCREF(*tb);
  32827. #else
  32828. *type = tstate->exc_type;
  32829. *value = tstate->exc_value;
  32830. *tb = tstate->exc_traceback;
  32831. Py_XINCREF(*type);
  32832. Py_XINCREF(*value);
  32833. Py_XINCREF(*tb);
  32834. #endif
  32835. }
  32836. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  32837. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  32838. _PyErr_StackItem *exc_info = tstate->exc_info;
  32839. PyObject *tmp_value = exc_info->exc_value;
  32840. exc_info->exc_value = value;
  32841. Py_XDECREF(tmp_value);
  32842. Py_XDECREF(type);
  32843. Py_XDECREF(tb);
  32844. #else
  32845. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32846. #if CYTHON_USE_EXC_INFO_STACK
  32847. _PyErr_StackItem *exc_info = tstate->exc_info;
  32848. tmp_type = exc_info->exc_type;
  32849. tmp_value = exc_info->exc_value;
  32850. tmp_tb = exc_info->exc_traceback;
  32851. exc_info->exc_type = type;
  32852. exc_info->exc_value = value;
  32853. exc_info->exc_traceback = tb;
  32854. #else
  32855. tmp_type = tstate->exc_type;
  32856. tmp_value = tstate->exc_value;
  32857. tmp_tb = tstate->exc_traceback;
  32858. tstate->exc_type = type;
  32859. tstate->exc_value = value;
  32860. tstate->exc_traceback = tb;
  32861. #endif
  32862. Py_XDECREF(tmp_type);
  32863. Py_XDECREF(tmp_value);
  32864. Py_XDECREF(tmp_tb);
  32865. #endif
  32866. }
  32867. #endif
  32868. /* SwapException (used by CoroutineBase) */
  32869. #if CYTHON_FAST_THREAD_STATE
  32870. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  32871. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32872. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  32873. _PyErr_StackItem *exc_info = tstate->exc_info;
  32874. tmp_value = exc_info->exc_value;
  32875. exc_info->exc_value = *value;
  32876. if (tmp_value == NULL || tmp_value == Py_None) {
  32877. Py_XDECREF(tmp_value);
  32878. tmp_value = NULL;
  32879. tmp_type = NULL;
  32880. tmp_tb = NULL;
  32881. } else {
  32882. tmp_type = (PyObject*) Py_TYPE(tmp_value);
  32883. Py_INCREF(tmp_type);
  32884. #if CYTHON_COMPILING_IN_CPYTHON
  32885. tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
  32886. Py_XINCREF(tmp_tb);
  32887. #else
  32888. tmp_tb = PyException_GetTraceback(tmp_value);
  32889. #endif
  32890. }
  32891. #elif CYTHON_USE_EXC_INFO_STACK
  32892. _PyErr_StackItem *exc_info = tstate->exc_info;
  32893. tmp_type = exc_info->exc_type;
  32894. tmp_value = exc_info->exc_value;
  32895. tmp_tb = exc_info->exc_traceback;
  32896. exc_info->exc_type = *type;
  32897. exc_info->exc_value = *value;
  32898. exc_info->exc_traceback = *tb;
  32899. #else
  32900. tmp_type = tstate->exc_type;
  32901. tmp_value = tstate->exc_value;
  32902. tmp_tb = tstate->exc_traceback;
  32903. tstate->exc_type = *type;
  32904. tstate->exc_value = *value;
  32905. tstate->exc_traceback = *tb;
  32906. #endif
  32907. *type = tmp_type;
  32908. *value = tmp_value;
  32909. *tb = tmp_tb;
  32910. }
  32911. #else
  32912. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
  32913. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32914. PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
  32915. PyErr_SetExcInfo(*type, *value, *tb);
  32916. *type = tmp_type;
  32917. *value = tmp_value;
  32918. *tb = tmp_tb;
  32919. }
  32920. #endif
  32921. /* CallTypeTraverse (used by CoroutineBase) */
  32922. #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
  32923. #else
  32924. static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
  32925. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
  32926. if (__Pyx_get_runtime_version() < 0x03090000) return 0;
  32927. #endif
  32928. if (!always_call) {
  32929. PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
  32930. unsigned long flags = PyType_GetFlags(base);
  32931. if (flags & Py_TPFLAGS_HEAPTYPE) {
  32932. return 0;
  32933. }
  32934. }
  32935. Py_VISIT((PyObject*)Py_TYPE(o));
  32936. return 0;
  32937. }
  32938. #endif
  32939. /* IterNextPlain (used by CoroutineBase) */
  32940. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  32941. static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
  32942. if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
  32943. __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
  32944. return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
  32945. }
  32946. #endif
  32947. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
  32948. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  32949. PyObject *result;
  32950. PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
  32951. if (unlikely(!next)) return NULL;
  32952. result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
  32953. return result;
  32954. #else
  32955. (void)__Pyx_GetBuiltinName; // only for early limited API
  32956. iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
  32957. assert(iternext);
  32958. return iternext(iterator);
  32959. #endif
  32960. }
  32961. /* PyObjectCall2Args (used by PyObjectCallMethod1) */
  32962. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
  32963. PyObject *args[3] = {NULL, arg1, arg2};
  32964. return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  32965. }
  32966. /* PyObjectGetMethod (used by PyObjectCallMethod1) */
  32967. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  32968. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
  32969. PyObject *attr;
  32970. #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
  32971. __Pyx_TypeName type_name;
  32972. PyTypeObject *tp = Py_TYPE(obj);
  32973. PyObject *descr;
  32974. descrgetfunc f = NULL;
  32975. PyObject **dictptr, *dict;
  32976. int meth_found = 0;
  32977. assert (*method == NULL);
  32978. if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
  32979. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  32980. goto try_unpack;
  32981. }
  32982. if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
  32983. return 0;
  32984. }
  32985. descr = _PyType_Lookup(tp, name);
  32986. if (likely(descr != NULL)) {
  32987. Py_INCREF(descr);
  32988. #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
  32989. if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
  32990. #else
  32991. #ifdef __Pyx_CyFunction_USED
  32992. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
  32993. #else
  32994. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
  32995. #endif
  32996. #endif
  32997. {
  32998. meth_found = 1;
  32999. } else {
  33000. f = Py_TYPE(descr)->tp_descr_get;
  33001. if (f != NULL && PyDescr_IsData(descr)) {
  33002. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  33003. Py_DECREF(descr);
  33004. goto try_unpack;
  33005. }
  33006. }
  33007. }
  33008. dictptr = _PyObject_GetDictPtr(obj);
  33009. if (dictptr != NULL && (dict = *dictptr) != NULL) {
  33010. Py_INCREF(dict);
  33011. attr = __Pyx_PyDict_GetItemStr(dict, name);
  33012. if (attr != NULL) {
  33013. Py_INCREF(attr);
  33014. Py_DECREF(dict);
  33015. Py_XDECREF(descr);
  33016. goto try_unpack;
  33017. }
  33018. Py_DECREF(dict);
  33019. }
  33020. if (meth_found) {
  33021. *method = descr;
  33022. return 1;
  33023. }
  33024. if (f != NULL) {
  33025. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  33026. Py_DECREF(descr);
  33027. goto try_unpack;
  33028. }
  33029. if (likely(descr != NULL)) {
  33030. *method = descr;
  33031. return 0;
  33032. }
  33033. type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
  33034. PyErr_Format(PyExc_AttributeError,
  33035. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
  33036. type_name, name);
  33037. __Pyx_DECREF_TypeName(type_name);
  33038. return 0;
  33039. #else
  33040. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  33041. goto try_unpack;
  33042. #endif
  33043. try_unpack:
  33044. #if CYTHON_UNPACK_METHODS
  33045. if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
  33046. PyObject *function = PyMethod_GET_FUNCTION(attr);
  33047. Py_INCREF(function);
  33048. Py_DECREF(attr);
  33049. *method = function;
  33050. return 1;
  33051. }
  33052. #endif
  33053. *method = attr;
  33054. return 0;
  33055. }
  33056. #endif
  33057. /* PyObjectCallMethod1 (used by CoroutineBase) */
  33058. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  33059. static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
  33060. PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
  33061. Py_DECREF(method);
  33062. return result;
  33063. }
  33064. #endif
  33065. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
  33066. #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
  33067. PyObject *args[2] = {obj, arg};
  33068. (void) __Pyx_PyObject_CallOneArg;
  33069. (void) __Pyx_PyObject_Call2Args;
  33070. return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  33071. #else
  33072. PyObject *method = NULL, *result;
  33073. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  33074. if (likely(is_method)) {
  33075. result = __Pyx_PyObject_Call2Args(method, obj, arg);
  33076. Py_DECREF(method);
  33077. return result;
  33078. }
  33079. if (unlikely(!method)) return NULL;
  33080. return __Pyx__PyObject_CallMethod1(method, arg);
  33081. #endif
  33082. }
  33083. /* PyObjectCallNoArg (used by CoroutineBase) */
  33084. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
  33085. PyObject *arg[2] = {NULL, NULL};
  33086. return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  33087. }
  33088. /* ReturnWithStopIteration (used by CoroutineBase) */
  33089. static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
  33090. static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
  33091. if (value == Py_None) {
  33092. if (async || !iternext)
  33093. PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
  33094. return;
  33095. }
  33096. __Pyx__ReturnWithStopIteration(value, async);
  33097. }
  33098. static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
  33099. #if CYTHON_COMPILING_IN_CPYTHON
  33100. __Pyx_PyThreadState_declare
  33101. #endif
  33102. PyObject *exc;
  33103. PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
  33104. #if CYTHON_COMPILING_IN_CPYTHON
  33105. if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
  33106. if (PY_VERSION_HEX >= (0x030e00A1)) {
  33107. exc = __Pyx_PyObject_CallOneArg(exc_type, value);
  33108. } else {
  33109. PyObject *args_tuple = PyTuple_New(1);
  33110. if (unlikely(!args_tuple)) return;
  33111. Py_INCREF(value);
  33112. PyTuple_SET_ITEM(args_tuple, 0, value);
  33113. exc = PyObject_Call(exc_type, args_tuple, NULL);
  33114. Py_DECREF(args_tuple);
  33115. }
  33116. if (unlikely(!exc)) return;
  33117. } else {
  33118. Py_INCREF(value);
  33119. exc = value;
  33120. }
  33121. #if CYTHON_FAST_THREAD_STATE
  33122. __Pyx_PyThreadState_assign
  33123. #if CYTHON_USE_EXC_INFO_STACK
  33124. if (!__pyx_tstate->exc_info->exc_value)
  33125. #else
  33126. if (!__pyx_tstate->exc_type)
  33127. #endif
  33128. {
  33129. Py_INCREF(exc_type);
  33130. __Pyx_ErrRestore(exc_type, exc, NULL);
  33131. return;
  33132. }
  33133. #endif
  33134. #else
  33135. exc = __Pyx_PyObject_CallOneArg(exc_type, value);
  33136. if (unlikely(!exc)) return;
  33137. #endif
  33138. PyErr_SetObject(exc_type, exc);
  33139. Py_DECREF(exc);
  33140. }
  33141. /* CoroutineBase (used by Generator) */
  33142. #if !CYTHON_COMPILING_IN_LIMITED_API
  33143. #include <frameobject.h>
  33144. #if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
  33145. #ifndef Py_BUILD_CORE
  33146. #define Py_BUILD_CORE 1
  33147. #endif
  33148. #include "internal/pycore_frame.h"
  33149. #endif
  33150. #endif // CYTHON_COMPILING_IN_LIMITED_API
  33151. static CYTHON_INLINE void
  33152. __Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
  33153. #if CYTHON_USE_AM_SEND
  33154. gen->yieldfrom_am_send = NULL;
  33155. #endif
  33156. Py_CLEAR(gen->yieldfrom);
  33157. }
  33158. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
  33159. PyObject *et, *ev, *tb;
  33160. PyObject *value = NULL;
  33161. CYTHON_UNUSED_VAR(__pyx_tstate);
  33162. __Pyx_ErrFetch(&et, &ev, &tb);
  33163. if (!et) {
  33164. Py_XDECREF(tb);
  33165. Py_XDECREF(ev);
  33166. Py_INCREF(Py_None);
  33167. *pvalue = Py_None;
  33168. return 0;
  33169. }
  33170. if (likely(et == PyExc_StopIteration)) {
  33171. if (!ev) {
  33172. Py_INCREF(Py_None);
  33173. value = Py_None;
  33174. }
  33175. else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
  33176. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
  33177. value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
  33178. if (unlikely(!value)) goto limited_api_failure;
  33179. #else
  33180. value = ((PyStopIterationObject *)ev)->value;
  33181. Py_INCREF(value);
  33182. #endif
  33183. Py_DECREF(ev);
  33184. }
  33185. else if (unlikely(PyTuple_Check(ev))) {
  33186. Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
  33187. #if !CYTHON_ASSUME_SAFE_SIZE
  33188. if (unlikely(tuple_size < 0)) {
  33189. Py_XDECREF(tb);
  33190. Py_DECREF(ev);
  33191. Py_DECREF(et);
  33192. return -1;
  33193. }
  33194. #endif
  33195. if (tuple_size >= 1) {
  33196. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  33197. value = PyTuple_GET_ITEM(ev, 0);
  33198. Py_INCREF(value);
  33199. #elif CYTHON_ASSUME_SAFE_MACROS
  33200. value = PySequence_ITEM(ev, 0);
  33201. #else
  33202. value = PySequence_GetItem(ev, 0);
  33203. if (!value) goto limited_api_failure;
  33204. #endif
  33205. } else {
  33206. Py_INCREF(Py_None);
  33207. value = Py_None;
  33208. }
  33209. Py_DECREF(ev);
  33210. }
  33211. else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
  33212. value = ev;
  33213. }
  33214. if (likely(value)) {
  33215. Py_XDECREF(tb);
  33216. Py_DECREF(et);
  33217. *pvalue = value;
  33218. return 0;
  33219. }
  33220. } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
  33221. __Pyx_ErrRestore(et, ev, tb);
  33222. return -1;
  33223. }
  33224. PyErr_NormalizeException(&et, &ev, &tb);
  33225. if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
  33226. __Pyx_ErrRestore(et, ev, tb);
  33227. return -1;
  33228. }
  33229. Py_XDECREF(tb);
  33230. Py_DECREF(et);
  33231. #if CYTHON_COMPILING_IN_LIMITED_API
  33232. value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
  33233. #else
  33234. value = ((PyStopIterationObject *)ev)->value;
  33235. Py_INCREF(value);
  33236. #endif
  33237. Py_DECREF(ev);
  33238. #if CYTHON_COMPILING_IN_LIMITED_API
  33239. if (unlikely(!value)) return -1;
  33240. #endif
  33241. *pvalue = value;
  33242. return 0;
  33243. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
  33244. limited_api_failure:
  33245. Py_XDECREF(et);
  33246. Py_XDECREF(tb);
  33247. Py_XDECREF(ev);
  33248. return -1;
  33249. #endif
  33250. }
  33251. static CYTHON_INLINE
  33252. __Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
  33253. if (*retval) {
  33254. return PYGEN_NEXT;
  33255. } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
  33256. return PYGEN_RETURN;
  33257. } else {
  33258. return PYGEN_ERROR;
  33259. }
  33260. }
  33261. static CYTHON_INLINE
  33262. void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
  33263. #if PY_VERSION_HEX >= 0x030B00a4
  33264. Py_CLEAR(exc_state->exc_value);
  33265. #else
  33266. PyObject *t, *v, *tb;
  33267. t = exc_state->exc_type;
  33268. v = exc_state->exc_value;
  33269. tb = exc_state->exc_traceback;
  33270. exc_state->exc_type = NULL;
  33271. exc_state->exc_value = NULL;
  33272. exc_state->exc_traceback = NULL;
  33273. Py_XDECREF(t);
  33274. Py_XDECREF(v);
  33275. Py_XDECREF(tb);
  33276. #endif
  33277. }
  33278. #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
  33279. static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
  33280. const char *msg;
  33281. CYTHON_MAYBE_UNUSED_VAR(gen);
  33282. if ((0)) {
  33283. #ifdef __Pyx_Coroutine_USED
  33284. } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
  33285. msg = "coroutine already executing";
  33286. #endif
  33287. #ifdef __Pyx_AsyncGen_USED
  33288. } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
  33289. msg = "async generator already executing";
  33290. #endif
  33291. } else {
  33292. msg = "generator already executing";
  33293. }
  33294. PyErr_SetString(PyExc_ValueError, msg);
  33295. }
  33296. static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
  33297. CYTHON_MAYBE_UNUSED_VAR(gen);
  33298. CYTHON_MAYBE_UNUSED_VAR(closing);
  33299. #ifdef __Pyx_Coroutine_USED
  33300. if (!closing && __Pyx_Coroutine_Check(gen)) {
  33301. PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
  33302. } else
  33303. #endif
  33304. if (value) {
  33305. #ifdef __Pyx_AsyncGen_USED
  33306. if (__Pyx_AsyncGen_CheckExact(gen))
  33307. PyErr_SetNone(PyExc_StopAsyncIteration);
  33308. else
  33309. #endif
  33310. PyErr_SetNone(PyExc_StopIteration);
  33311. }
  33312. }
  33313. static
  33314. __Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
  33315. __Pyx_PyThreadState_declare
  33316. PyThreadState *tstate;
  33317. __Pyx_ExcInfoStruct *exc_state;
  33318. PyObject *retval;
  33319. assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running
  33320. if (unlikely(self->resume_label == -1)) {
  33321. __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
  33322. return PYGEN_ERROR;
  33323. }
  33324. #if CYTHON_FAST_THREAD_STATE
  33325. __Pyx_PyThreadState_assign
  33326. tstate = __pyx_tstate;
  33327. #else
  33328. tstate = __Pyx_PyThreadState_Current;
  33329. #endif
  33330. exc_state = &self->gi_exc_state;
  33331. if (exc_state->exc_value) {
  33332. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  33333. #else
  33334. PyObject *exc_tb;
  33335. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  33336. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  33337. #elif PY_VERSION_HEX >= 0x030B00a4
  33338. exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
  33339. #else
  33340. exc_tb = exc_state->exc_traceback;
  33341. #endif
  33342. if (exc_tb) {
  33343. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  33344. PyFrameObject *f = tb->tb_frame;
  33345. assert(f->f_back == NULL);
  33346. #if PY_VERSION_HEX >= 0x030B00A1
  33347. f->f_back = PyThreadState_GetFrame(tstate);
  33348. #else
  33349. Py_XINCREF(tstate->frame);
  33350. f->f_back = tstate->frame;
  33351. #endif
  33352. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  33353. Py_DECREF(exc_tb);
  33354. #endif
  33355. }
  33356. #endif
  33357. }
  33358. #if CYTHON_USE_EXC_INFO_STACK
  33359. exc_state->previous_item = tstate->exc_info;
  33360. tstate->exc_info = exc_state;
  33361. #else
  33362. if (exc_state->exc_type) {
  33363. __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  33364. } else {
  33365. __Pyx_Coroutine_ExceptionClear(exc_state);
  33366. __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  33367. }
  33368. #endif
  33369. retval = self->body(self, tstate, value);
  33370. #if CYTHON_USE_EXC_INFO_STACK
  33371. exc_state = &self->gi_exc_state;
  33372. tstate->exc_info = exc_state->previous_item;
  33373. exc_state->previous_item = NULL;
  33374. __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
  33375. #endif
  33376. *result = retval;
  33377. if (self->resume_label == -1) {
  33378. return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
  33379. }
  33380. return PYGEN_NEXT;
  33381. }
  33382. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
  33383. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
  33384. CYTHON_UNUSED_VAR(exc_state);
  33385. #else
  33386. PyObject *exc_tb;
  33387. #if PY_VERSION_HEX >= 0x030B00a4
  33388. if (!exc_state->exc_value) return;
  33389. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  33390. #else
  33391. exc_tb = exc_state->exc_traceback;
  33392. #endif
  33393. if (likely(exc_tb)) {
  33394. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  33395. PyFrameObject *f = tb->tb_frame;
  33396. Py_CLEAR(f->f_back);
  33397. #if PY_VERSION_HEX >= 0x030B00a4
  33398. Py_DECREF(exc_tb);
  33399. #endif
  33400. }
  33401. #endif
  33402. }
  33403. #define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
  33404. ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
  33405. static PyObject *
  33406. __Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
  33407. CYTHON_MAYBE_UNUSED_VAR(gen);
  33408. if (likely(result == PYGEN_RETURN)) {
  33409. int is_async = 0;
  33410. #ifdef __Pyx_AsyncGen_USED
  33411. is_async = __Pyx_AsyncGen_CheckExact(gen);
  33412. #endif
  33413. __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
  33414. Py_XDECREF(retval);
  33415. }
  33416. return NULL;
  33417. }
  33418. #if CYTHON_COMPILING_IN_CPYTHON
  33419. static CYTHON_INLINE
  33420. PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
  33421. #if PY_VERSION_HEX <= 0x030A00A1
  33422. return _PyGen_Send(gen, arg);
  33423. #else
  33424. PyObject *result;
  33425. if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
  33426. if (PyAsyncGen_CheckExact(gen)) {
  33427. assert(result == Py_None);
  33428. PyErr_SetNone(PyExc_StopAsyncIteration);
  33429. }
  33430. else if (result == Py_None) {
  33431. PyErr_SetNone(PyExc_StopIteration);
  33432. }
  33433. else {
  33434. #if PY_VERSION_HEX < 0x030d00A1
  33435. _PyGen_SetStopIterationValue(result);
  33436. #else
  33437. if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
  33438. PyErr_SetObject(PyExc_StopIteration, result);
  33439. } else {
  33440. PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
  33441. if (likely(exc != NULL)) {
  33442. PyErr_SetObject(PyExc_StopIteration, exc);
  33443. Py_DECREF(exc);
  33444. }
  33445. }
  33446. #endif
  33447. }
  33448. Py_DECREF(result);
  33449. result = NULL;
  33450. }
  33451. return result;
  33452. #endif
  33453. }
  33454. #endif
  33455. static CYTHON_INLINE __Pyx_PySendResult
  33456. __Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
  33457. __Pyx_PySendResult result;
  33458. PyObject *val = NULL;
  33459. assert(__Pyx_Coroutine_get_is_running(gen));
  33460. __Pyx_Coroutine_Undelegate(gen);
  33461. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
  33462. result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
  33463. Py_XDECREF(val);
  33464. return result;
  33465. }
  33466. #if CYTHON_USE_AM_SEND
  33467. static __Pyx_PySendResult
  33468. __Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
  33469. PyObject *ret = NULL;
  33470. __Pyx_PySendResult delegate_result, result;
  33471. assert(__Pyx_Coroutine_get_is_running(gen));
  33472. delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
  33473. if (delegate_result == PYGEN_NEXT) {
  33474. assert (ret != NULL);
  33475. *retval = ret;
  33476. return PYGEN_NEXT;
  33477. }
  33478. assert (delegate_result != PYGEN_ERROR || ret == NULL);
  33479. __Pyx_Coroutine_Undelegate(gen);
  33480. result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
  33481. Py_XDECREF(ret);
  33482. return result;
  33483. }
  33484. #endif
  33485. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
  33486. PyObject *retval = NULL;
  33487. __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
  33488. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
  33489. }
  33490. static __Pyx_PySendResult
  33491. __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
  33492. __Pyx_PySendResult result;
  33493. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  33494. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  33495. *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
  33496. return PYGEN_ERROR;
  33497. }
  33498. #if CYTHON_USE_AM_SEND
  33499. if (gen->yieldfrom_am_send) {
  33500. result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
  33501. } else
  33502. #endif
  33503. if (gen->yieldfrom) {
  33504. PyObject *yf = gen->yieldfrom;
  33505. PyObject *ret;
  33506. #if !CYTHON_USE_AM_SEND
  33507. #ifdef __Pyx_Generator_USED
  33508. if (__Pyx_Generator_CheckExact(yf)) {
  33509. ret = __Pyx_Coroutine_Send(yf, value);
  33510. } else
  33511. #endif
  33512. #ifdef __Pyx_Coroutine_USED
  33513. if (__Pyx_Coroutine_Check(yf)) {
  33514. ret = __Pyx_Coroutine_Send(yf, value);
  33515. } else
  33516. #endif
  33517. #ifdef __Pyx_AsyncGen_USED
  33518. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  33519. ret = __Pyx_async_gen_asend_send(yf, value);
  33520. } else
  33521. #endif
  33522. #if CYTHON_COMPILING_IN_CPYTHON
  33523. if (PyGen_CheckExact(yf)) {
  33524. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  33525. } else
  33526. if (PyCoro_CheckExact(yf)) {
  33527. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  33528. } else
  33529. #endif
  33530. #endif
  33531. {
  33532. #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
  33533. if (value == Py_None && PyIter_Check(yf))
  33534. ret = __Pyx_PyIter_Next_Plain(yf);
  33535. else
  33536. #endif
  33537. ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
  33538. }
  33539. if (likely(ret)) {
  33540. __Pyx_Coroutine_unset_is_running(gen);
  33541. *retval = ret;
  33542. return PYGEN_NEXT;
  33543. }
  33544. result = __Pyx_Coroutine_FinishDelegation(gen, retval);
  33545. } else {
  33546. result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
  33547. }
  33548. __Pyx_Coroutine_unset_is_running(gen);
  33549. return result;
  33550. }
  33551. static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
  33552. __Pyx_PySendResult result;
  33553. PyObject *retval = NULL;
  33554. CYTHON_UNUSED_VAR(gen);
  33555. assert(__Pyx_Coroutine_get_is_running(gen));
  33556. #ifdef __Pyx_Generator_USED
  33557. if (__Pyx_Generator_CheckExact(yf)) {
  33558. result = __Pyx_Coroutine_Close(yf, &retval);
  33559. } else
  33560. #endif
  33561. #ifdef __Pyx_Coroutine_USED
  33562. if (__Pyx_Coroutine_Check(yf)) {
  33563. result = __Pyx_Coroutine_Close(yf, &retval);
  33564. } else
  33565. if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  33566. result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
  33567. } else
  33568. #endif
  33569. #ifdef __Pyx_AsyncGen_USED
  33570. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  33571. retval = __Pyx_async_gen_asend_close(yf, NULL);
  33572. result = PYGEN_RETURN;
  33573. } else
  33574. if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
  33575. retval = __Pyx_async_gen_athrow_close(yf, NULL);
  33576. result = PYGEN_RETURN;
  33577. } else
  33578. #endif
  33579. {
  33580. PyObject *meth;
  33581. result = PYGEN_RETURN;
  33582. meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
  33583. if (unlikely(!meth)) {
  33584. if (unlikely(PyErr_Occurred())) {
  33585. PyErr_WriteUnraisable(yf);
  33586. }
  33587. } else {
  33588. retval = __Pyx_PyObject_CallNoArg(meth);
  33589. Py_DECREF(meth);
  33590. if (unlikely(!retval)) {
  33591. result = PYGEN_ERROR;
  33592. }
  33593. }
  33594. }
  33595. Py_XDECREF(retval);
  33596. return result == PYGEN_ERROR ? -1 : 0;
  33597. }
  33598. static PyObject *__Pyx_Generator_Next(PyObject *self) {
  33599. __Pyx_PySendResult result;
  33600. PyObject *retval = NULL;
  33601. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  33602. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  33603. return __Pyx_Coroutine_AlreadyRunningError(gen);
  33604. }
  33605. #if CYTHON_USE_AM_SEND
  33606. if (gen->yieldfrom_am_send) {
  33607. result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
  33608. } else
  33609. #endif
  33610. if (gen->yieldfrom) {
  33611. PyObject *yf = gen->yieldfrom;
  33612. PyObject *ret;
  33613. #ifdef __Pyx_Generator_USED
  33614. if (__Pyx_Generator_CheckExact(yf)) {
  33615. ret = __Pyx_Generator_Next(yf);
  33616. } else
  33617. #endif
  33618. #ifdef __Pyx_Coroutine_USED
  33619. if (__Pyx_Coroutine_CheckExact(yf)) {
  33620. ret = __Pyx_Coroutine_Send(yf, Py_None);
  33621. } else
  33622. #endif
  33623. #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
  33624. if (PyGen_CheckExact(yf)) {
  33625. ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
  33626. } else
  33627. #endif
  33628. ret = __Pyx_PyIter_Next_Plain(yf);
  33629. if (likely(ret)) {
  33630. __Pyx_Coroutine_unset_is_running(gen);
  33631. return ret;
  33632. }
  33633. result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
  33634. } else {
  33635. result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
  33636. }
  33637. __Pyx_Coroutine_unset_is_running(gen);
  33638. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
  33639. }
  33640. static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
  33641. PyObject *retval = NULL;
  33642. __Pyx_PySendResult result;
  33643. CYTHON_UNUSED_VAR(arg);
  33644. result = __Pyx_Coroutine_Close(self, &retval);
  33645. if (unlikely(result == PYGEN_ERROR))
  33646. return NULL;
  33647. Py_XDECREF(retval);
  33648. Py_RETURN_NONE;
  33649. }
  33650. static __Pyx_PySendResult
  33651. __Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
  33652. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  33653. __Pyx_PySendResult result;
  33654. PyObject *yf;
  33655. int err = 0;
  33656. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  33657. *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
  33658. return PYGEN_ERROR;
  33659. }
  33660. yf = gen->yieldfrom;
  33661. if (yf) {
  33662. Py_INCREF(yf);
  33663. err = __Pyx_Coroutine_CloseIter(gen, yf);
  33664. __Pyx_Coroutine_Undelegate(gen);
  33665. Py_DECREF(yf);
  33666. }
  33667. if (err == 0)
  33668. PyErr_SetNone(PyExc_GeneratorExit);
  33669. result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
  33670. if (result == PYGEN_ERROR) {
  33671. __Pyx_PyThreadState_declare
  33672. __Pyx_PyThreadState_assign
  33673. __Pyx_Coroutine_unset_is_running(gen);
  33674. if (!__Pyx_PyErr_Occurred()) {
  33675. return PYGEN_RETURN;
  33676. } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
  33677. __Pyx_PyErr_Clear();
  33678. return PYGEN_RETURN;
  33679. }
  33680. return PYGEN_ERROR;
  33681. } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
  33682. __Pyx_Coroutine_unset_is_running(gen);
  33683. return PYGEN_RETURN;
  33684. } else {
  33685. const char *msg;
  33686. Py_DECREF(*retval);
  33687. *retval = NULL;
  33688. if ((0)) {
  33689. #ifdef __Pyx_Coroutine_USED
  33690. } else if (__Pyx_Coroutine_Check(self)) {
  33691. msg = "coroutine ignored GeneratorExit";
  33692. #endif
  33693. #ifdef __Pyx_AsyncGen_USED
  33694. } else if (__Pyx_AsyncGen_CheckExact(self)) {
  33695. msg = "async generator ignored GeneratorExit";
  33696. #endif
  33697. } else {
  33698. msg = "generator ignored GeneratorExit";
  33699. }
  33700. PyErr_SetString(PyExc_RuntimeError, msg);
  33701. __Pyx_Coroutine_unset_is_running(gen);
  33702. return PYGEN_ERROR;
  33703. }
  33704. }
  33705. static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
  33706. PyObject *args, int close_on_genexit) {
  33707. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  33708. PyObject *yf;
  33709. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
  33710. return __Pyx_Coroutine_AlreadyRunningError(gen);
  33711. yf = gen->yieldfrom;
  33712. if (yf) {
  33713. __Pyx_PySendResult result;
  33714. PyObject *ret;
  33715. Py_INCREF(yf);
  33716. if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
  33717. int err = __Pyx_Coroutine_CloseIter(gen, yf);
  33718. Py_DECREF(yf);
  33719. __Pyx_Coroutine_Undelegate(gen);
  33720. if (err < 0)
  33721. goto propagate_exception;
  33722. goto throw_here;
  33723. }
  33724. if (0
  33725. #ifdef __Pyx_Generator_USED
  33726. || __Pyx_Generator_CheckExact(yf)
  33727. #endif
  33728. #ifdef __Pyx_Coroutine_USED
  33729. || __Pyx_Coroutine_Check(yf)
  33730. #endif
  33731. ) {
  33732. ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
  33733. #ifdef __Pyx_Coroutine_USED
  33734. } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  33735. ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
  33736. #endif
  33737. } else {
  33738. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
  33739. if (unlikely(!meth)) {
  33740. Py_DECREF(yf);
  33741. if (unlikely(PyErr_Occurred())) {
  33742. __Pyx_Coroutine_unset_is_running(gen);
  33743. return NULL;
  33744. }
  33745. __Pyx_Coroutine_Undelegate(gen);
  33746. goto throw_here;
  33747. }
  33748. if (likely(args)) {
  33749. ret = __Pyx_PyObject_Call(meth, args, NULL);
  33750. } else {
  33751. PyObject *cargs[4] = {NULL, typ, val, tb};
  33752. ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  33753. }
  33754. Py_DECREF(meth);
  33755. }
  33756. Py_DECREF(yf);
  33757. if (ret) {
  33758. __Pyx_Coroutine_unset_is_running(gen);
  33759. return ret;
  33760. }
  33761. result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
  33762. __Pyx_Coroutine_unset_is_running(gen);
  33763. return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
  33764. }
  33765. throw_here:
  33766. __Pyx_Raise(typ, val, tb, NULL);
  33767. propagate_exception:
  33768. {
  33769. PyObject *retval = NULL;
  33770. __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
  33771. __Pyx_Coroutine_unset_is_running(gen);
  33772. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
  33773. }
  33774. }
  33775. static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
  33776. PyObject *typ;
  33777. PyObject *val = NULL;
  33778. PyObject *tb = NULL;
  33779. if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
  33780. return NULL;
  33781. return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
  33782. }
  33783. static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
  33784. #if PY_VERSION_HEX >= 0x030B00a4
  33785. Py_VISIT(exc_state->exc_value);
  33786. #else
  33787. Py_VISIT(exc_state->exc_type);
  33788. Py_VISIT(exc_state->exc_value);
  33789. Py_VISIT(exc_state->exc_traceback);
  33790. #endif
  33791. return 0;
  33792. }
  33793. static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
  33794. {
  33795. int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
  33796. if (e) return e;
  33797. }
  33798. Py_VISIT(gen->closure);
  33799. Py_VISIT(gen->classobj);
  33800. Py_VISIT(gen->yieldfrom);
  33801. return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
  33802. }
  33803. static int __Pyx_Coroutine_clear(PyObject *self) {
  33804. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  33805. Py_CLEAR(gen->closure);
  33806. Py_CLEAR(gen->classobj);
  33807. __Pyx_Coroutine_Undelegate(gen);
  33808. __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
  33809. #ifdef __Pyx_AsyncGen_USED
  33810. if (__Pyx_AsyncGen_CheckExact(self)) {
  33811. Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
  33812. }
  33813. #endif
  33814. Py_CLEAR(gen->gi_code);
  33815. Py_CLEAR(gen->gi_frame);
  33816. Py_CLEAR(gen->gi_name);
  33817. Py_CLEAR(gen->gi_qualname);
  33818. Py_CLEAR(gen->gi_modulename);
  33819. return 0;
  33820. }
  33821. static void __Pyx_Coroutine_dealloc(PyObject *self) {
  33822. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  33823. PyObject_GC_UnTrack(gen);
  33824. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  33825. if (gen->gi_weakreflist != NULL)
  33826. #endif
  33827. PyObject_ClearWeakRefs(self);
  33828. if (gen->resume_label >= 0) {
  33829. PyObject_GC_Track(self);
  33830. #if CYTHON_USE_TP_FINALIZE
  33831. if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
  33832. #else
  33833. {
  33834. destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
  33835. if (del) del(self);
  33836. }
  33837. if (unlikely(Py_REFCNT(self) > 0))
  33838. #endif
  33839. {
  33840. return;
  33841. }
  33842. PyObject_GC_UnTrack(self);
  33843. }
  33844. #ifdef __Pyx_AsyncGen_USED
  33845. if (__Pyx_AsyncGen_CheckExact(self)) {
  33846. /* We have to handle this case for asynchronous generators
  33847. right here, because this code has to be between UNTRACK
  33848. and GC_Del. */
  33849. Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
  33850. }
  33851. #endif
  33852. __Pyx_Coroutine_clear(self);
  33853. __Pyx_PyHeapTypeObject_GC_Del(gen);
  33854. }
  33855. #if CYTHON_USE_TP_FINALIZE
  33856. static void __Pyx_Coroutine_del(PyObject *self) {
  33857. PyObject *error_type, *error_value, *error_traceback;
  33858. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  33859. __Pyx_PyThreadState_declare
  33860. if (gen->resume_label < 0) {
  33861. return;
  33862. }
  33863. __Pyx_PyThreadState_assign
  33864. __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
  33865. #ifdef __Pyx_AsyncGen_USED
  33866. if (__Pyx_AsyncGen_CheckExact(self)) {
  33867. __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
  33868. PyObject *finalizer = agen->ag_finalizer;
  33869. if (finalizer && !agen->ag_closed) {
  33870. PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
  33871. if (unlikely(!res)) {
  33872. PyErr_WriteUnraisable(self);
  33873. } else {
  33874. Py_DECREF(res);
  33875. }
  33876. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  33877. return;
  33878. }
  33879. }
  33880. #endif
  33881. if (unlikely(gen->resume_label == 0 && !error_value)) {
  33882. #ifdef __Pyx_Coroutine_USED
  33883. #ifdef __Pyx_Generator_USED
  33884. if (!__Pyx_Generator_CheckExact(self))
  33885. #endif
  33886. {
  33887. PyObject_GC_UnTrack(self);
  33888. if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
  33889. PyErr_WriteUnraisable(self);
  33890. PyObject_GC_Track(self);
  33891. }
  33892. #endif
  33893. } else {
  33894. PyObject *retval = NULL;
  33895. __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
  33896. if (result == PYGEN_ERROR) {
  33897. PyErr_WriteUnraisable(self);
  33898. } else {
  33899. Py_XDECREF(retval);
  33900. }
  33901. }
  33902. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  33903. }
  33904. #endif
  33905. static PyObject *
  33906. __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
  33907. {
  33908. PyObject *name = self->gi_name;
  33909. CYTHON_UNUSED_VAR(context);
  33910. if (unlikely(!name)) name = Py_None;
  33911. Py_INCREF(name);
  33912. return name;
  33913. }
  33914. static int
  33915. __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
  33916. {
  33917. CYTHON_UNUSED_VAR(context);
  33918. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  33919. PyErr_SetString(PyExc_TypeError,
  33920. "__name__ must be set to a string object");
  33921. return -1;
  33922. }
  33923. Py_INCREF(value);
  33924. __Pyx_Py_XDECREF_SET(self->gi_name, value);
  33925. return 0;
  33926. }
  33927. static PyObject *
  33928. __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
  33929. {
  33930. PyObject *name = self->gi_qualname;
  33931. CYTHON_UNUSED_VAR(context);
  33932. if (unlikely(!name)) name = Py_None;
  33933. Py_INCREF(name);
  33934. return name;
  33935. }
  33936. static int
  33937. __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
  33938. {
  33939. CYTHON_UNUSED_VAR(context);
  33940. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  33941. PyErr_SetString(PyExc_TypeError,
  33942. "__qualname__ must be set to a string object");
  33943. return -1;
  33944. }
  33945. Py_INCREF(value);
  33946. __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
  33947. return 0;
  33948. }
  33949. static PyObject *
  33950. __Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
  33951. {
  33952. #if !CYTHON_COMPILING_IN_LIMITED_API
  33953. PyObject *frame;
  33954. #if PY_VERSION_HEX >= 0x030d0000
  33955. Py_BEGIN_CRITICAL_SECTION(self);
  33956. #endif
  33957. frame = self->gi_frame;
  33958. if (!frame) {
  33959. if (unlikely(!self->gi_code)) {
  33960. Py_RETURN_NONE;
  33961. }
  33962. PyObject *globals = PyDict_New();
  33963. if (unlikely(!globals)) return NULL;
  33964. frame = (PyObject *) PyFrame_New(
  33965. PyThreadState_Get(), /*PyThreadState *tstate,*/
  33966. (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/
  33967. globals, /*PyObject *globals,*/
  33968. 0 /*PyObject *locals*/
  33969. );
  33970. Py_DECREF(globals);
  33971. if (unlikely(!frame))
  33972. return NULL;
  33973. if (unlikely(self->gi_frame)) {
  33974. Py_DECREF(frame);
  33975. frame = self->gi_frame;
  33976. } else {
  33977. self->gi_frame = frame;
  33978. }
  33979. }
  33980. Py_INCREF(frame);
  33981. #if PY_VERSION_HEX >= 0x030d0000
  33982. Py_END_CRITICAL_SECTION();
  33983. #endif
  33984. return frame;
  33985. #else
  33986. CYTHON_UNUSED_VAR(self);
  33987. Py_RETURN_NONE;
  33988. #endif
  33989. }
  33990. static PyObject *
  33991. __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
  33992. CYTHON_UNUSED_VAR(context);
  33993. PyObject *frame = self->gi_frame;
  33994. if (frame)
  33995. return __Pyx_NewRef(frame);
  33996. return __Pyx__Coroutine_get_frame(self);
  33997. }
  33998. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  33999. PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  34000. PyObject *name, PyObject *qualname, PyObject *module_name) {
  34001. __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
  34002. if (unlikely(!gen))
  34003. return NULL;
  34004. return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
  34005. }
  34006. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  34007. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  34008. PyObject *name, PyObject *qualname, PyObject *module_name) {
  34009. gen->body = body;
  34010. gen->closure = closure;
  34011. Py_XINCREF(closure);
  34012. gen->is_running = 0;
  34013. gen->resume_label = 0;
  34014. gen->classobj = NULL;
  34015. gen->yieldfrom = NULL;
  34016. gen->yieldfrom_am_send = NULL;
  34017. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
  34018. gen->gi_exc_state.exc_value = NULL;
  34019. #else
  34020. gen->gi_exc_state.exc_type = NULL;
  34021. gen->gi_exc_state.exc_value = NULL;
  34022. gen->gi_exc_state.exc_traceback = NULL;
  34023. #endif
  34024. #if CYTHON_USE_EXC_INFO_STACK
  34025. gen->gi_exc_state.previous_item = NULL;
  34026. #endif
  34027. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  34028. gen->gi_weakreflist = NULL;
  34029. #endif
  34030. Py_XINCREF(qualname);
  34031. gen->gi_qualname = qualname;
  34032. Py_XINCREF(name);
  34033. gen->gi_name = name;
  34034. Py_XINCREF(module_name);
  34035. gen->gi_modulename = module_name;
  34036. Py_XINCREF(code);
  34037. gen->gi_code = code;
  34038. gen->gi_frame = NULL;
  34039. PyObject_GC_Track(gen);
  34040. return gen;
  34041. }
  34042. static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
  34043. char result;
  34044. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34045. Py_BEGIN_CRITICAL_SECTION(gen);
  34046. #endif
  34047. result = gen->is_running;
  34048. gen->is_running = 1;
  34049. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34050. Py_END_CRITICAL_SECTION();
  34051. #endif
  34052. return result;
  34053. }
  34054. static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
  34055. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34056. Py_BEGIN_CRITICAL_SECTION(gen);
  34057. #endif
  34058. assert(gen->is_running);
  34059. gen->is_running = 0;
  34060. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34061. Py_END_CRITICAL_SECTION();
  34062. #endif
  34063. }
  34064. static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
  34065. char result;
  34066. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34067. Py_BEGIN_CRITICAL_SECTION(gen);
  34068. #endif
  34069. result = gen->is_running;
  34070. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34071. Py_END_CRITICAL_SECTION();
  34072. #endif
  34073. return result;
  34074. }
  34075. static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
  34076. CYTHON_UNUSED_VAR(closure);
  34077. char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
  34078. if (result) Py_RETURN_TRUE;
  34079. else Py_RETURN_FALSE;
  34080. }
  34081. #if __PYX_HAS_PY_AM_SEND == 2
  34082. static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
  34083. Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
  34084. if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
  34085. return;
  34086. }
  34087. memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
  34088. static_amsend_methods->am_send = am_send;
  34089. type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
  34090. }
  34091. #endif
  34092. static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
  34093. CYTHON_UNUSED_VAR(arg);
  34094. __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self));
  34095. PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
  34096. self_type_name);
  34097. __Pyx_DECREF_TypeName(self_type_name);
  34098. return NULL;
  34099. }
  34100. /* Generator (used by GeneratorYieldFrom) */
  34101. static PyMethodDef __pyx_Generator_methods[] = {
  34102. {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
  34103. PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
  34104. {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
  34105. PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
  34106. {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
  34107. PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
  34108. {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
  34109. {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
  34110. {0, 0, 0, 0}
  34111. };
  34112. static PyMemberDef __pyx_Generator_memberlist[] = {
  34113. {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
  34114. PyDoc_STR("object being iterated by 'yield from', or None")},
  34115. {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
  34116. {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
  34117. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  34118. {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
  34119. #endif
  34120. {0, 0, 0, 0, 0}
  34121. };
  34122. static PyGetSetDef __pyx_Generator_getsets[] = {
  34123. {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
  34124. PyDoc_STR("name of the generator"), 0},
  34125. {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
  34126. PyDoc_STR("qualified name of the generator"), 0},
  34127. {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
  34128. PyDoc_STR("Frame of the generator"), 0},
  34129. {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
  34130. {0, 0, 0, 0, 0}
  34131. };
  34132. static PyType_Slot __pyx_GeneratorType_slots[] = {
  34133. {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
  34134. {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
  34135. {Py_tp_iter, (void *)PyObject_SelfIter},
  34136. {Py_tp_iternext, (void *)__Pyx_Generator_Next},
  34137. {Py_tp_methods, (void *)__pyx_Generator_methods},
  34138. {Py_tp_members, (void *)__pyx_Generator_memberlist},
  34139. {Py_tp_getset, (void *)__pyx_Generator_getsets},
  34140. {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
  34141. #if CYTHON_USE_TP_FINALIZE
  34142. {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
  34143. #endif
  34144. #if __PYX_HAS_PY_AM_SEND == 1
  34145. {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
  34146. #endif
  34147. {0, 0},
  34148. };
  34149. static PyType_Spec __pyx_GeneratorType_spec = {
  34150. __PYX_TYPE_MODULE_PREFIX "generator",
  34151. sizeof(__pyx_CoroutineObject),
  34152. 0,
  34153. #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34154. Py_TPFLAGS_MANAGED_WEAKREF |
  34155. #endif
  34156. Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
  34157. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
  34158. __pyx_GeneratorType_slots
  34159. };
  34160. #if __PYX_HAS_PY_AM_SEND == 2
  34161. static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
  34162. #endif
  34163. static int __pyx_Generator_init(PyObject *module) {
  34164. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  34165. mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(
  34166. mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL);
  34167. if (unlikely(!mstate->__pyx_GeneratorType)) {
  34168. return -1;
  34169. }
  34170. #if __PYX_HAS_PY_AM_SEND == 2
  34171. __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
  34172. #endif
  34173. return 0;
  34174. }
  34175. static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
  34176. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  34177. PyObject *retval = NULL;
  34178. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  34179. return __Pyx_Coroutine_AlreadyRunningError(gen);
  34180. }
  34181. __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
  34182. __Pyx_Coroutine_unset_is_running(gen);
  34183. (void) result;
  34184. assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
  34185. assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
  34186. return retval;
  34187. }
  34188. /* GeneratorYieldFrom */
  34189. #if CYTHON_USE_TYPE_SLOTS
  34190. static void __Pyx_PyIter_CheckErrorAndDecref(PyObject *source) {
  34191. __Pyx_TypeName source_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(source));
  34192. PyErr_Format(PyExc_TypeError,
  34193. "iter() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", source_type_name);
  34194. __Pyx_DECREF_TypeName(source_type_name);
  34195. Py_DECREF(source);
  34196. }
  34197. #endif
  34198. static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval) {
  34199. PyObject *source_gen;
  34200. __Pyx_PySendResult result;
  34201. #ifdef __Pyx_Coroutine_USED
  34202. if (__Pyx_Coroutine_Check(source)) {
  34203. Py_INCREF(source);
  34204. source_gen = source;
  34205. result = __Pyx_Coroutine_AmSend(source, Py_None, retval);
  34206. } else
  34207. #endif
  34208. {
  34209. #if CYTHON_USE_TYPE_SLOTS
  34210. if (likely(Py_TYPE(source)->tp_iter)) {
  34211. source_gen = Py_TYPE(source)->tp_iter(source);
  34212. if (unlikely(!source_gen)) {
  34213. *retval = NULL;
  34214. return PYGEN_ERROR;
  34215. }
  34216. if (unlikely(!PyIter_Check(source_gen))) {
  34217. __Pyx_PyIter_CheckErrorAndDecref(source_gen);
  34218. *retval = NULL;
  34219. return PYGEN_ERROR;
  34220. }
  34221. } else
  34222. #endif
  34223. {
  34224. source_gen = PyObject_GetIter(source);
  34225. if (unlikely(!source_gen)) {
  34226. *retval = NULL;
  34227. return PYGEN_ERROR;
  34228. }
  34229. }
  34230. *retval = __Pyx_PyIter_Next_Plain(source_gen);
  34231. result = __Pyx_Coroutine_status_from_result(retval);
  34232. }
  34233. if (likely(result == PYGEN_NEXT)) {
  34234. __Pyx_Coroutine_Set_Owned_Yield_From(gen, source_gen);
  34235. return PYGEN_NEXT;
  34236. }
  34237. Py_DECREF(source_gen);
  34238. return result;
  34239. }
  34240. /* append */
  34241. static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
  34242. if (likely(PyList_CheckExact(L))) {
  34243. if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
  34244. } else {
  34245. PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_mstate_global->__pyx_n_u_append, x);
  34246. if (unlikely(!retval))
  34247. return -1;
  34248. Py_DECREF(retval);
  34249. }
  34250. return 0;
  34251. }
  34252. /* PyLongBinop */
  34253. #if !CYTHON_COMPILING_IN_PYPY
  34254. static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
  34255. return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
  34256. }
  34257. #if CYTHON_USE_PYLONG_INTERNALS
  34258. static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  34259. CYTHON_MAYBE_UNUSED_VAR(inplace);
  34260. CYTHON_UNUSED_VAR(zerodivision_check);
  34261. const long b = intval;
  34262. long a;
  34263. const PY_LONG_LONG llb = intval;
  34264. PY_LONG_LONG lla;
  34265. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  34266. return __Pyx_NewRef(op2);
  34267. }
  34268. const int is_positive = __Pyx_PyLong_IsPos(op1);
  34269. const digit* digits = __Pyx_PyLong_Digits(op1);
  34270. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  34271. if (likely(size == 1)) {
  34272. a = (long) digits[0];
  34273. if (!is_positive) a *= -1;
  34274. } else {
  34275. switch (size) {
  34276. case 2:
  34277. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  34278. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34279. if (!is_positive) a *= -1;
  34280. goto calculate_long;
  34281. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  34282. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  34283. if (!is_positive) lla *= -1;
  34284. goto calculate_long_long;
  34285. }
  34286. break;
  34287. case 3:
  34288. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  34289. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34290. if (!is_positive) a *= -1;
  34291. goto calculate_long;
  34292. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  34293. lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  34294. if (!is_positive) lla *= -1;
  34295. goto calculate_long_long;
  34296. }
  34297. break;
  34298. case 4:
  34299. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  34300. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34301. if (!is_positive) a *= -1;
  34302. goto calculate_long;
  34303. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  34304. lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  34305. if (!is_positive) lla *= -1;
  34306. goto calculate_long_long;
  34307. }
  34308. break;
  34309. }
  34310. return PyLong_Type.tp_as_number->nb_add(op1, op2);
  34311. }
  34312. calculate_long:
  34313. {
  34314. long x;
  34315. x = a + b;
  34316. return PyLong_FromLong(x);
  34317. }
  34318. calculate_long_long:
  34319. {
  34320. PY_LONG_LONG llx;
  34321. llx = lla + llb;
  34322. return PyLong_FromLongLong(llx);
  34323. }
  34324. }
  34325. #endif
  34326. static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
  34327. CYTHON_UNUSED_VAR(zerodivision_check);
  34328. const long b = intval;
  34329. double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
  34330. double result;
  34331. result = ((double)a) + (double)b;
  34332. return PyFloat_FromDouble(result);
  34333. }
  34334. static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  34335. CYTHON_MAYBE_UNUSED_VAR(intval);
  34336. CYTHON_UNUSED_VAR(zerodivision_check);
  34337. #if CYTHON_USE_PYLONG_INTERNALS
  34338. if (likely(PyLong_CheckExact(op1))) {
  34339. return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
  34340. }
  34341. #endif
  34342. if (PyFloat_CheckExact(op1)) {
  34343. return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
  34344. }
  34345. return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
  34346. }
  34347. #endif
  34348. /* py_abs */
  34349. #if CYTHON_USE_PYLONG_INTERNALS
  34350. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
  34351. #if PY_VERSION_HEX >= 0x030C00A7
  34352. if (likely(__Pyx_PyLong_IsCompact(n))) {
  34353. return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
  34354. }
  34355. #else
  34356. if (likely(Py_SIZE(n) == -1)) {
  34357. return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
  34358. }
  34359. #endif
  34360. #if CYTHON_COMPILING_IN_CPYTHON
  34361. {
  34362. PyObject *copy = _PyLong_Copy((PyLongObject*)n);
  34363. if (likely(copy)) {
  34364. #if PY_VERSION_HEX >= 0x030C00A7
  34365. ((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
  34366. #else
  34367. __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
  34368. #endif
  34369. }
  34370. return copy;
  34371. }
  34372. #else
  34373. return PyNumber_Negative(n);
  34374. #endif
  34375. }
  34376. #endif
  34377. /* PyFloatBinop */
  34378. #if !CYTHON_COMPILING_IN_PYPY
  34379. static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
  34380. const double b = floatval;
  34381. double a, result;
  34382. CYTHON_UNUSED_VAR(inplace);
  34383. CYTHON_UNUSED_VAR(zerodivision_check);
  34384. if (likely(PyFloat_CheckExact(op1))) {
  34385. a = __Pyx_PyFloat_AS_DOUBLE(op1);
  34386. } else
  34387. if (likely(PyLong_CheckExact(op1))) {
  34388. #if CYTHON_USE_PYLONG_INTERNALS
  34389. if (__Pyx_PyLong_IsZero(op1)) {
  34390. a = 0.0;
  34391. } else if (__Pyx_PyLong_IsCompact(op1)) {
  34392. a = (double) __Pyx_PyLong_CompactValue(op1);
  34393. } else {
  34394. const digit* digits = __Pyx_PyLong_Digits(op1);
  34395. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
  34396. switch (size) {
  34397. case -2:
  34398. case 2:
  34399. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
  34400. a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34401. if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34402. if (size == -2)
  34403. a = -a;
  34404. break;
  34405. }
  34406. }
  34407. CYTHON_FALLTHROUGH;
  34408. case -3:
  34409. case 3:
  34410. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
  34411. a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34412. if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34413. if (size == -3)
  34414. a = -a;
  34415. break;
  34416. }
  34417. }
  34418. CYTHON_FALLTHROUGH;
  34419. case -4:
  34420. case 4:
  34421. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
  34422. a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34423. if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34424. if (size == -4)
  34425. a = -a;
  34426. break;
  34427. }
  34428. }
  34429. CYTHON_FALLTHROUGH;
  34430. default:
  34431. #endif
  34432. a = PyLong_AsDouble(op1);
  34433. if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
  34434. #if CYTHON_USE_PYLONG_INTERNALS
  34435. }
  34436. }
  34437. #endif
  34438. } else {
  34439. return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
  34440. }
  34441. result = a / b;
  34442. return PyFloat_FromDouble(result);
  34443. }
  34444. #endif
  34445. /* pybytes_as_double (used by pynumber_float) */
  34446. static double __Pyx_SlowPyString_AsDouble(PyObject *obj) {
  34447. PyObject *float_value = PyFloat_FromString(obj);
  34448. if (likely(float_value)) {
  34449. double value = __Pyx_PyFloat_AS_DOUBLE(float_value);
  34450. Py_DECREF(float_value);
  34451. return value;
  34452. }
  34453. return (double)-1;
  34454. }
  34455. static const char* __Pyx__PyBytes_AsDouble_Copy(const char* start, char* buffer, Py_ssize_t length) {
  34456. int last_was_punctuation = 1;
  34457. int parse_error_found = 0;
  34458. Py_ssize_t i;
  34459. for (i=0; i < length; i++) {
  34460. char chr = start[i];
  34461. int is_punctuation = (chr == '_') | (chr == '.') | (chr == 'e') | (chr == 'E');
  34462. *buffer = chr;
  34463. buffer += (chr != '_');
  34464. parse_error_found |= last_was_punctuation & is_punctuation;
  34465. last_was_punctuation = is_punctuation;
  34466. }
  34467. parse_error_found |= last_was_punctuation;
  34468. *buffer = '\0';
  34469. return unlikely(parse_error_found) ? NULL : buffer;
  34470. }
  34471. static double __Pyx__PyBytes_AsDouble_inf_nan(const char* start, Py_ssize_t length) {
  34472. int matches = 1;
  34473. char sign = start[0];
  34474. int is_signed = (sign == '+') | (sign == '-');
  34475. start += is_signed;
  34476. length -= is_signed;
  34477. switch (start[0]) {
  34478. #ifdef Py_NAN
  34479. case 'n':
  34480. case 'N':
  34481. if (unlikely(length != 3)) goto parse_failure;
  34482. matches &= (start[1] == 'a' || start[1] == 'A');
  34483. matches &= (start[2] == 'n' || start[2] == 'N');
  34484. if (unlikely(!matches)) goto parse_failure;
  34485. return (sign == '-') ? -Py_NAN : Py_NAN;
  34486. #endif
  34487. case 'i':
  34488. case 'I':
  34489. if (unlikely(length < 3)) goto parse_failure;
  34490. matches &= (start[1] == 'n' || start[1] == 'N');
  34491. matches &= (start[2] == 'f' || start[2] == 'F');
  34492. if (likely(length == 3 && matches))
  34493. return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
  34494. if (unlikely(length != 8)) goto parse_failure;
  34495. matches &= (start[3] == 'i' || start[3] == 'I');
  34496. matches &= (start[4] == 'n' || start[4] == 'N');
  34497. matches &= (start[5] == 'i' || start[5] == 'I');
  34498. matches &= (start[6] == 't' || start[6] == 'T');
  34499. matches &= (start[7] == 'y' || start[7] == 'Y');
  34500. if (unlikely(!matches)) goto parse_failure;
  34501. return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
  34502. case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
  34503. break;
  34504. default:
  34505. goto parse_failure;
  34506. }
  34507. return 0.0;
  34508. parse_failure:
  34509. return -1.0;
  34510. }
  34511. static CYTHON_INLINE int __Pyx__PyBytes_AsDouble_IsSpace(char ch) {
  34512. return (ch == 0x20) | !((ch < 0x9) | (ch > 0xd));
  34513. }
  34514. CYTHON_UNUSED static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length) {
  34515. double value;
  34516. Py_ssize_t i, digits;
  34517. const char *last = start + length;
  34518. char *end;
  34519. while (__Pyx__PyBytes_AsDouble_IsSpace(*start))
  34520. start++;
  34521. while (start < last - 1 && __Pyx__PyBytes_AsDouble_IsSpace(last[-1]))
  34522. last--;
  34523. length = last - start;
  34524. if (unlikely(length <= 0)) goto fallback;
  34525. value = __Pyx__PyBytes_AsDouble_inf_nan(start, length);
  34526. if (unlikely(value == -1.0)) goto fallback;
  34527. if (value != 0.0) return value;
  34528. digits = 0;
  34529. for (i=0; i < length; digits += start[i++] != '_');
  34530. if (likely(digits == length)) {
  34531. value = PyOS_string_to_double(start, &end, NULL);
  34532. } else if (digits < 40) {
  34533. char number[40];
  34534. last = __Pyx__PyBytes_AsDouble_Copy(start, number, length);
  34535. if (unlikely(!last)) goto fallback;
  34536. value = PyOS_string_to_double(number, &end, NULL);
  34537. } else {
  34538. char *number = (char*) PyMem_Malloc((digits + 1) * sizeof(char));
  34539. if (unlikely(!number)) goto fallback;
  34540. last = __Pyx__PyBytes_AsDouble_Copy(start, number, length);
  34541. if (unlikely(!last)) {
  34542. PyMem_Free(number);
  34543. goto fallback;
  34544. }
  34545. value = PyOS_string_to_double(number, &end, NULL);
  34546. PyMem_Free(number);
  34547. }
  34548. if (likely(end == last) || (value == (double)-1 && PyErr_Occurred())) {
  34549. return value;
  34550. }
  34551. fallback:
  34552. return __Pyx_SlowPyString_AsDouble(obj);
  34553. }
  34554. /* pynumber_float */
  34555. static CYTHON_INLINE PyObject* __Pyx__PyNumber_Float(PyObject* obj) {
  34556. double val;
  34557. if (PyLong_CheckExact(obj)) {
  34558. #if CYTHON_USE_PYLONG_INTERNALS
  34559. if (likely(__Pyx_PyLong_IsCompact(obj))) {
  34560. val = (double) __Pyx_PyLong_CompactValue(obj);
  34561. goto no_error;
  34562. }
  34563. #endif
  34564. val = PyLong_AsDouble(obj);
  34565. } else if (PyUnicode_CheckExact(obj)) {
  34566. val = __Pyx_PyUnicode_AsDouble(obj);
  34567. } else if (PyBytes_CheckExact(obj)) {
  34568. val = __Pyx_PyBytes_AsDouble(obj);
  34569. } else if (PyByteArray_CheckExact(obj)) {
  34570. val = __Pyx_PyByteArray_AsDouble(obj);
  34571. } else {
  34572. return PyNumber_Float(obj);
  34573. }
  34574. if (unlikely(val == -1 && PyErr_Occurred())) {
  34575. return NULL;
  34576. }
  34577. #if CYTHON_USE_PYLONG_INTERNALS
  34578. no_error:
  34579. #endif
  34580. return PyFloat_FromDouble(val);
  34581. }
  34582. /* PyFloatBinop */
  34583. #if !CYTHON_COMPILING_IN_PYPY
  34584. static int __Pyx_PyFloat_BoolEqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
  34585. const double b = floatval;
  34586. double a;
  34587. CYTHON_UNUSED_VAR(inplace);
  34588. CYTHON_UNUSED_VAR(zerodivision_check);
  34589. if (op1 == op2) {
  34590. return 1;
  34591. }
  34592. if (likely(PyFloat_CheckExact(op1))) {
  34593. a = __Pyx_PyFloat_AS_DOUBLE(op1);
  34594. } else
  34595. if (likely(PyLong_CheckExact(op1))) {
  34596. #if CYTHON_USE_PYLONG_INTERNALS
  34597. if (__Pyx_PyLong_IsZero(op1)) {
  34598. a = 0.0;
  34599. } else if (__Pyx_PyLong_IsCompact(op1)) {
  34600. a = (double) __Pyx_PyLong_CompactValue(op1);
  34601. } else {
  34602. const digit* digits = __Pyx_PyLong_Digits(op1);
  34603. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
  34604. switch (size) {
  34605. case -2:
  34606. case 2:
  34607. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
  34608. a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34609. if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34610. if (size == -2)
  34611. a = -a;
  34612. break;
  34613. }
  34614. }
  34615. CYTHON_FALLTHROUGH;
  34616. case -3:
  34617. case 3:
  34618. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
  34619. a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34620. if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34621. if (size == -3)
  34622. a = -a;
  34623. break;
  34624. }
  34625. }
  34626. CYTHON_FALLTHROUGH;
  34627. case -4:
  34628. case 4:
  34629. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
  34630. a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34631. if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34632. if (size == -4)
  34633. a = -a;
  34634. break;
  34635. }
  34636. }
  34637. CYTHON_FALLTHROUGH;
  34638. default:
  34639. #endif
  34640. {
  34641. PyObject *res =
  34642. #if CYTHON_USE_TYPE_SLOTS || __PYX_LIMITED_VERSION_HEX >= 0x030A0000
  34643. __Pyx_PyType_GetSlot((&PyFloat_Type), tp_richcompare, richcmpfunc)
  34644. #else
  34645. PyObject_RichCompare
  34646. #endif
  34647. (op2, op1,
  34648. Py_EQ);
  34649. return __Pyx_PyObject_IsTrueAndDecref(
  34650. res);
  34651. }
  34652. #if CYTHON_USE_PYLONG_INTERNALS
  34653. }
  34654. }
  34655. #endif
  34656. } else {
  34657. return __Pyx_PyObject_IsTrueAndDecref(
  34658. PyObject_RichCompare(op1, op2, Py_EQ));
  34659. }
  34660. if (a == b) {
  34661. return 1;
  34662. } else {
  34663. return 0;
  34664. }
  34665. }
  34666. #endif
  34667. /* PyLongBinop */
  34668. #if !CYTHON_COMPILING_IN_PYPY
  34669. static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, int inplace) {
  34670. return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
  34671. }
  34672. #if CYTHON_USE_PYLONG_INTERNALS
  34673. static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  34674. CYTHON_MAYBE_UNUSED_VAR(inplace);
  34675. CYTHON_UNUSED_VAR(zerodivision_check);
  34676. const long a = intval;
  34677. long b;
  34678. const PY_LONG_LONG lla = intval;
  34679. PY_LONG_LONG llb;
  34680. if (unlikely(__Pyx_PyLong_IsZero(op2))) {
  34681. return __Pyx_NewRef(op1);
  34682. }
  34683. const int is_positive = __Pyx_PyLong_IsPos(op2);
  34684. const digit* digits = __Pyx_PyLong_Digits(op2);
  34685. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op2);
  34686. if (likely(size == 1)) {
  34687. b = (long) digits[0];
  34688. if (!is_positive) b *= -1;
  34689. } else {
  34690. switch (size) {
  34691. case 2:
  34692. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  34693. b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34694. if (!is_positive) b *= -1;
  34695. goto calculate_long;
  34696. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  34697. llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  34698. if (!is_positive) llb *= -1;
  34699. goto calculate_long_long;
  34700. }
  34701. break;
  34702. case 3:
  34703. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  34704. b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34705. if (!is_positive) b *= -1;
  34706. goto calculate_long;
  34707. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  34708. llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  34709. if (!is_positive) llb *= -1;
  34710. goto calculate_long_long;
  34711. }
  34712. break;
  34713. case 4:
  34714. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  34715. b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34716. if (!is_positive) b *= -1;
  34717. goto calculate_long;
  34718. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  34719. llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  34720. if (!is_positive) llb *= -1;
  34721. goto calculate_long_long;
  34722. }
  34723. break;
  34724. }
  34725. return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  34726. }
  34727. calculate_long:
  34728. {
  34729. long x;
  34730. x = a - b;
  34731. return PyLong_FromLong(x);
  34732. }
  34733. calculate_long_long:
  34734. {
  34735. PY_LONG_LONG llx;
  34736. llx = lla - llb;
  34737. return PyLong_FromLongLong(llx);
  34738. }
  34739. }
  34740. #endif
  34741. static PyObject* __Pyx_Float___Pyx_PyLong_SubtractCObj(PyObject *float_val, long intval, int zerodivision_check) {
  34742. CYTHON_UNUSED_VAR(zerodivision_check);
  34743. const long a = intval;
  34744. double b = __Pyx_PyFloat_AS_DOUBLE(float_val);
  34745. double result;
  34746. result = ((double)a) - (double)b;
  34747. return PyFloat_FromDouble(result);
  34748. }
  34749. static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  34750. CYTHON_MAYBE_UNUSED_VAR(intval);
  34751. CYTHON_UNUSED_VAR(zerodivision_check);
  34752. #if CYTHON_USE_PYLONG_INTERNALS
  34753. if (likely(PyLong_CheckExact(op2))) {
  34754. return __Pyx_Unpacked___Pyx_PyLong_SubtractCObj(op1, op2, intval, inplace, zerodivision_check);
  34755. }
  34756. #endif
  34757. if (PyFloat_CheckExact(op2)) {
  34758. return __Pyx_Float___Pyx_PyLong_SubtractCObj(op2, intval, zerodivision_check);
  34759. }
  34760. return __Pyx_Fallback___Pyx_PyLong_SubtractCObj(op1, op2, inplace);
  34761. }
  34762. #endif
  34763. /* PyObjectVectorCallKwBuilder */
  34764. #if CYTHON_VECTORCALL
  34765. static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  34766. (void)__Pyx_PyObject_FastCallDict;
  34767. if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
  34768. Py_INCREF(key);
  34769. args[n] = value;
  34770. return 0;
  34771. }
  34772. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  34773. (void)__Pyx_VectorcallBuilder_AddArgStr;
  34774. if (unlikely(!PyUnicode_Check(key))) {
  34775. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  34776. return -1;
  34777. }
  34778. return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
  34779. }
  34780. static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  34781. PyObject *pyKey = PyUnicode_FromString(key);
  34782. if (!pyKey) return -1;
  34783. return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
  34784. }
  34785. #else // CYTHON_VECTORCALL
  34786. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
  34787. if (unlikely(!PyUnicode_Check(key))) {
  34788. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  34789. return -1;
  34790. }
  34791. return PyDict_SetItem(builder, key, value);
  34792. }
  34793. #endif
  34794. /* PyObjectFastCallMethod */
  34795. #if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
  34796. static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) {
  34797. PyObject *result;
  34798. PyObject *attr = PyObject_GetAttr(args[0], name);
  34799. if (unlikely(!attr))
  34800. return NULL;
  34801. result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1);
  34802. Py_DECREF(attr);
  34803. return result;
  34804. }
  34805. #endif
  34806. /* RaiseClosureNameError */
  34807. static void __Pyx_RaiseClosureNameError(const char *varname) {
  34808. PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
  34809. }
  34810. /* PyMethodNew (used by CythonFunctionShared) */
  34811. #if CYTHON_COMPILING_IN_LIMITED_API
  34812. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  34813. PyObject *result;
  34814. CYTHON_UNUSED_VAR(typ);
  34815. if (!self)
  34816. return __Pyx_NewRef(func);
  34817. #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
  34818. {
  34819. PyObject *args[] = {func, self};
  34820. result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
  34821. }
  34822. #else
  34823. result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
  34824. #endif
  34825. return result;
  34826. }
  34827. #else
  34828. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  34829. CYTHON_UNUSED_VAR(typ);
  34830. if (!self)
  34831. return __Pyx_NewRef(func);
  34832. return PyMethod_New(func, self);
  34833. }
  34834. #endif
  34835. /* PyVectorcallFastCallDict (used by CythonFunctionShared) */
  34836. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  34837. static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  34838. {
  34839. PyObject *res = NULL;
  34840. PyObject *kwnames;
  34841. PyObject **newargs;
  34842. PyObject **kwvalues;
  34843. Py_ssize_t i;
  34844. #if CYTHON_AVOID_BORROWED_REFS
  34845. PyObject *pos;
  34846. #else
  34847. Py_ssize_t pos;
  34848. #endif
  34849. size_t j;
  34850. PyObject *key, *value;
  34851. unsigned long keys_are_strings;
  34852. #if !CYTHON_ASSUME_SAFE_SIZE
  34853. Py_ssize_t nkw = PyDict_Size(kw);
  34854. if (unlikely(nkw == -1)) return NULL;
  34855. #else
  34856. Py_ssize_t nkw = PyDict_GET_SIZE(kw);
  34857. #endif
  34858. newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
  34859. if (unlikely(newargs == NULL)) {
  34860. PyErr_NoMemory();
  34861. return NULL;
  34862. }
  34863. for (j = 0; j < nargs; j++) newargs[j] = args[j];
  34864. kwnames = PyTuple_New(nkw);
  34865. if (unlikely(kwnames == NULL)) {
  34866. PyMem_Free(newargs);
  34867. return NULL;
  34868. }
  34869. kwvalues = newargs + nargs;
  34870. pos = 0;
  34871. i = 0;
  34872. keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
  34873. while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) {
  34874. keys_are_strings &=
  34875. #if CYTHON_COMPILING_IN_LIMITED_API
  34876. PyType_GetFlags(Py_TYPE(key));
  34877. #else
  34878. Py_TYPE(key)->tp_flags;
  34879. #endif
  34880. #if !CYTHON_ASSUME_SAFE_MACROS
  34881. if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
  34882. #else
  34883. PyTuple_SET_ITEM(kwnames, i, key);
  34884. #endif
  34885. kwvalues[i] = value;
  34886. i++;
  34887. }
  34888. if (unlikely(!keys_are_strings)) {
  34889. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  34890. goto cleanup;
  34891. }
  34892. res = vc(func, newargs, nargs, kwnames);
  34893. cleanup:
  34894. #if CYTHON_AVOID_BORROWED_REFS
  34895. Py_DECREF(pos);
  34896. #endif
  34897. Py_DECREF(kwnames);
  34898. for (i = 0; i < nkw; i++)
  34899. Py_DECREF(kwvalues[i]);
  34900. PyMem_Free(newargs);
  34901. return res;
  34902. }
  34903. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  34904. {
  34905. Py_ssize_t kw_size =
  34906. likely(kw == NULL) ?
  34907. 0 :
  34908. #if !CYTHON_ASSUME_SAFE_SIZE
  34909. PyDict_Size(kw);
  34910. #else
  34911. PyDict_GET_SIZE(kw);
  34912. #endif
  34913. if (kw_size == 0) {
  34914. return vc(func, args, nargs, NULL);
  34915. }
  34916. #if !CYTHON_ASSUME_SAFE_SIZE
  34917. else if (unlikely(kw_size == -1)) {
  34918. return NULL;
  34919. }
  34920. #endif
  34921. return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
  34922. }
  34923. #endif
  34924. /* CythonFunctionShared (used by CythonFunction) */
  34925. #if CYTHON_COMPILING_IN_LIMITED_API
  34926. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
  34927. if (__Pyx_CyFunction_Check(func)) {
  34928. return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
  34929. } else if (PyCFunction_Check(func)) {
  34930. return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
  34931. }
  34932. return 0;
  34933. }
  34934. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
  34935. if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
  34936. int result;
  34937. PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
  34938. if (unlikely(!newFunc)) {
  34939. PyErr_Clear(); // It's only an optimization, so don't throw an error
  34940. return 0;
  34941. }
  34942. result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
  34943. Py_DECREF(newFunc);
  34944. return result;
  34945. }
  34946. return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
  34947. }
  34948. #else
  34949. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
  34950. if (PyMethod_Check(func)) {
  34951. func = PyMethod_GET_FUNCTION(func);
  34952. }
  34953. return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  34954. }
  34955. #endif
  34956. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
  34957. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  34958. __Pyx_Py_XDECREF_SET(
  34959. __Pyx_CyFunction_GetClassObj(f),
  34960. ((classobj) ? __Pyx_NewRef(classobj) : NULL));
  34961. #else
  34962. __Pyx_Py_XDECREF_SET(
  34963. ((PyCMethodObject *) (f))->mm_class,
  34964. (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
  34965. #endif
  34966. }
  34967. static PyObject *
  34968. __Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
  34969. {
  34970. if (unlikely(op->func_doc == NULL)) {
  34971. #if CYTHON_COMPILING_IN_LIMITED_API
  34972. op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
  34973. if (unlikely(!op->func_doc)) return NULL;
  34974. #else
  34975. if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
  34976. op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
  34977. if (unlikely(op->func_doc == NULL))
  34978. return NULL;
  34979. } else {
  34980. Py_INCREF(Py_None);
  34981. return Py_None;
  34982. }
  34983. #endif
  34984. }
  34985. Py_INCREF(op->func_doc);
  34986. return op->func_doc;
  34987. }
  34988. static PyObject *
  34989. __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
  34990. PyObject *result;
  34991. CYTHON_UNUSED_VAR(closure);
  34992. __Pyx_BEGIN_CRITICAL_SECTION(op);
  34993. result = __Pyx_CyFunction_get_doc_locked(op);
  34994. __Pyx_END_CRITICAL_SECTION();
  34995. return result;
  34996. }
  34997. static int
  34998. __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  34999. {
  35000. CYTHON_UNUSED_VAR(context);
  35001. if (value == NULL) {
  35002. value = Py_None;
  35003. }
  35004. Py_INCREF(value);
  35005. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35006. __Pyx_Py_XDECREF_SET(op->func_doc, value);
  35007. __Pyx_END_CRITICAL_SECTION();
  35008. return 0;
  35009. }
  35010. static PyObject *
  35011. __Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
  35012. {
  35013. if (unlikely(op->func_name == NULL)) {
  35014. #if CYTHON_COMPILING_IN_LIMITED_API
  35015. op->func_name = PyObject_GetAttrString(op->func, "__name__");
  35016. #else
  35017. op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
  35018. #endif
  35019. if (unlikely(op->func_name == NULL))
  35020. return NULL;
  35021. }
  35022. Py_INCREF(op->func_name);
  35023. return op->func_name;
  35024. }
  35025. static PyObject *
  35026. __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
  35027. {
  35028. PyObject *result = NULL;
  35029. CYTHON_UNUSED_VAR(context);
  35030. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35031. result = __Pyx_CyFunction_get_name_locked(op);
  35032. __Pyx_END_CRITICAL_SECTION();
  35033. return result;
  35034. }
  35035. static int
  35036. __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  35037. {
  35038. CYTHON_UNUSED_VAR(context);
  35039. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  35040. PyErr_SetString(PyExc_TypeError,
  35041. "__name__ must be set to a string object");
  35042. return -1;
  35043. }
  35044. Py_INCREF(value);
  35045. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35046. __Pyx_Py_XDECREF_SET(op->func_name, value);
  35047. __Pyx_END_CRITICAL_SECTION();
  35048. return 0;
  35049. }
  35050. static PyObject *
  35051. __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
  35052. {
  35053. CYTHON_UNUSED_VAR(context);
  35054. PyObject *result;
  35055. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35056. Py_INCREF(op->func_qualname);
  35057. result = op->func_qualname;
  35058. __Pyx_END_CRITICAL_SECTION();
  35059. return result;
  35060. }
  35061. static int
  35062. __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  35063. {
  35064. CYTHON_UNUSED_VAR(context);
  35065. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  35066. PyErr_SetString(PyExc_TypeError,
  35067. "__qualname__ must be set to a string object");
  35068. return -1;
  35069. }
  35070. Py_INCREF(value);
  35071. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35072. __Pyx_Py_XDECREF_SET(op->func_qualname, value);
  35073. __Pyx_END_CRITICAL_SECTION();
  35074. return 0;
  35075. }
  35076. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  35077. static PyObject *
  35078. __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
  35079. {
  35080. CYTHON_UNUSED_VAR(context);
  35081. if (unlikely(op->func_dict == NULL)) {
  35082. op->func_dict = PyDict_New();
  35083. if (unlikely(op->func_dict == NULL))
  35084. return NULL;
  35085. }
  35086. Py_INCREF(op->func_dict);
  35087. return op->func_dict;
  35088. }
  35089. #endif
  35090. static PyObject *
  35091. __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
  35092. {
  35093. CYTHON_UNUSED_VAR(context);
  35094. Py_INCREF(op->func_globals);
  35095. return op->func_globals;
  35096. }
  35097. static PyObject *
  35098. __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
  35099. {
  35100. CYTHON_UNUSED_VAR(op);
  35101. CYTHON_UNUSED_VAR(context);
  35102. Py_INCREF(Py_None);
  35103. return Py_None;
  35104. }
  35105. static PyObject *
  35106. __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
  35107. {
  35108. PyObject* result = (op->func_code) ? op->func_code : Py_None;
  35109. CYTHON_UNUSED_VAR(context);
  35110. Py_INCREF(result);
  35111. return result;
  35112. }
  35113. static int
  35114. __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
  35115. int result = 0;
  35116. PyObject *res = op->defaults_getter((PyObject *) op);
  35117. if (unlikely(!res))
  35118. return -1;
  35119. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  35120. op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
  35121. Py_INCREF(op->defaults_tuple);
  35122. op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
  35123. Py_INCREF(op->defaults_kwdict);
  35124. #else
  35125. op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
  35126. if (unlikely(!op->defaults_tuple)) result = -1;
  35127. else {
  35128. op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
  35129. if (unlikely(!op->defaults_kwdict)) result = -1;
  35130. }
  35131. #endif
  35132. Py_DECREF(res);
  35133. return result;
  35134. }
  35135. static int
  35136. __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  35137. CYTHON_UNUSED_VAR(context);
  35138. if (!value) {
  35139. value = Py_None;
  35140. } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
  35141. PyErr_SetString(PyExc_TypeError,
  35142. "__defaults__ must be set to a tuple object");
  35143. return -1;
  35144. }
  35145. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
  35146. "currently affect the values used in function calls", 1);
  35147. Py_INCREF(value);
  35148. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35149. __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
  35150. __Pyx_END_CRITICAL_SECTION();
  35151. return 0;
  35152. }
  35153. static PyObject *
  35154. __Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
  35155. PyObject* result = op->defaults_tuple;
  35156. if (unlikely(!result)) {
  35157. if (op->defaults_getter) {
  35158. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  35159. result = op->defaults_tuple;
  35160. } else {
  35161. result = Py_None;
  35162. }
  35163. }
  35164. Py_INCREF(result);
  35165. return result;
  35166. }
  35167. static PyObject *
  35168. __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
  35169. PyObject* result = NULL;
  35170. CYTHON_UNUSED_VAR(context);
  35171. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35172. result = __Pyx_CyFunction_get_defaults_locked(op);
  35173. __Pyx_END_CRITICAL_SECTION();
  35174. return result;
  35175. }
  35176. static int
  35177. __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  35178. CYTHON_UNUSED_VAR(context);
  35179. if (!value) {
  35180. value = Py_None;
  35181. } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
  35182. PyErr_SetString(PyExc_TypeError,
  35183. "__kwdefaults__ must be set to a dict object");
  35184. return -1;
  35185. }
  35186. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
  35187. "currently affect the values used in function calls", 1);
  35188. Py_INCREF(value);
  35189. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35190. __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
  35191. __Pyx_END_CRITICAL_SECTION();
  35192. return 0;
  35193. }
  35194. static PyObject *
  35195. __Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
  35196. PyObject* result = op->defaults_kwdict;
  35197. if (unlikely(!result)) {
  35198. if (op->defaults_getter) {
  35199. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  35200. result = op->defaults_kwdict;
  35201. } else {
  35202. result = Py_None;
  35203. }
  35204. }
  35205. Py_INCREF(result);
  35206. return result;
  35207. }
  35208. static PyObject *
  35209. __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
  35210. PyObject* result;
  35211. CYTHON_UNUSED_VAR(context);
  35212. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35213. result = __Pyx_CyFunction_get_kwdefaults_locked(op);
  35214. __Pyx_END_CRITICAL_SECTION();
  35215. return result;
  35216. }
  35217. static int
  35218. __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  35219. CYTHON_UNUSED_VAR(context);
  35220. if (!value || value == Py_None) {
  35221. value = NULL;
  35222. } else if (unlikely(!PyDict_Check(value))) {
  35223. PyErr_SetString(PyExc_TypeError,
  35224. "__annotations__ must be set to a dict object");
  35225. return -1;
  35226. }
  35227. Py_XINCREF(value);
  35228. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35229. __Pyx_Py_XDECREF_SET(op->func_annotations, value);
  35230. __Pyx_END_CRITICAL_SECTION();
  35231. return 0;
  35232. }
  35233. static PyObject *
  35234. __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
  35235. PyObject* result = op->func_annotations;
  35236. if (unlikely(!result)) {
  35237. result = PyDict_New();
  35238. if (unlikely(!result)) return NULL;
  35239. op->func_annotations = result;
  35240. }
  35241. Py_INCREF(result);
  35242. return result;
  35243. }
  35244. static PyObject *
  35245. __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
  35246. PyObject *result;
  35247. CYTHON_UNUSED_VAR(context);
  35248. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35249. result = __Pyx_CyFunction_get_annotations_locked(op);
  35250. __Pyx_END_CRITICAL_SECTION();
  35251. return result;
  35252. }
  35253. static PyObject *
  35254. __Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
  35255. int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
  35256. if (is_coroutine) {
  35257. PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
  35258. fromlist = PyList_New(1);
  35259. if (unlikely(!fromlist)) return NULL;
  35260. Py_INCREF(marker);
  35261. #if CYTHON_ASSUME_SAFE_MACROS
  35262. PyList_SET_ITEM(fromlist, 0, marker);
  35263. #else
  35264. if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
  35265. Py_DECREF(marker);
  35266. Py_DECREF(fromlist);
  35267. return NULL;
  35268. }
  35269. #endif
  35270. module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
  35271. Py_DECREF(fromlist);
  35272. if (unlikely(!module)) goto ignore;
  35273. is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
  35274. Py_DECREF(module);
  35275. if (likely(is_coroutine_value)) {
  35276. return is_coroutine_value;
  35277. }
  35278. ignore:
  35279. PyErr_Clear();
  35280. }
  35281. return __Pyx_PyBool_FromLong(is_coroutine);
  35282. }
  35283. static PyObject *
  35284. __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
  35285. PyObject *result;
  35286. CYTHON_UNUSED_VAR(context);
  35287. if (op->func_is_coroutine) {
  35288. return __Pyx_NewRef(op->func_is_coroutine);
  35289. }
  35290. result = __Pyx_CyFunction_get_is_coroutine_value(op);
  35291. if (unlikely(!result))
  35292. return NULL;
  35293. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35294. if (op->func_is_coroutine) {
  35295. Py_DECREF(result);
  35296. result = __Pyx_NewRef(op->func_is_coroutine);
  35297. } else {
  35298. op->func_is_coroutine = __Pyx_NewRef(result);
  35299. }
  35300. __Pyx_END_CRITICAL_SECTION();
  35301. return result;
  35302. }
  35303. static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
  35304. #if CYTHON_COMPILING_IN_LIMITED_API
  35305. PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
  35306. if (!py_name) return;
  35307. PyErr_Format(PyExc_TypeError,
  35308. "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  35309. py_name, message, size);
  35310. Py_DECREF(py_name);
  35311. #else
  35312. const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
  35313. PyErr_Format(PyExc_TypeError,
  35314. "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  35315. name, message, size);
  35316. #endif
  35317. }
  35318. static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
  35319. #if CYTHON_COMPILING_IN_LIMITED_API
  35320. PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
  35321. if (!py_name) return;
  35322. PyErr_Format(PyExc_TypeError,
  35323. "%.200S() %s",
  35324. py_name, message);
  35325. Py_DECREF(py_name);
  35326. #else
  35327. const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
  35328. PyErr_Format(PyExc_TypeError,
  35329. "%.200s() %s",
  35330. name, message);
  35331. #endif
  35332. }
  35333. #if CYTHON_COMPILING_IN_LIMITED_API
  35334. static PyObject *
  35335. __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
  35336. CYTHON_UNUSED_VAR(context);
  35337. return PyObject_GetAttrString(op->func, "__module__");
  35338. }
  35339. static int
  35340. __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  35341. CYTHON_UNUSED_VAR(context);
  35342. return PyObject_SetAttrString(op->func, "__module__", value);
  35343. }
  35344. #endif
  35345. static PyGetSetDef __pyx_CyFunction_getsets[] = {
  35346. {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  35347. {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  35348. {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  35349. {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  35350. {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  35351. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  35352. {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
  35353. {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
  35354. #else
  35355. {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
  35356. {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
  35357. #endif
  35358. {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  35359. {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  35360. {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  35361. {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  35362. {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  35363. {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  35364. {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  35365. {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  35366. {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
  35367. {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
  35368. {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
  35369. #if CYTHON_COMPILING_IN_LIMITED_API
  35370. {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
  35371. #endif
  35372. {0, 0, 0, 0, 0}
  35373. };
  35374. static PyMemberDef __pyx_CyFunction_members[] = {
  35375. #if !CYTHON_COMPILING_IN_LIMITED_API
  35376. {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
  35377. #endif
  35378. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  35379. {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
  35380. #endif
  35381. #if CYTHON_METH_FASTCALL
  35382. #if CYTHON_COMPILING_IN_LIMITED_API
  35383. {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
  35384. #else
  35385. {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
  35386. #endif
  35387. #if CYTHON_COMPILING_IN_LIMITED_API
  35388. {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
  35389. #else
  35390. {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
  35391. #endif
  35392. #endif
  35393. {0, 0, 0, 0, 0}
  35394. };
  35395. static PyObject *
  35396. __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
  35397. {
  35398. PyObject *result = NULL;
  35399. CYTHON_UNUSED_VAR(args);
  35400. __Pyx_BEGIN_CRITICAL_SECTION(m);
  35401. Py_INCREF(m->func_qualname);
  35402. result = m->func_qualname;
  35403. __Pyx_END_CRITICAL_SECTION();
  35404. return result;
  35405. }
  35406. static PyMethodDef __pyx_CyFunction_methods[] = {
  35407. {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
  35408. {0, 0, 0, 0}
  35409. };
  35410. #if CYTHON_COMPILING_IN_LIMITED_API
  35411. #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
  35412. #else
  35413. #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
  35414. #endif
  35415. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
  35416. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  35417. #if !CYTHON_COMPILING_IN_LIMITED_API
  35418. PyCFunctionObject *cf = (PyCFunctionObject*) op;
  35419. #endif
  35420. if (unlikely(op == NULL))
  35421. return NULL;
  35422. #if CYTHON_COMPILING_IN_LIMITED_API
  35423. op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
  35424. if (unlikely(!op->func)) return NULL;
  35425. #endif
  35426. op->flags = flags;
  35427. __Pyx_CyFunction_weakreflist(op) = NULL;
  35428. #if !CYTHON_COMPILING_IN_LIMITED_API
  35429. cf->m_ml = ml;
  35430. cf->m_self = (PyObject *) op;
  35431. #endif
  35432. Py_XINCREF(closure);
  35433. op->func_closure = closure;
  35434. #if !CYTHON_COMPILING_IN_LIMITED_API
  35435. Py_XINCREF(module);
  35436. cf->m_module = module;
  35437. #endif
  35438. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  35439. op->func_dict = NULL;
  35440. #endif
  35441. op->func_name = NULL;
  35442. Py_INCREF(qualname);
  35443. op->func_qualname = qualname;
  35444. op->func_doc = NULL;
  35445. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  35446. op->func_classobj = NULL;
  35447. #else
  35448. ((PyCMethodObject*)op)->mm_class = NULL;
  35449. #endif
  35450. op->func_globals = globals;
  35451. Py_INCREF(op->func_globals);
  35452. Py_XINCREF(code);
  35453. op->func_code = code;
  35454. op->defaults = NULL;
  35455. op->defaults_tuple = NULL;
  35456. op->defaults_kwdict = NULL;
  35457. op->defaults_getter = NULL;
  35458. op->func_annotations = NULL;
  35459. op->func_is_coroutine = NULL;
  35460. #if CYTHON_METH_FASTCALL
  35461. switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
  35462. case METH_NOARGS:
  35463. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
  35464. break;
  35465. case METH_O:
  35466. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
  35467. break;
  35468. case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
  35469. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
  35470. break;
  35471. case METH_FASTCALL | METH_KEYWORDS:
  35472. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
  35473. break;
  35474. case METH_VARARGS | METH_KEYWORDS:
  35475. __Pyx_CyFunction_func_vectorcall(op) = NULL;
  35476. break;
  35477. default:
  35478. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  35479. Py_DECREF(op);
  35480. return NULL;
  35481. }
  35482. #endif
  35483. return (PyObject *) op;
  35484. }
  35485. static int
  35486. __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  35487. {
  35488. Py_CLEAR(m->func_closure);
  35489. #if CYTHON_COMPILING_IN_LIMITED_API
  35490. Py_CLEAR(m->func);
  35491. #else
  35492. Py_CLEAR(((PyCFunctionObject*)m)->m_module);
  35493. #endif
  35494. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  35495. Py_CLEAR(m->func_dict);
  35496. #elif PY_VERSION_HEX < 0x030d0000
  35497. _PyObject_ClearManagedDict((PyObject*)m);
  35498. #else
  35499. PyObject_ClearManagedDict((PyObject*)m);
  35500. #endif
  35501. Py_CLEAR(m->func_name);
  35502. Py_CLEAR(m->func_qualname);
  35503. Py_CLEAR(m->func_doc);
  35504. Py_CLEAR(m->func_globals);
  35505. Py_CLEAR(m->func_code);
  35506. #if !CYTHON_COMPILING_IN_LIMITED_API
  35507. #if PY_VERSION_HEX < 0x030900B1
  35508. Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
  35509. #else
  35510. {
  35511. PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
  35512. ((PyCMethodObject *) (m))->mm_class = NULL;
  35513. Py_XDECREF(cls);
  35514. }
  35515. #endif
  35516. #endif
  35517. Py_CLEAR(m->defaults_tuple);
  35518. Py_CLEAR(m->defaults_kwdict);
  35519. Py_CLEAR(m->func_annotations);
  35520. Py_CLEAR(m->func_is_coroutine);
  35521. Py_CLEAR(m->defaults);
  35522. return 0;
  35523. }
  35524. static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
  35525. {
  35526. if (__Pyx_CyFunction_weakreflist(m) != NULL)
  35527. PyObject_ClearWeakRefs((PyObject *) m);
  35528. __Pyx_CyFunction_clear(m);
  35529. __Pyx_PyHeapTypeObject_GC_Del(m);
  35530. }
  35531. static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  35532. {
  35533. PyObject_GC_UnTrack(m);
  35534. __Pyx__CyFunction_dealloc(m);
  35535. }
  35536. static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
  35537. {
  35538. {
  35539. int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
  35540. if (e) return e;
  35541. }
  35542. Py_VISIT(m->func_closure);
  35543. #if CYTHON_COMPILING_IN_LIMITED_API
  35544. Py_VISIT(m->func);
  35545. #else
  35546. Py_VISIT(((PyCFunctionObject*)m)->m_module);
  35547. #endif
  35548. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  35549. Py_VISIT(m->func_dict);
  35550. #else
  35551. {
  35552. int e =
  35553. #if PY_VERSION_HEX < 0x030d0000
  35554. _PyObject_VisitManagedDict
  35555. #else
  35556. PyObject_VisitManagedDict
  35557. #endif
  35558. ((PyObject*)m, visit, arg);
  35559. if (e != 0) return e;
  35560. }
  35561. #endif
  35562. __Pyx_VISIT_CONST(m->func_name);
  35563. __Pyx_VISIT_CONST(m->func_qualname);
  35564. Py_VISIT(m->func_doc);
  35565. Py_VISIT(m->func_globals);
  35566. __Pyx_VISIT_CONST(m->func_code);
  35567. #if !CYTHON_COMPILING_IN_LIMITED_API
  35568. Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
  35569. #endif
  35570. Py_VISIT(m->defaults_tuple);
  35571. Py_VISIT(m->defaults_kwdict);
  35572. Py_VISIT(m->func_is_coroutine);
  35573. Py_VISIT(m->defaults);
  35574. return 0;
  35575. }
  35576. static PyObject*
  35577. __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  35578. {
  35579. PyObject *repr;
  35580. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35581. repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
  35582. op->func_qualname, (void *)op);
  35583. __Pyx_END_CRITICAL_SECTION();
  35584. return repr;
  35585. }
  35586. static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
  35587. #if CYTHON_COMPILING_IN_LIMITED_API
  35588. PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
  35589. PyCFunction meth;
  35590. int flags;
  35591. meth = PyCFunction_GetFunction(f);
  35592. if (unlikely(!meth)) return NULL;
  35593. flags = PyCFunction_GetFlags(f);
  35594. if (unlikely(flags < 0)) return NULL;
  35595. #else
  35596. PyCFunctionObject* f = (PyCFunctionObject*)func;
  35597. PyCFunction meth = f->m_ml->ml_meth;
  35598. int flags = f->m_ml->ml_flags;
  35599. #endif
  35600. Py_ssize_t size;
  35601. switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
  35602. case METH_VARARGS:
  35603. if (likely(kw == NULL || PyDict_Size(kw) == 0))
  35604. return (*meth)(self, arg);
  35605. break;
  35606. case METH_VARARGS | METH_KEYWORDS:
  35607. return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
  35608. case METH_NOARGS:
  35609. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  35610. #if CYTHON_ASSUME_SAFE_SIZE
  35611. size = PyTuple_GET_SIZE(arg);
  35612. #else
  35613. size = PyTuple_Size(arg);
  35614. if (unlikely(size < 0)) return NULL;
  35615. #endif
  35616. if (likely(size == 0))
  35617. return (*meth)(self, NULL);
  35618. __Pyx_CyFunction_raise_argument_count_error(
  35619. (__pyx_CyFunctionObject*)func,
  35620. "takes no arguments", size);
  35621. return NULL;
  35622. }
  35623. break;
  35624. case METH_O:
  35625. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  35626. #if CYTHON_ASSUME_SAFE_SIZE
  35627. size = PyTuple_GET_SIZE(arg);
  35628. #else
  35629. size = PyTuple_Size(arg);
  35630. if (unlikely(size < 0)) return NULL;
  35631. #endif
  35632. if (likely(size == 1)) {
  35633. PyObject *result, *arg0;
  35634. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  35635. arg0 = PyTuple_GET_ITEM(arg, 0);
  35636. #else
  35637. arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
  35638. #endif
  35639. result = (*meth)(self, arg0);
  35640. #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  35641. Py_DECREF(arg0);
  35642. #endif
  35643. return result;
  35644. }
  35645. __Pyx_CyFunction_raise_argument_count_error(
  35646. (__pyx_CyFunctionObject*)func,
  35647. "takes exactly one argument", size);
  35648. return NULL;
  35649. }
  35650. break;
  35651. default:
  35652. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  35653. return NULL;
  35654. }
  35655. __Pyx_CyFunction_raise_type_error(
  35656. (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
  35657. return NULL;
  35658. }
  35659. static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  35660. PyObject *self, *result;
  35661. #if CYTHON_COMPILING_IN_LIMITED_API
  35662. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
  35663. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  35664. #else
  35665. self = ((PyCFunctionObject*)func)->m_self;
  35666. #endif
  35667. result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
  35668. return result;
  35669. }
  35670. static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
  35671. PyObject *result;
  35672. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
  35673. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  35674. __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
  35675. if (vc) {
  35676. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  35677. return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
  35678. #else
  35679. (void) &__Pyx_PyVectorcall_FastCallDict;
  35680. return PyVectorcall_Call(func, args, kw);
  35681. #endif
  35682. }
  35683. #endif
  35684. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  35685. Py_ssize_t argc;
  35686. PyObject *new_args;
  35687. PyObject *self;
  35688. #if CYTHON_ASSUME_SAFE_SIZE
  35689. argc = PyTuple_GET_SIZE(args);
  35690. #else
  35691. argc = PyTuple_Size(args);
  35692. if (unlikely(argc < 0)) return NULL;
  35693. #endif
  35694. new_args = PyTuple_GetSlice(args, 1, argc);
  35695. if (unlikely(!new_args))
  35696. return NULL;
  35697. self = PyTuple_GetItem(args, 0);
  35698. if (unlikely(!self)) {
  35699. Py_DECREF(new_args);
  35700. PyErr_Format(PyExc_TypeError,
  35701. "unbound method %.200S() needs an argument",
  35702. cyfunc->func_qualname);
  35703. return NULL;
  35704. }
  35705. result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
  35706. Py_DECREF(new_args);
  35707. } else {
  35708. result = __Pyx_CyFunction_Call(func, args, kw);
  35709. }
  35710. return result;
  35711. }
  35712. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  35713. static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
  35714. {
  35715. int ret = 0;
  35716. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  35717. if (unlikely(nargs < 1)) {
  35718. __Pyx_CyFunction_raise_type_error(
  35719. cyfunc, "needs an argument");
  35720. return -1;
  35721. }
  35722. ret = 1;
  35723. }
  35724. if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
  35725. __Pyx_CyFunction_raise_type_error(
  35726. cyfunc, "takes no keyword arguments");
  35727. return -1;
  35728. }
  35729. return ret;
  35730. }
  35731. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  35732. {
  35733. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  35734. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  35735. PyObject *self;
  35736. #if CYTHON_COMPILING_IN_LIMITED_API
  35737. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  35738. if (unlikely(!meth)) return NULL;
  35739. #else
  35740. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  35741. #endif
  35742. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  35743. case 1:
  35744. self = args[0];
  35745. args += 1;
  35746. nargs -= 1;
  35747. break;
  35748. case 0:
  35749. #if CYTHON_COMPILING_IN_LIMITED_API
  35750. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  35751. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  35752. #else
  35753. self = ((PyCFunctionObject*)cyfunc)->m_self;
  35754. #endif
  35755. break;
  35756. default:
  35757. return NULL;
  35758. }
  35759. if (unlikely(nargs != 0)) {
  35760. __Pyx_CyFunction_raise_argument_count_error(
  35761. cyfunc, "takes no arguments", nargs);
  35762. return NULL;
  35763. }
  35764. return meth(self, NULL);
  35765. }
  35766. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  35767. {
  35768. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  35769. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  35770. PyObject *self;
  35771. #if CYTHON_COMPILING_IN_LIMITED_API
  35772. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  35773. if (unlikely(!meth)) return NULL;
  35774. #else
  35775. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  35776. #endif
  35777. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  35778. case 1:
  35779. self = args[0];
  35780. args += 1;
  35781. nargs -= 1;
  35782. break;
  35783. case 0:
  35784. #if CYTHON_COMPILING_IN_LIMITED_API
  35785. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  35786. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  35787. #else
  35788. self = ((PyCFunctionObject*)cyfunc)->m_self;
  35789. #endif
  35790. break;
  35791. default:
  35792. return NULL;
  35793. }
  35794. if (unlikely(nargs != 1)) {
  35795. __Pyx_CyFunction_raise_argument_count_error(
  35796. cyfunc, "takes exactly one argument", nargs);
  35797. return NULL;
  35798. }
  35799. return meth(self, args[0]);
  35800. }
  35801. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  35802. {
  35803. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  35804. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  35805. PyObject *self;
  35806. #if CYTHON_COMPILING_IN_LIMITED_API
  35807. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  35808. if (unlikely(!meth)) return NULL;
  35809. #else
  35810. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  35811. #endif
  35812. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  35813. case 1:
  35814. self = args[0];
  35815. args += 1;
  35816. nargs -= 1;
  35817. break;
  35818. case 0:
  35819. #if CYTHON_COMPILING_IN_LIMITED_API
  35820. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  35821. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  35822. #else
  35823. self = ((PyCFunctionObject*)cyfunc)->m_self;
  35824. #endif
  35825. break;
  35826. default:
  35827. return NULL;
  35828. }
  35829. return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
  35830. }
  35831. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  35832. {
  35833. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  35834. PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
  35835. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  35836. PyObject *self;
  35837. #if CYTHON_COMPILING_IN_LIMITED_API
  35838. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  35839. if (unlikely(!meth)) return NULL;
  35840. #else
  35841. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  35842. #endif
  35843. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  35844. case 1:
  35845. self = args[0];
  35846. args += 1;
  35847. nargs -= 1;
  35848. break;
  35849. case 0:
  35850. #if CYTHON_COMPILING_IN_LIMITED_API
  35851. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  35852. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  35853. #else
  35854. self = ((PyCFunctionObject*)cyfunc)->m_self;
  35855. #endif
  35856. break;
  35857. default:
  35858. return NULL;
  35859. }
  35860. #if PY_VERSION_HEX < 0x030e00A6
  35861. size_t nargs_value = (size_t) nargs;
  35862. #else
  35863. Py_ssize_t nargs_value = nargs;
  35864. #endif
  35865. return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
  35866. }
  35867. #endif
  35868. static PyType_Slot __pyx_CyFunctionType_slots[] = {
  35869. {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
  35870. {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
  35871. {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
  35872. {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
  35873. {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
  35874. {Py_tp_methods, (void *)__pyx_CyFunction_methods},
  35875. {Py_tp_members, (void *)__pyx_CyFunction_members},
  35876. {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
  35877. {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
  35878. {0, 0},
  35879. };
  35880. static PyType_Spec __pyx_CyFunctionType_spec = {
  35881. __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
  35882. sizeof(__pyx_CyFunctionObject),
  35883. 0,
  35884. #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
  35885. Py_TPFLAGS_METHOD_DESCRIPTOR |
  35886. #endif
  35887. #if CYTHON_METH_FASTCALL
  35888. #if defined(Py_TPFLAGS_HAVE_VECTORCALL)
  35889. Py_TPFLAGS_HAVE_VECTORCALL |
  35890. #elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
  35891. _Py_TPFLAGS_HAVE_VECTORCALL |
  35892. #endif
  35893. #endif // CYTHON_METH_FASTCALL
  35894. #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
  35895. Py_TPFLAGS_MANAGED_DICT |
  35896. #endif
  35897. Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
  35898. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
  35899. __pyx_CyFunctionType_slots
  35900. };
  35901. static int __pyx_CyFunction_init(PyObject *module) {
  35902. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  35903. mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
  35904. mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
  35905. if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
  35906. return -1;
  35907. }
  35908. return 0;
  35909. }
  35910. static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
  35911. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  35912. m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
  35913. if (unlikely(!m->defaults))
  35914. return NULL;
  35915. return m->defaults;
  35916. }
  35917. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
  35918. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  35919. m->defaults_tuple = tuple;
  35920. Py_INCREF(tuple);
  35921. }
  35922. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
  35923. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  35924. m->defaults_kwdict = dict;
  35925. Py_INCREF(dict);
  35926. }
  35927. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
  35928. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  35929. m->func_annotations = dict;
  35930. Py_INCREF(dict);
  35931. }
  35932. /* CythonFunction */
  35933. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
  35934. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  35935. PyObject *op = __Pyx_CyFunction_Init(
  35936. PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
  35937. ml, flags, qualname, closure, module, globals, code
  35938. );
  35939. if (likely(op)) {
  35940. PyObject_GC_Track(op);
  35941. }
  35942. return op;
  35943. }
  35944. /* pyfrozenset_new (used by PySetContains) */
  35945. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
  35946. if (it) {
  35947. PyObject* result;
  35948. #if CYTHON_COMPILING_IN_PYPY
  35949. PyObject* args;
  35950. args = PyTuple_Pack(1, it);
  35951. if (unlikely(!args))
  35952. return NULL;
  35953. result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
  35954. Py_DECREF(args);
  35955. return result;
  35956. #else
  35957. if (PyFrozenSet_CheckExact(it)) {
  35958. Py_INCREF(it);
  35959. return it;
  35960. }
  35961. result = PyFrozenSet_New(it);
  35962. if (unlikely(!result))
  35963. return NULL;
  35964. if ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  35965. #if CYTHON_COMPILING_IN_LIMITED_API
  35966. || __Pyx_get_runtime_version() >= 0x030A0000
  35967. #endif
  35968. )
  35969. return result;
  35970. {
  35971. Py_ssize_t size = __Pyx_PySet_GET_SIZE(result);
  35972. if (likely(size > 0))
  35973. return result;
  35974. #if !CYTHON_ASSUME_SAFE_SIZE
  35975. if (unlikely(size < 0)) {
  35976. Py_DECREF(result);
  35977. return NULL;
  35978. }
  35979. #endif
  35980. }
  35981. Py_DECREF(result);
  35982. #endif
  35983. }
  35984. return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type);
  35985. }
  35986. /* PySetContains */
  35987. static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
  35988. int result = -1;
  35989. if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
  35990. PyObject *tmpkey;
  35991. PyErr_Clear();
  35992. tmpkey = __Pyx_PyFrozenSet_New(key);
  35993. if (tmpkey != NULL) {
  35994. result = PySet_Contains(set, tmpkey);
  35995. Py_DECREF(tmpkey);
  35996. }
  35997. }
  35998. return result;
  35999. }
  36000. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
  36001. int result = PySet_Contains(set, key);
  36002. if (unlikely(result < 0)) {
  36003. result = __Pyx_PySet_ContainsUnhashable(set, key);
  36004. }
  36005. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  36006. }
  36007. /* AllocateExtensionType */
  36008. static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
  36009. if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
  36010. allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
  36011. return alloc_func(t, 0);
  36012. } else {
  36013. newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
  36014. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  36015. if (!tp_new) {
  36016. PyObject *new_str = PyUnicode_FromString("__new__");
  36017. if (likely(new_str)) {
  36018. PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
  36019. Py_DECREF(new_str);
  36020. return o;
  36021. } else
  36022. return NULL;
  36023. } else
  36024. #endif
  36025. return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  36026. }
  36027. }
  36028. /* PyObjectCallMethod0 (used by PyType_Ready) */
  36029. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
  36030. #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
  36031. PyObject *args[1] = {obj};
  36032. (void) __Pyx_PyObject_CallOneArg;
  36033. (void) __Pyx_PyObject_CallNoArg;
  36034. return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  36035. #else
  36036. PyObject *method = NULL, *result = NULL;
  36037. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  36038. if (likely(is_method)) {
  36039. result = __Pyx_PyObject_CallOneArg(method, obj);
  36040. Py_DECREF(method);
  36041. return result;
  36042. }
  36043. if (unlikely(!method)) goto bad;
  36044. result = __Pyx_PyObject_CallNoArg(method);
  36045. Py_DECREF(method);
  36046. bad:
  36047. return result;
  36048. #endif
  36049. }
  36050. /* ValidateBasesTuple (used by PyType_Ready) */
  36051. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  36052. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
  36053. Py_ssize_t i, n;
  36054. #if CYTHON_ASSUME_SAFE_SIZE
  36055. n = PyTuple_GET_SIZE(bases);
  36056. #else
  36057. n = PyTuple_Size(bases);
  36058. if (unlikely(n < 0)) return -1;
  36059. #endif
  36060. for (i = 1; i < n; i++)
  36061. {
  36062. PyTypeObject *b;
  36063. #if CYTHON_AVOID_BORROWED_REFS
  36064. PyObject *b0 = PySequence_GetItem(bases, i);
  36065. if (!b0) return -1;
  36066. #elif CYTHON_ASSUME_SAFE_MACROS
  36067. PyObject *b0 = PyTuple_GET_ITEM(bases, i);
  36068. #else
  36069. PyObject *b0 = PyTuple_GetItem(bases, i);
  36070. if (!b0) return -1;
  36071. #endif
  36072. b = (PyTypeObject*) b0;
  36073. if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
  36074. {
  36075. __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
  36076. PyErr_Format(PyExc_TypeError,
  36077. "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
  36078. __Pyx_DECREF_TypeName(b_name);
  36079. #if CYTHON_AVOID_BORROWED_REFS
  36080. Py_DECREF(b0);
  36081. #endif
  36082. return -1;
  36083. }
  36084. if (dictoffset == 0)
  36085. {
  36086. Py_ssize_t b_dictoffset = 0;
  36087. #if CYTHON_USE_TYPE_SLOTS
  36088. b_dictoffset = b->tp_dictoffset;
  36089. #else
  36090. PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
  36091. if (!py_b_dictoffset) goto dictoffset_return;
  36092. b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
  36093. Py_DECREF(py_b_dictoffset);
  36094. if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
  36095. #endif
  36096. if (b_dictoffset) {
  36097. {
  36098. __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
  36099. PyErr_Format(PyExc_TypeError,
  36100. "extension type '%.200s' has no __dict__ slot, "
  36101. "but base type '" __Pyx_FMT_TYPENAME "' has: "
  36102. "either add 'cdef dict __dict__' to the extension type "
  36103. "or add '__slots__ = [...]' to the base type",
  36104. type_name, b_name);
  36105. __Pyx_DECREF_TypeName(b_name);
  36106. }
  36107. #if !CYTHON_USE_TYPE_SLOTS
  36108. dictoffset_return:
  36109. #endif
  36110. #if CYTHON_AVOID_BORROWED_REFS
  36111. Py_DECREF(b0);
  36112. #endif
  36113. return -1;
  36114. }
  36115. }
  36116. #if CYTHON_AVOID_BORROWED_REFS
  36117. Py_DECREF(b0);
  36118. #endif
  36119. }
  36120. return 0;
  36121. }
  36122. #endif
  36123. /* PyType_Ready */
  36124. CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
  36125. while (t) {
  36126. PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
  36127. if (bases) {
  36128. return 1;
  36129. }
  36130. t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
  36131. }
  36132. return 0;
  36133. }
  36134. static int __Pyx_PyType_Ready(PyTypeObject *t) {
  36135. #if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
  36136. (void)__Pyx_PyObject_CallMethod0;
  36137. #if CYTHON_USE_TYPE_SPECS
  36138. (void)__Pyx_validate_bases_tuple;
  36139. #endif
  36140. return PyType_Ready(t);
  36141. #else
  36142. int r;
  36143. if (!__Pyx_PyType_HasMultipleInheritance(t)) {
  36144. return PyType_Ready(t);
  36145. }
  36146. PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
  36147. if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
  36148. return -1;
  36149. #if !defined(PYSTON_MAJOR_VERSION)
  36150. {
  36151. int gc_was_enabled;
  36152. #if PY_VERSION_HEX >= 0x030A00b1
  36153. gc_was_enabled = PyGC_Disable();
  36154. (void)__Pyx_PyObject_CallMethod0;
  36155. #else
  36156. PyObject *ret, *py_status;
  36157. PyObject *gc = NULL;
  36158. #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
  36159. !CYTHON_COMPILING_IN_GRAAL
  36160. gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
  36161. #endif
  36162. if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
  36163. if (unlikely(!gc)) return -1;
  36164. py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
  36165. if (unlikely(!py_status)) {
  36166. Py_DECREF(gc);
  36167. return -1;
  36168. }
  36169. gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
  36170. Py_DECREF(py_status);
  36171. if (gc_was_enabled > 0) {
  36172. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
  36173. if (unlikely(!ret)) {
  36174. Py_DECREF(gc);
  36175. return -1;
  36176. }
  36177. Py_DECREF(ret);
  36178. } else if (unlikely(gc_was_enabled == -1)) {
  36179. Py_DECREF(gc);
  36180. return -1;
  36181. }
  36182. #endif
  36183. t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
  36184. #if PY_VERSION_HEX >= 0x030A0000
  36185. t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
  36186. #endif
  36187. #else
  36188. (void)__Pyx_PyObject_CallMethod0;
  36189. #endif
  36190. r = PyType_Ready(t);
  36191. #if !defined(PYSTON_MAJOR_VERSION)
  36192. t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
  36193. #if PY_VERSION_HEX >= 0x030A00b1
  36194. if (gc_was_enabled)
  36195. PyGC_Enable();
  36196. #else
  36197. if (gc_was_enabled) {
  36198. PyObject *tp, *v, *tb;
  36199. PyErr_Fetch(&tp, &v, &tb);
  36200. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
  36201. if (likely(ret || r == -1)) {
  36202. Py_XDECREF(ret);
  36203. PyErr_Restore(tp, v, tb);
  36204. } else {
  36205. Py_XDECREF(tp);
  36206. Py_XDECREF(v);
  36207. Py_XDECREF(tb);
  36208. r = -1;
  36209. }
  36210. }
  36211. Py_DECREF(gc);
  36212. #endif
  36213. }
  36214. #endif
  36215. return r;
  36216. #endif
  36217. }
  36218. /* HasAttr (used by ImportImpl) */
  36219. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  36220. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
  36221. PyObject *r;
  36222. if (unlikely(!PyUnicode_Check(n))) {
  36223. PyErr_SetString(PyExc_TypeError,
  36224. "hasattr(): attribute name must be string");
  36225. return -1;
  36226. }
  36227. r = __Pyx_PyObject_GetAttrStrNoError(o, n);
  36228. if (!r) {
  36229. return (unlikely(PyErr_Occurred())) ? -1 : 0;
  36230. } else {
  36231. Py_DECREF(r);
  36232. return 1;
  36233. }
  36234. }
  36235. #endif
  36236. /* ImportImpl (used by Import) */
  36237. static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) {
  36238. PyObject *imported_module = PyImport_GetModule(qualname);
  36239. if (unlikely(!imported_module)) {
  36240. *module = NULL;
  36241. if (PyErr_Occurred()) {
  36242. return -1;
  36243. }
  36244. return 0;
  36245. }
  36246. *module = imported_module;
  36247. return 1;
  36248. }
  36249. static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) {
  36250. PyObject *imported_module;
  36251. PyObject *top_level_package_name;
  36252. Py_ssize_t i;
  36253. int status, module_found;
  36254. Py_ssize_t dot_index;
  36255. module_found = __Pyx__Import_GetModule(qualname, &imported_module);
  36256. if (unlikely(!module_found || module_found == -1)) {
  36257. *module = NULL;
  36258. return module_found;
  36259. }
  36260. if (imported_names) {
  36261. for (i = 0; i < len_imported_names; i++) {
  36262. PyObject *imported_name = imported_names[i];
  36263. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  36264. int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name);
  36265. #else
  36266. int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name);
  36267. if (unlikely(has_imported_attribute == -1)) goto error;
  36268. #endif
  36269. if (!has_imported_attribute) {
  36270. goto not_found;
  36271. }
  36272. }
  36273. *module = imported_module;
  36274. return 1;
  36275. }
  36276. dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1);
  36277. if (dot_index == -1) {
  36278. *module = imported_module;
  36279. return 1;
  36280. }
  36281. if (unlikely(dot_index == -2)) goto error;
  36282. top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index);
  36283. if (unlikely(!top_level_package_name)) goto error;
  36284. Py_DECREF(imported_module);
  36285. status = __Pyx__Import_GetModule(top_level_package_name, module);
  36286. Py_DECREF(top_level_package_name);
  36287. return status;
  36288. error:
  36289. Py_DECREF(imported_module);
  36290. *module = NULL;
  36291. return -1;
  36292. not_found:
  36293. Py_DECREF(imported_module);
  36294. *module = NULL;
  36295. return 0;
  36296. }
  36297. static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) {
  36298. PyObject *module = 0;
  36299. PyObject *empty_dict = 0;
  36300. PyObject *from_list = 0;
  36301. int module_found;
  36302. if (!qualname) {
  36303. qualname = name;
  36304. }
  36305. module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module);
  36306. if (likely(module_found == 1)) {
  36307. return module;
  36308. } else if (unlikely(module_found == -1)) {
  36309. return NULL;
  36310. }
  36311. empty_dict = PyDict_New();
  36312. if (unlikely(!empty_dict))
  36313. goto bad;
  36314. if (imported_names) {
  36315. #if CYTHON_COMPILING_IN_CPYTHON
  36316. from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names);
  36317. if (unlikely(!from_list))
  36318. goto bad;
  36319. #else
  36320. from_list = PyList_New(len_imported_names);
  36321. if (unlikely(!from_list)) goto bad;
  36322. for (Py_ssize_t i=0; i<len_imported_names; ++i) {
  36323. if (PyList_SetItem(from_list, i, __Pyx_NewRef(imported_names[i])) < 0) goto bad;
  36324. }
  36325. #endif
  36326. }
  36327. if (level == -1) {
  36328. const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
  36329. if (package_sep != (0)) {
  36330. module = PyImport_ImportModuleLevelObject(
  36331. name, moddict, empty_dict, from_list, 1);
  36332. if (unlikely(!module)) {
  36333. if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
  36334. goto bad;
  36335. PyErr_Clear();
  36336. }
  36337. }
  36338. level = 0;
  36339. }
  36340. if (!module) {
  36341. module = PyImport_ImportModuleLevelObject(
  36342. name, moddict, empty_dict, from_list, level);
  36343. }
  36344. bad:
  36345. Py_XDECREF(from_list);
  36346. Py_XDECREF(empty_dict);
  36347. return module;
  36348. }
  36349. /* Import */
  36350. static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
  36351. return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
  36352. }
  36353. /* ImportFrom */
  36354. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  36355. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  36356. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  36357. const char* module_name_str = 0;
  36358. PyObject* module_name = 0;
  36359. PyObject* module_dot = 0;
  36360. PyObject* full_name = 0;
  36361. PyErr_Clear();
  36362. module_name_str = PyModule_GetName(module);
  36363. if (unlikely(!module_name_str)) { goto modbad; }
  36364. module_name = PyUnicode_FromString(module_name_str);
  36365. if (unlikely(!module_name)) { goto modbad; }
  36366. module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__2);
  36367. if (unlikely(!module_dot)) { goto modbad; }
  36368. full_name = PyUnicode_Concat(module_dot, name);
  36369. if (unlikely(!full_name)) { goto modbad; }
  36370. #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\
  36371. CYTHON_COMPILING_IN_GRAAL
  36372. {
  36373. PyObject *modules = PyImport_GetModuleDict();
  36374. if (unlikely(!modules))
  36375. goto modbad;
  36376. value = PyObject_GetItem(modules, full_name);
  36377. }
  36378. #else
  36379. value = PyImport_GetModule(full_name);
  36380. #endif
  36381. modbad:
  36382. Py_XDECREF(full_name);
  36383. Py_XDECREF(module_dot);
  36384. Py_XDECREF(module_name);
  36385. }
  36386. if (unlikely(!value)) {
  36387. PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
  36388. }
  36389. return value;
  36390. }
  36391. /* ListPack */
  36392. static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...) {
  36393. va_list va;
  36394. PyObject *l = PyList_New(n);
  36395. va_start(va, n);
  36396. if (unlikely(!l)) goto end;
  36397. for (Py_ssize_t i=0; i<n; ++i) {
  36398. PyObject *arg = va_arg(va, PyObject*);
  36399. Py_INCREF(arg);
  36400. if (__Pyx_PyList_SET_ITEM(l, i, arg) != (0)) {
  36401. Py_CLEAR(l);
  36402. goto end;
  36403. }
  36404. }
  36405. end:
  36406. va_end(va);
  36407. return l;
  36408. }
  36409. /* CLineInTraceback (used by AddTraceback) */
  36410. #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  36411. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  36412. #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
  36413. #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  36414. #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
  36415. #else
  36416. PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
  36417. PyObject **dict_ptr = _PyObject_GetDictPtr(o);
  36418. return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
  36419. }
  36420. #endif
  36421. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  36422. PyObject *use_cline = NULL;
  36423. PyObject *ptype, *pvalue, *ptraceback;
  36424. PyObject *cython_runtime_dict;
  36425. CYTHON_MAYBE_UNUSED_VAR(tstate);
  36426. if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
  36427. return c_line;
  36428. }
  36429. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  36430. cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
  36431. if (likely(cython_runtime_dict)) {
  36432. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  36433. use_cline, cython_runtime_dict,
  36434. __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
  36435. }
  36436. if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  36437. c_line = 0;
  36438. }
  36439. Py_XDECREF(use_cline);
  36440. Py_XDECREF(cython_runtime_dict);
  36441. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  36442. return c_line;
  36443. }
  36444. #endif
  36445. /* CodeObjectCache (used by AddTraceback) */
  36446. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  36447. int start = 0, mid = 0, end = count - 1;
  36448. if (end >= 0 && code_line > entries[end].code_line) {
  36449. return count;
  36450. }
  36451. while (start < end) {
  36452. mid = start + (end - start) / 2;
  36453. if (code_line < entries[mid].code_line) {
  36454. end = mid;
  36455. } else if (code_line > entries[mid].code_line) {
  36456. start = mid + 1;
  36457. } else {
  36458. return mid;
  36459. }
  36460. }
  36461. if (code_line <= entries[mid].code_line) {
  36462. return mid;
  36463. } else {
  36464. return mid + 1;
  36465. }
  36466. }
  36467. static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
  36468. __Pyx_CachedCodeObjectType* code_object;
  36469. int pos;
  36470. if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
  36471. return NULL;
  36472. }
  36473. pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
  36474. if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
  36475. return NULL;
  36476. }
  36477. code_object = code_cache->entries[pos].code_object;
  36478. Py_INCREF(code_object);
  36479. return code_object;
  36480. }
  36481. static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
  36482. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
  36483. (void)__pyx__find_code_object;
  36484. return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
  36485. #else
  36486. struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  36487. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  36488. __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
  36489. if (old_count < 0) {
  36490. __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
  36491. return NULL;
  36492. }
  36493. #endif
  36494. __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
  36495. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  36496. __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
  36497. #endif
  36498. return result;
  36499. #endif
  36500. }
  36501. static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
  36502. {
  36503. int pos, i;
  36504. __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
  36505. if (unlikely(!code_line)) {
  36506. return;
  36507. }
  36508. if (unlikely(!entries)) {
  36509. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  36510. if (likely(entries)) {
  36511. code_cache->entries = entries;
  36512. code_cache->max_count = 64;
  36513. code_cache->count = 1;
  36514. entries[0].code_line = code_line;
  36515. entries[0].code_object = code_object;
  36516. Py_INCREF(code_object);
  36517. }
  36518. return;
  36519. }
  36520. pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
  36521. if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
  36522. __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
  36523. entries[pos].code_object = code_object;
  36524. Py_INCREF(code_object);
  36525. Py_DECREF(tmp);
  36526. return;
  36527. }
  36528. if (code_cache->count == code_cache->max_count) {
  36529. int new_max = code_cache->max_count + 64;
  36530. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  36531. code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
  36532. if (unlikely(!entries)) {
  36533. return;
  36534. }
  36535. code_cache->entries = entries;
  36536. code_cache->max_count = new_max;
  36537. }
  36538. for (i=code_cache->count; i>pos; i--) {
  36539. entries[i] = entries[i-1];
  36540. }
  36541. entries[pos].code_line = code_line;
  36542. entries[pos].code_object = code_object;
  36543. code_cache->count++;
  36544. Py_INCREF(code_object);
  36545. }
  36546. static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
  36547. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
  36548. (void)__pyx__insert_code_object;
  36549. return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
  36550. #else
  36551. struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  36552. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  36553. __pyx_nonatomic_int_type expected = 0;
  36554. if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
  36555. return;
  36556. }
  36557. #endif
  36558. __pyx__insert_code_object(code_cache, code_line, code_object);
  36559. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  36560. __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
  36561. #endif
  36562. #endif
  36563. }
  36564. /* AddTraceback */
  36565. #include "compile.h"
  36566. #include "frameobject.h"
  36567. #include "traceback.h"
  36568. #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
  36569. #ifndef Py_BUILD_CORE
  36570. #define Py_BUILD_CORE 1
  36571. #endif
  36572. #include "internal/pycore_frame.h"
  36573. #endif
  36574. #if CYTHON_COMPILING_IN_LIMITED_API
  36575. static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
  36576. PyObject *firstlineno, PyObject *name) {
  36577. PyObject *replace = NULL;
  36578. if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
  36579. if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
  36580. replace = PyObject_GetAttrString(code, "replace");
  36581. if (likely(replace)) {
  36582. PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
  36583. Py_DECREF(replace);
  36584. return result;
  36585. }
  36586. PyErr_Clear();
  36587. return NULL;
  36588. }
  36589. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  36590. int py_line, const char *filename) {
  36591. PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
  36592. PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
  36593. PyObject *exc_type, *exc_value, *exc_traceback;
  36594. int success = 0;
  36595. if (c_line) {
  36596. c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
  36597. }
  36598. PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
  36599. code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
  36600. if (!code_object) {
  36601. code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
  36602. if (unlikely(!code_object)) goto bad;
  36603. py_py_line = PyLong_FromLong(py_line);
  36604. if (unlikely(!py_py_line)) goto bad;
  36605. if (c_line) {
  36606. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  36607. } else {
  36608. py_funcname = PyUnicode_FromString(funcname);
  36609. }
  36610. if (unlikely(!py_funcname)) goto bad;
  36611. dict = PyDict_New();
  36612. if (unlikely(!dict)) goto bad;
  36613. {
  36614. PyObject *old_code_object = code_object;
  36615. code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
  36616. Py_DECREF(old_code_object);
  36617. }
  36618. if (unlikely(!code_object)) goto bad;
  36619. __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
  36620. } else {
  36621. dict = PyDict_New();
  36622. }
  36623. getframe = PySys_GetObject("_getframe");
  36624. if (unlikely(!getframe)) goto bad;
  36625. if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
  36626. frame = PyEval_EvalCode(code_object, dict, dict);
  36627. if (unlikely(!frame) || frame == Py_None) goto bad;
  36628. success = 1;
  36629. bad:
  36630. PyErr_Restore(exc_type, exc_value, exc_traceback);
  36631. Py_XDECREF(code_object);
  36632. Py_XDECREF(py_py_line);
  36633. Py_XDECREF(py_funcname);
  36634. Py_XDECREF(dict);
  36635. Py_XDECREF(replace);
  36636. if (success) {
  36637. PyTraceBack_Here(
  36638. (struct _frame*)frame);
  36639. }
  36640. Py_XDECREF(frame);
  36641. }
  36642. #else
  36643. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  36644. const char *funcname, int c_line,
  36645. int py_line, const char *filename) {
  36646. PyCodeObject *py_code = NULL;
  36647. PyObject *py_funcname = NULL;
  36648. if (c_line) {
  36649. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  36650. if (!py_funcname) goto bad;
  36651. funcname = PyUnicode_AsUTF8(py_funcname);
  36652. if (!funcname) goto bad;
  36653. }
  36654. py_code = PyCode_NewEmpty(filename, funcname, py_line);
  36655. Py_XDECREF(py_funcname);
  36656. return py_code;
  36657. bad:
  36658. Py_XDECREF(py_funcname);
  36659. return NULL;
  36660. }
  36661. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  36662. int py_line, const char *filename) {
  36663. PyCodeObject *py_code = 0;
  36664. PyFrameObject *py_frame = 0;
  36665. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  36666. PyObject *ptype, *pvalue, *ptraceback;
  36667. if (c_line) {
  36668. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  36669. }
  36670. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  36671. if (!py_code) {
  36672. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  36673. py_code = __Pyx_CreateCodeObjectForTraceback(
  36674. funcname, c_line, py_line, filename);
  36675. if (!py_code) {
  36676. /* If the code object creation fails, then we should clear the
  36677. fetched exception references and propagate the new exception */
  36678. Py_XDECREF(ptype);
  36679. Py_XDECREF(pvalue);
  36680. Py_XDECREF(ptraceback);
  36681. goto bad;
  36682. }
  36683. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  36684. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  36685. }
  36686. py_frame = PyFrame_New(
  36687. tstate, /*PyThreadState *tstate,*/
  36688. py_code, /*PyCodeObject *code,*/
  36689. __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/
  36690. 0 /*PyObject *locals*/
  36691. );
  36692. if (!py_frame) goto bad;
  36693. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  36694. PyTraceBack_Here(py_frame);
  36695. bad:
  36696. Py_XDECREF(py_code);
  36697. Py_XDECREF(py_frame);
  36698. }
  36699. #endif
  36700. /* Declarations */
  36701. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  36702. #ifdef __cplusplus
  36703. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  36704. return ::std::complex< double >(x, y);
  36705. }
  36706. #else
  36707. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  36708. return x + y*(__pyx_t_double_complex)_Complex_I;
  36709. }
  36710. #endif
  36711. #else
  36712. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  36713. __pyx_t_double_complex z;
  36714. z.real = x;
  36715. z.imag = y;
  36716. return z;
  36717. }
  36718. #endif
  36719. /* Arithmetic */
  36720. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  36721. #else
  36722. static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36723. return (a.real == b.real) && (a.imag == b.imag);
  36724. }
  36725. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36726. __pyx_t_double_complex z;
  36727. z.real = a.real + b.real;
  36728. z.imag = a.imag + b.imag;
  36729. return z;
  36730. }
  36731. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36732. __pyx_t_double_complex z;
  36733. z.real = a.real - b.real;
  36734. z.imag = a.imag - b.imag;
  36735. return z;
  36736. }
  36737. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36738. __pyx_t_double_complex z;
  36739. z.real = a.real * b.real - a.imag * b.imag;
  36740. z.imag = a.real * b.imag + a.imag * b.real;
  36741. return z;
  36742. }
  36743. #if 1
  36744. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36745. if (b.imag == 0) {
  36746. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  36747. } else if (fabs(b.real) >= fabs(b.imag)) {
  36748. if (b.real == 0 && b.imag == 0) {
  36749. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
  36750. } else {
  36751. double r = b.imag / b.real;
  36752. double s = (double)(1.0) / (b.real + b.imag * r);
  36753. return __pyx_t_double_complex_from_parts(
  36754. (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
  36755. }
  36756. } else {
  36757. double r = b.real / b.imag;
  36758. double s = (double)(1.0) / (b.imag + b.real * r);
  36759. return __pyx_t_double_complex_from_parts(
  36760. (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
  36761. }
  36762. }
  36763. #else
  36764. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36765. if (b.imag == 0) {
  36766. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  36767. } else {
  36768. double denom = b.real * b.real + b.imag * b.imag;
  36769. return __pyx_t_double_complex_from_parts(
  36770. (a.real * b.real + a.imag * b.imag) / denom,
  36771. (a.imag * b.real - a.real * b.imag) / denom);
  36772. }
  36773. }
  36774. #endif
  36775. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
  36776. __pyx_t_double_complex z;
  36777. z.real = -a.real;
  36778. z.imag = -a.imag;
  36779. return z;
  36780. }
  36781. static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
  36782. return (a.real == 0) && (a.imag == 0);
  36783. }
  36784. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
  36785. __pyx_t_double_complex z;
  36786. z.real = a.real;
  36787. z.imag = -a.imag;
  36788. return z;
  36789. }
  36790. #if 1
  36791. static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
  36792. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  36793. return sqrt(z.real*z.real + z.imag*z.imag);
  36794. #else
  36795. return hypot(z.real, z.imag);
  36796. #endif
  36797. }
  36798. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36799. __pyx_t_double_complex z;
  36800. double r, lnr, theta, z_r, z_theta;
  36801. if (b.imag == 0 && b.real == (int)b.real) {
  36802. if (b.real < 0) {
  36803. double denom = a.real * a.real + a.imag * a.imag;
  36804. a.real = a.real / denom;
  36805. a.imag = -a.imag / denom;
  36806. b.real = -b.real;
  36807. }
  36808. switch ((int)b.real) {
  36809. case 0:
  36810. z.real = 1;
  36811. z.imag = 0;
  36812. return z;
  36813. case 1:
  36814. return a;
  36815. case 2:
  36816. return __Pyx_c_prod_double(a, a);
  36817. case 3:
  36818. z = __Pyx_c_prod_double(a, a);
  36819. return __Pyx_c_prod_double(z, a);
  36820. case 4:
  36821. z = __Pyx_c_prod_double(a, a);
  36822. return __Pyx_c_prod_double(z, z);
  36823. }
  36824. }
  36825. if (a.imag == 0) {
  36826. if (a.real == 0) {
  36827. return a;
  36828. } else if ((b.imag == 0) && (a.real >= 0)) {
  36829. z.real = pow(a.real, b.real);
  36830. z.imag = 0;
  36831. return z;
  36832. } else if (a.real > 0) {
  36833. r = a.real;
  36834. theta = 0;
  36835. } else {
  36836. r = -a.real;
  36837. theta = atan2(0.0, -1.0);
  36838. }
  36839. } else {
  36840. r = __Pyx_c_abs_double(a);
  36841. theta = atan2(a.imag, a.real);
  36842. }
  36843. lnr = log(r);
  36844. z_r = exp(lnr * b.real - theta * b.imag);
  36845. z_theta = theta * b.real + lnr * b.imag;
  36846. z.real = z_r * cos(z_theta);
  36847. z.imag = z_r * sin(z_theta);
  36848. return z;
  36849. }
  36850. #endif
  36851. #endif
  36852. /* FromPy */
  36853. static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject* o) {
  36854. #if CYTHON_COMPILING_IN_LIMITED_API
  36855. double real=-1.0, imag=-1.0;
  36856. real = PyComplex_RealAsDouble(o);
  36857. if (unlikely(real == -1.0 && PyErr_Occurred())) goto end;
  36858. imag = PyComplex_ImagAsDouble(o);
  36859. end:
  36860. return __pyx_t_double_complex_from_parts(
  36861. (double)real, (double)imag
  36862. );
  36863. #else
  36864. Py_complex cval;
  36865. #if !CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_GRAAL
  36866. if (PyComplex_CheckExact(o))
  36867. cval = ((PyComplexObject *)o)->cval;
  36868. else
  36869. #endif
  36870. cval = PyComplex_AsCComplex(o);
  36871. return __pyx_t_double_complex_from_parts(
  36872. (double)cval.real,
  36873. (double)cval.imag);
  36874. #endif
  36875. }
  36876. /* CIntToPy */
  36877. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
  36878. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  36879. #pragma GCC diagnostic push
  36880. #pragma GCC diagnostic ignored "-Wconversion"
  36881. #endif
  36882. const long neg_one = (long) -1, const_zero = (long) 0;
  36883. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  36884. #pragma GCC diagnostic pop
  36885. #endif
  36886. const int is_unsigned = neg_one > const_zero;
  36887. if (is_unsigned) {
  36888. if (sizeof(long) < sizeof(long)) {
  36889. return PyLong_FromLong((long) value);
  36890. } else if (sizeof(long) <= sizeof(unsigned long)) {
  36891. return PyLong_FromUnsignedLong((unsigned long) value);
  36892. #if !CYTHON_COMPILING_IN_PYPY
  36893. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  36894. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  36895. #endif
  36896. }
  36897. } else {
  36898. if (sizeof(long) <= sizeof(long)) {
  36899. return PyLong_FromLong((long) value);
  36900. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  36901. return PyLong_FromLongLong((PY_LONG_LONG) value);
  36902. }
  36903. }
  36904. {
  36905. unsigned char *bytes = (unsigned char *)&value;
  36906. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
  36907. if (is_unsigned) {
  36908. return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
  36909. } else {
  36910. return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
  36911. }
  36912. #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
  36913. int one = 1; int little = (int)*(unsigned char *)&one;
  36914. return _PyLong_FromByteArray(bytes, sizeof(long),
  36915. little, !is_unsigned);
  36916. #else
  36917. int one = 1; int little = (int)*(unsigned char *)&one;
  36918. PyObject *from_bytes, *result = NULL, *kwds = NULL;
  36919. PyObject *py_bytes = NULL, *order_str = NULL;
  36920. from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
  36921. if (!from_bytes) return NULL;
  36922. py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
  36923. if (!py_bytes) goto limited_bad;
  36924. order_str = PyUnicode_FromString(little ? "little" : "big");
  36925. if (!order_str) goto limited_bad;
  36926. {
  36927. PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
  36928. if (!is_unsigned) {
  36929. kwds = __Pyx_MakeVectorcallBuilderKwds(1);
  36930. if (!kwds) goto limited_bad;
  36931. if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
  36932. }
  36933. result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
  36934. }
  36935. limited_bad:
  36936. Py_XDECREF(kwds);
  36937. Py_XDECREF(order_str);
  36938. Py_XDECREF(py_bytes);
  36939. Py_XDECREF(from_bytes);
  36940. return result;
  36941. #endif
  36942. }
  36943. }
  36944. /* FormatTypeName */
  36945. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
  36946. static __Pyx_TypeName
  36947. __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
  36948. {
  36949. PyObject *module = NULL, *name = NULL, *result = NULL;
  36950. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  36951. name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
  36952. __pyx_mstate_global->__pyx_n_u_qualname);
  36953. #else
  36954. name = PyType_GetQualName(tp);
  36955. #endif
  36956. if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
  36957. module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
  36958. __pyx_mstate_global->__pyx_n_u_module);
  36959. if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
  36960. if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
  36961. result = name;
  36962. name = NULL;
  36963. goto done;
  36964. }
  36965. result = PyUnicode_FromFormat("%U.%U", module, name);
  36966. if (unlikely(result == NULL)) goto bad;
  36967. done:
  36968. Py_XDECREF(name);
  36969. Py_XDECREF(module);
  36970. return result;
  36971. bad:
  36972. PyErr_Clear();
  36973. if (name) {
  36974. result = name;
  36975. name = NULL;
  36976. } else {
  36977. result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__3);
  36978. }
  36979. goto done;
  36980. }
  36981. #endif
  36982. /* CIntFromPyVerify (used by CIntFromPy) */
  36983. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  36984. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  36985. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  36986. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  36987. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  36988. {\
  36989. func_type value = func_value;\
  36990. if (sizeof(target_type) < sizeof(func_type)) {\
  36991. if (unlikely(value != (func_type) (target_type) value)) {\
  36992. func_type zero = 0;\
  36993. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  36994. return (target_type) -1;\
  36995. if (is_unsigned && unlikely(value < zero))\
  36996. goto raise_neg_overflow;\
  36997. else\
  36998. goto raise_overflow;\
  36999. }\
  37000. }\
  37001. return (target_type) value;\
  37002. }
  37003. /* CIntFromPy */
  37004. static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
  37005. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  37006. #pragma GCC diagnostic push
  37007. #pragma GCC diagnostic ignored "-Wconversion"
  37008. #endif
  37009. const long neg_one = (long) -1, const_zero = (long) 0;
  37010. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  37011. #pragma GCC diagnostic pop
  37012. #endif
  37013. const int is_unsigned = neg_one > const_zero;
  37014. if (unlikely(!PyLong_Check(x))) {
  37015. long val;
  37016. PyObject *tmp = __Pyx_PyNumber_Long(x);
  37017. if (!tmp) return (long) -1;
  37018. val = __Pyx_PyLong_As_long(tmp);
  37019. Py_DECREF(tmp);
  37020. return val;
  37021. }
  37022. if (is_unsigned) {
  37023. #if CYTHON_USE_PYLONG_INTERNALS
  37024. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  37025. goto raise_neg_overflow;
  37026. } else if (__Pyx_PyLong_IsCompact(x)) {
  37027. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  37028. } else {
  37029. const digit* digits = __Pyx_PyLong_Digits(x);
  37030. assert(__Pyx_PyLong_DigitCount(x) > 1);
  37031. switch (__Pyx_PyLong_DigitCount(x)) {
  37032. case 2:
  37033. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  37034. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37035. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37036. } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
  37037. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  37038. }
  37039. }
  37040. break;
  37041. case 3:
  37042. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  37043. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37044. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37045. } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
  37046. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  37047. }
  37048. }
  37049. break;
  37050. case 4:
  37051. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  37052. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37053. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37054. } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
  37055. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  37056. }
  37057. }
  37058. break;
  37059. }
  37060. }
  37061. #endif
  37062. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  37063. if (unlikely(Py_SIZE(x) < 0)) {
  37064. goto raise_neg_overflow;
  37065. }
  37066. #else
  37067. {
  37068. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  37069. if (unlikely(result < 0))
  37070. return (long) -1;
  37071. if (unlikely(result == 1))
  37072. goto raise_neg_overflow;
  37073. }
  37074. #endif
  37075. if ((sizeof(long) <= sizeof(unsigned long))) {
  37076. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  37077. } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
  37078. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  37079. }
  37080. } else {
  37081. #if CYTHON_USE_PYLONG_INTERNALS
  37082. if (__Pyx_PyLong_IsCompact(x)) {
  37083. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  37084. } else {
  37085. const digit* digits = __Pyx_PyLong_Digits(x);
  37086. assert(__Pyx_PyLong_DigitCount(x) > 1);
  37087. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  37088. case -2:
  37089. if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
  37090. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37091. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37092. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  37093. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37094. }
  37095. }
  37096. break;
  37097. case 2:
  37098. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  37099. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37100. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37101. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  37102. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37103. }
  37104. }
  37105. break;
  37106. case -3:
  37107. if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  37108. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37109. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37110. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  37111. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37112. }
  37113. }
  37114. break;
  37115. case 3:
  37116. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  37117. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37118. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37119. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  37120. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37121. }
  37122. }
  37123. break;
  37124. case -4:
  37125. if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  37126. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37127. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37128. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  37129. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37130. }
  37131. }
  37132. break;
  37133. case 4:
  37134. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  37135. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37136. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37137. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  37138. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37139. }
  37140. }
  37141. break;
  37142. }
  37143. }
  37144. #endif
  37145. if ((sizeof(long) <= sizeof(long))) {
  37146. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  37147. } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
  37148. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  37149. }
  37150. }
  37151. {
  37152. long val;
  37153. int ret = -1;
  37154. #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
  37155. Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
  37156. x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
  37157. if (unlikely(bytes_copied == -1)) {
  37158. } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
  37159. goto raise_overflow;
  37160. } else {
  37161. ret = 0;
  37162. }
  37163. #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  37164. int one = 1; int is_little = (int)*(unsigned char *)&one;
  37165. unsigned char *bytes = (unsigned char *)&val;
  37166. ret = _PyLong_AsByteArray((PyLongObject *)x,
  37167. bytes, sizeof(val),
  37168. is_little, !is_unsigned);
  37169. #else
  37170. PyObject *v;
  37171. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  37172. int bits, remaining_bits, is_negative = 0;
  37173. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  37174. if (likely(PyLong_CheckExact(x))) {
  37175. v = __Pyx_NewRef(x);
  37176. } else {
  37177. v = PyNumber_Long(x);
  37178. if (unlikely(!v)) return (long) -1;
  37179. assert(PyLong_CheckExact(v));
  37180. }
  37181. {
  37182. int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
  37183. if (unlikely(result < 0)) {
  37184. Py_DECREF(v);
  37185. return (long) -1;
  37186. }
  37187. is_negative = result == 1;
  37188. }
  37189. if (is_unsigned && unlikely(is_negative)) {
  37190. Py_DECREF(v);
  37191. goto raise_neg_overflow;
  37192. } else if (is_negative) {
  37193. stepval = PyNumber_Invert(v);
  37194. Py_DECREF(v);
  37195. if (unlikely(!stepval))
  37196. return (long) -1;
  37197. } else {
  37198. stepval = v;
  37199. }
  37200. v = NULL;
  37201. val = (long) 0;
  37202. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  37203. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  37204. for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
  37205. PyObject *tmp, *digit;
  37206. long idigit;
  37207. digit = PyNumber_And(stepval, mask);
  37208. if (unlikely(!digit)) goto done;
  37209. idigit = PyLong_AsLong(digit);
  37210. Py_DECREF(digit);
  37211. if (unlikely(idigit < 0)) goto done;
  37212. val |= ((long) idigit) << bits;
  37213. tmp = PyNumber_Rshift(stepval, shift);
  37214. if (unlikely(!tmp)) goto done;
  37215. Py_DECREF(stepval); stepval = tmp;
  37216. }
  37217. Py_DECREF(shift); shift = NULL;
  37218. Py_DECREF(mask); mask = NULL;
  37219. {
  37220. long idigit = PyLong_AsLong(stepval);
  37221. if (unlikely(idigit < 0)) goto done;
  37222. remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
  37223. if (unlikely(idigit >= (1L << remaining_bits)))
  37224. goto raise_overflow;
  37225. val |= ((long) idigit) << bits;
  37226. }
  37227. if (!is_unsigned) {
  37228. if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
  37229. goto raise_overflow;
  37230. if (is_negative)
  37231. val = ~val;
  37232. }
  37233. ret = 0;
  37234. done:
  37235. Py_XDECREF(shift);
  37236. Py_XDECREF(mask);
  37237. Py_XDECREF(stepval);
  37238. #endif
  37239. if (unlikely(ret))
  37240. return (long) -1;
  37241. return val;
  37242. }
  37243. raise_overflow:
  37244. PyErr_SetString(PyExc_OverflowError,
  37245. "value too large to convert to long");
  37246. return (long) -1;
  37247. raise_neg_overflow:
  37248. PyErr_SetString(PyExc_OverflowError,
  37249. "can't convert negative value to long");
  37250. return (long) -1;
  37251. }
  37252. /* CIntFromPy */
  37253. static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
  37254. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  37255. #pragma GCC diagnostic push
  37256. #pragma GCC diagnostic ignored "-Wconversion"
  37257. #endif
  37258. const int neg_one = (int) -1, const_zero = (int) 0;
  37259. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  37260. #pragma GCC diagnostic pop
  37261. #endif
  37262. const int is_unsigned = neg_one > const_zero;
  37263. if (unlikely(!PyLong_Check(x))) {
  37264. int val;
  37265. PyObject *tmp = __Pyx_PyNumber_Long(x);
  37266. if (!tmp) return (int) -1;
  37267. val = __Pyx_PyLong_As_int(tmp);
  37268. Py_DECREF(tmp);
  37269. return val;
  37270. }
  37271. if (is_unsigned) {
  37272. #if CYTHON_USE_PYLONG_INTERNALS
  37273. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  37274. goto raise_neg_overflow;
  37275. } else if (__Pyx_PyLong_IsCompact(x)) {
  37276. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  37277. } else {
  37278. const digit* digits = __Pyx_PyLong_Digits(x);
  37279. assert(__Pyx_PyLong_DigitCount(x) > 1);
  37280. switch (__Pyx_PyLong_DigitCount(x)) {
  37281. case 2:
  37282. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  37283. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37284. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37285. } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
  37286. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  37287. }
  37288. }
  37289. break;
  37290. case 3:
  37291. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  37292. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37293. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37294. } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
  37295. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  37296. }
  37297. }
  37298. break;
  37299. case 4:
  37300. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  37301. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37302. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37303. } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
  37304. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  37305. }
  37306. }
  37307. break;
  37308. }
  37309. }
  37310. #endif
  37311. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  37312. if (unlikely(Py_SIZE(x) < 0)) {
  37313. goto raise_neg_overflow;
  37314. }
  37315. #else
  37316. {
  37317. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  37318. if (unlikely(result < 0))
  37319. return (int) -1;
  37320. if (unlikely(result == 1))
  37321. goto raise_neg_overflow;
  37322. }
  37323. #endif
  37324. if ((sizeof(int) <= sizeof(unsigned long))) {
  37325. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  37326. } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
  37327. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  37328. }
  37329. } else {
  37330. #if CYTHON_USE_PYLONG_INTERNALS
  37331. if (__Pyx_PyLong_IsCompact(x)) {
  37332. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  37333. } else {
  37334. const digit* digits = __Pyx_PyLong_Digits(x);
  37335. assert(__Pyx_PyLong_DigitCount(x) > 1);
  37336. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  37337. case -2:
  37338. if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
  37339. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37340. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37341. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  37342. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37343. }
  37344. }
  37345. break;
  37346. case 2:
  37347. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  37348. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37349. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37350. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  37351. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37352. }
  37353. }
  37354. break;
  37355. case -3:
  37356. if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  37357. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37358. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37359. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  37360. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37361. }
  37362. }
  37363. break;
  37364. case 3:
  37365. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  37366. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37367. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37368. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  37369. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37370. }
  37371. }
  37372. break;
  37373. case -4:
  37374. if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  37375. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37376. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37377. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  37378. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37379. }
  37380. }
  37381. break;
  37382. case 4:
  37383. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  37384. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37385. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37386. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  37387. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37388. }
  37389. }
  37390. break;
  37391. }
  37392. }
  37393. #endif
  37394. if ((sizeof(int) <= sizeof(long))) {
  37395. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  37396. } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
  37397. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  37398. }
  37399. }
  37400. {
  37401. int val;
  37402. int ret = -1;
  37403. #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
  37404. Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
  37405. x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
  37406. if (unlikely(bytes_copied == -1)) {
  37407. } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
  37408. goto raise_overflow;
  37409. } else {
  37410. ret = 0;
  37411. }
  37412. #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  37413. int one = 1; int is_little = (int)*(unsigned char *)&one;
  37414. unsigned char *bytes = (unsigned char *)&val;
  37415. ret = _PyLong_AsByteArray((PyLongObject *)x,
  37416. bytes, sizeof(val),
  37417. is_little, !is_unsigned);
  37418. #else
  37419. PyObject *v;
  37420. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  37421. int bits, remaining_bits, is_negative = 0;
  37422. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  37423. if (likely(PyLong_CheckExact(x))) {
  37424. v = __Pyx_NewRef(x);
  37425. } else {
  37426. v = PyNumber_Long(x);
  37427. if (unlikely(!v)) return (int) -1;
  37428. assert(PyLong_CheckExact(v));
  37429. }
  37430. {
  37431. int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
  37432. if (unlikely(result < 0)) {
  37433. Py_DECREF(v);
  37434. return (int) -1;
  37435. }
  37436. is_negative = result == 1;
  37437. }
  37438. if (is_unsigned && unlikely(is_negative)) {
  37439. Py_DECREF(v);
  37440. goto raise_neg_overflow;
  37441. } else if (is_negative) {
  37442. stepval = PyNumber_Invert(v);
  37443. Py_DECREF(v);
  37444. if (unlikely(!stepval))
  37445. return (int) -1;
  37446. } else {
  37447. stepval = v;
  37448. }
  37449. v = NULL;
  37450. val = (int) 0;
  37451. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  37452. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  37453. for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
  37454. PyObject *tmp, *digit;
  37455. long idigit;
  37456. digit = PyNumber_And(stepval, mask);
  37457. if (unlikely(!digit)) goto done;
  37458. idigit = PyLong_AsLong(digit);
  37459. Py_DECREF(digit);
  37460. if (unlikely(idigit < 0)) goto done;
  37461. val |= ((int) idigit) << bits;
  37462. tmp = PyNumber_Rshift(stepval, shift);
  37463. if (unlikely(!tmp)) goto done;
  37464. Py_DECREF(stepval); stepval = tmp;
  37465. }
  37466. Py_DECREF(shift); shift = NULL;
  37467. Py_DECREF(mask); mask = NULL;
  37468. {
  37469. long idigit = PyLong_AsLong(stepval);
  37470. if (unlikely(idigit < 0)) goto done;
  37471. remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
  37472. if (unlikely(idigit >= (1L << remaining_bits)))
  37473. goto raise_overflow;
  37474. val |= ((int) idigit) << bits;
  37475. }
  37476. if (!is_unsigned) {
  37477. if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
  37478. goto raise_overflow;
  37479. if (is_negative)
  37480. val = ~val;
  37481. }
  37482. ret = 0;
  37483. done:
  37484. Py_XDECREF(shift);
  37485. Py_XDECREF(mask);
  37486. Py_XDECREF(stepval);
  37487. #endif
  37488. if (unlikely(ret))
  37489. return (int) -1;
  37490. return val;
  37491. }
  37492. raise_overflow:
  37493. PyErr_SetString(PyExc_OverflowError,
  37494. "value too large to convert to int");
  37495. return (int) -1;
  37496. raise_neg_overflow:
  37497. PyErr_SetString(PyExc_OverflowError,
  37498. "can't convert negative value to int");
  37499. return (int) -1;
  37500. }
  37501. /* FastTypeChecks */
  37502. #if CYTHON_COMPILING_IN_CPYTHON
  37503. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  37504. while (a) {
  37505. a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
  37506. if (a == b)
  37507. return 1;
  37508. }
  37509. return b == &PyBaseObject_Type;
  37510. }
  37511. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  37512. PyObject *mro;
  37513. if (a == b) return 1;
  37514. mro = a->tp_mro;
  37515. if (likely(mro)) {
  37516. Py_ssize_t i, n;
  37517. n = PyTuple_GET_SIZE(mro);
  37518. for (i = 0; i < n; i++) {
  37519. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  37520. return 1;
  37521. }
  37522. return 0;
  37523. }
  37524. return __Pyx_InBases(a, b);
  37525. }
  37526. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
  37527. PyObject *mro;
  37528. if (cls == a || cls == b) return 1;
  37529. mro = cls->tp_mro;
  37530. if (likely(mro)) {
  37531. Py_ssize_t i, n;
  37532. n = PyTuple_GET_SIZE(mro);
  37533. for (i = 0; i < n; i++) {
  37534. PyObject *base = PyTuple_GET_ITEM(mro, i);
  37535. if (base == (PyObject *)a || base == (PyObject *)b)
  37536. return 1;
  37537. }
  37538. return 0;
  37539. }
  37540. return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
  37541. }
  37542. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  37543. if (exc_type1) {
  37544. return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
  37545. } else {
  37546. return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  37547. }
  37548. }
  37549. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  37550. Py_ssize_t i, n;
  37551. assert(PyExceptionClass_Check(exc_type));
  37552. n = PyTuple_GET_SIZE(tuple);
  37553. for (i=0; i<n; i++) {
  37554. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  37555. }
  37556. for (i=0; i<n; i++) {
  37557. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  37558. if (likely(PyExceptionClass_Check(t))) {
  37559. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  37560. } else {
  37561. }
  37562. }
  37563. return 0;
  37564. }
  37565. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  37566. if (likely(err == exc_type)) return 1;
  37567. if (likely(PyExceptionClass_Check(err))) {
  37568. if (likely(PyExceptionClass_Check(exc_type))) {
  37569. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  37570. } else if (likely(PyTuple_Check(exc_type))) {
  37571. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  37572. } else {
  37573. }
  37574. }
  37575. return PyErr_GivenExceptionMatches(err, exc_type);
  37576. }
  37577. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  37578. assert(PyExceptionClass_Check(exc_type1));
  37579. assert(PyExceptionClass_Check(exc_type2));
  37580. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  37581. if (likely(PyExceptionClass_Check(err))) {
  37582. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  37583. }
  37584. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  37585. }
  37586. #endif
  37587. /* GetRuntimeVersion */
  37588. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  37589. void __Pyx_init_runtime_version(void) {
  37590. if (__Pyx_cached_runtime_version == 0) {
  37591. const char* rt_version = Py_GetVersion();
  37592. unsigned long version = 0;
  37593. unsigned long factor = 0x01000000UL;
  37594. unsigned int digit = 0;
  37595. int i = 0;
  37596. while (factor) {
  37597. while ('0' <= rt_version[i] && rt_version[i] <= '9') {
  37598. digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
  37599. ++i;
  37600. }
  37601. version += factor * digit;
  37602. if (rt_version[i] != '.')
  37603. break;
  37604. digit = 0;
  37605. factor >>= 8;
  37606. ++i;
  37607. }
  37608. __Pyx_cached_runtime_version = version;
  37609. }
  37610. }
  37611. #endif
  37612. static unsigned long __Pyx_get_runtime_version(void) {
  37613. #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  37614. return Py_Version & ~0xFFUL;
  37615. #else
  37616. return __Pyx_cached_runtime_version;
  37617. #endif
  37618. }
  37619. /* CheckBinaryVersion */
  37620. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
  37621. const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
  37622. if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
  37623. return 0;
  37624. if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
  37625. return 1;
  37626. {
  37627. char message[200];
  37628. PyOS_snprintf(message, sizeof(message),
  37629. "compile time Python version %d.%d "
  37630. "of module '%.100s' "
  37631. "%s "
  37632. "runtime version %d.%d",
  37633. (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
  37634. __Pyx_MODULE_NAME,
  37635. (allow_newer) ? "was newer than" : "does not match",
  37636. (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
  37637. );
  37638. return PyErr_WarnEx(NULL, message, 1);
  37639. }
  37640. }
  37641. /* NewCodeObj */
  37642. #if CYTHON_COMPILING_IN_LIMITED_API
  37643. static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
  37644. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  37645. PyObject *fv, PyObject *cell, PyObject* fn,
  37646. PyObject *name, int fline, PyObject *lnos) {
  37647. PyObject *exception_table = NULL;
  37648. PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
  37649. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  37650. PyObject *version_info;
  37651. PyObject *py_minor_version = NULL;
  37652. #endif
  37653. long minor_version = 0;
  37654. PyObject *type, *value, *traceback;
  37655. PyErr_Fetch(&type, &value, &traceback);
  37656. #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  37657. minor_version = 11;
  37658. #else
  37659. if (!(version_info = PySys_GetObject("version_info"))) goto end;
  37660. if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
  37661. minor_version = PyLong_AsLong(py_minor_version);
  37662. Py_DECREF(py_minor_version);
  37663. if (minor_version == -1 && PyErr_Occurred()) goto end;
  37664. #endif
  37665. if (!(types_module = PyImport_ImportModule("types"))) goto end;
  37666. if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
  37667. if (minor_version <= 7) {
  37668. (void)p;
  37669. result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
  37670. c, n, v, fn, name, fline, lnos, fv, cell);
  37671. } else if (minor_version <= 10) {
  37672. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
  37673. c, n, v, fn, name, fline, lnos, fv, cell);
  37674. } else {
  37675. if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
  37676. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
  37677. c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
  37678. }
  37679. end:
  37680. Py_XDECREF(code_type);
  37681. Py_XDECREF(exception_table);
  37682. Py_XDECREF(types_module);
  37683. if (type) {
  37684. PyErr_Restore(type, value, traceback);
  37685. }
  37686. return result;
  37687. }
  37688. #elif PY_VERSION_HEX >= 0x030B0000
  37689. static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
  37690. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  37691. PyObject *fv, PyObject *cell, PyObject* fn,
  37692. PyObject *name, int fline, PyObject *lnos) {
  37693. PyCodeObject *result;
  37694. result =
  37695. #if PY_VERSION_HEX >= 0x030C0000
  37696. PyUnstable_Code_NewWithPosOnlyArgs
  37697. #else
  37698. PyCode_NewWithPosOnlyArgs
  37699. #endif
  37700. (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
  37701. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
  37702. if (likely(result))
  37703. result->_co_firsttraceable = 0;
  37704. #endif
  37705. return result;
  37706. }
  37707. #elif !CYTHON_COMPILING_IN_PYPY
  37708. #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  37709. PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  37710. #else
  37711. #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  37712. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  37713. #endif
  37714. static PyObject* __Pyx_PyCode_New(
  37715. const __Pyx_PyCode_New_function_description descr,
  37716. PyObject * const *varnames,
  37717. PyObject *filename,
  37718. PyObject *funcname,
  37719. PyObject *line_table,
  37720. PyObject *tuple_dedup_map
  37721. ) {
  37722. PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
  37723. Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
  37724. PyObject *varnames_tuple = PyTuple_New(var_count);
  37725. if (unlikely(!varnames_tuple)) return NULL;
  37726. for (Py_ssize_t i=0; i < var_count; i++) {
  37727. Py_INCREF(varnames[i]);
  37728. if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
  37729. }
  37730. #if CYTHON_COMPILING_IN_LIMITED_API
  37731. varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
  37732. if (!varnames_tuple_dedup) {
  37733. if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
  37734. varnames_tuple_dedup = varnames_tuple;
  37735. }
  37736. #else
  37737. varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
  37738. if (unlikely(!varnames_tuple_dedup)) goto done;
  37739. #endif
  37740. #if CYTHON_AVOID_BORROWED_REFS
  37741. Py_INCREF(varnames_tuple_dedup);
  37742. #endif
  37743. if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
  37744. Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
  37745. #if !CYTHON_ASSUME_SAFE_SIZE
  37746. if (unlikely(line_table_length == -1)) goto done;
  37747. #endif
  37748. Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
  37749. code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
  37750. if (unlikely(!code_bytes)) goto done;
  37751. char* c_code_bytes = PyBytes_AsString(code_bytes);
  37752. if (unlikely(!c_code_bytes)) goto done;
  37753. memset(c_code_bytes, 0, (size_t) code_len);
  37754. }
  37755. code_obj = (PyObject*) __Pyx__PyCode_New(
  37756. (int) descr.argcount,
  37757. (int) descr.num_posonly_args,
  37758. (int) descr.num_kwonly_args,
  37759. (int) descr.nlocals,
  37760. 0,
  37761. (int) descr.flags,
  37762. code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
  37763. __pyx_mstate_global->__pyx_empty_tuple,
  37764. __pyx_mstate_global->__pyx_empty_tuple,
  37765. varnames_tuple_dedup,
  37766. __pyx_mstate_global->__pyx_empty_tuple,
  37767. __pyx_mstate_global->__pyx_empty_tuple,
  37768. filename,
  37769. funcname,
  37770. (int) descr.first_line,
  37771. (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
  37772. );
  37773. done:
  37774. Py_XDECREF(code_bytes);
  37775. #if CYTHON_AVOID_BORROWED_REFS
  37776. Py_XDECREF(varnames_tuple_dedup);
  37777. #endif
  37778. Py_DECREF(varnames_tuple);
  37779. return code_obj;
  37780. }
  37781. /* DecompressString */
  37782. static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
  37783. PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed;
  37784. const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
  37785. PyObject *methodname = PyUnicode_FromString("decompress");
  37786. if (unlikely(!methodname)) return NULL;
  37787. #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
  37788. if (algo == 3) {
  37789. PyObject *fromlist = Py_BuildValue("[O]", methodname);
  37790. if (unlikely(!fromlist)) goto bad;
  37791. module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
  37792. Py_DECREF(fromlist);
  37793. } else
  37794. #endif
  37795. module = PyImport_ImportModule(module_name);
  37796. if (unlikely(!module)) goto import_failed;
  37797. decompress = PyObject_GetAttr(module, methodname);
  37798. if (unlikely(!decompress)) goto import_failed;
  37799. {
  37800. #ifdef __cplusplus
  37801. char *memview_bytes = const_cast<char*>(s);
  37802. #else
  37803. #if defined(__clang__)
  37804. #pragma clang diagnostic push
  37805. #pragma clang diagnostic ignored "-Wcast-qual"
  37806. #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
  37807. #pragma GCC diagnostic push
  37808. #pragma GCC diagnostic ignored "-Wcast-qual"
  37809. #endif
  37810. char *memview_bytes = (char*) s;
  37811. #if defined(__clang__)
  37812. #pragma clang diagnostic pop
  37813. #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
  37814. #pragma GCC diagnostic pop
  37815. #endif
  37816. #endif
  37817. #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
  37818. int memview_flags = 0x100;
  37819. #else
  37820. int memview_flags = PyBUF_READ;
  37821. #endif
  37822. compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
  37823. }
  37824. if (unlikely(!compressed_bytes)) {
  37825. Py_DECREF(decompress);
  37826. goto bad;
  37827. }
  37828. decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
  37829. Py_DECREF(compressed_bytes);
  37830. Py_DECREF(decompress);
  37831. Py_DECREF(module);
  37832. Py_DECREF(methodname);
  37833. return decompressed;
  37834. import_failed:
  37835. PyErr_Format(PyExc_ImportError,
  37836. "Failed to import '%.20s.decompress' - cannot initialise module strings. "
  37837. "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
  37838. module_name, algo);
  37839. bad:
  37840. Py_XDECREF(module);
  37841. Py_DECREF(methodname);
  37842. return NULL;
  37843. }
  37844. #include <string.h>
  37845. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
  37846. size_t len = strlen(s);
  37847. if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
  37848. PyErr_SetString(PyExc_OverflowError, "byte string is too long");
  37849. return -1;
  37850. }
  37851. return (Py_ssize_t) len;
  37852. }
  37853. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  37854. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  37855. if (unlikely(len < 0)) return NULL;
  37856. return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
  37857. }
  37858. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
  37859. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  37860. if (unlikely(len < 0)) return NULL;
  37861. return PyByteArray_FromStringAndSize(c_str, len);
  37862. }
  37863. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  37864. Py_ssize_t ignore;
  37865. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  37866. }
  37867. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  37868. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  37869. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  37870. #if CYTHON_COMPILING_IN_LIMITED_API
  37871. {
  37872. const char* result;
  37873. Py_ssize_t unicode_length;
  37874. CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  37875. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  37876. if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
  37877. #else
  37878. result = PyUnicode_AsUTF8AndSize(o, length);
  37879. #endif
  37880. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  37881. unicode_length = PyUnicode_GetLength(o);
  37882. if (unlikely(unicode_length < 0)) return NULL;
  37883. if (unlikely(unicode_length != *length)) {
  37884. PyUnicode_AsASCIIString(o);
  37885. return NULL;
  37886. }
  37887. #endif
  37888. return result;
  37889. }
  37890. #else
  37891. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  37892. if (likely(PyUnicode_IS_ASCII(o))) {
  37893. *length = PyUnicode_GET_LENGTH(o);
  37894. return PyUnicode_AsUTF8(o);
  37895. } else {
  37896. PyUnicode_AsASCIIString(o);
  37897. return NULL;
  37898. }
  37899. #else
  37900. return PyUnicode_AsUTF8AndSize(o, length);
  37901. #endif
  37902. #endif
  37903. }
  37904. #endif
  37905. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  37906. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  37907. if (PyUnicode_Check(o)) {
  37908. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  37909. } else
  37910. #endif
  37911. if (PyByteArray_Check(o)) {
  37912. #if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
  37913. *length = PyByteArray_GET_SIZE(o);
  37914. return PyByteArray_AS_STRING(o);
  37915. #else
  37916. *length = PyByteArray_Size(o);
  37917. if (*length == -1) return NULL;
  37918. return PyByteArray_AsString(o);
  37919. #endif
  37920. } else
  37921. {
  37922. char* result;
  37923. int r = PyBytes_AsStringAndSize(o, &result, length);
  37924. if (unlikely(r < 0)) {
  37925. return NULL;
  37926. } else {
  37927. return result;
  37928. }
  37929. }
  37930. }
  37931. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  37932. int is_true = x == Py_True;
  37933. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  37934. else return PyObject_IsTrue(x);
  37935. }
  37936. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  37937. int retval;
  37938. if (unlikely(!x)) return -1;
  37939. retval = __Pyx_PyObject_IsTrue(x);
  37940. Py_DECREF(x);
  37941. return retval;
  37942. }
  37943. static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
  37944. __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
  37945. if (PyLong_Check(result)) {
  37946. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  37947. "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
  37948. "The ability to return an instance of a strict subclass of int is deprecated, "
  37949. "and may be removed in a future version of Python.",
  37950. result_type_name)) {
  37951. __Pyx_DECREF_TypeName(result_type_name);
  37952. Py_DECREF(result);
  37953. return NULL;
  37954. }
  37955. __Pyx_DECREF_TypeName(result_type_name);
  37956. return result;
  37957. }
  37958. PyErr_Format(PyExc_TypeError,
  37959. "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
  37960. result_type_name);
  37961. __Pyx_DECREF_TypeName(result_type_name);
  37962. Py_DECREF(result);
  37963. return NULL;
  37964. }
  37965. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
  37966. #if CYTHON_USE_TYPE_SLOTS
  37967. PyNumberMethods *m;
  37968. #endif
  37969. PyObject *res = NULL;
  37970. if (likely(PyLong_Check(x)))
  37971. return __Pyx_NewRef(x);
  37972. #if CYTHON_USE_TYPE_SLOTS
  37973. m = Py_TYPE(x)->tp_as_number;
  37974. if (likely(m && m->nb_int)) {
  37975. res = m->nb_int(x);
  37976. }
  37977. #else
  37978. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  37979. res = PyNumber_Long(x);
  37980. }
  37981. #endif
  37982. if (likely(res)) {
  37983. if (unlikely(!PyLong_CheckExact(res))) {
  37984. return __Pyx_PyNumber_LongWrongResultType(res);
  37985. }
  37986. }
  37987. else if (!PyErr_Occurred()) {
  37988. PyErr_SetString(PyExc_TypeError,
  37989. "an integer is required");
  37990. }
  37991. return res;
  37992. }
  37993. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  37994. Py_ssize_t ival;
  37995. PyObject *x;
  37996. if (likely(PyLong_CheckExact(b))) {
  37997. #if CYTHON_USE_PYLONG_INTERNALS
  37998. if (likely(__Pyx_PyLong_IsCompact(b))) {
  37999. return __Pyx_PyLong_CompactValue(b);
  38000. } else {
  38001. const digit* digits = __Pyx_PyLong_Digits(b);
  38002. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
  38003. switch (size) {
  38004. case 2:
  38005. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  38006. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  38007. }
  38008. break;
  38009. case -2:
  38010. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  38011. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  38012. }
  38013. break;
  38014. case 3:
  38015. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  38016. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  38017. }
  38018. break;
  38019. case -3:
  38020. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  38021. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  38022. }
  38023. break;
  38024. case 4:
  38025. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  38026. return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  38027. }
  38028. break;
  38029. case -4:
  38030. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  38031. return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  38032. }
  38033. break;
  38034. }
  38035. }
  38036. #endif
  38037. return PyLong_AsSsize_t(b);
  38038. }
  38039. x = PyNumber_Index(b);
  38040. if (!x) return -1;
  38041. ival = PyLong_AsSsize_t(x);
  38042. Py_DECREF(x);
  38043. return ival;
  38044. }
  38045. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  38046. if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
  38047. return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  38048. } else {
  38049. Py_ssize_t ival;
  38050. PyObject *x;
  38051. x = PyNumber_Index(o);
  38052. if (!x) return -1;
  38053. ival = PyLong_AsLong(x);
  38054. Py_DECREF(x);
  38055. return ival;
  38056. }
  38057. }
  38058. static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
  38059. CYTHON_UNUSED_VAR(b);
  38060. return __Pyx_NewRef(Py_None);
  38061. }
  38062. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  38063. return __Pyx_NewRef(b ? Py_True: Py_False);
  38064. }
  38065. static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
  38066. return PyLong_FromSize_t(ival);
  38067. }
  38068. /* MultiPhaseInitModuleState */
  38069. #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
  38070. #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38071. #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
  38072. #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
  38073. #else
  38074. #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
  38075. #endif
  38076. #endif
  38077. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
  38078. #error "Module state with PEP489 requires atomics. Currently that's one of\
  38079. C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
  38080. #endif
  38081. #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38082. #define __Pyx_ModuleStateLookup_Lock()
  38083. #define __Pyx_ModuleStateLookup_Unlock()
  38084. #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
  38085. static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
  38086. #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
  38087. #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
  38088. #elif defined(__cplusplus) && __cplusplus >= 201103L
  38089. #include <mutex>
  38090. static std::mutex __Pyx_ModuleStateLookup_mutex;
  38091. #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
  38092. #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
  38093. #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
  38094. #include <threads.h>
  38095. static mtx_t __Pyx_ModuleStateLookup_mutex;
  38096. static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
  38097. static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
  38098. mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
  38099. }
  38100. #define __Pyx_ModuleStateLookup_Lock()\
  38101. call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
  38102. mtx_lock(&__Pyx_ModuleStateLookup_mutex)
  38103. #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
  38104. #elif defined(HAVE_PTHREAD_H)
  38105. #include <pthread.h>
  38106. static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
  38107. #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
  38108. #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
  38109. #elif defined(_WIN32)
  38110. #include <Windows.h> // synchapi.h on its own doesn't work
  38111. static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
  38112. #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  38113. #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  38114. #else
  38115. #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
  38116. Requires C standard >= C11, or C++ standard >= C++11,\
  38117. or pthreads, or the Windows 32 API, or Python >= 3.13."
  38118. #endif
  38119. typedef struct {
  38120. int64_t id;
  38121. PyObject *module;
  38122. } __Pyx_InterpreterIdAndModule;
  38123. typedef struct {
  38124. char interpreter_id_as_index;
  38125. Py_ssize_t count;
  38126. Py_ssize_t allocated;
  38127. __Pyx_InterpreterIdAndModule table[1];
  38128. } __Pyx_ModuleStateLookupData;
  38129. #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
  38130. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38131. static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
  38132. #endif
  38133. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38134. static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
  38135. #else
  38136. static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
  38137. #endif
  38138. static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
  38139. __Pyx_InterpreterIdAndModule* table,
  38140. Py_ssize_t count,
  38141. int64_t interpreterId) {
  38142. __Pyx_InterpreterIdAndModule* begin = table;
  38143. __Pyx_InterpreterIdAndModule* end = begin + count;
  38144. if (begin->id == interpreterId) {
  38145. return begin;
  38146. }
  38147. while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
  38148. __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
  38149. if (halfway->id == interpreterId) {
  38150. return halfway;
  38151. }
  38152. if (halfway->id < interpreterId) {
  38153. begin = halfway;
  38154. } else {
  38155. end = halfway;
  38156. }
  38157. }
  38158. for (; begin < end; ++begin) {
  38159. if (begin->id >= interpreterId) return begin;
  38160. }
  38161. return begin;
  38162. }
  38163. static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
  38164. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  38165. if (interpreter_id == -1) return NULL;
  38166. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38167. __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
  38168. {
  38169. __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  38170. if (likely(data)) {
  38171. __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
  38172. if (likely(data == new_data)) {
  38173. goto read_finished;
  38174. }
  38175. }
  38176. __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  38177. __Pyx_ModuleStateLookup_Lock();
  38178. __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
  38179. data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
  38180. __Pyx_ModuleStateLookup_Unlock();
  38181. }
  38182. read_finished:;
  38183. #else
  38184. __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
  38185. #endif
  38186. __Pyx_InterpreterIdAndModule* found = NULL;
  38187. if (unlikely(!data)) goto end;
  38188. if (data->interpreter_id_as_index) {
  38189. if (interpreter_id < data->count) {
  38190. found = data->table+interpreter_id;
  38191. }
  38192. } else {
  38193. found = __Pyx_State_FindModuleStateLookupTableLowerBound(
  38194. data->table, data->count, interpreter_id);
  38195. }
  38196. end:
  38197. {
  38198. PyObject *result=NULL;
  38199. if (found && found->id == interpreter_id) {
  38200. result = found->module;
  38201. }
  38202. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38203. __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  38204. #endif
  38205. return result;
  38206. }
  38207. }
  38208. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38209. static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
  38210. while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
  38211. }
  38212. #else
  38213. #define __Pyx_ModuleStateLookup_wait_until_no_readers()
  38214. #endif
  38215. static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
  38216. Py_ssize_t to_allocate = (*old_data)->allocated;
  38217. while (to_allocate <= interpreter_id) {
  38218. if (to_allocate == 0) to_allocate = 1;
  38219. else to_allocate *= 2;
  38220. }
  38221. __Pyx_ModuleStateLookupData *new_data = *old_data;
  38222. if (to_allocate != (*old_data)->allocated) {
  38223. new_data = (__Pyx_ModuleStateLookupData *)realloc(
  38224. *old_data,
  38225. sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
  38226. if (!new_data) {
  38227. PyErr_NoMemory();
  38228. return -1;
  38229. }
  38230. for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
  38231. new_data->table[i].id = i;
  38232. new_data->table[i].module = NULL;
  38233. }
  38234. new_data->allocated = to_allocate;
  38235. }
  38236. new_data->table[interpreter_id].module = module;
  38237. if (new_data->count < interpreter_id+1) {
  38238. new_data->count = interpreter_id+1;
  38239. }
  38240. *old_data = new_data;
  38241. return 0;
  38242. }
  38243. static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
  38244. __Pyx_InterpreterIdAndModule *read = data->table;
  38245. __Pyx_InterpreterIdAndModule *write = data->table;
  38246. __Pyx_InterpreterIdAndModule *end = read + data->count;
  38247. for (; read<end; ++read) {
  38248. if (read->module) {
  38249. write->id = read->id;
  38250. write->module = read->module;
  38251. ++write;
  38252. }
  38253. }
  38254. data->count = write - data->table;
  38255. for (; write<end; ++write) {
  38256. write->id = 0;
  38257. write->module = NULL;
  38258. }
  38259. data->interpreter_id_as_index = 0;
  38260. }
  38261. static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
  38262. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  38263. if (interpreter_id == -1) return -1;
  38264. int result = 0;
  38265. __Pyx_ModuleStateLookup_Lock();
  38266. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38267. __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
  38268. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  38269. #else
  38270. __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
  38271. #endif
  38272. __Pyx_ModuleStateLookupData *new_data = old_data;
  38273. if (!new_data) {
  38274. new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
  38275. if (!new_data) {
  38276. result = -1;
  38277. PyErr_NoMemory();
  38278. goto end;
  38279. }
  38280. new_data->allocated = 1;
  38281. new_data->interpreter_id_as_index = 1;
  38282. }
  38283. __Pyx_ModuleStateLookup_wait_until_no_readers();
  38284. if (new_data->interpreter_id_as_index) {
  38285. if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
  38286. result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
  38287. goto end;
  38288. }
  38289. __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
  38290. }
  38291. {
  38292. Py_ssize_t insert_at = 0;
  38293. {
  38294. __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
  38295. new_data->table, new_data->count, interpreter_id);
  38296. assert(lower_bound);
  38297. insert_at = lower_bound - new_data->table;
  38298. if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
  38299. lower_bound->module = module;
  38300. goto end; // already in table, nothing more to do
  38301. }
  38302. }
  38303. if (new_data->count+1 >= new_data->allocated) {
  38304. Py_ssize_t to_allocate = (new_data->count+1)*2;
  38305. new_data =
  38306. (__Pyx_ModuleStateLookupData*)realloc(
  38307. new_data,
  38308. sizeof(__Pyx_ModuleStateLookupData) +
  38309. (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
  38310. if (!new_data) {
  38311. result = -1;
  38312. new_data = old_data;
  38313. PyErr_NoMemory();
  38314. goto end;
  38315. }
  38316. new_data->allocated = to_allocate;
  38317. }
  38318. ++new_data->count;
  38319. int64_t last_id = interpreter_id;
  38320. PyObject *last_module = module;
  38321. for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
  38322. int64_t current_id = new_data->table[i].id;
  38323. new_data->table[i].id = last_id;
  38324. last_id = current_id;
  38325. PyObject *current_module = new_data->table[i].module;
  38326. new_data->table[i].module = last_module;
  38327. last_module = current_module;
  38328. }
  38329. }
  38330. end:
  38331. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38332. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
  38333. #else
  38334. __Pyx_ModuleStateLookup_data = new_data;
  38335. #endif
  38336. __Pyx_ModuleStateLookup_Unlock();
  38337. return result;
  38338. }
  38339. static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
  38340. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  38341. if (interpreter_id == -1) return -1;
  38342. __Pyx_ModuleStateLookup_Lock();
  38343. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38344. __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
  38345. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  38346. #else
  38347. __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
  38348. #endif
  38349. if (data->interpreter_id_as_index) {
  38350. if (interpreter_id < data->count) {
  38351. data->table[interpreter_id].module = NULL;
  38352. }
  38353. goto done;
  38354. }
  38355. {
  38356. __Pyx_ModuleStateLookup_wait_until_no_readers();
  38357. __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
  38358. data->table, data->count, interpreter_id);
  38359. if (!lower_bound) goto done;
  38360. if (lower_bound->id != interpreter_id) goto done;
  38361. __Pyx_InterpreterIdAndModule *end = data->table+data->count;
  38362. for (;lower_bound<end-1; ++lower_bound) {
  38363. lower_bound->id = (lower_bound+1)->id;
  38364. lower_bound->module = (lower_bound+1)->module;
  38365. }
  38366. }
  38367. --data->count;
  38368. if (data->count == 0) {
  38369. free(data);
  38370. data = NULL;
  38371. }
  38372. done:
  38373. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38374. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
  38375. #else
  38376. __Pyx_ModuleStateLookup_data = data;
  38377. #endif
  38378. __Pyx_ModuleStateLookup_Unlock();
  38379. return 0;
  38380. }
  38381. #endif
  38382. /* #### Code section: utility_code_pragmas_end ### */
  38383. #ifdef _MSC_VER
  38384. #pragma warning( pop )
  38385. #endif
  38386. /* #### Code section: end ### */
  38387. #endif /* Py_PYTHON_H */